Jump to content


Photo

tracking user from external site ?user= rewriting URL


  • Please log in to reply
1 reply to this topic

#1 Nilpez

Nilpez
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 March 2006 - 11:11 PM

I am quite a novice with php so please have some patience with me. I have a site that I administer which is going to be integrating with another outside site. I need to track and pass on through URL users that have logged into the external site and are brought to my site. Their login name needs to be added to all pages as they traverse my site, and bring it with them when they leave again. All my pages are already php pages mostly just so I can use php includes for the navigation. I have heard about using hidden form fields to do this but I really have no idea how. The webmaster of the external site has no patience for me and just wants to make me look bad, so I really want to get this working (with your help).
All my navigation is in one navigation.php file and one .js file for the drop menus. I just don't know where to start, and I don't want to build a huge additional script to do it if possible.

I need to pass on ?user=userloginname through the whole site. Do I use a hidden field somehow, and if so how exactly?

Your help is greatly appreciated. Thanks in advance.

#2 Humpty

Humpty
  • Members
  • PipPipPip
  • Advanced Member
  • 132 posts

Posted 22 March 2006 - 02:32 AM

Still unsure exactly the whole story here.

If you use a hidden field then it must be in a form and submitted.

Other than that you can pass the variable to each page using the $_GET coding.

You would probably be best using sessions though.

As the user comes into your site from the external site use the $_GET (from a URL) or the $_POST (from a form).

Retrieve his username and start a session and store it. (think of sessions as a way to store and hold data without having to pass it through all the time.

Things to search / look for:

$_GET
$_POST
session_start(); ...or is that sessionstart(); ..(you'll find it)

and setting and retrieving via $_SESSION['variablenameasusedbyyou']

I've found it very easy and as a lazy coder I've even used sessions to pass other variables to and from pages.

The main thing to watch out for is when you use sessions every page must start with

<?
sessionstart();

as the first piece of code.
- Humpty
  #> Where does the light go when it goes out?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users