Exemple #1
0
 if (!isset($input['password']) || !valid_password($input['password'])) {
     die("ERROR: Password must be between 4 and 30 characters long.\n");
 }
 // Load the DataLayer
 @(include_once 'includes/datalayer.class.php');
 // Make sure the DataLayer class loaded sucessfully
 if (!class_exists('DataLayer')) {
     die("ERROR: Unable to load DataLayer class.\n");
 }
 $dl = new DataLayer($config['datalayer']);
 if ($dl === false) {
     die("ERROR: Unable to connect to database.\n");
 }
 $values = $input;
 // Check if the user already exists before going further
 if ($dl->Player_Exists_ByUsername($values['username'])) {
     die("ERROR: The username '" . $values['username'] . "' already exists. Please choose another username.\n");
 } else {
     // Leave the 'email' and 'password' blank. These will be filled after
     // the user activates their account
     $values['email'] = '';
     $values['password'] = '';
     $values['created'] = $values['lastaccess'] = NOW;
     $values['createdipaddress'] = $values['lastaccessipaddress'] = $_SERVER['REMOTE_ADDR'];
     // When the account is activated, these will be moved to 'password' and
     // 'email', respectively.
     $values['newpassword'] = md5($values['password']);
     $values['newemail'] = $values['email'];
     $values['activationkey'] = generate_random_string($config['activation']['keyLength']);
     $values['activated'] = 0;
     $values['token'] = '';