Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="login.php" method="post">
- <div class="containerLogin">
- <label><b>Username</b></label>
- <input type="text" placeholder="Enter Username"name="username" required>
- <label><b>Password</b></label>
- <input type="password" placeholder="Enter Password" name="password" required>
- </div>
- <div class="containerLogin" style="background-color:#f1f1f1">
- <input type="submit" name="submit" value="submit" class="btn btn-primary">
- <span class="password">Forgot <a href="#">password?</a></span>
- </div>
- </form>
- <?php
- include_once "connection.php";
- if (isset($_POST['submit'])) {
- session_start();
- if($_POST['username'] && $_POST['password']) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $query = mysqli_query("SELECT * FROM studenttable WHERE username='$username' and password='$password'");
- $res = mysqli_query($con, $query);
- $count_user = mysqli_num_rows($res);
- if($count_user==1)
- {
- $row = mysqli_fetch_array($res);
- $_SESSION['username'] = $row['username'];
- $_SESSION['password'] = $row['password'];
- header("location:dashboard.php?success=1");
- }else{
- $error = 'Incorrect Username, Password and Branch.';
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment