brsy
nah mang
- May 12, 2011
- 1,530
- 272
SupaUpdate
SupaUpdate is a quick and easy tool that can be used to set one value to a mass amount of data within a database, plus it's secure! Here is the code, put it into a PHP file and name it whatever you want so people can't find it. Afterwards, open the file using a PHP file editor, and edit lines 17-21. Save, then you're done!
Code:
SupaUpdate is a quick and easy tool that can be used to set one value to a mass amount of data within a database, plus it's secure! Here is the code, put it into a PHP file and name it whatever you want so people can't find it. Afterwards, open the file using a PHP file editor, and edit lines 17-21. Save, then you're done!
Code:
PHP:
<?php
/*
* Script Name: SupaUpdater
* Script Description: Database alterations made easy.
* Created by: ChrizPHP
* Released on: N/A
*
* This script was created by ChrizPHP, on behalf of ***** -- an all-around
* development group dedicated on providing top-quality products to the
* internet.
*/
function filter($str) {
mysql_real_escape_string(htmlentities($str));
}
$supa['dbDatabase'] = 'bullet'; // database that has your hotel's DB.
$supa['dbUsername'] = 'root'; // username to connect to database (usually root)
$supa['dbHostname'] = 'localhost'; // hostname for databases (usually localhost)
$supa['dbPassword'] = 'abc123'; // password used to connect to database
$supa['adminPassword'] = 'supaPassword'; // password used to sign into SupaUpdate
$connect = mysql_pconnect($supa['dbHostname'], $supa['dbUsername'], $supa['dbPassword']);
mysql_select_db($supa['dbDatabase'], $connect);
if(isset($_POST['done'])) {
$column = filter($_POST['column']);
$value = filter($_POST['value']);
$table = filter($_POST['table']);
mysql_query("UPDATE ".$table." SET ".$column." = '".$value."'");
$error = mysql_error();
if(isset($error)) {
die($error. '<br /><b>Refresh the page to try again.<b>');
}
}
if(!isset($_SESSION['logged'])) { ?>
<form action="" method="POST">
<label>Administrative Password:</label>
<input type="password" name="password" />
<input type="submit" name="login" />
</form>
<?php
if(isset($_POST['login'])) {
if($_POST['password'] != $supa['adminPassword']) {
die('The password you have entered does not match the password you have set for supaUpdate. If you have not yet created a password, please edit your SupaUpdate file.');
}
else {
$_SESSION['logged'] = true;
}
}
}
if(isset($_SESSION['logged'])) {
?>
<center>
<h3>supaUpdater</h3><hr />
<form method="POST" action="">
<label>Table Name:</label>
<input style="width:175px;" type="text" name="table" />
<br />
<label>Altered Column:</label>
<input style="outline: #FFF000;margin-right:19px;width:175px;" type="text" name="column" />
<br />
<label>New Value: </label>
<input style="margin-left:6px;width:175px;" type="text" name="value" />
<br /><br />
<input type="submit" style="height:30px;width:270px;" value="Make Changes!" name="done" />
</form>
</center>
<?php } ?>