Click to See Complete Forum and Search --> : write sessionid + current page to db


mikeyzc
09-08-2003, 09:14 AM
okay,
So I have the referal program setup, im storing the referal numbers and session ids in a table, but now I want to track the pages they goto on the website. basically I just need to elarn how to write the current page to the db table. I could go in to each page and define the file as a variable, but i was wondering if there was a quicker way to accomplish this.

pyro
09-08-2003, 10:51 AM
You could use something like $_SERVER['PHP_SELF'] to get the current page's path...

mikeyzc
09-09-2003, 06:16 AM
okay, I can retrieve both the SID and the PHP_SELF, but I'm having one problem with the SID. When I come to the site for the first time after clearing the cache in my browser it will not create the SID. If I browse to another site and then come back to my site it will create and log the SID correctly. below is the code fromt he index...


<?php
include ( "includes/config.inc" );
session_start();
$_SESSION['refer'] = $_GET["refer"];
$_SESSION['sessid'] = $PHPSESSID;
$_SERVER['PHP_SELF'] = $PHP_SELF;

dbConnect();
dbExecute ($sql);

#echo $_SESSION['refer'];
#echo $_SESSION['sessid'];
#echo $_SERVER['PHP_SELF'];
?>

Khalid Ali
09-09-2003, 06:34 AM
Originally posted by mikeyzc

$_SESSION['sessid'] = $PHPSESSID;
?>
[/php]

It doesn't look like you are creating a session id at all?( if there is something tat I missed)
to get a session id I think this what you will need to do

$_SESSION['sessid'] = session_id();