PHP Click counter.


SUBMITTED BY: Guest

DATE: March 15, 2014, 12:38 p.m.

FORMAT: PHP

SIZE: 1.2 kB

HITS: 1109

  1. <?php
  2. include("connect.php");
  3. if (!isset($_GET['reload'])){
  4. if (isset($_COOKIE['screen'])) {
  5. $screen = $_COOKIE['screen'];
  6. $cookend = true;
  7. } else {
  8. ?><meta HTTP-EQUIV="REFRESH" content="0; url="<?=$_SERVER['PHP_SELF'] . 'reload=1';?>""><?php
  9. }
  10. }
  11. $date = date("Y-m-d H:i:s");
  12. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  13. $ip = $_SERVER['REMOTE_ADDR'];
  14. $httpaccess = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
  15. $name = $_COOKIE['name'];
  16. $sql = "INSERT INTO `info` ( `Time` , `IP` , `Useragent` , `Cookieson` , `Screen` , `HTTPAcceptL` , `hostname` , `name` , `empty2` )
  17. VALUES (
  18. '$date' , '$ip' , '$_SERVER[HTTP_USER_AGENT]' , '$cookend' , '$screen' , '$httpaccess' , '$hostname' , '$name' , ''
  19. ) ;
  20. ";
  21. $result = mysql_query($sql);
  22. if(!$result)
  23. {
  24. //something went wrong, display the error
  25. echo 'Something went wrong. Please try again later.';
  26. //echo mysql_error(); //debugging purposes, uncomment when needed
  27. }
  28. ?>
  29. </head>
  30. </html>

comments powered by Disqus