<?
/* ----------------------------------------------------------------------------------
DarkZero's Account Creator for Helbreath Servers
If you find a bug, have a suggestion for another script,
or need to contact me, please contact me one of the following ways:
Email: dz@suckas.net
AIM: DarkZeroPU
ICQ: 157544686
IRC: irc.hbportal.net #h2 #hbredemption
-------------------------------------------------------------------------------------
This file may be distributed freely as long as this part of the code is left intact.
I do not demand it, but please give me credit if you decide to use my script. No, it's
not that good but it did take a long time to make.
Everything herein is Copyright Brian Seeders 2003
-------------------------------------------------------------------------------------
The only thing you need to do is insert your character directory into the line
below (leave off the \ at the end)
Make sure to use double \'s
-------------------------------------------------------------------------------------
Release Notes:
August 30, 2003: First release

In the next release:
-Suggestions Needed-

---------------Edit this----------------*/
$dir = 'C:\\example\\Helbreath\\Account';
/*--------------------------------------*/
if(!$_POST){
  echo
'<form action='.$_SERVER['PHP_SELF'].' method=post>
  Account-Name:
  <input name=account type=text maxlength=10>
  <br>
  Password:
  <input name=password type=password maxlength=10>
  <br>
  Password(Again):
  <input name=confirm type=password maxlength=10>
  <br>
  E-Mail:
  <input name=email type=text>
  <br>
  Security Question:
  <input name=question type=text>
  <br>
  Answer:
  <input name=answer type=text>
  </font>
  <br>
  <input name=submit type=submit value=Submit>
  <p>
  Abuse of this system will result in deletion of accounts,characters, and permanent ban.</p>
  '
;
}
else{
  
$account = $_POST['account'];
  
$confirm = $_POST['confirm'];
  
$date = date('F d, Y g:i A');
  
$password = $_POST['password'];
  
$email = $_POST['email'];
  
$question = $_POST['question'];
  
$answer = $_POST['answer'];
  
$ip = $_SERVER['REMOTE_ADDR'];
  
$firstletter = substr($account, 0, 1);
  
$ascii = ord($firstletter);
  
$filename = $dir . '\\ASCII'.$ascii.'\\'.$account.'.txt';
  if(
$account == '') { echo 'Account creation failed. Please fill out all fields.'; }
  elseif(
file_exists($filename)) { echo 'Account creation failed. Account name already exists.';}
  elseif(
$email == '') { echo 'Account creation failed. Please fill out all fields.';}
  elseif(!
ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", $email)){ echo 'Account Creation Failed. Please enter a valid E-Mail.'; }
  elseif(
$password != $confirm) { echo 'Account creation failed. Password does not match confirmation password.';}
  else{
    
$fp = fopen($filename, 'w+');
    
$string = 'Account Created: '.$date.' With the IP: '.$ip.'

[NAME]

account-name     = '
.$account.'

[PASSWORD]

account-password = '
.$password.'

[ACCOUNT-STATUS]

account-valid-time = 0
account-valid-date = 2003 4 5

account-change-password = 2003 3 29
[ETC]

account-Gender   = Male
account-Age      =
account-Birth-Year = xxxx
account-Birth-Month = xx
account-Birth-Day   = xx
account-RealName = a
account-SSN      = aaaaa
account-Email    = '
.$email.'
account-Quiz     = '
.$question.'
account-Answer   = '
.$answer.'
account-created-by = DarkZero\'s Account Generator'
;
    
$write = fputs($fp, $string);
    
fclose($fp);
    echo
'Account created successfully, you may now login.';
  }
}
?>