Guest User

kden

a guest
Jun 2nd, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. $result = $conpdo->prepare("SELECT * FROM `logs` WHERE `username` LIKE :username");
  2. $result->execute(array(':username' => $_GET['username']));         
  3. $info = $result->fetch(PDO::FETCH_ASSOC);
  4.  
  5. if(empty($info))
  6. {
  7.     $result = $conpdo->prepare("INSERT INTO `logs` (`id`, `ip`, `username`, `last_update`) VALUES (NULL, :ip, :username, '0000-00-00 00:00:00');");
  8.     $result->execute(array(':username' => $_GET['username'], ':ip' => $_GET['ip']));  
  9. }
  10. else
  11. {
  12.     $result = $conpdo->prepare("UPDATE `logs` SET `ip` = :ip WHERE `logs`.`id` = :id");
  13.     $result->execute(array(':ip' => $_GET['ip'], ':id' => $info['id']));       
  14. }
Add Comment
Please, Sign In to add comment