Jump to content

Not too hot with JS .. cookie question


xcandiottix

Recommended Posts

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!

Link to comment
Share on other sites

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']

Link to comment
Share on other sites

  • 2 weeks later...

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.