b2k Posted January 21, 2008 Share Posted January 21, 2008 Hi, I already created an script, and recently i added an admin panel to the script, my question now, is how i can put some security to the Panel, like password, session or something like. I need that somebody give me some reference about how to do it. Cheers! Link to comment https://forums.phpfreaks.com/topic/87086-admin-panel/ Share on other sites More sharing options...
PHP Monkeh Posted January 21, 2008 Share Posted January 21, 2008 Well if you've created a script and added your own admin control to it, you seem like you know the basics of form input. You can either just create a table to store your single admin password, or you could just store it in your PHP file (unless you're expecting someone to hack in to your site). Then just do a simple form and check to see if the details they entered = the password you set. If you're wanting to do sessions make sure you have session_start() at the top of every page you wish to use the sessions on. Then you can simply use: <?php $_SESSION['loggedIn'] = true; ?> or something similar just to say they're logged in. To check whether they're logged in or not you can use code such as: <?php if(!$_SESSION['loggedIn']) { header("Location: notloggedin.php"; } ?> Enjoy! Link to comment https://forums.phpfreaks.com/topic/87086-admin-panel/#findComment-445498 Share on other sites More sharing options...
b2k Posted January 22, 2008 Author Share Posted January 22, 2008 Well if you've created a script and added your own admin control to it, you seem like you know the basics of form input. You can either just create a table to store your single admin password, or you could just store it in your PHP file (unless you're expecting someone to hack in to your site). Then just do a simple form and check to see if the details they entered = the password you set. If you're wanting to do sessions make sure you have session_start() at the top of every page you wish to use the sessions on. Then you can simply use: <?php $_SESSION['loggedIn'] = true; ?> or something similar just to say they're logged in. To check whether they're logged in or not you can use code such as: <?php if(!$_SESSION['loggedIn']) { header("Location: notloggedin.php"; } ?> Enjoy! I don't get it Link to comment https://forums.phpfreaks.com/topic/87086-admin-panel/#findComment-445751 Share on other sites More sharing options...
revraz Posted January 22, 2008 Share Posted January 22, 2008 Not sure what you don't get. You asked how you can use a session or a password. What part don't you get? Link to comment https://forums.phpfreaks.com/topic/87086-admin-panel/#findComment-445752 Share on other sites More sharing options...
teng84 Posted January 22, 2008 Share Posted January 22, 2008 <a href="http://www.w3schools.com/php/php_sessions.asp">session</a> do you know how to <a href="http://www.w3schools.com/php/php_mysql_select.asp">connect and query </a> your database? Link to comment https://forums.phpfreaks.com/topic/87086-admin-panel/#findComment-445755 Share on other sites More sharing options...
b2k Posted January 22, 2008 Author Share Posted January 22, 2008 Ok, im gettting something xD My next stepts are Create a DB with user and pass Create a Form where you can signin Create the session file, and put in all the admin's page? Im right? Link to comment https://forums.phpfreaks.com/topic/87086-admin-panel/#findComment-445758 Share on other sites More sharing options...
teng84 Posted January 22, 2008 Share Posted January 22, 2008 yep. Link to comment https://forums.phpfreaks.com/topic/87086-admin-panel/#findComment-445760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.