Forum Moderators: coopster

Message Too Old, No Replies

Set a cookie that change the visitor's file extension

         

nimonogi

10:57 pm on Mar 31, 2006 (gmt 0)

10+ Year Member



Hello,

I'm trying to do this for some days now but still not getting somewhere.

I want to set a cookie that change the visitor's file extension upon click on a link, ex.

Link1: index.1.php
Link2: index.2.php
Link3: index.3.php
...

Now lets say that you are click on Link1 and the cookie is placed, and then click on a second link, lets say default.php; now i want the default file get the extension .1.php rather than .php, and so on. When a cookie is set all the following files get the specified extension.

Can anybody help?

Thanks.

coopster

2:42 am on Apr 1, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, nimonogi.

I'm not quite sure I understand. However, there are $_SERVER variables available that will let you know which page you are on or perhaps you could use a session to keep track of which page has been visited and submitted.

nimonogi

7:17 am on Apr 1, 2006 (gmt 0)

10+ Year Member



Hello coopster, thanks for replying.

I want to create a php file to change the file extension, maybe something like:

$file = "index";
$path = $_SERVER['DOCUMENT_ROOT']."/$file.1.php";
include($path);

Now (the cookie part) i want to set a cookie that call the code above if the visitor click on a link, and every time the visitor click on a different link (ex. from Link1 to Link2) this cookie updated with the right file extension.

Thanks a lot :)