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 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"); ?> 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) 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. 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. 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 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'; } ?> Link to comment https://forums.phpfreaks.com/topic/66942-please-help/#findComment-335717 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.