How can i create login form in PHP?

This must be one of the PHP subjects with the most tutorials out there. If you want someone to do your work, then open up a WTB thread and pay. Otherwise, learn to use Google.
 
There's lots of open source login scripts available for php. Search Google and look for something that has been tested and secured. Much safer if you've never done this before. And then study the scripts to see what they're doing.
 
Get an SSL certificate. Once you have HTTPS working on your server (work with your hosting company to get it working), you can use code similar to the following to force an HTTPS connection in PHP. .htaccess is another option, mentioned elsewhere.
 
You can't make form directly in PHP but it provides dynamic features in web pages. Form is made on HTML language and PHP basically meant for server side working.
 
Create database table in mysql with username and password held
create login form
post to a processing page (on that page access database and compare login variables)
if variables don't match redirect to log out page and destroy session
if login variables match create session and add variables to session
run security at the top of each page to check if the user is good if not send to session destroy page
use session to keep people out of pages with security script

thats just what I do in a nut shell but I add a few other things here and there
Brenig at Univelocity
 
What does https have to do worth logging in?
 
The first file we need to create is "main_login.php" which is a login form.
############### Code


<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Member Login </strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="text" id="mypassword"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
 
Back
Top