[liphp] Sample Code (Improved)
Orrin Edwards
[email protected]
Wed, 15 Oct 2003 07:21:10 -0700 (PDT)
Thanks Alexander!
Now I have to get out the books and try to determine just how the
script works!
--- "Alexander (Sasha) Mejenkov" <[email protected]> wrote:
> Hello Orrin,
>
> Here is improved (and simplified) script that passes exact value
> of
> user's screen resolution.
>
> By the way it gives an actual screen resolution, not the
> current browser window. You can certain it yourself by changing
> browser's window and running script again
>
>
> <?php
> if (isset($_GET['resolution'])) {
> $resolution = "Screen resolution is
> ".urldecode($_GET['resolution']);
> $agent = "agent.log";
> $fd1 = fopen($agent, "a");
> $today = getdate();
> $year = $today['year'];
> $month = $today['mon'];
> $day = $today['mday'];
> $hour = $today['hours'];
> $min = $today['minutes'];
> $adata = $_SERVER["HTTP_USER_AGENT"];
> $agent_log = "$year-$month-$day $hour:$min ";
> $agent_log .= "{$adata}\n";
> $agent_log .= "$resolution\n";
> fwrite($fd1, "$agent_log");
> fclose($fd1);
> echo $agent_log;
> }
> else {
> ?>
> <SCRIPT LANGUAGE="JavaScript">
> <!--
> var height=0;
> var width=0;
> if (self.screen) // for NN4 � IE4
> {
> width = screen.width
> height = screen.height
> }
> else if (self.java) // for NN3
> {
> var jkit = java.awt.Toolkit.getDefaultToolkit();
> var scrsize = jkit.getScreenSize();
> width = scrsize.width;
> height = scrsize.height;
> }
>
> window.location='<?php echo
> $_SERVER['PHP_SELF'];?>'+'?resolution='+width+'x'+height;
> // -->
> </SCRIPT>
> <?php
> }
> ?>
>
>
> --
> Best regards,
> Alexander mailto:[email protected]
>
>
> _______________________________________________
> Liphp mailing list
> [email protected]
> https://www.liphp.org/mailman/listinfo/liphp
>
>
=====
Orrin - Long Island, New York
http://www.orrin.org/ Site Index
http://www.orrin.org/carib/ Caribbean Index
http://www.orrin.org/syocc/ Syosset Camera Club
http://www.orrin.org/aruba/ Aruba Trip Notes
Linux by SuSE... a world without Windows!