Advertisement
Guest User

Untitled

a guest
Mar 15th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2. if('sub') {
  3.  
  4. $client = $_SERVER['REMOTE_ADDR'];
  5. $username="user";
  6. $password="pass";
  7. $database="db";
  8. mysql_connect(localhost,$username,$password);
  9. $time = strtotime("2 minutes");
  10. $now = strtotime("now");
  11. @mysql_select_db($database) or die( "Unable to select database");
  12. $query = "SELECT Time FROM log WHERE IP='$client'";
  13. $result= mysql_query($query);
  14. $num=mysql_num_rows($result);
  15.  
  16.  
  17. while($rows=mysql_fetch_array($result)){
  18. $timestamp = $rows['Time'];
  19. }
  20. echo n;
  21. echo $now;
  22. echo t;
  23. echo $timestamp;
  24.  
  25.  
  26. if($now < $timestamp)
  27. {
  28. echo "<center><h2 style="color:red" class="texts" id="homeLink">Please wait 2 minutes.</h2></center>";
  29.  
  30. }
  31. else{
  32. //some other code
  33.  
  34. $query1 = "INSERT INTO log VALUES ('$client','$time','$username')";
  35. $query2 = "UPDATE `log` SET `Time`='$time' SET `Username`='$username' WHERE `IP`='$client'";
  36.  
  37. if($num == 0)
  38. {
  39. mysql_query($query1);
  40. }
  41. else
  42. {
  43. mysql_query($query2);
  44. }
  45.  
  46. mysql_close();
  47. }
  48. ?>
  49.  
  50. UPDATE `log` SET `Time`='$time' SET `Username`='$username' WHERE `IP`='$client'"
  51.  
  52. UPDATE `log` SET `Time`='$time', `Username`='$username' WHERE `IP`='$client'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement