Page 1 of 1

tracking help

Posted: Sat Jul 09, 2005 5:09 pm
by webbuilder
i want when some body when call my url say http://www.xyz.com/abc/123 that will pass through a page click.php and redirect to a specified url of id 123 which i have assigned into my admin.

i dont know how to split the url and from that i get 123 as id number.

also i dont know how i call click.php page when click http://www.xyz.com/abc/123 .

i can easily do one thing http://www.xyz.com/click.php?id=123 but i dont want that.


can anybody help me.

Posted: Sat Jul 09, 2005 5:15 pm
by Burrito
you could use a combination of $_SERVER["SERVER_NAME"], $_SERVER["PHP_SELF"], substr(), and strlen() to determine the end of the url.

to redirect, you're best bet would be to see if some variable is set (probably best to use a session) and if not then use header() to redirect them to a page that catches the url information, set's the variable, then sends them back.

Posted: Mon Jul 11, 2005 2:55 am
by djot
-
Well, how should that work with PHP only?
You will have to use htaccess files, that redirect to your click.php file.

djot
-

Posted: Mon Jul 11, 2005 10:41 am
by Burrito
djot wrote:-
Well, how should that work with PHP only?
You will have to use htaccess files, that redirect to your click.php file.
-
nah, just see if a session var is set, and if not, then include the click.php page.

on click.php just set the session var.

Posted: Mon Jul 11, 2005 11:11 am
by djot
-
I still don't understand. Entering

http://www.xyz.com/abc/123
or
http://www.xyz.com/abc/456
or
http://www.xyz.com/abc/789

into the browser will call no click.php file, or you will have to put an index.php in every folder/for every single ID.

djot
-