I want help.
what i do:I creat three pages 1. login.php, 2. welcome.php, 3.change password.php.
when we login(right Id & P/W) welcome.php will open,On that page i have put two option
i. Logout, ii.change password.,on clicking on Logout we will logout to enter again we have to enter password.As session is distroyed.

Problem: On welcome.php page when I logout then sesstion is dertroyed so we can not go back. welcome page when I click on back button(on brosure) it come on login page and on click on forward botton it come on welcome page.But i want ones it come on login page without without entering Id & password it should not come on welcome page as in logout condition.

you could use javascript to disable back i think but its not secure as they can just disable java.

I don't know too much about javascript,so plz tell me some script if u know for this.

I find one script that is
<Script>window.history.forward(1);</Script>
but it disable back button for all pages.

anyone have batter idia.if any then plz tell me.

i am trying to understand exactly what you mean. so you don't want people to go back to welcome.php after logout. is that what you are saying?

Hi Ajay Babu

According to me, you should just use session with proper understanding, I think your code write properly. Just make sure the use of session...

Thanks
Nishit Soni
nishit_0627@yahoo.co.in

yes kkeith29,what you understand that is right.and I have got the solution for that there is javascript which slove my problem that scripte is.

<Script>
window.history.forward(1);
</Script>

but still i m looking for batter solution
now I want something like yahoomail,on which after login ones if we come on login page(without doing logout) then we have to login again.

Soniji thanks for suggestion.
I read basic of session and I m using that,as I do logout session get distroyed.but I don't know how to distroy session when user come on privious page(i.t. loginpage) so if u have some idea about that then plz help me.

try this.

Login page -

<?php
if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
session_destroy();
}
else {
   //Put login script here
}
?>

thanks kkeith
I try this code but still problem is not slove,Do u have any other idea then plz suggest me.plz Tell that how can we handal event by windows object in php.

try this.

Login page -

<?php
if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
session_destroy();
}
else {
   //Put login script here
}
?>

well, what exactly was the problem. did you change 'username' and 'password' to your session name for those. also i didn't think about this before but when the session is destroyed the page has to be refreshed before the logout will be successful. maybe after the session is destroyed, have the page refresh

echo '<meta http-equiv="refresh' content="0">';

this should work. it did for me

First, do not disable my back button. It's 2nd on my list of most hated website activities. (1st is opening new browser windows.)

Ok, now to try to understand what you're trying to do: If you want to prevent a user who logged out from seeing the information on a previous user's welcome.php page, your best bet is to tell the browser the page is out of date and needs refreshed. That way, the browser won't load the page from cache and instead load the page from the server.

I think using a "META" tag with the option "expires" (Search for "META expires" and see what comes up) is the way to go here.

thanks kkeith u help me lot.I note two different thing about (gmail yahoomail)that gemail has disable back brouser as i have done in my code.But as i tould that on yahoo when we login our mail box get openand,and when we click on back button, then it comes on login page but on click forward button it will ask for login id password again for opening our mail box,here i was wrong bcoz, in yahoo when I login my mail box get open,and we click on back button, then it comes on login page and on click forward button again it will go to mail box.
So I thing what I want that is not posibal but still i will try to find some option.anyways thank you again.

well, what exactly was the problem. did you change 'username' and 'password' to your session name for those. also i didn't think about this before but when the session is destroyed the page has to be refreshed before the logout will be successful. maybe after the session is destroyed, have the page refresh

echo '<meta http-equiv="refresh' content="0">';

this should work. it did for me

i was just thinking about it and i thought you might be able to use page views as an option.
use a session variable to hold the number and when someone visits a page the count increases. if the count goes above 2 then logout will happen. i have never tested this so i have no idea if it works, but i think it might.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.