Free download web templates, books and more. Free php projects ,games and apps. GTA mods and more

Breaking

Simple login form php Mysql | login formphp using session

Simple Login Form PHP MySQLi
Using simple and better less line coding pHP and MySQLi login form.
 it is mandatory to have a user login form in a website if you only want people with certain credentials view your content. It is a good way to keep your data secure from those who it is not intended for. Do you remember one of our previous tutorials on saving data to a database. Well, we will use that same data and that same users table.
 create the login form.
login.php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Login Form</title> </head> <body> <form method="post" action="login.php" > <table border="1" > <tr> <td><label for="users_email">Email</label></td> <td><input type="text" name="users_email" id="users_email"></td> </tr> <tr> <td><label for="users_pass">Password</label></td> <td><input name="users_pass" type="password" id="users_pass"></input></td> </tr> <tr> <td><input type="submit" value="Submit"/> <td><input type="reset" value="Reset"/> </tr> </table> </form> </body> </html>
Next you will create
logi
submitted information


<?php 
$email = $_POST["users_emcreatass = $_POST["users_pass"]; // Connect to the database $con = mysql_connect("localhost","root",""); // Make sure we connected successfully if(! $con) { die('Connection Failed'.mysql_error()); } // Select the database to use mysql_select_db("dbname",$con); $result = mysql_query("SELECT users_email, users_pass FROM users WHERE users_email = $email"); $row = mysql_fetch_array($result); if($row["users_email"]==$email && $row["users_pass"]==$pass)   //next you will create dashboard.php
Header(location:dashboard.php); else echo"Sorry, your credentials are not valid, Please try again"; ?>
If the username and password both are correct, then the output will be:
You are a validated user.
Login password and name match to go in index page 
Failed to