Light Poster
4Aug2011,06:37   #121
dean8710's Avatar
Quote:
Originally Posted by patrick View Post
Hello Mr. Shabbir
The code works well, but after logging out, somebody could hit the back button and see any data on the pages. How difficult would it be to prevent anyong seeing the pages after a logout just like the web sites for all the banks?
shabbir - admin:

how to clear all the previous data?
how to restrict the previous page?
Go4Expert Founder
4Aug2011,09:41   #122
shabbir's Avatar
Quote:
Originally Posted by dean8710 View Post
shabbir - admin:

how to clear all the previous data?
how to restrict the previous page?
What previous data you want to clear? Do you want to restrict previous page with back button?
Light Poster
4Aug2011,11:05   #123
dean8710's Avatar
i found the solution to 'disable BACK button:

<script type="text/javascript">
window.history.forward();
function noBack(){ window.history.forward(); }
</script>
</head>
<body onLoad="noBack();" onpageshow="if (event.persisted) noBack();" onUnload="">

the problem is, when i clicked on 'log out' link, it will redirect user to index.html.
then, i clicked 'back' button, it will go back to previous page where, member area, some php code make looks ugly..

'undefined bla bla bla on line bla bla bla', which mean i already unset all data

is the solution of disabled the 'back' button is good?
Go4Expert Founder
4Aug2011,11:25   #124
shabbir's Avatar
The best is to session expire the page rather than trying those JS tricks.
Light Poster
4Aug2011,12:05   #125
dean8710's Avatar
tq
John Hoder
23Aug2011,01:37   #126
Scripting's Avatar
This tut is really awardworthy
Light Poster
26Sep2011,08:23   #127
shellz's Avatar
Hi Mr Shabbir..
I'm really new in php.. i've tried this code, but it doesn't work.. Can you please help me?
Thanks..
Newbie Member
26Sep2011,10:55   #128
paulelliott's Avatar
hi! glad to be here!
Light Poster
26Sep2011,11:08   #129
dean8710's Avatar
im sorry, above code is not working, btw above code is to disabled right click of the mouse so, user cannot copy using 'right-click', and view the source code.

here is the right code:

[COLOR="DarkGreen"]
<!-- disable right click -->
<script>
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUS EUP);
function mischandler(){
return false;
}
function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
</script>
<!-- disable right click -->
Light Poster
26Sep2011,11:09   #130
dean8710's Avatar
im sorry, above code is not working, btw above code is to disabled right click of the mouse so, user cannot copy using 'right-click', and view the source code.

here is the right code:

<!-- disable right click -->
<script>
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUS EUP);
function mischandler(){
return false;
}
function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
</script>
<!-- disable right click -->