Talk:Work:MySQL Database Manager

From Zoelife4U Wiki
Jump to: navigation, search

The Base64 Encoded Crap

Here's the Settings:

<?php
print base64_encode('
ini_set("register_globals", "Off");
ini_set("max_execution_time", "600");
ini_set("max_input_time", "600");
ini_set("memory_limit", "260M");
ini_set("upload_max_filesize", "256M");
ini_set("post_max_size", "257M");
 
');
?>

Joe's change Collation script

<?php
// This code is licensed under the GPL Version 2.0 only
// Make sure you name the file with the .php extension
// or one that is run as php.
// This script allows it's file name to be anything,
// so long as it is run through the php parser.
// This is Beta version 0.0.3
?>
<html><head><title>Database collation Changer</title>
<!-- This code is licensed under the GPL Version 2.0 only -->
</head><body><p>
<?php
if($_POST['d'] == "yes"){
	$date = date("Y-m-d-H-i-s");
	$dbName = $_POST['dbName'];
	$dbUserName = $_POST['dbUserName'];
	$dbPassword = $_POST['dbPassword'];
	$collation = $_POST['collation'];
	$host = $_POST['host'];
	$db = mysql_connect($host,$dbUserName,$dbPassword);
	if(!$db){
		echo "Cannot connect to the database - incorrect details";
	} else{
		system("mysqldump -u$dbUserName -p$dbPassword $dbName > ./$dbName.$date.sql");
		mysql_select_db($dbName);
		$result=mysql_query('show tables');
		while($tables = mysql_fetch_array($result)) {
			foreach ($tables as $key => $value) {
				mysql_query("ALTER TABLE $value COLLATE $collation");
			}
		}
	}
?>
The collation of your database has been successfully changed!
<?php
}else{
	$myuser = trim(`whoami`)."_";
?>
<form method="post" action="">
<table cellspacing="0" cellpadding="0">
<tr><td colspan="2"><b><font size="5" color="#FF0000">All fields are required.</font></b></td></tr>
<tr><td align="right">Database Name:</td>
<td><input type="text" name="dbName" size="20" value="<?php print $myuser;?>"></td></tr>
<tr><td align="right">Database User Name:</td>
<td><input type="text" name="dbUserName" size="20" value="<?php print $myuser;?>"></td></tr>
<tr><td align="right">Database Password:</td>
<td><input type="password" name="dbPassword" size="20"></td></tr>
<tr><td align="right">Collation Type:</td>
<td><input type="text" name="collation" value="utf8_unicode_ci" size="20"></td></tr>
<tr><td align="right">Database Server:<br>(Most likely localhost.)</td>
<td><input type="text" name="host" value="localhost" size="20"></td></tr>
<tr><td align="right">Change collation of your database?</td>
<td><input type="submit" value="yes" name="d"></td></tr>
</table>
</form>
<?php
}
?>
</p></body></html>
Personal tools
Online Users
Zoelife4U: