Advertisement
Guest User

Untitled

a guest
Jan 12th, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. <?php
  2. if (isset($_GET['page']) && $_GET['page']='activate' ) {
  3. unset($_SESSION['regok']);
  4. if (isset($_GET['hash'])) {
  5. $res = q("
  6. SELECT * FROM `no_active_users`
  7. WHERE `hash` = '".es($_GET['hash'])."'
  8. ");
  9.  
  10. if (mysqli_num_rows($res)) {
  11. $row = mysqli_fetch_assoc($res);
  12.  
  13. $res2 = q("
  14. SELECT * FROM `users`
  15. WHERE `name` = '".es($row['name'])."'
  16. LIMIT 1
  17. ");
  18. if (mysqli_num_rows($res2)) {
  19. $_SESSION['activated']='activated';
  20. }
  21. else {
  22. $result = q("
  23. SELECT MAX(`ID`) max_id FROM `users`
  24. ");
  25. if (mysqli_num_rows($result)) {
  26. $ID = mysqli_fetch_assoc($result);
  27. $ID['max_id'] = $ID['max_id'] + 16;
  28. }
  29. else {
  30. $ID['max_id'] = 32;
  31. }
  32.  
  33. q("
  34. INSERT INTO `users` SET
  35. `name` = '".es($row['name'])."',
  36. `passwd` = '".es($row['passwd'])."',
  37. `email` = '".es($row['email'])."',
  38. `creatime` = '".es($row['creatime'])."',
  39. `ID` = '".$ID['max_id']."',
  40. `Prompt` = '0',
  41. `answer` = '0',
  42. `truename` = '0',
  43. `idnumber` = '0',
  44. `mobilenumber` = '0',
  45. `province` = '0',
  46. `phonenumber` = '0',
  47. `city` = '0',
  48. `address` = '0',
  49. `postalcode` = '0'
  50. ");
  51.  
  52. q("
  53. UPDATE `no_active_users` SET
  54. `hash` = 'none'
  55. WHERE `name` = '".es($row['name'])."'
  56. ");
  57. $_SESSION['activating'] ='activating';
  58. $_SESSION['name'] = $row['name'];
  59. $_SESSION['ID'] = $ID['max_id'];
  60. }
  61.  
  62. } else {
  63. $_SESSION['activatefall'] = 'activatefall';
  64. }
  65. }
  66. ?>
  67. </div>
  68. </body>
  69. <?php
  70. }
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement