93 lines
No EOL
2.6 KiB
PHP
93 lines
No EOL
2.6 KiB
PHP
<?php namespace ProcessWire;
|
|
|
|
if($input->post->user && $input->post->pass)
|
|
{
|
|
$user = $sanitizer->username($input->post->user);
|
|
$pass = $input->post->pass;
|
|
|
|
if($session->login($user, $pass))
|
|
{
|
|
$session->redirect($page->parent->httpUrl);
|
|
}
|
|
}
|
|
|
|
$url1 = $sanitizer->name($input->urlSegment1);
|
|
$resEmpresa = null;
|
|
$q = "template=empresa, name={$url1}, limit=1";
|
|
|
|
if($url1)
|
|
{
|
|
if($pages->count($q))
|
|
{
|
|
$resEmpresa = $pages->find($q)->first();
|
|
setcookie("w_empresa", $resEmpresa->name , time()+4000000, "/gestion/");
|
|
}
|
|
else
|
|
{
|
|
$session->redirect($page->parent->httpUrl);
|
|
setcookie("w_empresa", "", time()-3600);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
setcookie("w_empresa", "", time()-3600);
|
|
unset($_COOKIE['w_empresa']);
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Document</title>
|
|
</head>
|
|
<body class="login">
|
|
<div>
|
|
<a class="hiddenanchor" id="signup"></a>
|
|
<a class="hiddenanchor" id="signin"></a>
|
|
|
|
<div class="login_wrapper">
|
|
<div class="animate form login_form">
|
|
<section class="login_content">
|
|
<form action="/es/gestion/acceder/" method='post' >
|
|
|
|
<?php if ($url1 || $resEmpresa): ?>
|
|
<img src="<?php echo $resEmpresa->imagen->first()->url; ?>" class="img-responsive"><br>
|
|
<?php else: ?>
|
|
<h1>Disnav Gestión</h1>
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if($input->post->user) echo "<h2 class='error '>Usuario o contraseña incorrecta</h2>"; ?>
|
|
<div>
|
|
<input type="text" name="user" class="form-control" placeholder="Usuario">
|
|
</div>
|
|
<div>
|
|
<input type="password" name="pass" class="form-control login-password" placeholder="Contraseña">
|
|
</div>
|
|
<div>
|
|
<!-- <a class="btn btn-default submit" href="index.html">Entrar</a> -->
|
|
<input type='submit' name='submit' value='Entrar' class="btn btn-default btn-block btn-validation" />
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
<div class="separator">
|
|
|
|
|
|
<div class="clearfix"></div>
|
|
<br />
|
|
|
|
<div>
|
|
|
|
<p>©2016 All Rights Reserved. Developed by <a href="http://www.procgal.es" target="_blank">Procgal</a></p>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|