Advertisement
Guest User

Untitled

a guest
May 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.32 KB | None | 0 0
  1. <?php
  2. echo "<HTML>
  3. <TITLE>Show Screen Resolution</TITLE>
  4. <HEAD>";
  5.  
  6. if(isset($_COOKIE["users_resolution"]))
  7. {
  8. $screen_res = $_COOKIE["users_resolution"];
  9. $res = explode("x",$screen_res);
  10.  
  11. $con = @mysql_connect('localhost','NAME','PASS')
  12.     or die(mysql_error());
  13. mysql_select_db('cmd276_res', $con)
  14.     or die('SQL Base not found.');
  15.  
  16.  
  17.     mysql_query("INSERT INTO `cmd276_res`.`sizes` (`size`, `ip`) VALUES ('$screen_res', '".$_SERVER['REMOTE_ADDR']."');");
  18. }
  19. else //means cookie is not found set it using Javascript
  20. {
  21. echo "<script language=\"javascript\">
  22. <!--
  23. writeCookie();
  24. function writeCookie()
  25. {
  26. var today = new Date();
  27. var the_date = new Date(\"December 31, 2023\");
  28. var the_cookie_date = the_date.toGMTString();
  29. var the_cookie = \"users_resolution=\"+ screen.width +\"x\"+ screen.height;
  30. var the_cookie = the_cookie + \";expires=\" + the_cookie_date;
  31. document.cookie=the_cookie
  32.  
  33. location = \'res.php\';
  34. }
  35. //-->
  36. </script>";
  37. }
  38. echo "</head>
  39. <body><pre>
  40. Thanks for your screen res! Its been added to the list.<br />
  41. Your res is $screen_res <br />
  42. I have";
  43. $a = mysql_query("SELECT COUNT(`ip`) FROM `sizes`");
  44. $b = mysql_fetch_array($a);
  45. echo $b[0] ." different people(s) resolutions now :)<br />";
  46. echo $screen_res ."\n";
  47. echo $res[0] ."\n";
  48. echo $_COOKIE["users_resolution"] ."\n";
  49. echo "</body>
  50. </html>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement