|
-
May 12th, 2004, 04:07 PM
#1
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.
-
May 12th, 2004, 04:36 PM
#2
Oddly enough, that happens automaticaly in most placed. Called the HTTP REFERER.
TG
-
May 13th, 2004, 09:27 AM
#3
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
-
May 13th, 2004, 09:30 AM
#4
BTW your home site does not validiate...take away your badge of honor...
http://validator.w3.org/check?uri=ht...website.net%2F
-
May 13th, 2004, 09:36 AM
#5
Ex-Super Mod'rater
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.

-
May 13th, 2004, 02:02 PM
#6
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?
-
May 13th, 2004, 02:10 PM
#7
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
-
May 13th, 2004, 02:17 PM
#8
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?
-
May 13th, 2004, 02:30 PM
#9
Ex-Super Mod'rater
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.

-
May 13th, 2004, 02:48 PM
#10
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
-
May 13th, 2004, 02:50 PM
#11
Ex-Super Mod'rater
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.

-
May 13th, 2004, 04:09 PM
#12
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..
-
May 13th, 2004, 04:11 PM
#13
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....
-
May 13th, 2004, 04:42 PM
#14
Ex-Super Mod'rater
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.

-
May 13th, 2004, 04:51 PM
#15
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.
-
May 13th, 2004, 05:04 PM
#16
Ex-Super Mod'rater
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.

-
May 14th, 2004, 02:26 AM
#17
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|