1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

PHP: referring browser

Discussion in 'Software Development' started by mussavcom, Apr 25, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    I have a PHP page that I want accessible only to people who arrive at the webpage from my AIM (AOL Instant Messenger) profile. Is there a superglobal or something that tells the referring browser (not the browser they're currently using; the one that sent them to the page)?
     
  2. deuce868

    deuce868

    Joined:
    Nov 2, 2000
    Messages:
    637
    nope, you're not going to get the browser that referred them. You can get some kind of referrering address, but I have no idea what an AIM link would show up as in that.
     
  3. Snake~eyes

    Snake~eyes

    Joined:
    Apr 18, 2002
    Messages:
    640
    You have to test it and see. I think the referring address is some javascript if I remember correctly. :)
     
  4. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    Tried, there's no referring address at all.
     
  5. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    The user Agent string for aim 5.5.3951 on Win2K, is

    Mozilla/4.08 [en] (WinNT; U ;Nav)
     
  6. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    This will open a link in Internet Explorer. What I want to do is pass the user's screen name to IE via GET (link.php?sn=%n, and AIM will automatically replace the %n with the person's screen name). If I can disable people from accessing unless they are sent by AIM, they won't be able to change the screenname in the URL.
     
  7. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    The http referrer will always be undefined when coming from aim in that matter.
     
  8. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    One thing you should know about web programming: never trust the client. ANYTHING the client sends you can be forged/falsified, including user-agent and GET/POST data.

    The only way I can think of to verify who an AIM user actually is, would be to send them an instant message. Although more complicated than putting a link in your profile, it might be worth it to do something like this.

    I would do this:
    When a person clicks the link in your profile, they are asked to enter their screenname. They enter it, and you have a PHP script send a message to the screenname they entered. That person must then type "ok" or something like that, to confirm. Then your PHP script will allow that person access to your web site.

    A couple other ideas, using an AIM bot are
    A) When someone sends your bot an IM, send back the data for your profile. Disadvantage is that your profile is restricted by the content that you can put in an instant message.

    B) When someone sends your bot an IM, send back a randomly generated password., and store it in your database. Then, have the user type their screenname and the password into your webpage before letting them see your page. Harder on the user, but the most accurate way to do this.
     
  9. Fyzbo

    Fyzbo

    Joined:
    Feb 6, 2002
    Messages:
    1,683
    I wanted to do a similar thing. What I do is have an if statement inside the page saying that $sn must have a value to display the rest of the page. Then I save the screen name and the IP address. I've noticed that most people click on the page first then after it loads go and change the name in the address bar. For the average case you can figure out who is doing it by comparing IPs. :D
     
  10. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/223683

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice