SHARE
TWEET

Untitled

a guest Jun 8th, 2017 86 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. if (!$posted)
  14. {
  15. // Buttons, Text.
  16. echo '
  17. <form action="Register.php" method="post">
  18. ID: <input type="text" name="userid" />
  19. Password: <input type="text" name="pass1" />
  20. Confirm Passowrd: <input type="text" name="pass2" />
  21. Security Code: <input type="text" name="charsil" />
  22. Confirm Security Code: <input type="text" name="charsil1" />
  23. Email: <input type="text" name="email" />
  24. Confirm Email: <input type="text" name="email1" />
  25. </form>
  26. ';
  27. }
  28. else
  29. {
  30. //actually register
  31.  
  32. // posted data
  33. $login = sanitize(@$_POST['userid'],5);
  34.             $pw = sanitize($_POST['pass1'],5);
  35.             $c_pw =sanitize($_POST['pass2'],5);
  36.             $socNo = sanitize($_POST['charsil'],4);
  37.             $socNo2 = sanitize($_POST['charsil1'],4);
  38.             $email = sanitize($_POST['email'],25);
  39.             $email2 = sanitize($_POST['email1'],25);
  40.  
  41.  
  42.  
  43. // Error Codes
  44. if ($pw != $c_pw) {
  45. echo 'Password Confirmed';
  46. die();
  47. }
  48.  
  49. if (!empty($login) {
  50. echo 'Fill In Login Field';
  51. die();
  52. }
  53.  
  54. if (!empty($pw) && !empty($c_pw) {
  55. echo 'Fill in Password Field';
  56. die();
  57. }
  58.  
  59. if (!empty($socNo) && !empty($socNo2) {
  60. echo 'Fill In Security Code Field';
  61. die();
  62. }
  63.  
  64. if (!empty($email) && !empty($email2) {
  65. echo 'Fill In Email Field';
  66. die();
  67. }
  68.  
  69. //Registration
  70. $msconnect=odbc_connect($DB,$User,$Pass);
  71. $stmt = odbc_prepare($msconnect, "INSERT INTO TB_USER (strACcountID, strPasswd, strSocNo, Email) VALUES (?,?,?,?)");
  72.     $result = odbc_execute($stmt, array($login,$pw,$socno,$email));
  73.  
  74. }
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. ?>
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