Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2. /* Подключение конфига */
  3. require_once "../config/config.php";
  4.  
  5. $isCorrect = false;
  6. $neededID;
  7.  
  8. $db_getter = new mysqli(DATABASE_HOST, LEARNIT_DB_GETTER_NAME, LEARNIT_DB_GETTER_PASSWORD, DATABASE_NAME);
  9. $neededLink = $db_getter->query("SELECT id, activation_link FROM activatedaccs");
  10. while($row = $neededLink->fetch_assoc()) {
  11. $link = "http://{$_SERVER[HTTP_HOST]}{$_SERVER[REQUEST_URI]}";
  12. if($row["activation_link"] == $link) {
  13. echo "Есть совпадения!";
  14. $isCorrect = true;
  15. $neededID = $row["id"];
  16. }
  17. }
  18. $db_getter->close();
  19. $neededLink->close();
  20.  
  21. if($isCorrect and $neededID) {
  22. $db_setter = new mysqli(DATABASE_HOST, LEARNIT_DB_SETTER_NAME, LEARNIT_DB_SETTER_PASSWORD, DATABASE_NAME);
  23. $update = $db_setter->prepare("UPDATE activatedaccs SET activated = true WHERE id = ?");
  24. $update->bind_param('i', $neededID);
  25. $update->execute();
  26. $update->close();
  27. $db_setter->close();
  28. }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement