Guest User

Untitled

a guest
Apr 27th, 2018
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. <?php
  2. include("../modules/include/Config.php");
  3. require_once("../modules/include/sqlConn.php");
  4. require_once("../modules/include/Security.php");
  5.  
  6. mssql_select_db($dbName1, $dbConn) or die ("Couln't select database $dbName1");
  7.  
  8. if ($_POST['password1'] != $_POST['password2']) {
  9. header("location:./../?pwMissmatch");
  10. } else if (empty($_POST['nickname']) || empty($_POST['password1']) || empty($_POST['password2']) || empty($_POST['username'])) {
  11. header("location:./../?noData");
  12. } else
  13. {
  14. if(strlen($_POST['username']) < 3) $msg[] = "Username too short";
  15. if(strlen($_POST['username']) > 16)$msg[] = "Username too long";
  16. if(strlen($_POST['password1']) < 6) $msg[] = "Password [1] too short";
  17. if(strlen($_POST['password1']) > 32)$msg[] = "Password [1] too long";
  18. if(strlen($_POST['password2']) < 6) $msg[] = "Password [2] too short";
  19. if(strlen($_POST['password']) > 32) $msg[] = "Password [2] too long";
  20.  
  21. $check = new security();
  22. $message = null;
  23. if($check->is_secure($_POST['username']) == false) $message[] = "";
  24. if ($check->is_secure($_POST['password1']) == false) $message[] = "";
  25. if ($check->is_secure($_POST['password2']) == false) $message[] = "";
  26. if ($check->is_secure($_POST['nickname']) == false) $message[] = "";
  27. if(count($message) > 0) {
  28. for($i = 0; $i < count($message); $i++) {
  29. print $message[$i];
  30. header("location:./../?invalidData");
  31. }
  32. return;
  33. } else {
  34. $username = $_POST['username'];
  35. $password = md5($_POST['password2']);
  36. $nickname = $_POST['nickname'];
  37. $verifyAccount = mssql_num_rows(mssql_query("select * from TB_User where StrUserID = '$username'"));
  38. if($verifyAccount > 0) {
  39. header("location:./../?NameExists");
  40. } else {
  41. mssql_query("exec _AddUser '$username','$password','$nickname',0,0,0,0,3,3,0");
  42. header("location:./../?regComplete");
  43. }
  44. }
  45. }
  46. ?>
Add Comment
Please, Sign In to add comment