PHP Basic Login Script

Demo (loginusername admin password admin)

As my first fully written php tutorial, this script aims to teach the user about session handling, basic mysql insert and update queries while creating a login system. This system dives a bit deeper than simply logging in and logging out a user.


  • login/logout user
  • create user & set as admin
  • modify user details
  • delete users from system
  • restrict admin account from being changed to basic user

This article has 2 comments

  1. sam Reply

    Hi i came across your script while doing some research.I downloaded it and i did a run on wamp but it generates an error especially to the index page where you have initialized the variable ‘p’.

    //grab the page the user wants to navigate to

    if($_GET[‘p’]) {
    $p = $_GET[‘p’];

    Is there a way to eliminate the error?

    I have also tried the demo on your website but it only prints the username and password one has entered.

    Awaiting your response.

  2. Rob Reply

    The error is likely a security setting. Set SecFilterEngine Off in .htaccess file

Leave a Comment

Your email address will not be published. Required fields are marked *