tracking help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
webbuilder
Forum Newbie
Posts: 1
Joined: Sat Jul 09, 2005 5:06 pm

tracking help

Post 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.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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.
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post 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
-
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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.
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post 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
-
Post Reply