Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- <
- ?php
- session_start();
- $error = ""; // store error message
- if(isset($_POST['submit']))
- {
- if(empty($_POST['username']) || empty($_POST['password']))
- {
- $error = "Username and password is invalid";
- echo "$error";
- }
- else
- {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $conn = mysql_connect('localhost','','','practice');
- if($conn==true)
- {
- $query = mysql_query($conn,"select * from employee where username=$username AND password=$password");
- $rows = mysql_num_rows($query);
- if($rows == 1)
- {
- $_SESSION['login_user'] = $username;
- header("location:profile.php");
- }
- else
- {
- $error = "Username and Password is Invalid";
- }
- }
- else
- {
- echo "error";
- }
- mysql_close($conn);
- }
- }
- ?>
- }
Add Comment
Please, Sign In to add comment