Код
// SQL data
$db_u = "=-=-=-=-=-"; // fill in ur db username
$db_p = "=-=-=-=-="; // fill in ur db pass
$db_host = "=-=-=-=-="; // fill in only if u're not running it on the same machine as the db.
// don't change
$u = $_POST['user'];
$p = $_POST['pass'];
$e = $_POST['email'];
if(!$u){
// Realm Status
$h = "metaplane.biz.tm"; //server address
$p = "3724"; //default realmd port
$s = fsockopen($h, $p, $errno, $errstr, 30);
if(!$s){
echo "Realm status is:"." <font color=red><strong>Down!</strong></font>";
}
else
{
echo "Realm status is:" ." <font color=green><strong>Online!</strong></font>";
}
// die("Registration is offline!"); // uncomment if u want to turn off reg.
echo ' <form name="form1" method="post" action="index.php">
Username:<br>
<input type="text" name="user"><br>
Password:<br>
<input type="text" name="pass"><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Clear" value="Clear">
</form>';
}
else
{
// Some lame protection code against sql injections
if (!get_magic_quotes_gpc()) {
$u = addslashes($_POST['user']);
$p = addslashes($_POST['pass']);
$e = $_POST['email'];
} else {
$u = $_POST['user'];
$P = $_POST['pass'];
$e = $_POST['email'];
}
// DB SHITZ. DO NOT TOUCH !!!
@$link = mysql_connect("$db_host", "$db_u", "$db_p");
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('realmd');
$q = "insert into account ( username,password,gmlevel,sessionkey,joindate,banned,last_ip,failed_logins,locke
d,last_login,online) values ('$u','$p','1','',NOW(),'0','127.0.0.1','0','0','2000-01-01 00:00:00','0')";
$r = mysql_query($q);
if (!$r) { echo "MySQL error: " . mysql_error()."!"; } else { echo "Registration Completed!";}
echo '<a href="index.php">Return to add another.</a>';
}
?>
Как видите обычный запрос к базе не более того. Скрипт писал не я, так как он мне попался на глаза раньше чем понадобился.