Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require('db_con.php');
- if (isset($_POST['user_name'])and isset($_POST['user_password']))
- {
- $username=$_POST['user_name'];
- $password=$_POST['user_password'];
- $query="select * from `users` where `user_name`='".$username."' and user_password ='".$password."'";
- $result=mysqli_query($con, $query) or die(mysqli_error($con));
- $count=mysqli_num_rows($result);
- if($count==1){
- $_SESSION['user_name']=$username;
- }
- else
- {
- $fmsg="Invalid Login Credentials.";
- }
- }
- if(isset($_SESION['user_name']))
- {
- $username=$_SESSION['user_name'];
- echo"Hello" .$username ."";
- }
- ?>
- <html>
- <head>
- <title>Login</title>
- </head>
- <body>
- <h1></h1>
- <form action="" method="post">
- <label>User Name :</label>
- <input type="text" name="user_name" /><br />
- <label>Password</label>
- <input type="password" name="user_password" /><br />
- <input type="submit" value="Login" name="submit"/>
- </form>
- <?php
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement