fricx Posted August 27, 2007 Share Posted August 27, 2007 Hi, If someone can help please do. I have a website done with subdreamer (cms). I want to restrict access to my website. Is it possible somehow to make this: When user comes to my website, that he needs to enter username and password (lets say that he knows it) and after that he will be redirected to the web. Maybe it can be done with sessions but i don't know how. Please Help. Regards Quote Link to comment https://forums.phpfreaks.com/topic/66942-please-help/ Share on other sites More sharing options...
pocobueno1388 Posted August 27, 2007 Share Posted August 27, 2007 If you want to redirect them, use the header() function. www.php.net/header Or you could just simply put this at the top of your header page: <?php die("Site is down"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/66942-please-help/#findComment-335671 Share on other sites More sharing options...
trq Posted August 27, 2007 Share Posted August 27, 2007 Where exactly are you stuck? Keep in mind were not here to write code for you. There should be plenty of tutorials around for this type of thing. (PHP Login) Quote Link to comment https://forums.phpfreaks.com/topic/66942-please-help/#findComment-335672 Share on other sites More sharing options...
fricx Posted August 27, 2007 Author Share Posted August 27, 2007 Yes, i want help, if possible. There is index.php and i wish that it will be viewable only if user enters username and password, and if not, he will not be able to view it. Quote Link to comment https://forums.phpfreaks.com/topic/66942-please-help/#findComment-335678 Share on other sites More sharing options...
pocobueno1388 Posted August 27, 2007 Share Posted August 27, 2007 Tutorials: http://www.phpeasystep.com/workshopview.php?id=6 http://php.about.com/od/finishedphp1/ss/php_login_code.htm http://www.devshed.com/c/a/MySQL/Creating-a-Login-Script-for-a-PHPMySQL-Blogging-System/ There is plenty more if you google it. Quote Link to comment https://forums.phpfreaks.com/topic/66942-please-help/#findComment-335690 Share on other sites More sharing options...
fricx Posted August 27, 2007 Author Share Posted August 27, 2007 Maybe you didn't understood me. I wan to implement this into index.php If no session than include login.php else show index.php So simple but i am new into this and i don't know how to make it work. Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/66942-please-help/#findComment-335695 Share on other sites More sharing options...
pocobueno1388 Posted August 27, 2007 Share Posted August 27, 2007 Well...I assume when they login you register a session or cookie. So do something like this: <?php if (isset($_SESSION['your_session'])){ include 'index.php'; } else { include 'login.php'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/66942-please-help/#findComment-335717 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.