How to Create Login Page in PHP and MySQL with Session

##########################
NEW UPDATE!!!
PHPMySimpleLogin 0.3

Download full source code:
http://rapidshare.com/files/404808631/phpmysimplelogin-0.3-frozenade.co.nr.zip.html
##########################

The production of login page using PHP and MySQL is actually very simple.

I assume that you use local web server connection (Apache and PHP) and your MySQL database configuration use ‘localhost’ as hostname and ‘root’ as username with blank password.
For this case, I recommend you to using XAMPP (http://www.apachefriends.org/en/xampp-windows.html).
Please download and install it to your path choice. e.g: C:\xampp

Run XAMPP Control Panel on desktop.

Start Apache and PHP modules.

Let’s create a database with PHPMyAdmin. Open your favorite browser, then type ‘http://localhost/phpmyadmin’ at your browser address bar.

Create database ‘phpmysimplelogin’.

Click ‘Create’.

Now, let’s create a table, name it ‘user’ with ‘2’ (two) number of fields.

Click ‘Go’.

First field, name it ‘username’, type ‘varchar’, lenght/values ’25’.
Second field, name it ‘password’, type ‘varchar’, lenght/values ‘255’.

Click ‘Save’.

After that, we will fill the table. Click ‘SQL’ menu, then type this query on textbox:
INSERT INTO user (username, password) VALUES (‘admin’, md5(‘admin’))

Click ‘Go’.

It means, you fill ‘username’ field with string ‘admin’ and ‘username’ field with an encryption string of ‘admin’.
MD5 ia a function to create one-way encryption (hashing) from our password, so it can be more secure.
For detail, please check: http://www.php.net/manual/en/function.md5.php

Okay, now let’s prepare the web pages.
Create folder ‘phpmysimplelogin’ in your XAMPP’s htdocs. So, it will be ‘C:\xampp\htdocs\phpmysimplelogin’.
Remember to save all of your files you will create, inside this folder.

Run your favorite PHP code editor, e.g: PHP Expert Editor, RapidPHP, etc; or just Microsoft Notepad is fine.

Save document below with name ‘config.inc’.

<?php

$hostname = 'localhost';        // Your MySQL hostname. Usualy named as 'localhost', so you're NOT necessary to change this even this script has already online on the internet.
$dbname   = 'phpmysimplelogin'; // Your database name.
$username = 'root';             // Your database username.
$password = '';                 // Your database password. If your database has no password, leave it empty.

// Let's connect to host
mysql_connect($hostname, $username, $password) or DIE('Connection to host is failed, perhaps the service is down!');
// Select the database
mysql_select_db($dbname) or DIE('Database name is not available!');

?>

Next step, save document below and name it as ‘index.php’:

<?php

// Inialize session
session_start();

// Check, if user is already login, then jump to secured page
if (isset($_SESSION['username'])) {
header('Location: securedpage.php');
}

?>
<html>

<head>
<title>PHPMySimpleLogin 0.3</title>
</head>

<body>

<h3>User Login</h3>

<table border="0">
<form method="POST" action="loginproc.php">
<tr><td>Username</td><td>:</td><td><input type="text" name="username" size="20"></td></tr>
<tr><td>Password</td><td>:</td><td><input type="password" name="password" size="20"></td></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td><td><input type="submit" value="Login"></td></tr>
</form>
</table>

</body>

</html>

As you see, there is ‘session_start();’.
This function is used to initializes a data session. It will creates a new session or continues previous session from data session changed by GET, POST or cookie.
See the detail information about session here: http://id.php.net/function.session-start

Now, prepare a file and give it name ‘loginproc.php’ to check the validity of username and password.

<?php

// Inialize session
session_start();

// Include database connection settings
include('config.inc');

// Retrieve username and password from database according to user's input
$login = mysql_query("SELECT * FROM user WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "')");

// Check username and password match
if (mysql_num_rows($login) == 1) {
// Set username session variable
$_SESSION['username'] = $_POST['username'];
// Jump to secured page
header('Location: securedpage.php');
}
else {
// Jump to login page
header('Location: index.php');
}

?>

If username and password are correct, then we’ll be directed to ‘securedpage.php’.
This is the page that we want to show if login is successful. This page cannot be accessed if the correct data session is not found when login check is passed.
This page also contains ‘logout’ menu, so we can destroy our login data session then return to login page.

This is content of ‘securedpage.php’:

<?php

// Inialize session
session_start();

// Check, if username session is NOT set then this page will jump to login page
if (!isset($_SESSION['username'])) {
header('Location: index.php');
}

?>
<html>

<head>
<title>Secured Page</title>
</head>

<body>

<p>This is secured page with session: <b><?php echo $_SESSION['username']; ?></b>
<br>You can put your restricted information here.</p>
<p><a href="logout.php">Logout</a></p>

</body>

</html>

This is content of ‘logout.php’:

<?php

// Inialize session
session_start();

// Delete certain session
unset($_SESSION['username']);
// Delete all session variables
// session_destroy();

// Jump to login page
header('Location: index.php');

?>

Try on your favorite browser, ‘http://localhost/phpmysimplelogin/&#8217;.

So easy cake, isn’t it? 😉

##########################
NEW UPDATE!!!
PHPMySimpleLogin 0.3

Download full source code:
http://rapidshare.com/files/404808631/phpmysimplelogin-0.3-frozenade.co.nr.zip.html
##########################

366 Responses to How to Create Login Page in PHP and MySQL with Session

  1. swastik says:

    wOw dUde..rlly cUte..nd XciTng…Thnkx a lOt..
    miss U tOOO….it will useful tO me and Others jUs hOpe…bye Tkre

    Luv nd rgrds…

    swastIk…

  2. Puneet says:

    Thnaks Man…. Thank You Very Much for This Script… This Script Helped Me a Lot…. I have no Words… You Know I was trying to create Sessions for the Last Two Days… But You Made That Task Easy for Me..

    Thanks Buddy.. Please Keep on Adding Scripts Like This.. This Will Really Help Others.. Who are Struggling..

  3. frozenade says:

    you’re welcome.

    it’s nice to me to able to helped other people out. 😉

  4. swastika says:

    hy mOrning dUde..hOw r U..
    hOPe fine well..

    please pOst mE Display a Random Image..
    Thnks in advanz…

    rgrds nd lUv
    sWastik…Tkre…

  5. frozenade says:

    i’m a little dizzy right now. 🙂

    which random method do you like? by determined names of files, or by all files in a folder?

    but, a little late perhaps, ’cause i’m working on my final project right now, and i shall collect it next two weeks. 😀

  6. microsofttre says:

    up to with a chunk a bit of attempt. from by themselves accomplish a real the boys the boys as proud let it go.

  7. shanmu says:

    Hi.. frozenade ..

    Really ur Post is very useful for me..

    Thanks alot

    Continue ur post like this in future also.

  8. frozenade says:

    hello.

    glad to know that.. 🙂
    thx.
    i’ll add the others soon.

  9. blackHat says:

    For some reason when i tried this, when i tried to test the login, i just got a blank page. No errors or anything were referenced, and i was not redirected to securepage.php. It’s as if the code on loginproc.php is unreadable or something…

    Any idea why this would be?

  10. frozenade says:

    I tested it and works well.

    what engine do you use? XAMPP, PHPTriad, etc?

  11. ajani ashish says:

    hoe do you create login php with sql session start with javascript alert

  12. salman says:

    hye man can you explain me how can i create login page in front page?and where i crete table?

    (create table tbuser
    (username varchar(50),
    password varchar(255)))

    i dont know about where i create this table?

  13. sivaji says:

    This code is not secure ,it can allow sql injections .

  14. boris says:

    hello, trying to work with sessions – but i experience sessions having a limited validity. how can you control the validity of a session?

  15. coding says:

    Thanks very much. Your scripts are straight forward. They have really helped, i have been struggling to get something clear and easy to understand like yours. Keep on adding more.

  16. ryaganti says:

    Thank you very much.

  17. Daniel B says:

    Hi, this is a very good scipt. I have been browing the internet looking for a good one. I am just having a very little detail, when I run the script(loginproc.php) there is an error message saying: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Hunter\loginproc.php on line 10

    Warning: Cannot modify header information – headers already sent by (output started at C:\wamp\www\Hunter\loginproc.php:10) in C:\wamp\www\Hunter\loginproc.php on line 17
    Can some body help me out with this? Thank you in advance.

  18. Daniel B says:

    by the way, I am using WAMP

  19. frozenade says:

    @ajani ashish
    it’s simple, just add “alert(‘your message’)” in your javascript session.

    @salman
    use MySQL command console, open your mysql directory then run mysql.exe

    @sivaji
    Yes you’re right. This is for beginning user. For advance, you can modify this script.

    @boris
    of course you can. see the session manual to set the timing at PHP website.

    @Daniel B
    I have try this script and it’s okay.
    Make sure if you copy-paste the script from this blog, change “ sign to “. Because WordPress convert double quote to ASCII character, so it cannot be recognized. What WAMP version do you use? I use XAMPP.

  20. Daniel B says:

    Thank you very much Frozenade for your prompt response. I am using WampServer 2 this is the latest version that it shows in the wamp website. By the way, would you recomend wamp or XAMPP.? Thank you.

  21. Daniel B says:

    And I am using Zend 5.5.0 to create the php files. Should I use another editor.?

  22. frozenade says:

    Hi, Daniel..

    I never try WAMP yet. But I recommend you to use XAMPP ‘coz it more comfortable to be used.

    About editor, you can use any text editor. Never mind. I use DzSoft PHP Editor and RapidPHP. They’re handy.

    You can try using XAMPP first, if you still have problem. Just report to me then I’ll send you the whole working files. 😉

  23. Steve D says:

    Hi, All seems ok I have changed the ” characters but when I press submit on the opening form it shows the loginproc.php in the nav but when I click it just refreshes a blank loginpage.php form,

    code for loginpage.php

    login page

    username:
    password:

    Code for loginproc.php

  24. frozenade says:

    I’ll send you the whole working files. I’ll be home on this Sunday, coz the files are in there and I am not in that place right now. But remind me ok? coz I’m forgettable.. 😀

  25. jake says:

    I too am getting a blank loginproc.php page.. also using WAMP.. any idea on what could be causing it?

  26. Chaity says:

    Hi
    Thanks thanks thanks…

    I mvery new in php. I was in problem for login logout including session..u solve my problem..

    many many thanks…

  27. Chaity says:

    I have a problem in my php code. I am using php 5. The problem is that when i insert some data it is inserted successfully in the database. But if i refresh the insert.php the same data is inserted again in the database. it is simple insert code. please give me solution how can i solve the problem.

  28. rini says:

    TQ, fren!!!!

    means a lot!

    really useful for my FYP:)

  29. Emir says:

    Thank you for this wonderful post!!

  30. praveen says:

    hi i want to know that when one table of content in mysql is showing in another table how to solve this problem

  31. Krupesh says:

    Hey Ive done everything you have written at the top but every time i press submit i just get a blank page :S very weird? is there any solution to this it would be very helpful Cheers Krups

  32. frozenade says:

    Mmm.. strange. It works here.

    Okay, I’ll upload the zipped file here. 😉

  33. how can i use session in php

  34. frozenade says:

    Hello all friends.

    This is the download link for the script.

    Enjoy;)

    ==========================
    Due to a lot of problem reported by friends about these script writing, so here I put the complete scripts. You can grab it here:

    http://rapidshare.com/files/195043222/login-frozenade.co.nr.zip

    Thank you for concern. 🙂
    ==========================

  35. phpcobra says:

    this script its not secure, it contains the connection data that now adays with injections could be easily retrieved:
    $server = “localhost”;
    $username = “root”;
    $password = “”;
    $db_name = “dblogin”;

    $db = mysql_connect($server,$username,$password) or DIE(“Connection to database failed, perhaps the service is down !!”);

    This piece of code should be written in a separate file, and included with require_once(‘connection.php’)
    so that thee datas are parsed, then….
    in order to be able to move the file from one server to the other i would use in stead a dynamic url…
    function dynamic_url($page= ‘index.php’){
    $url= ‘http://’.$_SERVER[‘PHP_HOST’]. dirname($_POST[‘PHP_SELF’]);
    $url= rtrim($url, ‘\\/’);
    $url.=’/’.$page;
    return $url;
    }
    //
    its true your code works, but if your form goes in wrong hands…..
    ciao

  36. frozenade says:

    yes, you are absolutely right.
    i have put comment about this inside readme file.
    I’ll show safe way to handle login form later. 😉

    thanks for care, bro 🙂

  37. trima kasih udah ngajarin caranya!
    mudah dimengerti dan simpel

    Thanx

  38. Thanks for the script.I have got to know a lot from it.

  39. frozenade says:

    @Septo Aji Passat
    sama² bro 😉

    @anindya chatterjee
    you’re very welcome.. 😉

  40. Shadow396 says:

    “blackHat Says:
    March 31, 2008 at 11:12 pm

    For some reason when i tried this, when i tried to test the login, i just got a blank page. No errors or anything were referenced, and i was not redirected to securepage.php. It’s as if the code on loginproc.php is unreadable or something…

    Any idea why this would be?”

    I m having the same problem……………

    Pls frozenade help

  41. frozenade says:

    hmm… strange. it works fine here.

    okay, i’ll create another one. hope it works…
    please wait and come back again… 🙂

  42. Waqas says:

    thanx alot simple and to the point

  43. jet says:

    everything works fine for me… you just save my day. thank you!!!

  44. jet says:

    @frozenade:

    one more thing… i’ve notice that after logging in, the securepage.php only shows “secured page with session” does it print a username after that line or its just a plain simple text of that? thank you!

  45. Milind says:

    Thanks I just Implement This

  46. tunde Olaofe says:

    Thank you for the free script code for the creating of the logging page but I have issue here which is

    Warning: session_start() [function.session-start]: Cannot send session cookie – headers already sent by (output started at C:\xampp\htdocs\form\loginproc.php:6) in C:\xampp\htdocs\form\loginproc.php on line 7

    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at C:\xampp\htdocs\form\loginproc.php:6) in C:\xampp\htdocs\form\loginproc.php on line 7

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\form\loginproc.php:6) in C:\xampp\htdocs\form\loginproc.php on line 24

    the page can’t function properly and I have debug here I dont know where the error is from ?

  47. kk says:

    gr8 things

  48. Shurane says:

    For those of you having problems with the script, it’s probably because there aren’t any “php” tags. The “<?" in the beginning should say "<?php", minus the quotation marks.

    That's what I did to get it working. Maybe it's something with PHP5?

  49. Zia says:

    Man that was ridiculously simple. Thanks alot man.

  50. frozenade says:

    #tunde olaofe:
    make sure you dont put anything above session_start();

  51. frozenade says:

    #jet; it prints username session. 🙂

  52. Sarb says:

    Hi frozenade,

    Thanks for the script. It is a great help for me as I am just started learning PHP/MySql.

    The script worked finally with one modification. In loginproc.php file, I have to remove md5 function. I just delete md5 from the following line and bang, it worked. Is there any reason for using md5 function here. just curious. Please reply

    $login = mysql_query(“select * from tbuser where (username = ‘” . $_POST[‘username’] . “‘) and (password = ‘” . md5($_POST[‘password’]) . “‘)”,$db);

    hi..

    i suggest you don’t disappear the md5 function. it’s required to keep your password secured. and to avoid a SQL injection, please append mysql_real_escape_string function in every form field post. ex: mysql_real_escape_string($_POST[‘username’])

    thanks 😉

  53. sam says:

    thank you very much !!! it really helped me, coool
    needed to add (php)

  54. socoro says:

    nice tutorial easy to understand
    p.s. I agree with Sarb >>mysql_real_escape_string

  55. Surya says:

    Hi Frozenade!! I can’t use your script boss!! Whenever I’m giving the user name & password (whether right or wrong, after clicking “Submit”, it’s showing a blank page with address “loginproc.php”.
    Pls help me ASAP.

  56. wanie says:

    hai..kwn2 boleh tolong sy hasilkan page login x ?

  57. wanie says:

    sy x thu mcm mne nk hasilkan login bagi web based…please…

  58. wanie says:

    how to update password???

  59. Jeremy says:

    All I get no matter what I do is a blank page and it should at least give an error. This script should be laced with error warnings t figure out what the issue is. I think when it comes to logins root should not be used anyway. Sure locally on a testing server cool but the web should not use root. Starting from scratch in setting it up as it were to be used from the internet with seperate username and password would be nice as well as a register

  60. Elvis says:

    Man, thanks a lot, so easy, so nice, and still perfect, i was able to create my perfect registration, login, logout and user managing in 15minutes!
    Instead of a securedpage with a redirect to the loginpage you could use your index with a link to the login somewhere and instead of a redirect you pass a value $log=0, something like this:

    and

    login

    logout

    where you want the link:)
    that’s just how i’ve used, still your code is the simplicity made beauty.
    See ya

  61. frozenade says:

    hmm… it seems still difficult for some people. okay, I will update it into better one.

    stay tune.. 😉

  62. santosh b says:

    thanks.. It worked

  63. mahmoud says:

    Thanks man!

  64. Nasir Hussain says:

    hi,
    its really better than many other web pages.
    it is also better for those who are in the early stages to learn php mysql how to create sessions.
    Thanks a lot Sir/Madam

    Excellent script i am the servent of you.

  65. Mustapha says:

    Thanks 😉 it works and it saved me a hell of effort 😀

  66. ziyed says:

    thanks a lot ..!

  67. Mahir says:

    Hey, Where do you enter the create db code etc.

  68. Well I am so impressed I was having a hard time doing this for my final year project. I read so many complex tutorials on sessions but thanks to this. I will put a link to your site via my site.

  69. jignesh says:

    Thanks for help please give me some usefull scripts in php at my E-mail address.
    Please…..

  70. Hey anyone know where I can learn to make pages exclusive once someone logs in? Thanks this is a real good article to get started. On a client log in system

    Hi Austin, please try find it on phpclasses.org. there’s a lot of examples..

  71. Jim says:

    OMG! It works!!! I love u!!!

  72. frozenade says:

    you can type it in SQL command in PHPMyAdmin. 😉

  73. frozenade says:

    nice to hear it, Rescue Leokeng. thx 😉

  74. anoop says:

    iam using webhosting pad server.iwant to cerate alogin page.

  75. I have to agree and found this very interesting 🙂

  76. N. says:

    Does not seem to work for me… I get the same problem with going to a blank page.

  77. rabia says:

    hi…
    please help me am badly stuck in php ..
    making a projet on online shopping botique … but my edit page and sessions are not working …so please help

  78. sanjaya says:

    this lesson is very easy and interesting. thanks

  79. Pavan says:

    Even i am using Wamp.. this code works fine with the modification req for me,,, amazing job man,,, thanks a lot:)

  80. siddesh says:

    Hello!!your tutorial is been of great use for me.I am very new to PHP…This tutorial had really helped me.The way you have given the explaination it was of great use..Thnx you

  81. Akhilesh Pandey says:

    Man, thanks a lot, so easy, so nice, and still perfect, i was able to create my perfect registration, login, logout and user managing web pages
    Instead of a securedpage with a redirect to the loginpage you could use your index with a link to the login somewhere and instead of a redirect you pass a value $log=0, thanks .

  82. deepak says:

    Hi
    i m student doing project on
    website design with the help of PHP and Mysql
    and wordpress
    i m getting difficult to upload the plugin
    so i need user login and register coding for wordpress
    and how to implement in wordpress

    thank you

  83. manas says:

    i was not guided properly in my training , but u guided
    me properly. thanks and u r really a student’s friend

  84. yasir says:

    hi;
    I am using this script but facing the following error

    Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\test.php on line 16

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\test.php on line 17

    plz send me the solutin.i am very beginner in Php.

  85. frozenade says:

    Perhaps there are some errors or mistype in your mysql query, could be strings or quotes. please check.. 😉

  86. Kaushik says:

    Hi guys(whomever got blank loginproc.php),

    I also got the same. On checking it has been found that all php code must be started with “<?php" instead of "<?"

  87. roni says:

    hey dude i try this but can’t get my answer.
    so plz tell me how can i implement loginpage..
    tell me the easy way for implement loginpage

  88. Jagmeet says:

    thanks so much !

  89. Dodo says:

    I have created a login page, but I want another finction.. “Remember” (password) field.
    Insted the page being blank ..can u help me addiing back ground colour and a jpeg image to the login page.
    Plz help.

    Thanks

  90. frozenade says:

    hi. you need set cookie. take a look at this http://www.w3schools.com/PHP/php_cookies.asp
    and about adding background to login page i’ll work on it soon. stay tuned! 😉

  91. Ales says:

    Thank you Frozenade.
    That simplified my login page 🙂

  92. Raj says:

    Hi all,
    Actually I am trying to create a application in which I have to implement as follwing:

    Note: I have to use only Zend framework for the same.

    1. Set up an environment somewhere, on your pc or a server. and deploy apache/php/mysql on it with zend
    2. write an application with the zend framework on your server, something basic that allows the user to do the following:
    -create an account and login/maintain a session
    -record their daily runs by entering start time, and end time of their runs (physical run )
    -for each run, they should also be able to enter a start and end address
    -use the google maps api to figure out the distance they’ve run, and make a report to show their runs, speed for each run.

    Please help me out .

  93. shuja says:

    thanks

  94. tonyo says:

    thanks a lot men your such a genius! hehehe thanks 🙂

  95. nivitha says:

    i’m not logged into the securedpage…i used the same code as yours..i tried different password and username also…

  96. nivitha says:

    i’m not logged into the secured page even if my username and password is correct…..pls help me out

  97. martmen says:

    i am so new to php,i just downloaded the xampp 1.7.3
    and i followed your example but it keeps showing me this error after i insert INSERT INTO user (username, password) VALUES (‘admin’, md5(‘admin’))—
    #1054 – Unknown column ‘‘admin’’ in ‘field list’
    INSERT INTO user( username,
    PASSWORD )
    VALUES (
    ‘admin’, md5( ‘admin’ )
    )

    please help me out here thanks

  98. frozenade says:

    try to type it manually, ’cause wordpress turn ‘quotes’ to ASCII characters.

  99. frozenade says:

    hmm, it seems need more time to create it.

  100. frozenade says:

    try to type the script manually, because copy paste from wordpress is not good for coding

  101. ahmad says:

    Do u know to create login page that have access level?

  102. satish says:

    hi thnx a lot …it was very useful for mw..thnx 1ce again

  103. ana says:

    do i need to active the links is not working

  104. Hey, I’m using this script for a website I am making. Everything works perfectly, but I was wondering how to add more Usernames/Passwords. I try and enter in a new row with a new username and password, but when I type them into the login area it just redirects to the index.php page. Please help! I am a beginner so I’m not very familiar with PHP or MySQL.

  105. frozenade says:

    @ahmad
    Hi ahmad. To create access level. Just add a field name it ‘level’. You can set 1 as admin, 2 as author, and 3 as user then update the query with parameter of new field. I’ll add this feature in next version. Thank you.

    @ana
    Hi ana. What link is it?

    @David
    Hi David. To add more user, you just can insert next data row. It should works too. Can you tell me how do you insert the second row?

  106. Hey, I inserted the row by going to the Insert Tab in PHPMyAdmin. When looking at the code everything looked fine, so I’m still unsure as to why it isn’t working. Also, why is the password value some random set of numbers instead of just ‘admin’? Is there something I’m missing?

    Here is my code for reference:

    — phpMyAdmin SQL Dump
    — version 3.2.0.1
    http://www.phpmyadmin.net

    — Host: localhost
    — Generation Time: Nov 03, 2010 at 05:10 PM
    — Server version: 5.1.36
    — PHP Version: 5.3.0

    SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”;


    — Database: `phpmysimplelogin`

    — ——————————————————–


    — Table structure for table `user`

    CREATE TABLE IF NOT EXISTS `user` (
    `username` varchar(25) NOT NULL,
    `password` varchar(255) NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;


    — Dumping data for table `user`

    INSERT INTO `user` (`username`, `password`) VALUES
    (‘admin’, ‘21232f297a57a5a743894a0e4a801fc3’),
    (‘david’, ‘david’);

  107. frozenade says:

    Ah I see. The problem is, you insert password field as is. To make password secure, you should convert password string to md5 hash. try to add md5 function. I give you an example:

    INSERT INTO `user` (`username`, `password`) VALUES
    (‘admin’, md5(’admin′)),
    (‘david’, md5(‘david’));

  108. Thank you so much!! Worked like a charm!

  109. tyler says:

    Im still having issues with my login script. Can you help? I can send you what I have

  110. abby says:

    hi..an error occur when i clicked the submit button..here’s the error..hope someone can help me..tnx..

    Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\phpmylogin\loginproc.php on line 5

  111. rejoice says:

    I am new on PHP. I have copied the script as it is but its gives me an eror when trying to sign in indicating that the database is unavailable.

  112. frozenade says:

    create th database first. Open http://localhost/phpmyadmin on your browser, then create the suitable database there.

  113. frozenade says:

    try to check the ‘quote’ sign…

  114. vishu says:

    i made same code with same database but still it’s not working..… I get the same problem with going to a blank page in loginproc.php

  115. chathuranga says:

    thanks dear thanks it is usefull to my school project thnkssss

  116. chathuranga says:

    INSERT INTO user (`username`,`password`) VALUES(‘hhhh’,md5(‘mypassword’));

  117. jc kamaraj says:

    this is really great. exactly what i was looking for. thanks for the compilation. scripts are short and to the point.

  118. deep says:

    can u also show how to create a signup page.

  119. sayanta das says:

    thanks..

  120. sad_garbage says:

    please help me, when i enter the pswd n usernme, it doesnt link me to any other page, instead of index.php

  121. hans says:

    hi,hello mr frozenade..
    how to update the users password? I mean how to create php page for changing password after login.
    Thanks. Please ya..Urgent..(“,)

  122. frozenade says:

    hmm. It seem some users got difficult to implement this script.
    All right, I’ll try to make better, by adding feature, like registration and change password.

    Stay tune.. 😉

  123. hans says:

    ok..thanks again ya..i will wait..(“,)

  124. MD CHAND says:

    it’s worth. Gud work dude keep it up… (:

  125. Nagarjun Palavalli says:

    The following SQL error appears:
    #1054 – Unknown column ‘‘admin’’ in ‘field list’ when I enter INSERT INTO user (username, password) VALUES (‘admin’, md5(‘admin’)). How can I make it work?

  126. nelson says:

    Thanks …
    It really helps me…..

  127. james says:

    for this user login code..what is the password and username..i seem to be having problem with that…

  128. Nameless says:

    Its really great……what 2 say ?I m hoping such a solution in future as well.
    Great work.
    Thx

  129. Osvaldo says:

    Thanks for the code. I have tried it and when I hit login the same page reloads with no action. I have tried to download the file but it is not longer available. Is there any other link to download it? thx

  130. mondolity says:

    thanks for your tutorial. 😀

  131. mike says:

    Hello. I like the code but I was wondering If I should replace The * in $login = mysql_query(“SELECT * FROM user WHERE (username = ‘” . mysql_real_escape_string($_POST[‘username’]
    Thanks

  132. Hendrick says:

    Hi Bro,

    I upload the myphpsimplelogin into the website ftp. When I use the login and click submit, it show “Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘root’@’localhost’ (using password: NO) in I:\domains\*****************\wwwroot\phpmysimplelogin\config.inc on line 9
    Connection to host is failed, perhaps the service is down!”

    What does it mean???

  133. chris says:

    this is the error I get in
    Run SQL query/queries on database phpmysimplelogin:

    #1054 – Unknown column ‘‘admin’’ in ‘field list’

    INSERT INTO user (username, password) VALUES (‘admin’, md5(‘admin’))

    what can i do

  134. Dave says:

    I am inserting your code into my website that i am creating and i am having difficulty. I have a table that allows users to add their name and details. i want to be able to use their username and password as their login. how can i do that? plz reply

  135. Brendan says:

    When i try to enter this part “INSERT INTO user (username, password) VALUES (‘admin’, md5(‘admin’))” i get this error:

    #1054 – Unknown column ‘‘Amdin’’ in ‘field list’

    please help

  136. vibhuti says:

    thanku very very much…u make it so easy…now plz help me to make simple and easy forum….plz plz plzzzzzzzzzzzzzz

  137. vibhuti says:

    you made it so simple,can u please help me that what happens after login,i mean i want to provide and update the circulars of bank to the users who logged in,can u please please please help me out,,,,,,thanks in advanced

  138. kal says:

    Thank you i was looking something for this as a php newbie i think is really helpful 😀

  139. Taylor says:

    hey man how can i add users to the page? Btw Great work! Im just learning so anything would be helpful! Thanks ❤

  140. hi_j76@yahoo.com says:

    you taught me a lot of things in no seconds

  141. gadasu says:

    i need sometime to digest it and be with u. thanks

  142. Vikram says:

    I’ve tried the above code but after entering the correct username and password it is not redirecting to the securedpage.php please help me in solving this problem.

  143. Thank You So Much…its Work..I’v been try it..

  144. Terima kasih banyak sangat bermanfaat..saya sudah mencobanya dan berhasil..

  145. devidas says:

    thanx to help this login form

  146. latha says:

    hi,

    thank u so much.
    it helped me a lot.
    it made my work easier.
    thank u so much

  147. Puja says:

    Hi Frozenade,
    I’m a beginner to php,and have a question…i did as u told for my project login page.The last this u told was[ http://localhost/phpmysimplelogin/’ ]

    my html page comes (login) and i can put my username and password . when i click ‘submit’ nothing happens…-does it have to show something….? how do i know that i’m ‘Logged In’ and how can i ‘Log out’??

    Puja

  148. Poo says:

    HI Frozenade

    I did exactly u said … and when i go to ‘login form’ i can submit my username and password but after that it doesnt show if it’s ‘Logged in’,or if i can ‘Log out’ …
    Please help I want this for my project asap.
    Thanks

  149. Poo says:

    HI Frozenade

    I did exactly u said … and when i go to ‘login form’ i can submit my username and password but after that it doesnt show if it’s ‘Logged in’,or if i can ‘Log out’ …
    Please help I want this for my project asap.
    Thanks

  150. THOMAS says:

    Thank you so much, i was looking for this thing..glad to find it..pls can you include a more secured one..? Nice work!..God bless you!

  151. Gjosse says:

    I get these errors idk what i am doing wrong

    ysql_num_rows(): supplied argument is not a valid MySQL result resource
    and

    Warning: Cannot modify header information – headers already sent by

  152. Wasif Saleem says:

    Frozenade your work is awesome and very discriptive….I am new to php started late but working hard to unserstand the functions and the code….my instroctor to check my php knowledge gave me an assignment to create a proper registration and login database….your script really helped me alot in the assigment…thank you so much for such help….God bless you…:)

  153. Amol says:

    Thanks a lots for this kind of good tutorial..

  154. McbainGames says:

    hey frozenade i dont know why people say this is hard to implement because i found this the easiest and i have LITERALY searched and clicked on every php login tutorial ,took me days.Please make a registration tutorial to go with this PLEASE and email me the page if possible at mcbain-games@hotmail.com , loved it mate keep it up!

  155. shaheen says:

    super easy login script.i like it really helpful.

  156. Rachna says:

    hey can u please tell me how to add the option of registeration??

  157. tommcat says:

    Hi, got struck with some old script of mine, your tutorial was very helpful. Thanks.

  158. Sathish says:

    Great work my friend.no words to praise you.You dont know how this will help me..Thanks again.

  159. Funeral Urns says:

    Every person that comes into our life comes for a reason, some come to learn and others come to teach. � Unknown

  160. Kezuke San says:

    help i was trying to follow the above tutorial but when i’m creating a database all i got is this error “#1054 – Unknown column ‘‘admin’’ in ‘field list” don’t know how to fix it..

  161. ernest says:

    This is very good, it has really helped me

  162. Karthi Keyan says:

    Hello JI,
    you did it long way back.. but it is very much useful for me now… Thanks a lot..

  163. nyamida isiak says:

    help me out with online examination php code connected to database.

  164. Shah says:

    Thanks. This script did the job for me. I got the task during my internship and I had it done within half an hour because of your tutorial

  165. farzi says:

    this is awesome! 😀

  166. John Seplak says:

    This was really helpful. Thanks so much.

  167. Nicholas says:

    i have issue, when i click back button after logout, i am able to see the session still exist.

  168. bring says:

    please explain me why:

    index, loginproc, securepage and logout(!) starts a session?

    there isn’t a catch that each of that file runs own (new) session?

  169. Thanks for the code. I used this code and created a login page myself. Its working fine. thanks once again.

  170. subha says:

    its very much useful for me…..thanks a lot….
    i tried this coding….so that i got full idea of session……….

  171. subha says:

    this coding useful for creating session

  172. MOHIT M RAO says:

    Hi, wonderfull work, can u also pls upload the registration page with this…

  173. neha says:

    good

  174. hahns says:

    Nice article….

  175. JAIKY says:

    how i pop up some messages if username and password is wrong

  176. haren819 says:

    How to Create registration Page in PHP and MySQL with Session & required fields???

  177. carlyn says:

    how can i die the log in form after the user logged?? I MEAN, how can i disable the back arrow on my browser?? so that if the user click on the back arrow, it will automaticaly display his home page and the “LOG IN form again..??? O.o

  178. carlyn says:

    “AND NOT THE LOG IN FORM AGAIN (rather)

  179. Max says:

    Thank you. I learned a lot from this.
    Honours to your house..

  180. Jayachandra says:

    Hi, This is very userful script for me. I am looking for this type of example for a long time. I got this. My sincere thanks to Frozenade.

  181. krogs says:

    i dont tried it yet but i think it might help me !!!

  182. Jeffery says:

    Thanks a lot buddy 🙂 it really helped 😉

  183. Rajesh Kannan S says:

    Nice post. helped me a lot .. Thanks

  184. Azaz says:

    This is a very simple for newly user of php. I used of your code for my php login page.

  185. James says:

    No matter what I try, I still cannot connect to the database. To the best of my knowledge, I have correctly followed each step.

    I get the following:


    You have successfully reached out to loginproc.php
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘username’@’localhost’ (using password: NO) in C:\xampp\htdocs\config.inc on line 9
    Connection to host is failed, perhaps the service is down!

    I couldn’t get “root” to work in “config.inc”. So, I created a user called “username” without a password. “username” has been given privildeges to the database “phpmysimplelogin” and to the “user” table within it.

    Below, is my modified “config.inc”:

    Any help will be greatly appreciated.

    Thanks,

    J

  186. Payal says:

    index.php code doesnt work properly actually whenevr i put username and passwd to login and after hiting login button its not redirected to any page it just make the field as blank …please help me out

  187. mumu aktar says:

    thnx for this code.bt i have a problem.i have jst done the same thing that u instructed.bt when i run this and put username password and submit then the same page appears.what is the problem and what is its solution?plz answer me.

  188. D says:

    Hi there

    I tested it out on my localhost and it works. I guess for me is trying to understand it all. I want to use this inside a cms. I have a cms built and finding it hard to add them in.

    Will keep trying until I have solution and then I can ask for some serious help.

    P.S keep up the good.
    CHEERS 🙂

  189. sujit says:

    I have used your code But i am faced with many error

    Warning: include(config.inc) [function.include]: failed to open stream: No such file or directory in D:\xampp\htdocs\p1\loginproc.php on line 7

    Warning: include() [function.include]: Failed opening ‘config.inc’ for inclusion (include_path=’.;D:\xampp\php\pear\’) in D:\xampp\htdocs\p1\loginproc.php on line 7

    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user ‘ODBC’@’localhost’ (using password: NO) in D:\xampp\htdocs\p1\loginproc.php on line 10

    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in D:\xampp\htdocs\p1\loginproc.php on line 10

    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user ‘ODBC’@’localhost’ (using password: NO) in D:\xampp\htdocs\p1\loginproc.php on line 10

    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in D:\xampp\htdocs\p1\loginproc.php on line 10

    Warning: mysql_query() [function.mysql-query]: Access denied for user ‘ODBC’@’localhost’ (using password: NO) in D:\xampp\htdocs\p1\loginproc.php on line 10

    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in D:\xampp\htdocs\p1\loginproc.php on line 10

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\xampp\htdocs\p1\loginproc.php on line 13

    Warning: Cannot modify header information – headers already sent by (output started at D:\xampp\htdocs\p1\loginproc.php:7) in D:\xampp\htdocs\p1\loginproc.php on line 21

  190. sujit says:

    sorry,it work properly,but when i submitted login button ,it don’t work properly.i am very glad if u will answer me.

  191. shdgjfsj says:

    values can not be inserted into the database,
    following error appears……………………

    Error

    SQL query:

    INSERT INTO user( username,
    PASSWORD )
    VALUES (
    ‘admin’, md5( ‘admin’ )
    )

    MySQL said: Documentation
    #1054 – Unknown column ‘‘admin’’ in ‘field list’

  192. frozenade says:

    @shdgjfsj
    Do not copy paste. Type it manually.
    ‘‘ sign made errors.

  193. frozenade says:

    @sujit
    It works for me. What machine do you use? XAMPP, LAMPP, EasyPHP, PHPTriad, etc?

  194. frozenade says:

    @sujit
    Sorry for late reply. 😉

  195. frozenade says:

    @D
    Glad to know it.
    Good luck with your works. 😉

  196. frozenade says:

    @mumu aktar
    It works for me. What machine do you use? XAMPP, LAMPP, EasyPHP, PHPTriad, etc?

  197. frozenade says:

    @Payal
    Try to upgrade your PHP. If it still doesn’t work, please let me know.

  198. frozenade says:

    @James
    Sory for late reply.
    Could you show me the config.inc again please? Because I cannot see the content you’ve paste.

  199. frozenade says:

    @Brendan
    ‘‘ sign makes error. Type it manually.

  200. frozenade says:

    @Nagarjun Palavalli
    Try to type it manually.

  201. Sam says:

    Below is the error which I am getting –

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\new-timings\loginproc.php on line 13

    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\new-timings\loginproc.php:13) in C:\xampp\htdocs\new-timings\loginproc.php on line 21

    This is the line 13 which seems to create the problem –
    if (mysql_num_rows($login) == 1) {

    However when I login using the form the session is already created and the user is logged in. Next time when I go to the secured page I can see it, but it directly does not get redirected from the loginproc.php page.

    Please help me in this regard.

  202. Sam says:

    1 more addition. If I change the code to
    if (mysql_num_rows($login) == 0) {
    the session gets created and the user is logged in. But still the error above remains the same.

  203. frozenade says:

    @james
    username and password is ‘admin’. Take a look at tutorials.

  204. frozenade says:

    @Osvaldo
    The download link still available. Try again! 😉

  205. frozenade says:

    @mike
    The asterisk sign means, you grab all field from query. If you don’t want to grab all, sure you can change directly with field name. But, the point is not field result, but count result.

  206. frozenade says:

    @Hendrick
    Make sure the password in your MySQL account is same with your config file.

  207. frozenade says:

    @chris
    Remove ‘ and ’

  208. frozenade says:

    @Dave
    I’ll add this feature on next release. Stay tuned. 😉

  209. Bhushan says:

    Extreeemly Extreeemly, Thank you…… for this script and its just like a water sprinkling on dry land……

  210. naveen says:

    what is the user name and password to be entered in page========http://localhost/login/index.php

  211. akabelle says:

    Thank you so very much!!! You saved my live >:D< if you were here, I'd hug you!

  212. shanavas says:

    This method is good for php beginners thank u!!!!!!!!!!!!!!!…

  213. shankar says:

    Thank you very very much.. Really an Amazing post..thank you again..for this wonderful code.@shankar

  214. dileep says:

    thanks for this code……..

  215. harish says:

    Cool
    works perfect!!

  216. Naidu says:

    Very nice and easy to follow article. Enjoyed it. Thanks.

  217. hafeez says:

    i am getting problem in this page like
    Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\loginproc.php:5) in C:\xampp\htdocs\loginproc.php on line 25

    need help…

  218. Atul says:

    IT shows “404 file not found on this server ” help me plzzzz

  219. url says:

    Great sharing..

  220. liya says:

    Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\ip\loginproc.php on line 15

    macam mana nak selesaikan error ni? please~

  221. Saran says:

    i created everything as you said.. i also created an user in database. but i couldnt login with that user.. Can you rectify? Pls help.. i’m a newbie

  222. Saran says:

    Help needed!!

  223. Saran says:

    I did everything as you said.. and thanks and fine everything is working superb! Now how can i add an user to the database?

  224. priyagopal says:

    wow…. super … it works fine, thank u so much….. 🙂

  225. asif says:

    Not bad 😀

  226. bella mason says:

    I’ve try this and it’s work out! nice job frozenade.

    anyhow, I do have a question. what if at the login form, there is 3 different user. for example student, staff and admin. do we need to create 3 different login table for the database ?

    what about the session ? is it possible to have a multi session in a single form ?

  227. Ola says:

    Thank you broda..you just made php login so simple for me.am gonna more ppl here to get acquainted with it.

  228. Manzur says:

    Thnx man! 🙂

  229. Sandeepmishra says:

    Is it secured?If i login and want to see the secure page and then copy the url.After logout, Is it not acessed using the URL copied.
    If it happen ,it’s very usefull for my portal.
    Thanx a lot.

  230. dz says:

    Thanks bro..this really help me..simple and easy to understand and quick respond to your visitor.

    *Attn: please don’t copy/paste the code direct…type it manually.. sure resolve some of the problem here.

  231. ruthenia says:

    this is a very helpful tutorial..thanks alot..:-)

  232. someone says:

    Thank you so much!!!!!!!!

  233. luke says:

    I am using my hosting company mysql.

    in hostname i put the correct server but when i type the username and password it always redirects me to the index page even if the password is correct.

    Any help please?

  234. JJH says:

    Every time i try this it says that there is an error in the loginproc: line : ” else {” I have tried everything to resolve it.. Whats happening?! please help

  235. kasun says:

    This code really helped me.. thank …. keep it up

  236. JJH says:

    Hey Froze, Ok I have managed to figure out exactly what the problem is.. for some reason it my login details are not working properly.. it has connected to my dadatebase because there are no messages saying other wise.. hopwever it does not recognise any of my logins .. inclusinf the amin login.. i have gone over all the scriptrs to check for any errors in my sql,, however i am unable to find.. would you be able to tell me why it is not recognising my login info for my db table ?? thanking you in advance

  237. wilmar says:

    thnkx a lot u save my life!!!

  238. Sandeepmishra says:

    Thanks a lot.It work as i required.

  239. sathiya says:

    cool dude.. it worked great for me..thanks a lot…

  240. Omar says:

    i have the code up in running but now i want to look at my index (using xampp). do i need to do something to allow myself to enter the index?
    like i tried referencing it but i think i would have to kill the index.php
    not sure if i make sense.

  241. keval says:

    i get the following error while entering into the database
    please help
    #1054 – Unknown column ‘‘admin’’ in ‘field list’

  242. adebukola says:

    Hi froze,
    thanks for making my creation of database easy bcos i have try to understand the php and mysql material i have but to no avail… a big thanks.froze….

  243. […] for this kind of thing? Ideally it'd be session-based (obviously). I found one system here: https://frozenade.wordpress.com/2007/…-with-session/ but it's several years old, and the misspellings in the comments tend to scare me away a bit. […]

  244. pradeep says:

    i am using xammp server but with your all coding output is only username, password & after clicking on submit button there is no action perform & data also not save in the database

  245. Mohit Jain says:

    hi frozenade… i tried using your tutorial but i am unable to execute it.. i made an entry in database… but when i login…whether i enter proper info or no…loginpage.php opens…please tell me where to make changes in the code…thanks

  246. A.M.Rinaz says:

    hi!
    where I find my database values in xampp?

  247. 3d says:

    3d…

    […]How to Create Login Page in PHP and MySQL with Session « Frozenade’s Zone[…]…

  248. tkm9o7ka says:

    Hi, I like this site. Thanks be given to you recompense tips. I found these tips rather helpful. But I got another query: where to believe good and shoddy designer products?

  249. justfansxxx says:

    bro… i wanna ask from your script, can we make a specific user access specific page?? I tried to modified your code so one user (admin) can access xampp to edit the database… Please I really need your help, thank u in advance

  250. hoor says:

    hahahaha..bkwas hai ekdum

  251. Artyom says:

    Thank you!!!

  252. Sherry says:

    Oh my gosh, you just saved my project. Thank you very much for posting

  253. Android Development says:

    Good help for every one specially for beginners…

  254. amit kumar verma says:

    thanx for the code, 2morrow is my presentation.

  255. Ali Hasnain says:

    Nice Post,Thanks for your help..its really help me to understand the sessions completely

  256. just another web user says:

    Hi there. First of all thank you for that great article and the simple login system. But I have a question about protecting certain file. How to protect file config.inc from being opened directly in the browser. This is the most important file because it contains user name and password for the secured login database . And now if I put it even very deep in dir for example – http://www.mysite.com/__12345/_qwerty/confic.inc – it doesn’t really matter because if somebody types the address directly the file is open. Even if the directory is protected and there are index files in it.

    Please, somebody write a solution if there is any
    Thank you

  257. niesa says:

    why my loginproc.php did not function? after i click submit button theres no action happen?

  258. niesa says:

    how to put prompt alert message coding when login fail and login success ? i done it refer to your given code above.. and now i want to add the prompt alert message into the below coding but it didnt work….can you help me?

    This is my script alert message that i had tried to put in above coding…

    window.alert(‘Log in Failed.’)

  259. anonymus says:

    thanks a lot! u save my software engineering!

  260. Ashish says:

    Grrrrrrrrrrrrrreatttt Submission bro…
    Exactly what I was searching for… 🙂
    Thanks a lottt…… 🙂

  261. santosh says:

    thanks for the useful script to me

  262. johnson says:

    nice 2tor & 9c explanation i lyke its.I struggle 4 long tyme bt now i got soln Tanx man, try 2 post other scripts lyke dis….. Wooowah its work as i lyke.NO Wonder……!!!!!!!
    Tanx Buddy

  263. Omkar says:

    Thx a lot for this tutorial..
    its really useful for me.

  264. pandatoshare says:

    very helpful for me..
    how to make a database for this code ? 😀

  265. this is useful script i need please suggest me how i can direct install wordpress in my website, i also used it with fantastico but now i need direct installation so please suggest me

    thanks

  266. Rafeeq Kummath says:

    wow…. super … it works fine, thank u so much…..

  267. Thanyani Netshisumbewa says:

    Thanx a lot man.

  268. rahul says:

    Really ur Post is very useful for me..

    Thanks alot

  269. mann says:

    its not working dnt knw y
    i need it urgently CAN ANY ONE HELP MEEE

  270. Jaydev says:

    how can i create client login page in my website, and how to i give connectivity in php coding ?

  271. omar says:

    thnx alot and keep posting such a usefull info

  272. vishwas says:

    i m stucked with my project. I need ur help. Plz tell me ur mail id Frozenade …i hope dat is ur name

  273. Shraddha says:

    Thanks Froze.. For the help…!!!

  274. JackH says:

    Please help! When I log in (no matter what credentials- bad or correct) I get redirected back to the login page (index.html).

  275. Domie says:

    Good work

  276. parvez says:

    Hey thanks.. Its nice and really works well..

  277. daz says:

    I’m trying to alter the above code for use on my website, but I’m using a MSSQL dbase. Config as follows: PHP 5.3, IIS 6.0 and the SQLSVR driver.
    Connection etc is fine. Just having trouble with the code to match the user and pass input to the dbase.
    Help would be appreciated.

  278. pratik says:

    Zakkas code. Thanks for sharing it. Helped for my site.

  279. ryan says:

    hi there, i tried your code and it works but it seems that your login session can only access with one password. .i tried to make a new username and a new password but it didn’t work. .plz help me to fix it. .thanks

    you can email me at salasjohnryan@yahoo.com

  280. Kumar Vaibhav says:

    sorry but this code is not work on my system i get this ‘Index of /phpmysimplelogin’ after putting the address in the browser. and all the files comes as i put in the folder.

    so please tell me how can i alter this problem.

    Thanks

  281. Siv says:

    hi,
    i am new to php..n i want to learn and excel myself in this field..please help me to understand php in easy way.. i read your script it’s really good but still make it more simpler so that it can be easily understood….please update me with the php basics and what functions should be use to run the code more accurately. If possible please provide me with some example tutorials on my e-mail id….

  282. thanks for the help really appreciate it

  283. joy says:

    nice dude.. Helpful me

  284. Kunal Raina says:

    Its not working for me too. I get the same page as the login.php every time I try to login. Please help. I am using Xampp 1.6.8

  285. prabhakar says:

    very good nice code .

  286. Pablo says:

    Nice. What code to use to secure page, like if !logged
    Header index.php

    Mean if i want to create a change pw page, required that the user is logged in.

  287. Absar says:

    It was very useful for me thanks for posting

  288. yogesh says:

    hello h r u
    recently i have start php so i want parchase a book for php plz tell me which book is best at this time and simple language.

  289. What’s up, of course this article is truly fastidious and I have learned lot of things from it about blogging. thanks.

  290. Zach says:

    THANK YOU!! All of the other places I looked to do this where either out-dated or didn’t explain good enough. I wish you had also included a Registration part, but I know how to do that. Good tutorial: simple, quick, easy!

  291. cassa says:

    its one of the best dude ,thanks very much

  292. Hark says:

    it’s goood

  293. Johann says:

    I had try the codes. They doesn’t work on my WAMP.
    Why save in config.inc?
    Please send me the codes by email.

  294. I actually blog as well and I’m publishing a
    thing related to this specific posting, “How to Create
    Login Page in PHP and MySQL with Session Frozenades Zone”.

    Do you mind in the event that Iemploy a lot of of your own concepts?
    Thanks for your effort ,Lino

  295. here says:

    Hi there! Do you use Twitter? I’d like to follow you if that would be ok. I’m definitely enjoying your blog
    and look forward to new posts.

    yes i have. #frozenade. thank u for enjoying my posts. 😉

  296. Telani says:

    Thank u veryyyyyyy much

  297. Shivaleela says:

    it is not working …
    i m stucked with project. i need it urgently CAN ANY ONE HELP MEEE…

    Thanks..

  298. Venkat says:

    This is an awesome script. I was looking for this and it’s very helpful.
    Very much appreciate your work. Continue your good work buddy.

  299. Yuichi says:

    #1054 – Unknown column ‘‘admin’’ in ‘field list’

    what to do?

  300. I will immediately grasp your rss as I can not in finding your email subscription link or newsletter service.
    Do you’ve any? Kindly permit me understand in order that I could subscribe. Thanks.

  301. nikunj says:

    thans itss realy ver help full site

  302. chanthy2013 says:

    I have tried all of your guide, but it still not working well

  303. For more information on health and hemp, check Health Benefits of Hemp Seed.
    By looking for cheap clothes online, you can get designer clothes at affordable prices.

    Despite developed and designed economies are still about recovery, BRICS nations around bring appeared since the innovative powerplant using earth’s economic situation. Empowerment Enterprises: Today’s Business
    Attire -. But these kinds are usually not for the faint of heart.

  304. gauri says:

    how can i create client login page in my website, and how to i give connectivity in php coding ? and how to retrieve password

  305. GOING HERE says:

    Hi, i feel that i noticed you visited my blog thus i came to return the choose?
    .I’m trying to to find things to improve my website!I assume its ok to make use of a few of your ideas!!

  306. chanthy2013 says:

    hi all PHP advanced user, I have some problem with PHP form that I can’t insert data into table in database. Here is my code:

    $query = “INSERT INTO members(id,username,password,group)
    VALUES(null,’$username’,’$password ‘,’$group’)”;

    $result = mysql_query($query) or die(“The data is not added to the Table!”);
    My table field are :(id(auto_increament),username,password,group)
    Note:group has 2 options if 1=Admin, if 2=Normal User
    Please send me back the answers.
    Thanks for helps…!

  307. Arshita Singh says:

    Please help me for giving the code regarding registration. When we register any site then immediately password is send to our mobile no. How it can be done in php.??

  308. p.senthilkumar says:

    ofrget login code for php

  309. banks says:

    wat is a session

  310. Diksha Chawla says:

    Hey there..
    Somebody already reported this error, but for some reason I can’t figure out what exactly is wrong with my code.
    This is what I have for loginproc.php:

    and here is the error I am getting :

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /nfs/c03/h04/mnt/166547/domains/lithuaniavote.com/html/login/loginproc.php on line 13

    Warning: Cannot modify header information – headers already sent by (output started at /nfs/c03/h04/mnt/166547/domains/lithuaniavote.com/html/login/config.inc:15) in /nfs/c03/h04/mnt/166547/domains/lithuaniavote.com/html/login/loginproc.php on line 21

    I’d really appreciate any help. Thanks.

  311. Diksha Chawla says:

    loginproc.php:

  312. Diksha Chawla says:

    Damn, sorry!

    loginproc.php:

  313. thank you bro. i had problem with session, than i tryed to find from everywhere, and… you know… than i found your post, and it helped. amazing! thank you again!

  314. Melodee says:

    Your own article features verified necessary to me personally.
    It’s very informative and you are obviously extremely experienced of
    this type. You have got popped my personal eyes for you to varying opinion of this specific subject matter together with intriquing, notable and sound content material.

  315. Aileen says:

    What i do not realize is actually how you’re not really a lot more smartly-favored than you may be now. You are so intelligent. You already know thus considerably in the case of this topic, made me in my view believe it from numerous various angles. Its like women and men are not fascinated unless it is something to do with Woman gaga! Your own stuffs nice. All the time handle it up!

  316. BadSeed says:

    hey there frozenade, I am new to this…So I did it, it goes to the loginproc page no matter if the password or the username is right, how do I fix this?

  317. Jose says:

    Great beat ! I wish to apprentice while you amend your web site, how can
    i subscribe for a blog web site? The account aided me a acceptable deal.
    I had been tiny bit acquainted of this your broadcast
    offered bright clear idea

  318. Ralph Melen says:

    My business is extremely impressed with this view point. Thanks for sharing such useful information inside your blog. A great content so you can get the proper information about the subject.

  319. Hai says:

    Hello colleagues, how is all, and what you want to say about this paragraph, in my view its actually remarkable in favor
    of me.

  320. 72494 says:

    Solid write up. I’m studying something similar here at University of Central Florida. It’s always helpful to learn new stuff from fellow writers and gather
    information from new sources. If it’s okay, I’d seriously appreciate it if I re-post use some
    of the articles on your blog. And of course,
    I’ll offer a link to your site at wordpress.com on my own page. Thanks for posting.

  321. Cialis says:

    Your current post features proven helpful to myself.
    It’s quite educational and you really are clearly
    really knowledgeable in this region. You get popped our eyes for you
    to various thoughts about this particular topic along with intriquing, notable and reliable articles.

  322. Ganbat says:

    Hi thank you u r best..

  323. Ecksofa says:

    There’s definately a lot to find out about this issue. I love all of the points you have made.Visit my website at Ecksofa 😉

  324. Shaun says:

    Hi there, im totally new to login pages etc. I just have got a job and i need to create a shopping cart and registration page. The client has to register before he can buy any of the products.. I have to experience in this field and i can find anybody that can seem to help. How do i approach this where do i start.

  325. julie says:

    hi hope you are still reading this as I need some help, the login worked for me, but when get to my success page after logging In, this is the error
    This is secured page with session:
    Notice: Undefined variable: _SESSION in C:\xampp\htdocs\SecureLogin\sucess.php on line 29

    Something to do with this line 29
    This is secured page with session:
    Thanks for reading

  326. It’s amazing for me to have a website, which is helpful in support of my knowledge. thanks admin

  327. Ahaa, its good dialogue about this paragraph here at this weblog, I have read all that, so at this time me also commenting at this place.

  328. They can even get a judgment order against you
    and go for wage garnishment. A mortgage broker is someone who arranges mortgage
    loans for individuals and businesses. I knew I would end
    up selling the property if they didnt make payments on the mortgage as my security and I could always deduct the mortgage interest
    on my returns.

  329. lalit kumar says:

    when click on submit button it show same page on browser no error…

  330. Appreciation to my father who informed me about this website, this blog is really amazing.

  331. Anoop Kp says:

    HI Guys,

    We are giving all kinds of PHP codes through http://www.websnippet.in

    check put websnippet.in and get your code

    Thanks
    Anoop

  332. tarnów says:

    I do believe all of the ideas you have introduced in your post.
    They’re really convincing and can certainly work. Nonetheless, the posts are very quick for novices. Could you please extend them a bit from next time? Thank you for the post.Do you love Speedway? Enjoy to us! żużel

  333. tribhuwan mishra says:

    thank for help……..

  334. The next important consideration if you are going with
    discount web hosting is how many other people are sharing the same server as
    you are. In the wake of the rapidly moving environment, such hosting services
    should be considered for websites, for safety
    purpose and hence a successful business. As each
    year passes, web hosting continues to get cheaper and cheaper.

  335. Thanks for sharing your thoughts. I truly appreciate your efforts and I will be waiting for your further post thanks once again.

  336. Hi there, just wanted to tell you, I loved
    this blog post. It was practical. Keep on posting!

  337. sravya says:

    Thank you sir it a god job.its very helpful to me becz am a fresher thank you for ur detail explanation

  338. Charles Gray says:

    Very nice post, I was able to implement this into my design. One small problem with it, When I used the md5 hash the database column for password wouldn’t let me use charvar for the value, I had to use int for the value in the database.

  339. I visited multiple web pages however the audio feature for audio songs current at this web site is in fact superb.

  340. What’s up i am kavin, its my first time to commenting anywhere, when i read this post i thought i could also create comment due to this good paragraph.

  341. Anonymous says:

    I like to disseminate understanding that I’ve accumulated through the season to assist improve team overall performance.

  342. Anonymous says:

    Excellent confident synthetic eye just for details and can foresee troubles prior to they will take place.

  343. Mohammed says:

    If some one needs expert view concerning running a blog after that i recommend
    him/her to pay a visit this weblog, Keep up the pleasant job.

  344. Santiago says:

    Hi, Neat post. There’s an issue with your website in web explorer,
    might check this? IE nonetheless is the marketplace chief and
    a good section of other people will leave out your great writing because of this problem.

  345. venkat says:

    nice informationn

  346. Simone says:

    I got this site from my buddy who told me about
    this site and at the moment this time I am visiting his web
    page and reading vsry informative posts here.

  347. sanjali says:

    thankew so much 🙂 preety nice code.. it worked 🙂

  348. Hello, I read your new stuff like every week.
    Your humoristic style is awesome, keep it up!

  349. vivek parashar says:

    help me plzz with md5 in my phpmyadmin in sql ur querry not working INSERT INTO user (username, password) VALUES (‘admin’, md5(‘admin’))

    make a way and tell me wht to do …. when i input this querry its show a error …………#1054 – Unknown column ‘‘admin’’ in ‘field list’

  350. molly says:

    Thanks very helpful 🙂

  351. Jagadeesh says:

    Dear Sir , Ma’am.
    When I Implement this login Codes . It is show Data Base is not Available

  352. Jagadeesh says:

    Thank 🙂 U Very Much , Above Code. Now its working

  353. bhrigu deka says:

    thnk ew…it rly help me a lot..

  354. pooja says:

    hey i followed all d stes bt i am getting error saying object not found
    how can i solve it please telme…

  355. bhashkar says:

    thanks a lot for this code ……….

  356. Robby says:

    I seldom comment, but i did some searching and wound
    up here How to Create Login Page in PHP and MySQL with Session | Frozenade’s Zone.

    And I do have a couple of questions for
    you if it’s allright. Is it just me or does it appear like
    a few of the comments appear like written by brain dead individuals?
    😛 And, if you are writing at additional social sites, I would like to follow anything new you have to post.
    Would you list of the complete urls of your public sites like your twitter feed, Facebook
    page or linkedin profile?

  357. shela says:

    what username and password should i use?

  358. Krishnadas KP says:

    Oh mate…I know it is kind of late to comment in a post of 2008 XD

    I was searching all over the internet on this problem. I got several number of codes which worked perfectly alright but for me it wasn’t enough. I had learned about sessions and all and wanted the code to go in harmony with my knowledge.. And I was almost fed up unless I decided to check the second page of google’s search results… TA DA…I got the perfect solution…Thank you mate.. Keep up the good work (y) All the best.

  359. frozenade says:

    wow, i’m wondering to read your comment. glad to know that it’s still usefull.

Leave a comment