How to batch modify "Contact Information" in a finished website?
Published: 2013-06-27
A ready-made website is very convenient for quickly building and publishing a website, but after activation, if contact information appears on many pages, modifying each page in layout mode, not to mention being time-consuming, may also result in a large number of omissions that are not successfully modified, the following method can quickly batch modify contact information.Because the operation directly operates the database and the operation is irreversible, please back up the database data first, and then perform the following operations!
1.Log in to the hosting space ftp, under wwwroot create replace.php
2,Edit this file and enter the following content:
/**
date:2013-05-12
function:Batch replace contact information in the database
**/
header("content-Type: text/html; charset=utf-8");
include_once("config.inc.php");
if(isset($_GET["act"]) && $_GET["act"] == "del" ){ //Delete test file
$filename=basename($_SERVER['PHP_SELF']);
@unlink($filename);
exit('Error:File Not Found!');
}
$host=$dbHost;
$user=$dbUser; //Database username
$passwd=$dbPass; //Password
$db=$dbName; //Database name
$plustitle=$_POST["plustitle"]; //Target string
$plusname=$_POST["plusname"]; //Target string
$tables=$TablePre._base_plus;
$link= mysql_connect($host,$user,$passwd) or die('Could not connect: '.mysql_error() );
mysql_select_db( $db,$link ) or die ('can\'t use'. $db . mysql_error());
mysql_query ('SET NAMES utf8');
$sql1="UPDATE `$tables` SET text='$txt' where title='$plustitle' and pluslable='$plusname'";
if(mysql_query($sql1))
echo "<font color=red>Replacement successful!<br></font>";
else
echo "Replacement failed:".mysql_error()."<br>";
mysql_close($link);
}
?>
<form method="post" action="">
<?
echo "Database host: ".$dbHost ;
echo "<br/>Database name: ".$dbName;
echo "<br/>Database username: ".$dbUser;
echo "<br/>Database password: ".$dbPass;
echo "<br/>Table prefix: ".$TablePre;
?>
<br/>
Plugin title:<input name="plustitle" value="Contact Us" type="txt"><br/>
Plugin name:<input name="plusname" value="modText" type="txt"><br/>
Replacement content:<textarea name="txt" cols="50" rows="10" warp="virtual"></textarea> <br/>
<input type="submit" name="submit" value="Start replacement"><br/><br/>
<font color=red >The operation is irreversible, please back up the database before use</font><br/>
<a href='?act=del'>Delete test file</a>
</form>
Save and upload to the hosting space
3.Visit this http://yourdomain/replace.php
Follow the prompts to complete the batch replacement, then you can replace the content that is the contact information in the plugin named "modText", individual pages may not have been modified; refer to step 4 to modify them
4.Visit http://yourdomain/admin.php, after logging in, click "Webpage">>"Webpage management">> find Contact Us, click the edit button behind it, and complete the corresponding modification.
5.After confirming the modification is complete, be sure to delete the just-created "replace.php". to prevent others from knowing about it, and damaging the normal display of the website
