Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Racing Game Registration</title>
- </head>
- <body style="background-color:#36c;font-family:calibri;color:#F0F0F0;text-align:center;">
- <h1><i>Racing Game</i></h1><hr/>
- <h2><i>Registration</i></h2>
- <p >
- <form name="register" method="post">
- Username: <input type="varchar" name="name" /><br/><br/>
- Password: <input type="password" name="pass" /><br/><br/>
- <input type="submit" value="Register" style="height:40px;width:80px"/>
- </form>
- <?php
- if(isset($_POST['name']) && isset($_POST['pass']))
- {
- $name = $_POST['name'];
- $pass = $_POST['pass'];
- $con = mysql_connect("localhost","root","");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("users");
- $exist = 0;
- $regiUsers = mysql_query("SELECT name FROM players") or die("Query failed with error: ".mysql_error());
- while($row = mysql_fetch_array($regiUsers) && $exist!=1)
- {
- echo $row['name'] ."<br />". $name;
- if($row['name'] == $name)
- {
- $exist = 1;
- echo "<script>alert('Username already exist please try another one');</script>";
- }
- if($row['name'] === $name)
- echo "<script>alert('haha');</script>";
- else
- echo "<script>alert('muhahaha');</script>";
- }
- if(strlen($pass)>=6)
- {
- if($exist != 1)
- {
- mysql_query("INSERT INTO players (name,pass,hs) VALUES ($name,$pass,0)");
- mysql_close($con);
- echo "<script>alert('Registered successfuly!');</script>";
- }
- }
- else
- {
- echo "<script>alert('Your password must be at least 6 chars long! please try again');</script>";
- }
- }
- else
- echo "failed";
- ?>
- </p>
- <br/>
- <p2 style="font-size:12px;">© tal vintrob</p2>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement