Advertisement
Guest User

Untitled

a guest
May 20th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.64 KB | None | 0 0
  1. <?php
  2. #Connect to database
  3.  include 'connect.php'
  4. #Declare variables given in registration form
  5.  $username = $_POST['username'];
  6.   $password = $_POST['password'];
  7.   $passconf = $_POST['passconf'];
  8.   $username = strip_tags($username);
  9.   $wowname  = $_POST['wowname'];
  10.   $class    = $_POST['classname'];
  11.   $treespec = $_POST['specilization'];
  12.   $wowname  = strip_tags($wowname);
  13.   $class    = strip_tags($class);
  14.   $treespec = strip_tags($treespec);
  15.   #Start validating registration
  16.    if ($password == $passconf)
  17.       {
  18.         #Load details of current user-database
  19.          $isuser  = "SELECT * from chosen_users where username = '$username'";
  20.           $isuser1 = mysql_query($isuser) or die ("Could not complete user query");
  21.           $isuser2 = mysql_fetch_array($isuser1);
  22.          
  23.           if     (!$_POST['password'])
  24.             {
  25.                 print "You did not enter a password";
  26.             }
  27.           elseif (!$_POST['passconf')
  28.             {
  29.                 print "You did not enter password confirmation";
  30.             }
  31.           else if($isuser2)
  32.             {
  33.                 print "There is already a player of that name, please try again.";
  34.             }
  35.           else if(strlen($username>12)
  36.             {
  37.                 print "Sorry, you specified a illegal username. /n Please read the Terms & Conditions, found at the bottom of the page.";
  38.             }
  39.           else if(strlen($username)<=3)
  40.             {
  41.                 print "Sorry, you specified a illegal username. /n Please read the Terms & Conditions, found at the bottom of the page.";
  42.             }
  43.           else if($username==$password)
  44.             {
  45.                 print "You cannot use your username as a password, please try again.";
  46.             }
  47.           else if(!$_POST['wowname'])
  48.             {
  49.                 print "You did not enter anything in the Wow username area";
  50.             }
  51.           else
  52.             {
  53.                 $iswowname="SELECT * from chosen_users where wowname='$wowname'";
  54.                 $iswowname2=mysql_query($iswowname) or die("Unable to complete query");
  55.                 $iswowname3=mysql_fetch_array($iswowname2);
  56.                  
  57.                   if($iswowname3)
  58.                     {
  59.                         print "There is already a player registered using that WoW username, please try again.";
  60.                     }
  61.                   else if(!$_POST['classname']);
  62.                     {
  63.                         print "You did not post anything in the class name section";
  64.                         if($classname != 'Death Knight','Warlock','Warrior','Paladin','Mage','Priest','Druid','Hunter','Rogue','Shaman')
  65.                           {
  66.                               print "You did not specify a legitimate WoW class, they are as follows<br />";
  67.                               print "Warlock<br />";
  68.                               print "Death Knight<br />";
  69.                               print "Warrior<br />";
  70.                               print "Paladin<br />";
  71.                               print "Mage<br />";
  72.                               print "Priest<br />";
  73.                               print "Druid<br />";
  74.                               print "Hunter<br />";
  75.                               print "Rogue<br />";
  76.                               print "Shaman<br />";
  77.                               print "Please try again.";
  78.                           }
  79.                         else if(!$_POST['specilization'])
  80.                           {
  81.                               print "You did not enter any information in the talent spec field";
  82.                           }
  83.                         else
  84.                           {
  85.                           #Complete registration process by applying new user details to current database
  86.                              $password=md5($password);
  87.                               $date=round(date("U")/1000);
  88.                               srand($date);
  89.                               $SQL = "INSERT into chosen_users(username, password, wowname, classname , specilization, validated) VALUES ('$username','$password','$wowname','$classname','$treespec','1')";
  90.                               mysql_query($SQL) or die("Could not register, please try again.");
  91.                               print "Registration Successful.<br />";
  92.                               print "Click here to <A href='login.php'>Login</a>";
  93.                           }
  94.                     }
  95.             }
  96.       }
  97.     else
  98.       {
  99.         #A problem other than those specified occured and the registration process has been nulled
  100.          print "Something went wrong, please try again.";
  101.       }
  102.  
  103.  
  104. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement