<?php
$uname = $_REQUEST["uname"];
$pass = $_REQUEST["pass"];
$email = $_REQUEST["email"];
$ip = GetHostByName($REMOTE_ADDR);
$ip2 = str_replace(".","",$ip);
$fileName = strrev($ip2);

if (!file_exists(path)){

$file = fopen("accounts/".$fileName.".php","w+");
$file2 = fopen("code.txt","r+");
$fileContent = "<?php
$" . "" . "email = '" . $email . "';
$" . "" . "uname = '" . $uname . "';
$" . "" . "pass = '" . $pass . "';
$" . "" . "fname = '" . $fileName . ".php';
";

while(!feof($file2)) {
	$fileContent .= fread($file2,1);
}

fclose($file2);

fwrite($file,$fileContent);

fclose($file);

$subject = "Your BNO account!";
$headers = "From: BNO Auto Email";
$message = "
Almost there! Follow the link to complete the sign up process for your Battle Network Online account:\n
\n
http://bno.decidel.net/accounts/".$fileName.".php\n
\n
If you received this email by accident just delete it.
";

echo "<head>
<title>Complete!</title>
</head>
<body bgcolor=#000000>
<font face=Arial, Helvetica, sans-serif color=#0000FF>
<p>An email has been sent to " . $email . ".
<p>Follow the link in the email to complete the sign up process.
</font>
</body>
";
mail($email,$subject,$message,$headers);

}
else {

echo "<head>
<title>Complete!</title>
</head>
<body bgcolor=#000000>
<font face=Arial, Helvetica, sans-serif color=#0000FF>
<p>A validation request for this ip is still pending.
<p>Possible solutions:
<ul>
	<li>Check your email. You cannot create another account from this ip until all pending accounts have been completed by following the link in the comfirmation email.</li>
	<li>If someone else uses this computer, they may have an account that is currently pending. You may 'politely' remind them.</li>
	<li>You can also email me at <a href='mailto:goaspad@gmail.com'>goaspad@gmail.com</a> or </a href='mailto:decidel@gmail.com'>Vance Serori</a> (the creator).</li>
<ul>
</font>
</body>
";
}

?>