Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $error=false;
- ob_start();
- // Errors reporting, used if needed
- error_reporting(E_ALL);
- ini_set('display_errors', 'on');
- // General configuration like base, used if needed
- include_once ('include/config.inc.php');
- // Mail functions
- include_once ('include/mail.functions.php');
- // Start session if needed
- session_start();
- // DBConn
- include_once ('class/DB/DBConn.includeall.php');
- $db = new DBConn(NULL);
- // Includere clasa login
- require_once ('class/class_login.php');
- // Set up current language
- $lang = "ro";
- $_SESSION[PRE.'lang'] = $lang;
- $access = 0;
- // Check if the cookie for "remember me" exists
- if(isset($cookie_name))
- {
- if(isset($_COOKIE[$cookie_name]))
- {
- parse_str($_COOKIE[$cookie_name]);
- $login = new Login($db);
- if ($login->_checkLogin($usr, $hash) == true)
- {
- $access = 1;
- }
- }
- }
- $msg_email_recover = "";
- $conn = pg_connect("host=dev.incorom.local port=5432 dbname=login_robinson user=robinson password=123");
- $rezervare= isset($_POST['pass_login']);
- $result = pg_query($conn, "SELECT checkin_status FROM tcheckin WHERE nr_rezervare = '$rezervare'");
- if (!$result) {
- echo "An error occurred.\n";
- exit;
- }
- $checkin_status = pg_fetch_row($result);
- // Daca s-a submis formul de login si avem codul de checkin, aici este problema
- if(isset($_POST['pass_login']) && trim($_POST['pass_login']) != '')
- {
- $login = new Login($db);
- if ($login->_checkLogin(trim($_POST['pass_login']), $_POST['pass_login']) && $checkin_status[0] == 0)
- {
- $access = 1;
- //Set cookie for "remember me"
- if(isset($_POST["remember_me"]) && $_POST["remember_me"] == 1)
- {
- $password_hash = $_POST['pass_login']; // will result in a 32 characters hash
- $nume_utilizator = $_SESSION[PRE . 'username'];
- $set_cook = setcookie ($cookie_name, 'usr='.$nume_utilizator.'&hash='.$password_hash, time() + $cookie_time);
- }
- }
- }
- // Daca s-a reusit logarea
- if(0 < $access)
- {
- // Redirectam in functie de rol, dupa ce adaugam si locatiile corespunzatoare in sesiune
- $rol = $_SESSION[PRE . "rol"];
- // ROL 1 AFL
- if(isset($_POST['login']) && $checkin_status[0] != 1)
- {
- header('Location:' . $BASE);
- exit();
- }
- }
- if (isset($_POST['login'])) {
- //update action
- if(isset($_POST['pass_login']) == 0 && $checkin_status[0] != 1){
- echo "login success";
- }
- else{
- $error = true;
- }
- }
- if (isset($_POST['register'])) {
- header("location:register.php");
- }
- ?>
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
- <head>
- <!-- <base href="http://dev.incorom.local/ticketing/www/login.php" /> -->
- <title>Login</title>
- <?php
- include('include/links.php');
- include('include/scripts.php');
- ?>
- </head>
- <body style="display: block !important;" ng-cloak="" ng-class="{ 'layout-fixed' : app.layout.isFixed, 'layout-boxed' : app.layout.isBoxed, 'layout-dock' : app.layout.isDocked, 'layout-material': app.layout.isMaterial, 'aside-offscreen' : app.sidebar.isOffscreen, 'aside-mini' : app.sidebar.isMini, 'aside-right' : app.sidebar.isRight, 'footer-hidden': app.footer.hidden, 'in-app': !$state.includes('page')}">
- <div class="animated fadeOutZoom">
- <div class="container container-sm animated fadeInDown">
- <div class="center-block mt-xl">
- <img src="images/logo_iconlab.png" alt="Image" class="center-block img-rounded">
- <div class="panel">
- <div class="panel-body">
- <p class="pv text-bold">Date de logare</p>
- <form class="mb-lg" method="post" action="login.php" id="form">
- <div class="row">
- <div class="col-md-12">
- <div class="form-group has-feedback">
- <input id="exampleInputPassword1" type="text" placeholder="Numar rezervare" class="form-control" name="pass_login" /><span class="fa fa-lock form-control-feedback text-muted"></span>
- </div>
- </div>
- <div class="col-md-12">
- <button type="submit" class="btn btn-block btn-info btnblue mb" name="login" value="login">Login</button>
- <button type="submit" class="btn btn-block btn-info btnblue mb login" name="register" value="register">Inregistrare</button>
- </div>
- </form>
- <?php if($error){ ?>
- <script> alert ("S-a produs o eroare la validarea formularului. Probabil utilizator nu exista in baza de date sau checkin-ul a fost efectuat deja.")</script>
- <?php } ?>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- </html>
- <?php
- ob_end_flush();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement