Jump to content


Photo

session or browser problem?


  • Please log in to reply
4 replies to this topic

#1 apol

apol
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 04 October 2006 - 07:16 PM

Hi,

I have a problem with sessions which i describe below:

1) I have a form (form.php) with 2 fields 1-->userName 2--->passwd.
2) User fill in the form and submit it.
3) The form_check.php file starts a session and proccess the requested form, if the form fields are valid then i set this $_SESSION['userPass']="go";
4) When user decides to log-out  press log_out link and the log_out.php is executed.
5) Here is the log_out.php:

<?php
session_start();
$_SESSION[]=array();
if (isset($_COOKIE[session_name()])) {
  setcookie(session_name(), '', 0, '/');
}
session_unset();
session_destroy();

?>

and some html follows...

I have checked the session and it has destroyed. But when i press Back button of Internet Explorer it saids me that if i press F5 or Refresh i could see the page i requested.
And i am doing that, and the page appears, i also ckecked the session and it has created again.
Why is that happening? How could i avoid it?
I am confused...

Thanks a lot

Adreas

#2 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 04 October 2006 - 07:19 PM

Is the previous page just the login page?  If you hit refresh, it likely reposts the form you submited, relogging you in. 

If you login, browse a couple of pages, logout, then it back, I bet it won't be logged in.


#3 apol

apol
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 04 October 2006 - 07:27 PM

Is the previous page just the login page?  If you hit refresh, it likely reposts the form you submited, relogging you in. 

If you login, browse a couple of pages, logout, then it back, I bet it won't be logged in.


I try it byt the problem still exist!!!

thanks

#4 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 04 October 2006 - 07:35 PM

how are you checking to see if they are logged in?

if you browse to a page in a fresh browser window after a restart, does it let you in?

#5 apol

apol
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 05 October 2006 - 09:09 PM

how are you checking to see if they are logged in?

if you browse to a page in a fresh browser window after a restart, does it let you in?


About the first question:

// Create and execute sql query
$sql = "select * from users  where userName = '$_POST[usrName]' and passwd = '$_POST[passwd]'";
$this->result = mysql_query($sql,$link) or die(mysql_error());


// Find out how many rows returned from the query
$num_result = mysql_num_rows ($this->result);

if($num_result == 1){
" Valid user..."
}
else{
                                 " Not valid user..."
                }

About the 2nd question :

If i browse from a fresh browser window it doesn't let me in.

Thanks for your time....any idea will be usefull.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users