Ive been looking through about a hundred different threads on timed out sessions but could not find any useful information. After searching through the entire site, I couldnt really find anything so this is my last ditch effort.
On my site I have a a place where customers can use their account number and an assigned pin number to access some of there information. Im currently using sessions to keep my validate page secure (as shown below)
PHP Code:
session_start();
$_SESSION[account] = $account;
$_SESSION[pin] = $pin;
The session code is first then all the connection code, etc, is afterwards.
Back to my story, after the user types in there information, they push submit, and a new window with their information is there. Works fine.
Heres the problem, I close that window and try a new account# and Pin#, and when the new window comes up, I previous information is there... not the new one.
I actually dont know too much about cookies but from all my readings so far tell me that I need to set a cookie and give it a time limit.
Is this true?
&
Where do I start?
Complete Code
PHP Code:
<?
session_start();
$_SESSION[account] = $account;
$_SESSION[pin] = $pin;
include (../connect.php);
$query = SELECT * FROM points WHERE account=$account AND pin=$pin;
//run the query and get the number of affected rows
$result = mysql_query($query, $connect) or die(error making query);
$affected_rows = mysql_num_rows($result);
//if theres exactly one result, the user is validated. Otherwise, hes invalid
if($affected_rows == 1) {
$account = mysql_result($result,0,account);
$basequota = mysql_result($result,0,base);
$ytd = mysql_result($result,0,ytd);
$total = mysql_result($result,0,total);
$today = date(F Y);
echo
webpage;
}
else {
print You are not allowed to go there!;
}
?>
Ive been looking through about a hundred different threads on timed out sessions but could not find any useful information. After searching through the entire site, I couldnt really find anything so this is my last ditch effort.
On my site I have a a place where customers can use their account number and an assigned pin number to access some of there information. Im currently using sessions to keep my validate page secure (as shown below)
PHP Code:
session_start();
$_SESSION[account] = $account;
$_SESSION[pin] = $pin;
The session code is first then all the connection code, etc, is afterwards.
Back to my story, after the user types in there information, they push submit, and a new window with their information is there. Works fine.
Heres the problem, I close that window and try a new account# and Pin#, and when the new window comes up, I previous information is there... not the new one.
I actually dont know too much about cookies but from all my readings so far tell me that I need to set a cookie and give it a time limit.
Is this true?
&
Where do I start?
Complete Code
PHP Code:
<?
session_start();
$_SESSION[account] = $account;
$_SESSION[pin] = $pin;
include (../connect.php);
$query = SELECT * FROM points WHERE account=$account AND pin=$pin;
//run the query and get the number of affected rows
$result = mysql_query($query, $connect) or die(error making query);
$affected_rows = mysql_num_rows($result);
//if theres exactly one result, the user is validated. Otherwise, hes invalid
if($affected_rows == 1) {
$account = mysql_result($result,0,account);
$basequota = mysql_result($result,0,base);
$ytd = mysql_result($result,0,ytd);
$total = mysql_result($result,0,total);
$today = date(F Y);
echo
webpage;
}
else {
print You are not allowed to go there!;
}
?>
|
|
Search Webmaster Help and Solution
session loged out right when they log inRelated ItemsQuery failed: connection to localhost:3354 failed (errno=111, msg=Connection refused). |
