<?php
$host="127.0.0.1";
$user="eoserv";
$pass="eoserv";
$dbname="eoserv";
$postuser=mysql_real_escape_string($_POST["username"]);
$postpass=mysql_real_escape_string($_POST["password"]);
$postname=mysql_real_escape_string($_POST["realname"]);
$postcountry=mysql_real_escape_string($_POST["country"]);
$postemail=mysql_real_escape_string($_POST["email"]);
$SALT="changeme"; //Must match the salt in config.ini of your server
$con=mysql_connect($host,$user,$pass);
if ($con){
mysql_select_db($dbname);
if ($_POST["password"]==$_POST["repassword"]){
$sql=mysql_query("select * from accounts where username='".$postuser."'");
if ($row=mysql_fetch_array($sql)){
echo("account already exists!");
}else{
echo("account does not exist, script continuing<br />"); $password=hash('sha256',$SALT.strtolower($postuser).substr($postpass,0,12));
$currip=$_SERVER['REMOTE_ADDR'];
$now=time();
$sql=mysql_query("INSERT INTO `accounts` (username,password,fullname,location,email,regip,lastip,created,lastused) VALUES('$postuser','$password','$postname','$postcountry','$postemail','$currip','$currip',$now,$now)");
if (!$sql){
die(mysql_error());
}else{
echo("account: ".$postuser." created successfully!<br />");
}
}
}else{
echo("Passwords do not match!");
}
}else{
echo("database connection could not be made. Mysql error: ".mysql_error());
}
?>