Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "<HTML>
- <TITLE>Show Screen Resolution</TITLE>
- <HEAD>";
- if(isset($_COOKIE["users_resolution"]))
- {
- $screen_res = $_COOKIE["users_resolution"];
- $res = explode("x",$screen_res);
- $con = @mysql_connect('localhost','NAME','PASS')
- or die(mysql_error());
- mysql_select_db('cmd276_res', $con)
- or die('SQL Base not found.');
- mysql_query("INSERT INTO `cmd276_res`.`sizes` (`size`, `ip`) VALUES ('$screen_res', '".$_SERVER['REMOTE_ADDR']."');");
- }
- else //means cookie is not found set it using Javascript
- {
- echo "<script language=\"javascript\">
- <!--
- writeCookie();
- function writeCookie()
- {
- var today = new Date();
- var the_date = new Date(\"December 31, 2023\");
- var the_cookie_date = the_date.toGMTString();
- var the_cookie = \"users_resolution=\"+ screen.width +\"x\"+ screen.height;
- var the_cookie = the_cookie + \";expires=\" + the_cookie_date;
- document.cookie=the_cookie
- location = \'res.php\';
- }
- //-->
- </script>";
- }
- echo "</head>
- <body><pre>
- Thanks for your screen res! Its been added to the list.<br />
- Your res is $screen_res <br />
- I have";
- $a = mysql_query("SELECT COUNT(`ip`) FROM `sizes`");
- $b = mysql_fetch_array($a);
- echo $b[0] ." different people(s) resolutions now :)<br />";
- echo $screen_res ."\n";
- echo $res[0] ."\n";
- echo $_COOKIE["users_resolution"] ."\n";
- echo "</body>
- </html>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement