Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

59 lines
2.2 KiB

  1. <?php
  2. # this function verifies that the e-mail address passed doesn't contain any illegal characters
  3. function validateEmail($email) {
  4. return filter_var($email, FILTER_VALIDATE_EMAIL);
  5. }
  6. # this function verifies the desired e-mail address doesn't already exist in the database
  7. function usedEmail($usedemail) {
  8. $con = mysqli_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  9. $sqlemailcheck = "SELECT usermail FROM userinfo WHERE userinfo.usermail = '" . $usedemail . "'";
  10. $results = mysqli_query($con, $sqlemailcheck);
  11. if (mysqli_num_rows($results) >= 1) {
  12. echo '<hr><center>This e-mail address is already registered, please click on the forgot password link.<br /><a href="register.php" class="navlink">Please try again!</a><hr><br />';
  13. include_once ('footer.php');
  14. exit();
  15. }
  16. }
  17. # this function verifies that a username doesn't already exist in the database
  18. function validateUsername($uname) {
  19. $con = mysqli_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  20. $sqlunamecheck = "SELECT username FROM userinfo WHERE userinfo.username = '" . $uname . "'";
  21. $results = mysqli_query($con, $sqlunamecheck);
  22. if (mysqli_num_rows($results) >= 1) {
  23. echo '<center>This username has already been taken, please choose another one<br /><a href="register.php" class="navlink">Please try again!</a><br />';
  24. include_once ('footer.php');
  25. exit();
  26. }
  27. }
  28. ####################
  29. # verifying the username doesn't already exist in the database
  30. if (!empty($_POST['username'])) {
  31. $username = mysqli_real_escape_string($con, $_POST['username']);
  32. validateUsername($username);
  33. }
  34. ####################
  35. # verifying the e-mail address is in a valid format
  36. if (!empty($_POST['useremail'])) {
  37. $verifyemail = validateEmail($_POST['useremail']);
  38. if (empty($verifyemail)) {
  39. echo '<center>This address: ' . $_POST['useremail'] . ' is not a valid e-mail address!<br />Please verify and type it again.<br />';
  40. include_once ('footer.php');
  41. exit();
  42. }
  43. usedEmail($_POST['useremail']);
  44. }
  45. ####################
  46. # verifying passwords match each other
  47. if (!empty($_POST['userpass1'] && $_POST['userpass2'])) {
  48. if (($_POST['userpass1']) != ($_POST['userpass2'])) {
  49. echo '<center>The passwords don\'t match!<br />Please try again!';
  50. include_once ('footer.php');
  51. exit();
  52. }
  53. }
  54. ?>