Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('.' . DIRECTORY_SEPARATOR . "app" . DIRECTORY_SEPARATOR . "boot.php");
- /*if (isset($_SESSION['student'])) {
- header("Location: students/index.php");
- }
- if (isset($_SESSION['teacher'])) {
- header("Location: teachers/index.php");
- }
- if (isset($_SESSION['parent'])) {
- header("Location: parents/index.php");
- }*/
- $stmt = $connect->query("SELECT close_site FROM control");
- $row = $stmt->fetch();
- $mode = $row['close_site'];
- if ($mode == 0 ) {
- header("Location: close.php");
- die();
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <meta name="description" content="">
- <meta name="author" content="">
- <link rel="icon" href="../../favicon.ico">
- <title><?php echo $language['main_title'];?></title>
- <!-- Bootstrap Core CSS -->
- <link href="css/bootstrap-theme.css" rel="stylesheet">
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <link href="css/style.css" rel="stylesheet">
- <link href="css/home_style.css" rel="stylesheet">
- <!-- javascript -->
- <link href="libs/validationEngine/validationEngine.jquery.css" rel="stylesheet">
- <?php
- if (isset($_SESSION['english'])) {
- echo '<link href="libs/validationEngine/languages/jquery.validationEngine-en.css" rel="stylesheet"/>';
- }
- if (isset($_SESSION['shqip'])) {
- echo '<link href="libs/validationEngine/languages/jquery.validationEngine-sq.css" rel="stylesheet"/>';
- }
- ?>
- <script>
- $(function()
- $("#login_students").validationEngine();
- $("#login_teachers").validationEngine();
- $("#login_parents").validationEngine();
- });
- </script>
- </head>
- <body>
- <div class="navbar navbar-default">
- <div class="container">
- <form id="language" action="" method="POST">
- <input type="submit" name="en" value="english" class="english">
- <input type="submit" name="sq" value="shqip" class="shqip">
- </form>
- </div>
- </div>
- <div class="container main">
- <?php
- if(isset($_POST['submit_students'])){
- $student_name = htmlspecialchars($_POST['student_name']);
- $student_pass = htmlspecialchars(md5($_POST['student_pass']));
- $stmt_login = $connect->prepare("SELECT * FROM students_users WHERE username = :student_name and password = :student_pass");
- $stmt_login->bindParam(':student_name', $student_name, PDO::PARAM_STR);
- $stmt_login->bindParam(':student_pass', $student_pass, PDO::PARAM_STR);
- $stmt_login->execute();
- if ($stmt_login->rowCount() == 1) {
- $row = $stmt_login->fetch();
- $user = $row['username'];
- $pass = $row['password'];
- $student_index = $row['student_index'];
- if ($user == $student_name and $pass == $student_pass) {
- $_SESSION['student'] = $user;
- $_SESSION['student_index'] = $student_index;
- $token_rand = uniqid(rand());
- $_SESSION['token'] = $token_rand;
- header("Location: students/index.php");
- }
- }
- else {
- header("Location: index.php?login=error");
- }
- }
- if(isset($_POST['submit_teachers'])){
- $teacher_name = htmlspecialchars($_POST['teacher_name']);
- $teacher_pass = htmlspecialchars(md5($_POST['teacher_pass']));
- $stmt_login = $connect->prepare("SELECT * FROM teachers_users WHERE username = :teacher_name and password = :teacher_pass");
- $stmt_login->bindParam(':teacher_name', $teacher_name, PDO::PARAM_STR);
- $stmt_login->bindParam(':teacher_pass', $teacher_pass, PDO::PARAM_STR);
- $stmt_login->execute();
- if ($stmt_login->rowCount() == 1) {
- $row = $stmt_login->fetch();
- $user = $row['username'];
- $pass = $row['password'];
- $teacher_index = $row['teacher_index'];
- if ($user == $teacher_name and $pass == $teacher_pass) {
- $_SESSION['teacher'] = $user;
- $_SESSION['teacher_index'] = $teacher_index;
- $token_rand = uniqid(rand());
- $_SESSION['token'] = $token_rand;
- header("Location: teachers/index.php");
- }
- }
- else {
- header("Location: index.php?login=error");
- }
- }
- if(isset($_POST['submit_parents'])){
- $parent_name = htmlspecialchars($_POST['parent_name']);
- $parent_pass = htmlspecialchars(md5($_POST['parent_pass']));
- $stmt_login = $connect->prepare("SELECT * FROM parents_users WHERE username = :parent_name and password = :parent_pass");
- $stmt_login->bindParam(':parent_name', $parent_name, PDO::PARAM_STR);
- $stmt_login->bindParam(':parent_pass', $parent_pass, PDO::PARAM_STR);
- $stmt_login->execute();
- if ($stmt_login->rowCount() == 1) {
- $row = $stmt_login->fetch();
- $user = $row['username'];
- $pass = $row['password'];
- $parent_index = $row['parent_index'];
- if ($user == $parent_name and $pass == $parent_pass) {
- $_SESSION['parent'] = $user;
- $_SESSION['parent_index'] = $parent_index;
- $token_rand = uniqid(rand());
- $_SESSION['token'] = $token_rand;
- header("Location: parents/index.php");
- }
- }
- else {
- header("Location: index.php?login=error");
- }
- }
- ?>
- <div class="clear"></div>
- <div class="col-md-8 col-md-offset-2">
- <center><h2><?php echo $language['main_title'];?></h2>
- <div class="login">
- <h1><?php echo $language['log-in'] ?> </h1>
- <?php
- if (isset($_GET['login']) == "error") {
- echo "<div class='alert alert-danger center'> <p>". $language['username_or_password_error']."</p></div>";
- }
- ?>
- <button class="button" data-toggle="modal" data-target="#TeacherLogin" ><span>Teacher </span></button>
- <button class="button" data-toggle="modal" data-target="#StudentLogin"><span>Student </span></button>
- <button class="button" data-toggle="modal" data-target="#ParentLogin"><span>Parent </span></button>
- </center>
- <div class="container main">
- <div class="clear"></div>
- <br>
- <!-- Teacher Login Form -->
- <div class="modal fade" id="TeacherLogin" tabindex="-1" role="dialog" aria-labelledby="TeacherLogin" aria-hidden="true" style="display: none;">
- <div class="modal-dialog">
- <div class="loginmodal-container">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <hr>
- <h1>Welcome to Teacher Login</h1><br>
- <form id="login_teacher" action="" method="post">
- <input type="text" name="teacher_name" class = "validate[required]" placeholder="<?php echo $language['username']; ?>"/>
- <input type="password" name="teacher_pass" class = "validate[required]" placeholder="<?php echo $language['password']; ?>"/>
- <input type="submit" name="submit_teachers" class="login loginmodal-submit" value="<?php echo $language['login']?>"/>
- </form>
- <div class="login-help">
- <a href="#">Forgot Password</a>
- </div>
- <hr>
- </div>
- </div>
- </div>
- <!-- Student Login Form -->
- <div class="modal fade" id="StudentLogin" tabindex="-1" role="dialog" aria-labelledby="StudentLogin" aria-hidden="true" style="display: none;">
- <div class="modal-dialog">
- <div class="loginmodal-container">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <hr>
- <h1>Welcome to Student Login</h1><br>
- <form id="login_student" action="" method="post">
- <input type="text" name="student_name" class = "validate[required]" placeholder="<?php echo $language['username']; ?>"/>
- <input type="password" name="student_pass" placeholder="<?php echo $language['password']; ?>"/>
- <input type="submit" name="submit_students" class="login loginmodal-submit" value="<?php echo $language['login']?>"/>
- </form>
- <div class="login-help">
- <a href="#">Forgot Password</a>
- </div>
- <hr>
- </div>
- </div>
- </div>
- <!-- Parents Login Form -->
- <div class="modal fade" id="ParentLogin" tabindex="-1" role="dialog" aria-labelledby="ParentLogin" aria-hidden="true" style="display: none;">
- <div class="modal-dialog">
- <div class="loginmodal-container">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <hr>
- <h1>Welcome to Student Login</h1><br>
- <form id="login_parent" action="" method="post">
- <input type="text" name="parent_name" class = "validate[required]" placeholder="<?php echo $language['username']; ?>"/>
- <input type="password" name="parent_pass" placeholder="<?php echo $language['password']; ?>"/>
- <input type="submit" name="submit_parents" class="login loginmodal-submit" value="<?php echo $language['login']?>"/>
- </form>
- <div class="login-help">
- <a href="#">Forgot Password</a>
- </div>
- <hr>
- </div>
- </div>
- </div>
- <!-- jQuery -->
- <script src="js/jquery.min.js"></script>
- <!-- Bootstrap Core JavaScript -->
- <script src="js/bootstrap.min.js"></script>
- <!-- Initialize Bootstrap functionality -->
- <script>
- // Initialize tooltip component
- $(function () {
- $('[data-toggle="tooltip"]').tooltip()
- })
- // Initialize popover component
- $(function () {
- $('[data-toggle="popover"]').popover()
- })
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement