Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- #Connect to database
- include 'connect.php'
- #Declare variables given in registration form
- $username = $_POST['username'];
- $password = $_POST['password'];
- $passconf = $_POST['passconf'];
- $username = strip_tags($username);
- $wowname = $_POST['wowname'];
- $class = $_POST['classname'];
- $treespec = $_POST['specilization'];
- $wowname = strip_tags($wowname);
- $class = strip_tags($class);
- $treespec = strip_tags($treespec);
- #Start validating registration
- if ($password == $passconf)
- {
- #Load details of current user-database
- $isuser = "SELECT * from chosen_users where username = '$username'";
- $isuser1 = mysql_query($isuser) or die ("Could not complete user query");
- $isuser2 = mysql_fetch_array($isuser1);
- if (!$_POST['password'])
- {
- print "You did not enter a password";
- }
- elseif (!$_POST['passconf')
- {
- print "You did not enter password confirmation";
- }
- else if($isuser2)
- {
- print "There is already a player of that name, please try again.";
- }
- else if(strlen($username>12)
- {
- print "Sorry, you specified a illegal username. /n Please read the Terms & Conditions, found at the bottom of the page.";
- }
- else if(strlen($username)<=3)
- {
- print "Sorry, you specified a illegal username. /n Please read the Terms & Conditions, found at the bottom of the page.";
- }
- else if($username==$password)
- {
- print "You cannot use your username as a password, please try again.";
- }
- else if(!$_POST['wowname'])
- {
- print "You did not enter anything in the Wow username area";
- }
- else
- {
- $iswowname="SELECT * from chosen_users where wowname='$wowname'";
- $iswowname2=mysql_query($iswowname) or die("Unable to complete query");
- $iswowname3=mysql_fetch_array($iswowname2);
- if($iswowname3)
- {
- print "There is already a player registered using that WoW username, please try again.";
- }
- else if(!$_POST['classname']);
- {
- print "You did not post anything in the class name section";
- if($classname != 'Death Knight','Warlock','Warrior','Paladin','Mage','Priest','Druid','Hunter','Rogue','Shaman')
- {
- print "You did not specify a legitimate WoW class, they are as follows<br />";
- print "Warlock<br />";
- print "Death Knight<br />";
- print "Warrior<br />";
- print "Paladin<br />";
- print "Mage<br />";
- print "Priest<br />";
- print "Druid<br />";
- print "Hunter<br />";
- print "Rogue<br />";
- print "Shaman<br />";
- print "Please try again.";
- }
- else if(!$_POST['specilization'])
- {
- print "You did not enter any information in the talent spec field";
- }
- else
- {
- #Complete registration process by applying new user details to current database
- $password=md5($password);
- $date=round(date("U")/1000);
- srand($date);
- $SQL = "INSERT into chosen_users(username, password, wowname, classname , specilization, validated) VALUES ('$username','$password','$wowname','$classname','$treespec','1')";
- mysql_query($SQL) or die("Could not register, please try again.");
- print "Registration Successful.<br />";
- print "Click here to <A href='login.php'>Login</a>";
- }
- }
- }
- }
- else
- {
- #A problem other than those specified occured and the registration process has been nulled
- print "Something went wrong, please try again.";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement