SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    Digital Warrior Renegade's Avatar
    Join Date
    Nov 2000
    Location
    Portland, OR
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Infamous Screen Res question...

    Ok, I know you have all heard this many times before, but how would I go about getting the screen res of the current visitor into a MySQL DB?

    I know that PHP being a server side language, is not capable of this, so I need to use Javascript. No problem, I can do that. But once it is in the JS var, where do I go from there?

    Is there a temp env var that I can set to the JS var, the set the PHP var equal to that? Sorta like using the enviornment var as the bridge between PHP and JS.

    Suggestions? Thanks

  2. #2
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The javascript:
    Code:
    <SCRIPT>
    // script to get res goes here
    //...
    
    self.location.href = "addtodb.php?width=" + width + "&height=" + height;
    </SCRIPT>
    addtodb.php has the code to add the screen resolution to the database, and has the following code at the top:
    PHP Code:
    <?PHP
    header
    ("Status: 204 No Content");
    ?>
    Note make sure that nothing is outputed to the browser after the header.

  3. #3
    Digital Warrior Renegade's Avatar
    Join Date
    Nov 2000
    Location
    Portland, OR
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh ok, I get it. Thanks

    One last question, what does the header "Status: 204 no content" do? I know what a header is, as in Location:, but not this. And why is that important?

    Thanks again

  4. #4
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ck :: bringing chris to the masses.


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
  •