Results 1 to 17 of 17

Thread: Get the URL I am at....[Resolved]

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Get the URL I am at....[Resolved]

    Is it possible to get the URL I am at using PHP, so I can store it in a variable and send it to the next site I am going to? Or do I have to use JS to do that?
    Last edited by NoteMe; May 13th, 2004 at 09:27 AM.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Oddly enough, that happens automaticaly in most placed. Called the HTTP REFERER.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Thanks...couldn't find anything about it in my 2 PHP books, or in my HTML book, but after seacrhing this forum up and down I finaly found out what you where talking about.

    Most of the answers where just talkinag about it, nothing more...but here is some help for the next person searching...


    http://www.vbforums.com/showthread.p...hlight=REFERER

  4. #4

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    BTW your home site does not validiate...take away your badge of honor...


    http://validator.w3.org/check?uri=ht...website.net%2F

  5. #5
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Come on Note, you not search the forum
    http://www.vbforums.com/showthread.p...hreadid=289337
    Its still on the page, only a couple down. .
    And I wouldn't relie on the REFFERER thing becuase it can be disabled by most Security Programs. I had that problem a while back .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  6. #6

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by Electroman
    Come on Note, you not search the forum
    http://www.vbforums.com/showthread.p...hreadid=289337
    Its still on the page, only a couple down. .
    And I wouldn't relie on the REFFERER thing becuase it can be disabled by most Security Programs. I had that problem a while back .

    First of all, I didn't know what to search for. And second of all, what security app are you talking about. Apps on the clients PC?

    And other thing, the thread you posted a link to....isn't that only printing the name of the current page?

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    HTTP REFERER will tell you where you jsut came from. That's how refere links/tracking works. When you go from say, www.vbforums.com to www.developerkb.com, part of the header data is that the last page you were on was at vbf. BUT, there are some firewalls and proxy servers that block that kind of data from being transmitted.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    So is there a safe way to get the last page without sending it as as a variable from all my pages? Or should I just use for the the clients that can use it, and check if it is "" for all other users and send them to a defualt page if it is empty?

  9. #9
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Things like Norton Security has a privicy option where it will stop any browser your using from passing on the REFFERER header. Can't remember which user it was but he had a page which let you downlaod a files of his but it checked you had came from his site and it hadn't been linked to from else where. It thought I waas coming from another site because the refferer didn't have his website in it (It was blank).

    The thread I linked to shows: $_SERVER["SCRIPT_NAME"]; which hold the address of the script file, he then split it up to get just the filename. If you skip the splitting part you should have a variable which the current pages address. Notice it won't include and parameter pairs sent with it but you can easily loop through the $_GET[] array to get all of them andadd them if that what you need.

    I'll let you off on the searching though .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  10. #10
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Originally posted by Electroman
    Things like Norton Security has a privicy option where it will stop any browser your using from passing on the REFFERER header. Can't remember which user it was but he had a page which let you downlaod a files of his but it checked you had came from his site and it hadn't been linked to from else where. It thought I waas coming from another site because the refferer didn't have his website in it (It was blank).

    The thread I linked to shows: $_SERVER["SCRIPT_NAME"]; which hold the address of the script file, he then split it up to get just the filename. If you skip the splitting part you should have a variable which the current pages address. Notice it won't include and parameter pairs sent with it but you can easily loop through the $_GET[] array to get all of them andadd them if that what you need.

    I'll let you off on the searching though .
    But isn't that only going to tell you where you ARE, and not where you WERE? Or dod I miss something?

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  11. #11
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Yeah you pass that variable when the user follows a link and you know where the user was last on your site .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  12. #12

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by techgnome
    But isn't that only going to tell you where you ARE, and not where you WERE? Or dod I miss something?

    TG

    That was what I was asking about too..

  13. #13

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by Electroman
    Yeah you pass that variable when the user follows a link and you know where the user was last on your site .
    OK...I get it now...but I still don't like it...then I still have to write it on all the pages I want to use it.......But I will live....

  14. #14
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    how about this variable gets stored in a cookie instead of being part of the address to the next page? That would work but may come up with strange results if they have more than one page open on your site.

    Ow I now get why it wasn't very usefull to start with . You could just make a constant in all the fiels instead of this. I see now techgnome was on the right lines by the refferer thing. Mind I still wouldn't trust it to tell the truth. You could of course just bugger it up for people that stop the refferer from being sent. I'm sure they deserve it, its not as if its important info in it.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  15. #15
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Originally posted by Electroman
    Yeah you pass that variable when the user follows a link and you know where the user was last on your site .
    OK, so stuff it into a variable, then what? It still needs to get to the new page somehow.

    Originally posted by Electroman
    how about this variable gets stored in a cookie instead of being part of the address to the next page? That would work but may come up with strange results if they have more than one page open on your site.

    Ow I now get why it wasn't very usefull to start with . You could just make a constant in all the fiels instead of this. I see now techgnome was on the right lines by the refferer thing. Mind I still wouldn't trust it to tell the truth. You could of course just bugger it up for people that stop the refferer from being sent. I'm sure they deserve it, its not as if its important info in it.
    Cookie may not work either. You'ld have to set the cookie, then reset the location back to the same page to get the cookie to stick.

    Also does $_SERVER["SCRIPT_NAME"]; retain any querystring data?

    TG

    EDIT: Either way, it jsut seems to me that there should be a better way.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  16. #16
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Posted by techgnome
    OK, so stuff it into a variable, then what? It still needs to get to the new page somehow.
    The idea was to send it by GET, everywhere the next page would need it add in onto the link as a paramter.

    Posted by techgnome
    Also does $_SERVER["SCRIPT_NAME"]; retain any querystring data?
    Nope.

    Yeah I don't think the cookie ideas was that great either
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  17. #17

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I will just use the Referer for now. And if I get some time in the end I will change it ans send it as a variable and use SCRIPT_NAME.....

Posting Permissions

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



Click Here to Expand Forum to Full Width