Editing: client_login.php
Kembali
<?php include '../components/connect.php'; session_start(); $client_email = $_SESSION['client_email']; if(isset($client_email)){ header('location:index.php'); } if(isset($_POST['submit'])){ $email = $_POST['client_email']; $email = filter_var($email, FILTER_SANITIZE_STRING); $pass = sha1($_POST['pass']); $pass = filter_var($pass, FILTER_SANITIZE_STRING); $sql = "SELECT * FROM client_login WHERE client_email='$email';"; $res = mysqli_query($conn, $sql); // print_r($res); // echo(mysqli_error($conn) ); if(mysqli_num_rows($res) != 0){ $row = mysqli_fetch_array($res); if($pass != $row['client_password']){ $message[] = "Invalid password!"; } else{ $result = "Loggedin successfully! Redirecting..."; $_SESSION['client_email'] = $row['client_email']; $_SESSION['client_category']=$row['category']; $_SESSION['client_contact']=$row['client_contact']; header('location:index.php'); } } else{ $message[] = "Invalid username!"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>login</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"> <link rel="stylesheet" href="../css/admin_style.css"> </head> <body> <?php if(isset($message)){ foreach($message as $message){ echo ' <div class="message"> <span>'.$message.'</span> <i class="fas fa-times" onclick="this.parentElement.remove();"></i> </div> '; } } ?> <section class="form-container"> <form action="" method="post"> <h3>login</h3> <!-- <p>default username = <span>admin</span> & password = <span>111</span></p> --> <label>Email</label> <input type="email" name="client_email" required placeholder="enter your Email" maxlength="20" class="box" oninput="this.value = this.value.replace(/\s/g, '')"> <label>Password</label> <input type="password" name="pass" required placeholder="enter your password" maxlength="20" class="box" oninput="this.value = this.value.replace(/\s/g, '')"> <input type="submit" value="login now" class="btn" name="submit"> <div style="font-size: 1.5rem;margin-top: 1rem;">Dont Have Account? <a href="./signup.php">Signup Now</a> </div> </form> </section> </body> </html>
SIMPAN PERUBAHAN