<?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 Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.
---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards