Jump to content

php admin login


jnerotrix

Recommended Posts

I have an administration page

i have a mysql database

popcornpetz_main

TABLE: admin

(3) Fields

username

password

id (auto Increment)

 

-------------------

I need it so that user must be logged in to view the admin page but i am unsure of how to do this

 

there is no register page needed

 

i just need the page to show if the user is logged in and to show something else if they are not maybe with a session or something but i dont know how also i need a logout button.

 

so it would be like this

 

if admin is logged in {

show this

} else {

show this

}

 

thanks for any help

jnerotrix

 

 

Link to comment
https://forums.phpfreaks.com/topic/141669-php-admin-login/
Share on other sites

ok now i just need to make the login page

 

 

This is login.php

 

<form action="login2.php" method="post">

UserName: <input type="text" name="user"><br>

Password: <input type="password" name="pass"><br>

<input type="submit" value="LOGIN">

</form>

 

What Woulf i put on the login2.php page to check if the login info was correct then put them into a session

Link to comment
https://forums.phpfreaks.com/topic/141669-php-admin-login/#findComment-741577
Share on other sites

you're going to need to put

session_start();

at the very beginning of every page you want authorized...or restricted.

 

Also you're login pages will need it too, even though they aren't restricted, session_start allows your login page to actually USE the session.

Link to comment
https://forums.phpfreaks.com/topic/141669-php-admin-login/#findComment-741589
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.