Jump to content

tracking user from external site ?user= rewriting URL


Nilpez

Recommended Posts

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.
Link to comment
Share on other sites

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

[code]<?
sessionstart();
[/code]

as the first piece of code.
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.