Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $arrayerror='';
- if (isset($_POST['submit'])) {
- if (empty($_POST['username']) || empty($_POST['password'])) {
- $arrayerror = "your username or password is empty";
- }
- else
- {
- $username=$_POST['username'];
- $password=$_POST['password'];
- include("configs/connect.php");
- $query = mysql_query("select * from st_users where user_password='$password' AND user_name ='$username'");
- $rows = mysql_num_rows($query);
- if ($rows == 1) {
- $_SESSION['login_user']=$username;
- header("location: profile.php");
- } else {
- $arrayerror = "your username or password is invalid ";
- }
- mysql_close($connection);
- }
- }
- ?>
- <?php
- if(isset($_SESSION['login_user'])){
- header("location: profile.php");
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <link href="style.css" rel="stylesheet" type="text/css">
- </head>
- <body>
- <div id="main">
- <h1>WELCOM</h1>
- <div id="login">
- <form action="" method="post">
- <label>UserName :</label></br>
- <input id="name" name="username" type="text"></br>
- <label>Password :</label></br>
- <input id="password" name="password" type="password"></br>
- <input name="submit" type="submit" value=" Login ">
- <span><?php echo $arrayerror; ?></span>
- </form>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement