<?php

//Create de vars
$uname = $_REQUEST["uname"];
$pass = $_REQUEST["pass"];
$email = $_REQUEST["email"];
$ip = GetHostByName($REMOTE_ADDR);
$ip2 = str_replace(".","",$ip);
$fileName = strrev($ip2);
$file = fopen("accounts/".$fileName.".php","w+");
$file2 = fopen("code.txt","r+");
$fileContent = "<?php
$" . "" . "email = '" . $email . "';
$" . "" . "uname = '" . $uname . "';
$" . "" . "fname = '" . $fileName . ".php';
";

while(!feof($file2)) {
	$fileContent .= fread($file2,1);
}

fclose($file2);

fwrite($file,$fileContent);

fclose($file);

//elist, ulist, users, ...

$subject = "Your BNO account!";
$headers = "From: BNO Auto E-mail";
$message = "
Almost there! Follow the link below to complete the registration process for Battle Network Online:\n
\n
http://bno.decidel.net/accounts/".$fileName.".php\n
\n
If you received this e-mail by accident, just delete it.
";
//$message2

//Finds the number of accounts based on the \n in the accounts file (basically, for every two lines add 1 to the user count)
//while

//Places the account info in the accounts.txt file (2 lines: [1] = username [2] = password)
//fwrite

//Show de user wat de gots
echo "<head>
<title>Complete!</title>
</head>
<body bgcolor=#000000>
<font face=Arial, Helvetica, sans-serif color=#0000FF>
<p>An e-mail has been sent to " . $email . ".
<p>Follow the link in the e-mail to complete the registration process for Battle Network Online.
</font>
</body>
";
mail($email,$subject,$message,$headers);
//mail dems guys

?>