php login script with mysql without creating sessions create a file for login and logout php mysql using with a session variable this file contains login form login authorize program and logout program all in one but short and easily this tutorial require php files and table of mysql database index php this file is the login and logout file main php this file is the target when login is o k database tutorial and table admin with fields id auto increment username varchar password varchar the password field is design for md password for more sucurity what is md function click here then put a record into this table in this tutorial put a record with name admin and password dc bdb d dc dbd ed this password was encrypted by md function from the real password when you test this script you must to put the real password in password box index php the mainly file for do things login form including fields username and password and submit button login login authorize program do authorize check after you submit form if passed in username and password this page will re direct to main php if not show the invalid user or password message logout clear the login session when come back or refresh this page source code untitled document user password main php this file is the target file when authorize check on index php has been passed it checks for session variable name username if this variable does not exist re direct to index php if you have php files must login before open them copy the php section and place it on the top of them source code untitled document hello you are now logged in logout