<?php session_start(); ?> <?php require_once("includes/connection.php"); ?> <?php if(!isset($_SESSION['username'])) { $error= array(); if(isset($_POST['submit'])) { //Get values from form $username = $_POST['username']; $password = $_POST['password']; $query = "select * from users where username = '" .mysql_real_escape_string($username) . "'"; $query_run = mysqli_query($connection, $query); if(!$query_run) echo 'username, password query is not working well. <br />' . mysqli_connect_error(); if(mysqli_num_rows($query_run) != 0 ) { $user = mysqli_fetch_array($query_run); if($username == $user['username']) { if($password == $user['password']) { $_SESSION['username'] = $username; //User session is created here header("Location: index.php"); exit; } else { array_push($error, 'password Wrong'); } } else { array_push($error, 'Username Wrong'); } } else { array_push($error, 'Login Error'); } } } else { header('Location: signup.php'); exit; } ?> <div align="left" style="float:right"> <h2 align="center">Login Panel for Developer</h2> <form method="post" action="login.php"> <label for="username">Username: </label><input name="username" type="text" id="username" /><br /> <label for="password">Password: </label><input type="password" name="password" id="password" /><br /> <input type="submit" name="submit" value="Login" /> </form> <?php if(isset($_POST['submit'])) { echo $error[0]; } ?> </div>
Simple Login Page And Its Code For Creating Sassion
Labels:
PHP Learning

Post a Comment
Give your reviews about this blog. Leave your comments. What do you think about this post?
Comments Guidelines:
1) I love to read comments, but please avoid spam.
2) Like this blog, share your insights, and spread the word.
3) You can use basic HTML/xHTML tags.
4) All comments are DoFollow—please use the section professionally.
5) Kindly mention your name or brand below your comment.
6) Constructive suggestions for improvement are always welcome.
Thanks for visiting Samee Articles.
========================================
Best Regards,
Samee U. Feroz