Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- include("config.php");
- if ($_POST[register]) {
- $username = $_POST[username];
- $password = $_POST[pass];
- $cpassword = $_POST[cpass];
- $email = $_POST[emai1];
- $motto = $_POST[motto];
- $dob = $_POST[dob];
- $date = date("Y.m.d");
- //the above lines set variables with the user submitted information
- if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {
- //checks to make sure no fields were left blank
- echo "<div style=\"font-family:verdana;font-size:11px;padding:10px;width:500px;margin:10px auto 10px auto;border:1px solid #C16161;background-color:#FEDBDB;color:#C16161;\">A field was left blank.<br/><a href=\"?=back\" onClick=\"history.back()\">Back</a></div>";
- }else{
- //none were left blank! We continue...
- if($password != $cpassword) {
- // the passwords are not the same!
- echo "<div style=\"font-family:verdana;font-size:11px;padding:10px;width:500px;margin:10px auto 10px auto;border:1px solid #C16161;background-color:#FEDBDB;color:#C16161;\">Passwords do not match.<br/><a href=\"?=back\" onClick=\"history.back()\">Back</a></div>";
- }else{
- // the passwords are the same! we continue...
- // encrypts the password
- $checkname = mysql_query("SELECT username FROM users WHERE username='$username'");
- $checkname= mysql_num_rows($checkname);
- $checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
- $checkemail = mysql_num_rows($checkemail);
- if ($checkemail>0|$checkname>0) {
- // oops...someone has already registered with that username or email!
- echo "<div style=\"font-family:verdana;font-size:11px;padding:10px;width:500px;margin:10px auto 10px auto;border:1px solid #C16161;background-color:#FEDBDB;color:#C16161;\">The username or email is already in use.<br/><a href=\"?=back\" onClick=\"history.back()\">Back</a></div>";
- }else{
- // noone is using that email or username! We continue...
- $username = htmlspecialchars($username);
- $password = htmlspecialchars($password);
- $email = htmlspecialchars($email);
- // the above lines make it so that there is no html in the user submitted information.
- //Everything seems good, lets insert.
- $query = mysql_query("INSERT INTO users (username, password, signedup, email, dob, motto, figure, gender, coins, films, gametickets, ssoticket) VALUES('$username','$password','$date','$email','$dob','$motto','hd-180-1.ch-255-64.lg-270-64.sh-300-62.hr-165-1316','M','50','50','50','DeltarLoginTicket')");
- // inserts the information into the database.
- echo ("<div style=\"font-family:verdana;font-size:11px;padding:10px;width:500px;margin:10px auto 10px auto;border:1px solid #31D525;background-color:#EEFEED;color:#31D525;\">Congratulations, you have successfully registered.</div>");
- echo ("<meta http-equiv=\"Refresh\" content=\"4; URL=login.php\"/>You'll be redirected to the login page in 4 or so seconds");
- }
- }
- }
- }
- else
- {
- // the form has not been submitted...so now we display it.
- echo ("
- <h1>Register</h1>
- <form method=\"POST\">
- Username: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"><br />
- Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"pass\"><br />
- Confirm Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"cpass\"><br />
- Email: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"emai1\"><br />
- DOB: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"dob\"><br />
- Motto: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"motto\"><br />
- <input name=\"register\" type=\"submit\" value=\"Register\">
- </form><br />
- Already have a account? Login <a href=\"register.php\">here</a>.
- ");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement