// include helper $smarty->assign('CSS_URL', CSS_URL); $smarty->display('header.tpl'); //including header if (isset($_POST['submit'])) { if ($valid1->IsValidateemail($_POST['email']) && $_POST['username'] != NULL && $_POST['password'] != NULL && $_POST['contact'] != NULL && $_POST['req'] != NULL) { //if valid and complete $login = new login(); $login->add($_POST['username'], $_POST['password'], 2); //adding data to login table $users = new users(); $users->add($_POST['username'], $_POST['name'], $_POST['contact'], $_POST['req']); //addding data to users table session_start(); //starting and setting session $_SESSION['userid'] = $login->getId($_POST['username']); $_SESSION['username'] = $_POST['username']; $_SESSION['type'] = 2; $date = date("d-m-y h:i:sa"); $_SESSION['last_login'] = strtotime($date); $login->update('last_login', $_SESSION['last_login'], $_SESSION['userid']); header('Location:' . URL . 'userhp.php'); //relocating to users homepage } else { echo "FILL COMPLETE INFO PLEASE"; } } $smarty->display('signup.tpl'); //including signup page $smarty->display('footer.tpl'); //including footers
//include filehead file if (isset($_SESSION['userid'])) { if ($_SESSION['type'] == 0) { require_once 'helper/Validation.php'; //email validation $smarty->assign('CSS_URL', CSS_URL); $smarty->display('header.tpl'); $smarty->assign('username', $_SESSION['username']); $smarty->display('userheader.tpl'); if (isset($_POST['submit'])) { $valid = new validation(); if ($valid->IsValidateemail($_POST['email']) && $_POST['username'] != NULL && $_POST['password'] != NULL && $_POST['contact'] != NULL && $_POST['address'] != NULL && $_POST['name'] != NULL && $_POST['department'] != NULL && $_POST['salary'] != NULL) { $login = new login(); $login->add($_POST['username'], $_POST['password'], 1); //adding record to login table $userid = $login->getId($_POST['username']); $staff = new staff(); $staff->add($userid, $_POST['email'], $_POST['username'], $_POST['contact'], $_POST['address'], $_POST['name'], $_POST['department'], $_POST['salary']); //adding record to staff table } else { echo "COMPLETE INFORMATION NECCESSARY"; } } $smarty->display('newstaff.tpl'); //including newstaff template $smarty->display('footer.tpl'); //include footer file } else { header('Location:' . URL . 'notauthorised.php'); } } else {
<?php session_start(); $clave = $_POST["clave"]; $password = $_POST["password"]; if (!empty($password) && !empty($clave)) { require_once "../classes/login.php"; $login = new login(); $result = $login->logging($clave, $password); if ($login->getValido() == "1") { $_SESSION['valido'] = $login->getValido(); $_SESSION['nombre'] = $login->getNombre(); $_SESSION['id'] = $login->getId(); } echo $result; } else { echo "{\"result\":\"-1\"}"; } ?>