jimsanghvi@hotmail.com Posted August 6, 2011 Share Posted August 6, 2011 Please help . What i want to do is . Say for example : There is a URL www.site.com/post.php when some one directly try to open or type this URL in browser . It should ask user to login in or redirect him to login page and once he is successfully login in then only this page should be visible to him That is if he is not a member then www.site.com/post.php should not be visible to him or her Quote Link to comment https://forums.phpfreaks.com/topic/244070-directly-try-to-open-or-type-this-url-in-browser-should-ask-to-login/ Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 Hi there, Maybe I can help you out a bit here, First and mostly when you use the word "Directly" it can mean that you want a http header authorization approach or you are simply searching for a way to login users. If the first method is what you want to do then head on over to this site and learn more about it. For the user login script, Google provides many tutorials. Quote Link to comment https://forums.phpfreaks.com/topic/244070-directly-try-to-open-or-type-this-url-in-browser-should-ask-to-login/#findComment-1253449 Share on other sites More sharing options...
mikesta707 Posted August 6, 2011 Share Posted August 6, 2011 It sounds like what you are trying to do is have restricted pages (like a members_area type page). Have you created a login script yet? if so, then you probably use sessions or cookies. Either way you simply check if the session or cookie is set to the correct value, and if not show an error message (like "You must log in to view this page") or simply redirect the user. if you haven't created a user login script then, as phpSensei suggested, you should consult google for some tutorials Quote Link to comment https://forums.phpfreaks.com/topic/244070-directly-try-to-open-or-type-this-url-in-browser-should-ask-to-login/#findComment-1253482 Share on other sites More sharing options...
voip03 Posted August 6, 2011 Share Posted August 6, 2011 This may help full to u http://www.phpfreaks.com/forums/index.php?topic=340151.msg1604484#msg1604484 Quote Link to comment https://forums.phpfreaks.com/topic/244070-directly-try-to-open-or-type-this-url-in-browser-should-ask-to-login/#findComment-1253503 Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 This may help full to u http://www.phpfreaks.com/forums/index.php?topic=340151.msg1604484#msg1604484 I think you provided the wrong link Voip03. Quote Link to comment https://forums.phpfreaks.com/topic/244070-directly-try-to-open-or-type-this-url-in-browser-should-ask-to-login/#findComment-1253505 Share on other sites More sharing options...
voip03 Posted August 7, 2011 Share Posted August 7, 2011 read this one , hopw will help http://www.phpfreaks.com/forums/index.php?topic=340151.msg1603450#msg1603450 Quote Link to comment https://forums.phpfreaks.com/topic/244070-directly-try-to-open-or-type-this-url-in-browser-should-ask-to-login/#findComment-1253508 Share on other sites More sharing options...
phpSensei Posted August 7, 2011 Share Posted August 7, 2011 Sorry Voip3, somehow I ended on some other thread... Its the right link Quote Link to comment https://forums.phpfreaks.com/topic/244070-directly-try-to-open-or-type-this-url-in-browser-should-ask-to-login/#findComment-1253510 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.