tyoung560 Posted April 5, 2013 Share Posted April 5, 2013 Hi all, first post here so please bear with me. I chose to try and reach out to the internet community for help on this one because it is over my head. I currently have a bootstrap based HTMl website. I would like to add a login system so my employees can access restricted pages in order to download company matierals. I have the html and css for a login popup already created but I have no idea what to do for the php backend to make it function. I understand that I need to point it to a mySQL database along with various php code. Idealy, I want to create usernames for the employees to keep things simple and consistent. I don't neccesairly need an admin panel because I can simply hard code the material download links into the restricted page. Any help would be appreciated. here is a link to my site - www.youngexplosives.com Quote Link to comment https://forums.phpfreaks.com/topic/276573-php-user-login-system-on-html-site/ Share on other sites More sharing options...
TOA Posted April 5, 2013 Share Posted April 5, 2013 The basics: Sign up: load users info into db Login: check login credentials against said db. Set a $_SESSION variable or cookie To restrict a page: Check said $_SESSION variable or cookie You are going to have to learn some php here; or pay someone to do it for you..there's a freelance section if your interested in that option. Quote Link to comment https://forums.phpfreaks.com/topic/276573-php-user-login-system-on-html-site/#findComment-1423084 Share on other sites More sharing options...
davidannis Posted April 5, 2013 Share Posted April 5, 2013 Why not just use htaccess and put all of the restricted materials into a protected directory? http://httpd.apache.org/docs/2.2/howto/htaccess.html Quote Link to comment https://forums.phpfreaks.com/topic/276573-php-user-login-system-on-html-site/#findComment-1423085 Share on other sites More sharing options...
tyoung560 Posted April 5, 2013 Author Share Posted April 5, 2013 Why not just use htaccess and put all of the restricted materials into a protected directory? http://httpd.apache.org/docs/2.2/howto/htaccess.html I've read up on that but I do not host my website. I use Network Solutions as a host. I'm not sure I can access what you suggested. Anyways, here's an update... I've successfully added a simple login. It can be accessed by going to www.yectest.com/login.php Now what I would like to do is integrate that code into the HTML and CSS I already have located at http://www.youngexplosives.com under the "Login" link in the top right corner. Quote Link to comment https://forums.phpfreaks.com/topic/276573-php-user-login-system-on-html-site/#findComment-1423093 Share on other sites More sharing options...
tyoung560 Posted April 5, 2013 Author Share Posted April 5, 2013 Well I'm proud of myself I've integrated the php with the html and css. Now my only question is...how do I save a users session so he/she can navigate through the website while still being logged in and still have access to the resrticted page? Quote Link to comment https://forums.phpfreaks.com/topic/276573-php-user-login-system-on-html-site/#findComment-1423150 Share on other sites More sharing options...
tyoung560 Posted April 5, 2013 Author Share Posted April 5, 2013 ok, well i came up with a real hacked up way of saving a user session....it works but it isnt pretty! haha. i duplicated each page and resaved as example.php now i have a set of html pages that do not require a user validation and a set of php pages that do require validation. now after login, the user is navigating through all of the .php pages. http://www.yectest.com Quote Link to comment https://forums.phpfreaks.com/topic/276573-php-user-login-system-on-html-site/#findComment-1423164 Share on other sites More sharing options...
davidannis Posted April 5, 2013 Share Posted April 5, 2013 Network Solutions (and almost every other hosting provider) support htaccess. You can maintain it through their control panel or by uploading your own .htaccess file to a directory, just don't mix the two methods because changes made in one won't be reflected in the other. http://www.networksolutions.com/support/does-network-solutions-support-htaccess-files/ Quote Link to comment https://forums.phpfreaks.com/topic/276573-php-user-login-system-on-html-site/#findComment-1423213 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.