Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body background="background.jpg">
- <title>EngineWar - Closed Beta Registration</title>
- <?php
- if(isset($_POST['username']) && isset($_POST['nickname']) && isset($_POST['mail']) && isset($_POST['pass']) && isset($_POST['pass2']))
- {
- include("connect.php");
- $tempUsername = strip_tags($_POST['username']);
- $tempPasswort = strip_tags($_POST['pass']);
- $Passwort_Confirm = strip_tags($_POST['pass2']);
- function chkEmail($email)
- {
- // elimino spazi, "a capo" e altro alle estremità della stringa
- $email = trim($email);
- // se la stringa è vuota sicuramente non è una mail
- if(!$email) {
- return false;
- }
- // controllo che ci sia una sola @ nella stringa
- $num_at = count(explode( '@', $email )) - 1;
- if($num_at != 1) {
- return false;
- }
- // controllo la presenza di ulteriori caratteri "pericolosi":
- if(strpos($email,';') || strpos($email,',') || strpos($email,' ')) {
- return false;
- }
- // la stringa rispetta il formato classico di una mail?
- if(!preg_match( '/^[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}$/', $email)) {
- return false;
- }
- return true;
- }
- function randomsalt($lunghezza2=5){
- $caratteri_disponibili2 ="1234567890abcdefghijklmnopqrstuvwxyz";
- //$caratteri_disponibili ="abcdefghijklmnopqrstuvwxyz";
- $refer2 = "";
- for($i = 0; $i<$lunghezza2; $i++){
- $refer2 = $refer2.substr($caratteri_disponibili2,rand(0,strlen($caratteri_disponibili2)-1),1);
- }
- return $refer2;
- }
- function randomcode($lunghezza22=12){
- $caratteri_disponibili22 ="1234567890abcdefghijklmnopqrstuvwxyz";
- //$caratteri_disponibili ="abcdefghijklmnopqrstuvwxyz";
- $refer22 = "";
- for($i = 0; $i<$lunghezza22; $i++){
- $refer22 = $refer22.substr($caratteri_disponibili22,rand(0,strlen($caratteri_disponibili22)-1),1);
- }
- return $refer22;
- }
- function randomcodesess($lunghezza222=12){
- $caratteri_disponibili222 ="1234567890abcdefghijklmnopqrstuvwxyz";
- //$caratteri_disponibili ="abcdefghijklmnopqrstuvwxyz";
- $refer222 = "";
- for($i = 0; $i<$lunghezza222; $i++){
- $refer222 = $refer222.substr($caratteri_disponibili222,rand(0,strlen($caratteri_disponibili222)-1),1);
- }
- return $refer222;
- }
- //controllo e modifico le mail farlocche
- $_POST['mail'] = str_replace("@nwldx.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@mailmetrash.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@anonymbox.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@mailcatch.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@no-spam.ws", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@yopmail.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@sharklasers.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@filzmail.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@mint.us.to", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@spambox.us", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@sofimail.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@noclickemail.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@mailinator.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@meltmail.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@TempEmail.net", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@dunflimblag.mailexpire.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@tittbit.in", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@temporaryemail.us", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@ixi.me", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@tempthe.net", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@emailthe.net", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@trashmail.ws", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@fakeinbox.com", "", $_POST['mail']);
- $_POST['mail'] = str_replace("@jetable.org", "", $_POST['mail']);
- //fine controllo
- $usrsess=randomcodesess();
- $code=randomcode();
- $salt=randomsalt();
- $nickname=strip_tags($_POST['nickname']);
- $email = strip_tags($_POST['mail']);
- $pass=strip_tags($_POST['pass']);
- $timestamp = (time()+ 864000); //equivale a 7 giorni in piu oltre la data attuale
- $orario = time(); //imposta il timestamp della data attuale
- /*echo "Timestamp: ";
- echo $timestamp;
- echo "<br>Username: ";
- echo $tempUsername;
- echo "<br>password in chiaro: ";
- echo $pass;
- echo "<br>Password criptata: ";
- echo $tempPasswort;
- echo "<br>Salt: ";
- echo $salt;
- echo "<br>Nickname: ";
- echo $nickname;
- echo "<br>Email: ";
- echo $email;
- Die();*/
- if($nickname) {
- $nickname = str_replace("[GA]", "", $nickname);
- if(chkEmail($email)) {
- if($Passwort_Confirm == $pass)
- {
- $tempUserLength = strlen($tempUsername);
- if($tempUserLength < 16)
- {
- if($tempUserLength > 3)
- {
- //controllo se esiste gia l'username
- $i_spieler="SELECT * FROM users where username='".$tempUsername."'";
- $i_spieler2=mysql_query($i_spieler)or die("MySQL ErrCode 1 - Username");
- $i_spieler3=mysql_fetch_array($i_spieler2);
- //controllo se esiste gia il nickname
- $i_spieler1="SELECT * FROM users where nickname='".$nickname."'";
- $i_spieler21=mysql_query($i_spieler1)or die("MySQL ErrCode - Nickname");
- $i_spieler31=mysql_fetch_array($i_spieler21);
- //controllo se esiste gia la mail
- $i_spieler11="SELECT * FROM users where email='".$email."'";
- $i_spieler211=mysql_query($i_spieler11)or die("MySQL ErrCode - Nickname");
- $i_spieler311=mysql_fetch_array($i_spieler211);
- if($i_spieler311)
- {
- echo '<table><br>
- <center><b><font color="red">This nickname has already taken!.</font><br><br>
- <a href="Register2.php">Go Back</a></table></font>';
- }
- else
- {
- $userQuery = "INSERT INTO users(username,password,salt,nickname,email,premium,dinar,exp,kills,deaths,premiumExpire,cash) VALUES ('$tempUsername','$tempPasswort','$salt','$nickname','$email',3,100000,0,0,0,'$timestamp','20000')";
- mysql_query($userQuery) or die("MySQL ErrCode 2 - Account");
- $idnuovo="SELECT id FROM users where username='". $tempUsername ."'";
- $iricevuto=mysql_query($idnuovo)or die("MySQL ErrCode 3 - ExistUsername");
- $idecuip=mysql_fetch_array($iricevuto);
- $idnumero= $idecuip['id'];
- $equip = "INSERT INTO equipment(ownerid) VALUES ('".$idnumero."')";
- mysql_query($equip) or die("MySQL ErrCode 4 - Equipment");
- echo '<table><br>
- <center><b><font color="lime">Registered successfully! Now you can login!</font><br><br>
- <a href="index.php">Go Back</a></table></font></center>';//header('Location: registerdone.php'); exit;
- }
- }
- else
- {
- echo '<table><br>
- <center><b><font color="red">Username length is too short (min 4 characters)!</font><br><br>
- <a href="index.php">Go Back</a></table></font></center>'; //header('Location: registerfail2.php'); exit;
- }
- }
- else
- {
- echo '<table><br>
- <center><b><font color="red">Username too long (max 15 characters)!</font><br><br>
- <a href="index.php">Go Back</a></table></font></center>'; //header('Location: registerfail3.php'); exit;
- }
- }else
- {
- echo '<table><br>
- <center><b><font color="red">Both password aren not same!</font><br><br>
- <a href="index.php">Go Back</a></table></font></center>'; //header('Location: registerfail3.php'); exit;
- }
- }
- else {
- echo '<table><br>
- <center><b><font color="red">This email is not accepted or invalid from the system!</font><br><br>
- <a href="index.php">Go Back</a></table></font></center>';
- }
- }
- else {
- echo '<table><br>
- <center><b><font color="red">You did not put the nickname!</font><br><br>
- <a href="index.php">Go Back</a></table></font></center>';
- }
- }
- else
- {
- ?><center>
- <table>
- </td><td>
- <form action='index.php' method='post'>
- <table border='0'>
- <center><tr><td><b><font color='red'>Register for EliteWar!</td><td>
- </td></tr></center></table>
- <table border='0'>
- <tr><td><b><font color='white'>Username:</td><td>
- <input type='text' name='username' maxlength='15'>
- </td></tr>
- <tr><td><b><font color='white'>Nick in Game:</td><td>
- <input type='text' name='nickname' maxlength='15'>
- </td></tr>
- <tr><td><b><font color='white'>Email:</td><td>
- <input type='text' name='mail' maxlength='25'>
- </td></tr>
- <tr><td><b><font color='white'>Password: (max 10 char)</td><td>
- <input type='password' name='pass' maxlength='10'>
- </td></tr>
- <tr><td><b><font color='white'>Confirm Password: (max 10 char)</td><td>
- <input type='password' name='pass2' maxlength='10'>
- </td></tr>
- <tr><th colspan=2><input type='submit' name='submit'
- value='Register'></th></tr> </table></font>
- </form>
- </th></tr> </table></font></center>
- <?php
- }
- ?>
- <form action='index.php' method='post'>
- <table border='0'>
- <center><tr><td><b><font color='red'></td><td>
- </td></tr></center></table>
- </body>
- </html>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement