xcandiottix Posted June 15, 2010 Share Posted June 15, 2010 Does anyone know of a simple script in which I can just record the current url into? For example: I vist www.site.com/videos.html I receive a cookie that says: http://www.site.com/videos.html or even better, just: videos.html I'm needing to save the cookie via html so a php include will know what page the visitor is viewing. Thanks! Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 15, 2010 Share Posted June 15, 2010 I'm needing to save the cookie via html so a php include will know what page the visitor is viewing. Huh? You can determine that easier with PHP. Take a look at the variables accessible via the array $_SERVER in PHP. http://php.net/manual/en/reserved.variables.server.php I think you would want to use $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] or $_SERVER['REQUEST_URI'] Quote Link to comment Share on other sites More sharing options...
haku Posted June 15, 2010 Share Posted June 15, 2010 And cookies cannot be saved to another location. Each browser stores cookies in its own manner, and there is no way to override that. Quote Link to comment Share on other sites More sharing options...
xcandiottix Posted June 26, 2010 Author Share Posted June 26, 2010 I acutally accomplished it like so: Page 1: <html> <!--#set var="Current" value="$SCRIPT_NAME"--> <meta http-equiv="refresh" content="0;url=next page"> </html> Page 2: $currentuserpage = $_SERVER['Current']; $RtrimmedCUP = rtrim($currentuserpage, ".html"); $CUP = ltrim($RtrimmedCUP, "/users/"); $_COOKIE['CurrentPage'] = $CUP Page one had to remain an HTML page so that's why I needed a work around. SSI was the answer, not js .. then the php page (2) got the var from the server. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.