SHARE
TWEET

Untitled

a guest Jun 8th, 2017 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // ODBC
  3. $DB = "KN_Online";
  4. $User = "Knight";
  5. $Pass = "Knight";
  6.  
  7. // Function
  8. function sanitize($input,$length)
  9. {
  10.         return substr(htmlentities($input, ENT_QUOTES), 0, $length);
  11. }
  12.  
  13. // Check
  14. if (sizeof($_POST)
  15.  
  16. // Buttons, Text.
  17. echo '
  18. <div align = "center">
  19. <form action = "Register.php" method="post">
  20. <div align = "center">ID: <input type="text" name="userid" /></div>
  21. <div align = "center">Password: <input type="text" name="pass1" /></div>
  22. <div align = "center">Confirm Passowrd: <input type="text" name="pass2" /></div>
  23. <div align = "center">Security Code: <input type="text" name="charsil" /></div>
  24. <div align = "center">Confirm Security Code: <input type="text" name="charsil1" /></div>
  25. <div align = "center">Email: <input type="text" name="email" /></div>
  26. <div align = "center">Confirm Email: <input type="text" name="email1" /></div>
  27. <div align = "center"><input type = "submit" value = "Register" /></div>
  28. </form>
  29. </div>
  30. ';
  31. }
  32.  
  33. else
  34.  
  35. {
  36.  
  37.  
  38. // Posted Data
  39. $login = sanitize($_POST['userid'],5);
  40.             $pw = sanitize($_POST['pass1'],5);
  41.             $c_pw =sanitize($_POST['pass2'],5);
  42.             $socNo = sanitize($_POST['charsil'],4);
  43.             $socNo2 = sanitize($_POST['charsil1'],4);
  44.             $email = sanitize($_POST['email'],25);
  45.             $email2 = sanitize($_POST['email1'],25);
  46.  
  47.  
  48.  
  49. // Error Codes
  50. if ($pw == $c_pw) {
  51. echo 'Password Confirmed';
  52. die();
  53. }
  54.  
  55. if (empty($login)) {
  56. echo 'Fill In Login Field';
  57. die();
  58. }
  59.  
  60. if (empty($pw) || empty($c_pw)) {
  61. echo 'Fill in Password Field';
  62. die();
  63. }
  64.  
  65. if (empty($socNo) || empty($socNo2)) {
  66. echo 'Fill In Security Code Field';
  67. die();
  68. }
  69.  
  70. if (empty($email) || empty($email2)) {
  71. echo 'Fill In Email Field';
  72. die();
  73. }
  74.  
  75. // Check For Previous Accounts
  76. $msconnect=odbc_connect($DB,$User,$Pass);
  77. $stmt = odbc_prepare($msconnect, " select count(*) from TB_User where straccountid = ?");
  78. $msresul=odbc_exec($msconnect,$stmt)
  79.         odbc_fetch_row($msresul);
  80.  if ($count > 0) deny { // Curious why count would have to be a variable in this?
  81.  echo 'Account Name In Use'
  82.  die ();
  83.  }
  84.  
  85.  
  86. //Registration
  87. $stmt = odbc_prepare($msconnect, "INSERT INTO TB_USER (strACcountID, strPasswd, strSocNo, Email) VALUES (?,?,?,?)");
  88.     $result = odbc_execute($stmt, array($login,$pw,$socno,$email));
  89.  
  90. }
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top