SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Whats happenin

  1. #1
    SitePoint Guru godsfshrmn's Avatar
    Join Date
    Mar 2001
    0 Post(s)
    0 Thread(s)

    Whats happenin

    What does this script do? I have no JS knowdlege at all, only PHP, so please be kinda vague .
    <script language="javascript">
    var data, p;
    var agt=navigator.userAgent.toLowerCase();
    var img=escape("./buttons/b1.jpg");
    if((location.href.substr(0,6)=='https:')||(location.href.substr(0,6)=='HTTPS:')) {p='https';} data = '&agt=' + escape(agt) + '&img=' + img + '&r=' + escape(document.referrer) + '&aN=' + escape(navigator.appName) + '&lg=' + escape(navigator.systemLanguage) + '&OS=' + escape(navigator.platform) + '&aV=' + escape(navigator.appVersion);
    if(navigator.appVersion.substring(0,1)>'3') {data = data + '&cd=' + screen.colorDepth + '&p=' + escape(screen.width+ 'x'+screen.height) + '&je=' + navigator.javaEnabled();};
    document.write('<a href="">');
    document.write('<img border=0 hspace=0 '+'vspace=0 src="' + data + '"> </a>');
    s c r i p t s f o r y o u . n e t

  2. #2
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Whistler BC originally from Guelph Ontario
    0 Post(s)
    0 Thread(s)
    I don't know if you want me to walk you through but essentially you are grabbing a button from another server. Looks like a statitcs server by the look of things.

    first it figures out if you are an http or https

    It is sending all of the information about the user such as the browser, platform, language and also the information about the referer (the web sites with the button)

    It then checks to see if version number 3 or up for any browser and then sends screen height, width, colour depth and if it java enabled.

    it then takes all of this information and sends it to a php base server stat couter.

    Hope that helps ...(that code was damn ugly looking too)
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  3. #3
    SitePoint Enthusiast RogueJedi's Avatar
    Join Date
    Oct 2001
    0 Post(s)
    0 Thread(s)
    On my system here at work, using IE 5.5sp2 it produces the following code:
    <A href=""><IMG hspace=0 
    border=0> </A>
    What the script is doing is building the querystring portion of a URL for the image source, so that a particular image is shown depending on if you are running a browser version higher than 3. This appears to be for some sort of stats tracking. The querystring details what website you just came from, your browser name and version, your OS and language (locale), your screen resolution and color depth, and if Java is enabled or not.
    Rob Nolan
    Do or do not, there is no try.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts