PHP make an Admin Area ,to check the User name and Password and then load to another Page
views:
130answers:
5There are plenty of ways you could achieve this. I recommend using sessions to check if the user logged in with a valid username and password. You can store the usernames and passwords in a database or code it directly in your php-code. Storing your passwords in a database might be a security issue as long as you store them in plain-text. You should use a password hash (created with md5($string)) instead and compare the hashed user input with your database. Just use an HTML-Form where the user enters his name and password, pass the two entered values as session-variables and check whether they match the username and password you stored. If so the desired page can load.
I would suggest learning a CMS like Joomla or Drupal. It takes the headache out of creating admin areas. And, if your asking this question, I think it might be easier than learning to write it in PHP.
If you are in a really big hurry, you can try something like PHPMaker. It can examine your database tables and generate the typical create / update / modify / delete forms that you would need to manage users.
Note: I am not endorsing PHPMaker, in fact I really don't care for the code that it actually generates. Its no better and possibly worse than scaffolding provided by MVC frameworks. I posted it as an alternative to telling you 'just use a MVC framework with scaffolding and re-write everything you have done so far'.
However, when lazy, it can be handy.
The real solution is write your own intuitive admin interface.
You could try that:
http://www.tutorialized.com/view/tutorial/Simple-PHP-Login-Script/52350
Hello,
there's no point in writing this whole code for you. You should try to read some books / articles and then try to code something simple by yourself to see how PHP actually works.
You should check first some simple tutorials first. Like:
- http://www.swish-db.com/tutorials/view.php/tid/601
- http://www.webdesign.org/web-programming/php/register-login-script.8721.html
Also, consider reading the PHP documentation. There are some nice tips there (also discussions for each topic are usually interesting).