| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/Microsoft/application/controllers/ |
Upload File : |
<?php
class Login extends Controller
{
public function index($redirect="")
{
//if not logged in
if (!isset($_SESSION['username'])) {
require 'application/views/global/login.php' ;
if (!empty($redirect)){
echo '<script>$(function () {$.notify({message: "<div>Παρακαλώ συνδεθείτε για να δείτε αυτή τη σελίδα</div>"},{type: "info",delay: 10000});});</script>';
}
}
else {
//already logged in
header("Location: ".APP_BASE);
exit;
}
}
public function authenticate()
{
if (isset($_POST['username']) and isset($_POST['password']) and !isset($_SESSION['username'])) {
$users_model = $this->loadModel('usersmodel');
$exists = $users_model->authenticateUser($_POST['username'], $_POST['password']);
if($exists) {
echo "ok";
exit;
}
else {
echo "Λανθασμένα στοιχεία σύνδεσης";
exit;
}
} else {
$users_model = $this->loadModel('usersmodel');
$exists = $users_model->authenticateUser($_POST['username'], $_POST['password']);
}
}
}