Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include 'db_conn.php';
- if(isset($_POST['submit'])) {
- if(isset($_POST['username'])) $username = $_POST['username'];
- if(isset($_POST['email'])) $username = $_POST['email'];
- if(isset($_POST['contact'])) $username = $_POST['contact'];
- if(isset($_POST['password'])) $password = $_POST['password'];
- if(empty($username)) {
- $msg = "প্রবেশের জন্য তথ্যপূরণ আবশ্যক";
- header("Location:login.php?msg=$msg");
- } else {
- if(empty($password)) {
- $msg = "প্রবেশের জন্য গুপ্তমন্ত্র আবশ্যক";
- header("Location:login.php?msg=$msg");
- } else{
- $user = "SELECT * FROM user_info WHERE username = '$username' or email = '$username' or contact = '$username'";
- $usercheck = $conn->query($user);
- $sqli = "SELECT * FROM user_info WHERE username = '$username' and password = '$password' and approval = '1' or email = '$username' or contact = '$username' ";
- $result = $conn->query($sqli);
- $sqla = "SELECT * FROM user_info WHERE username = '$username' and password = '$password' and approval = '0' or email = '$username' or contact = '$username' ";
- $resulta = $conn->query($sqla);
- if ($result->num_rows > 0) {
- // output data of each row
- // using loop we are getting following information
- $user_id="";
- $email="";
- $username="";
- while($row = $result->fetch_assoc()) {
- $user_id=$row["user_id"];
- $email=$row["email"];
- $username=$row["username"];
- }
- $_SESSION['user_id'] = $user_id;
- $_SESSION['email'] = $email;
- $_SESSION['username'] = $username;
- $_SESSION['flag'] = true;
- header("location: home.php");
- } else{
- if ($resulta->num_rows > 0) {
- $msg = "তোমার খবর আছে";
- header("Location:login.php?msg=$msg");
- } else {
- if ($usercheck->num_rows > 0) {
- $msg = "তোমার গুপ্তমন্ত্রটি মিথ্যা, আবার চেষ্টা করো";
- header("Location:login.php?msg=$msg");
- } else {
- $msg = "তোমার তথ্যসমূহ অবান্তর";
- header("Location:login.php?msg=$msg");
- }}}}}
- $conn->close();
- }
- ?>
Add Comment
Please, Sign In to add comment