Jump to content

PHP user login system on HTML site


tyoung560

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.