Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?php
// rename all tables in a PHPBB structure
// Author: espicom aka Jeff Brenton
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'config.php');
if (!isset($_POST['newname']))
{
// first run, display form
echo "<html><head><title>Rename tables</title></head>\n";
echo "<body>\n";
echo "<FORM ACTION='$PHP_SELF' method='post'>\n";
echo "<p>Old prefix is $table_prefix. <br />\n";
echo "Input new prefix: <input type=\"text\" name=\"newname\" value=\"\" /><br />";
echo "Confirm prefix: <input type=\"text\" name=\"newconfirm\" value=\"\" /><br />";
echo "<INPUT TYPE='submit' NAME='changeit' value='Click to change prefix' class='formbutton' WIDTH='70' HEIGHT='17' BORDER='0'>";
echo "</p></form></body></html>\n";
}
else
{
// make sure the new prefix is viable
$newprefix = htmlentities($_POST['newname']);
$confirmpf = htmlentities($_POST['newconfirm']);
if ($newprefix != $confirmpf)
{
// display mismatch message and redisplay form
echo "<html><head><title>Rename tables</title></head>\n";
echo "<body>\n";
echo "<FORM ACTION='$PHP_SELF' method='post'>\n";
echo "<p><font color='ff0000'>Mis-match on confirm prefix change, please try again!</font><br />\n";
echo "Old prefix is $table_prefix. <br />\n";
echo "Input new prefix: <input type=\"text\" name=\"newname\" value=\"$newprefix\" /><br />";
echo "Confirm prefix: <input type=\"text\" name=\"newconfirm\" value=\"\" /><br />";
echo "<INPUT TYPE='submit' NAME='changeit' value='Click to change prefix' class='formbutton' WIDTH='70' HEIGHT='17' BORDER='0'>";
echo "</p></form></body></html>\n";
die();
}
// got valid prefix to change, so go to it!
// connect to the database server
$db = mysql_connect($dbhost,$dbuser,$dbpasswd);
if (!$db) die("Unable to connect to database!\n");
// select the PHPBB database
mysql_select_db($dbname,$db);
// get a list of tables for this PHPBB
$tablequery = "show tables like '".$table_prefix."%'";
$tablelist = mysql_query($tablequery,$db);
$prefixlength = strlen($table_prefix);
echo "<html><head><title>Rename tables</title></head>\n";
echo "<body>\n";
// cycle through them for repair
while ($tar = mysql_fetch_array($tablelist))
{
$tablename = $tar[0];
$newtablename = $newprefix . substr($tablename,$prefixlength);
// output some verbosity for comfort
echo "Now renaming table <font color='ff0000'>$tablename</font> to <font color='00ff00'>$newtablename</font><br>\n";
$repres = mysql_query("RENAME table $tablename TO $newtablename");
}
echo "<p><font color='ff0000'>You now must edit your config.php file to reflect the new prefix!</font></p>\n";
echo "</body></html>\n";
}
?>