Guest User

Untitled

a guest
May 15th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 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. $check = new security();
  15. $message = null;
  16. if($check->is_secure($_POST['username']) == false) $message[] = "";
  17. if ($check->is_secure($_POST['password1']) == false) $message[] = "";
  18. if ($check->is_secure($_POST['password2']) == false) $message[] = "";
  19. if ($check->is_secure($_POST['nickname']) == false) $message[] = "";
  20.  
  21. if(strlen($_POST['username']) < 3) $message[] = "Username too short";
  22. if(strlen($_POST['username']) > 16)$message[] = "Username too long";
  23. if(strlen($_POST['password1']) < 4) $message[] = "Password [1] too short";
  24. if(strlen($_POST['password1']) > 32)$message[] = "Password [1] too long";
  25. if(strlen($_POST['password2']) < 4) $message[] = "Password [2] too short";
  26. if(strlen($_POST['password']) > 32) $message[] = "Password [2] too long";
  27.  
  28. if (preg_match("/[!@#$%^&\*()_+\}\{\]\[]/", $_POST['username'])) $message[] = "Bad character in username";
  29.  
  30. if(count($message) > 0) {
  31. for($i = 0; $i < count($message); $i++) {
  32. print $message[$i];
  33.  
  34. header("location:./../?invalidData");
  35.  
  36. }
  37. return;
  38. } else {
  39. $username = $_POST['username'];
  40. $password = md5($_POST['password2']);
  41. $nickname = $_POST['nickname'];
  42. $verifyAccount = mssql_num_rows(mssql_query("select * from TB_User where StrUserID = '$username'"));
  43. if($verifyAccount > 0) {
  44. header("location:./../?NameExists");
  45. } else {
  46. mssql_query("exec _AddUser '$username','$password','$nickname',0,0,0,0,3,3,0");
  47. header("location:./../?regComplete");
  48. }
  49. }
  50. }
  51. ?>
Add Comment
Please, Sign In to add comment