i wonder if i can declare a new session every time part my php code runs. For example i have one decleration of session at start of php and i want to declare a new session with else if statment and pass its key.
Right now when i call :
the first sessionkey is passed to:
What i want each time this script called:
new session key is passed to :
So my main goals is to get new sessin key for the
./script.php?cmd=file&file=chatFrame without user have to
close browser .I be happy if some one show me how this can be done.Thanks
Note: i don't want to kill the first sessionkey since i need that sessionkey to avoid duplication in db
script.php
Right now when i call :
Code:
./script.php?cmd=file&file=visitorWantsToChat
Code:
./script.php?cmd=file&file=chatFrame
What i want each time this script called:
Code:
./script.php?cmd=file&file=visitorWantsToChat
Code:
./script.php?cmd=file&file=chatFrame
./script.php?cmd=file&file=chatFrame without user have to
close browser .I be happy if some one show me how this can be done.Thanks
Note: i don't want to kill the first sessionkey since i need that sessionkey to avoid duplication in db
script.php
Code:
<?
session_start();
$engage="./script.php?cmd=file&file=chatFrame&sessionkey=" . session_id() . "";
if($cmd=="inPage" && $visitorStatus=="INSITE_STATUS")
{
writetodb();
}
else if ($cmd=="file" && $file=="visitorWantsToChat")
{
header("Location: $engage");
}
[b]else if ($cmd=="file" && $file=="chatFrame")
{
/// i want to get new session each time this part runs
}[/b]
else
{
}
function writetodb()
{
$server = "localhost"; // MySQL hostname
$username = "root"; // MySQL username
$password = ""; // MySQL password
$dbname = "db"; // MySQL db name
$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$query = "SELECT * FROM visitor WHERE who_sessid = \"" . session_id() . "\" ";
$result = mysql_query( $query );
if( mysql_num_rows( $result ) )
{
//update visitor table
}
else
{
$query2 = "INSERT INTO visitor (`ID`, `ip`, `date`,`who_sessid`,) VALUES ('$ID','".$_SERVER['REMOTE_ADDR']."',NOW(),\"" . session_id() . "\")";
$result2 = mysql_query( $query2 );
}
}