updatePlayerData($playerdata['id'], $playerdata); $error = 3; } else { $error = 105; } } else { $error = 106; } } if ($do == 'changerulerplanet') { $rulername = secureData($_POST['rulername']); $planetname = secureData($_POST['planetname']); if (!$rulername || !$planetname) { $error = 108; } if (getCurrentTick() > 1500) { $error = 109; } if ((getIdByRulername($rulername)) && ($rulername != $playerdata['rulername'])) { $error = 110; } if ((getIdByPlanetname($planetname)) && ($planetname != $playerdata['planetname'])) { $error = 111; } if ($error < 100) { $sql_updrp = "UPDATE $table[players] SET `rulername` = '$rulername', `planetname` = '$planetname' WHERE `id` = '$playerdata[id]'"; mysql_query($sql_updrp) or die(mysql_error()); $error = 4; } } $playerdata = getPlayerdata($playerdata['id']); switch($error) { case 0: $msg = "Succesfully changed password"; break; case 1: $msg = "Succesfully changed galaxy and took 30% of your resources."; break; case 2:
require_once("global.inc.php"); unset ($user, $_SESSION['user']); if ($_POST['submit']) { $secretcode = '3485ghfgh98ghfdghq31qqqzxfjkdfgddkjwer08448534gdfgbdfg'; /* Used for activation code generation */ $username = secureData($_POST['username']); $rulername = secureData($_POST['rulername']); $planetname = secureData($_POST['planetname']); $password = secureData($_POST['password']); $password2 = secureData($_POST['password2']); $email = secureData($_POST['email']); $email2 = secureData($_POST['email2']); if (getIdByUsername($username)) { $msg = '<font color=red>That username is already taken.</font>'; } elseif (getIdByRulername($rulername)) { $msg = '<font color=red>That rulername is already taken.</font>'; } elseif (getIdByPlanetname($planetname)) { $msg = '<font color=red>That planetname is already taken.</font>'; } elseif (getIdByEmail($email)) { $msg = '<font color=red>The email address you\'re trying to use, is already taken.</font>'; } elseif ($password != $password2) { $msg = '<font color=red>The passwords don\'t match!</font>'; } elseif ($email != $email2) { $msg = '<font color=red>The e-mails don\'t match!</font>'; } elseif (!$username || !$planetname || !$password || !$password2 || !$email) { $msg = '<font color=red>Empty fields are not allowed.</font>'; } else { $activation_code = md5($username.time().$email.$secretcode); /* Generate a unique md5 has by using the username, current time, email address and a private code. */ $galaxy_id = getRandomGalaxyId(); if (getFreeGalaxySpot($galaxy_id)) { $galaxy_spot = getFreeGalaxySpot($galaxy_id); } else { $msg = 'Registration failed. Your data was inserted correctly, but the galaxy spot is not right. Contact the crew'; } $password = md5($password); $sql_newplayer = "INSERT INTO `$table[players]` (`username` , `password` , `email` , `activated` , `activation_code` , `rulername`,`planetname` , `galaxy_id` , `galaxy_spot`) VALUES ('$username', '$password', '$email', '0', '$activation_code', '$rulername','$planetname', '$galaxy_id', '$galaxy_spot')"; mysql_query($sql_newplayer) or die(mysql_error()); $msg = '<font color=green>Thank you for registration. You will be redirected to the login page in 3 seconds.<br>You can not login yet, please check your email inbox for the activation e-mail.</font>';