stribor40 Posted November 27, 2013 Share Posted November 27, 2013 Hi I have link a href that when user clicks it will laungh pop up window where user will enter user name and password. <li><a href="#" onClick="javascript:window.open('https://someOutsideScript');">Link to my page</a> </li> This basically just validate user and when this OutsideScript gets returned I have couple variables that I can work with. The problem is that once user logs in and it gets validated and it starts filling my form (Link to my Page) if for some reason user clicks on that link again it will start this authorization process all over again. Can I somehow avoid this by using sessions so user gets validated only once. Any suggestions would be appreciated. Thanks Link to comment https://forums.phpfreaks.com/topic/284338-session-help/ Share on other sites More sharing options...
bashy Posted November 27, 2013 Share Posted November 27, 2013 Without knowing what you're checking for in each part of the page, it's hard to give help. Are you checking for existing sessions? How does the external script communicate with other parts? Link to comment https://forums.phpfreaks.com/topic/284338-session-help/#findComment-1460409 Share on other sites More sharing options...
stribor40 Posted November 27, 2013 Author Share Posted November 27, 2013 External script will check what user entered in popup box(username,password) and will autenticate this with external database. Once it is authenticated it will present user with my page. Now i am wondering what happens if user clicks in same link again after he has been autheticate. What happens is that once he clicks it again ( by mistake or for whatever reason) this whole thing happens again. ( pop up box,user enters username and password etc) and it goes to validate again. I would like to prevent that if user is already logged in( if it has already been authenticated? Link to comment https://forums.phpfreaks.com/topic/284338-session-help/#findComment-1460415 Share on other sites More sharing options...
bashy Posted November 27, 2013 Share Posted November 27, 2013 You using an API or something? Anyway, just check with an IF statement to see? if (isset($_SESSION['user_id'])) { echo 'You\'re already logged in...'; } Link to comment https://forums.phpfreaks.com/topic/284338-session-help/#findComment-1460417 Share on other sites More sharing options...
stribor40 Posted November 28, 2013 Author Share Posted November 28, 2013 exactly but does that mean if if say if (isset($_SESSION['user_id'])){ // hide the link } else { //dont hide the link } what would be est way to do this? Link to comment https://forums.phpfreaks.com/topic/284338-session-help/#findComment-1460432 Share on other sites More sharing options...
dalecosp Posted November 28, 2013 Share Posted November 28, 2013 Check and see if your SESSION cookie is actually being set. Not sure, but seems like a possibility would be that the browser doesn't have the right cookie to send because the authentication happened in another window. A "modal window" would be preferable in these "Web two point oh" days, anyway. If that helps at all ;-) Link to comment https://forums.phpfreaks.com/topic/284338-session-help/#findComment-1460435 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.