SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast rev909's Avatar
    Join Date
    Mar 2002
    Location
    Romania
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Image based counter

    Hello I have a counter which works part by PHP and part by JavaScript calling an image... I use the following JavaScript to log the user's resolution, color depth and wether he has Java / JavaScript enabled or not.

    Code:
    <script language="JavaScript">
    <!--
      <?php global $pmv_vis, $pmv_install_dir, $pmv_img_width, $pmv_img_heigth; ?>
      pmv_vis = "<?php echo($pmv_vis); ?>";
      sw = "-";
      sc = "-";
      c = "-";
      je = 0;
      js = 1;
      app = "-";
      app = escape(navigator.appName);
      sw = screen.width;
      sh = screen.height;
      if(navigator.javaEnabled()) {je = 1}
      if(app != "Netscape") {c=screen.colorDepth}
      else {c = screen.pixelDepth}
      r = "pmv_vis="+pmv_vis+"&screenw="+sw+"&screenh="+sh+"&colors="+c+"&java="+je+"&js="+js;
      url = "<?php echo($pmv_install_dir); ?>counter_image.php?" + r; 
      document.write('<img src="'+url+'" width=<?php echo($pmv_img_width); ?> height=<?php echo($pmv_img_heigth); ?> border=0 alt="pmv">\n');
    // -->
    </script>
    Where pmv_vis is a unique ID, pmv_install_dir is where I have my counter script installed and the other two varibles refer to the image's size.

    Problem is that I noticed that this script doesn't work with older browsers. Is there a way to make it work? Where I am mistaken?

    I'm not a JavaScript guru this script is merely a copy / paste from a counter site's code...

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why don't you show us what is looks like AFTER php has sent it to the browser
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Enthusiast rev909's Avatar
    Join Date
    Mar 2002
    Location
    Romania
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, here's the snip from Apache's log:

    Code:
    "GET /counter_image.php?pmv_vis=0M1J9374X7&screenw=1152&screenh=864&colors=32&java=0&js=1 HTTP/1.1"

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I meant the HTML
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Enthusiast rev909's Avatar
    Join Date
    Mar 2002
    Location
    Romania
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry!

    Code:
    <script language="JavaScript">
    <!--
      pmv_vis = "3P152Q8HD2";
      sw = "-";
      sc = "-";
      c = "-";
      je = 0;
      js = 1;
      app = "-";
      app = escape(navigator.appName);
      sw = screen.width;
      sh = screen.height;
      if(navigator.javaEnabled()) {je = 1}
      if(app != "Netscape") {c=screen.colorDepth}
      else {c = screen.pixelDepth}
      r = "pmv_vis="+pmv_vis+"&screenw="+sw+"&screenh="+sh+"&colors="+c+"&java="+je+"&js="+js;
      url = "/phpMyVisitors/counter_image.php?" + r; 
      document.write('<img src="'+url+'" width=27 height=14 border=0 vspace=3 alt="pmv">\n');
    // -->
    </script>
    So this is how it looks rendered.


Bookmarks

Posting Permissions

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