I just came up a day ago a website developed by my nomas. But it gives an error in the login.php script.
Error 500: Internal Server Error.
The server is working with php 7. But the truth is I do not know what it can be, At the local computer it was obviously perfect.
the page is www.ottracerveza.com
in index.php I have:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GESTION OTTRA</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="css/stylos.css"/>
<meta charset="utf-8" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.css" />
<link rel="stylesheet" href="css/stylos.css" />
<script src="includes/jquery-3.3.1.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
</head>
<body>
<?php session_start(); ?>
<script type="text/javascript" src="views/login.js"></script>
<?php
require_once("routes.php");
if ( isset($_SESSION['username']) && isset($_SESSION['userid']) ){
if (isset($_GET['controller'])&&isset($_GET['action'])) {
require_once("views/template.php");
$controller=$_GET['controller'];
$action=$_GET['action'];
if (isset($_GET['id'])){
$id=$_GET['id'];
call($controller,$action,$id);
}else{
call($controller,$action,0); }
}else{
}
}
else{
echo '<div class="contenedor">
<div class="cabecera">
</div>
<div class="cuerpo">
<div class="panel panel-primary" style="width:50%">
<div class="panel-heading">INGRESE AL SISTEMA</div>
<div class="row">
<div class="col-sm-4">
<label style="color: blue">Usuario:</label></div><div class="col-sm-4">
<input type="text" style="color:blue" name="login_username" id="login_username" /></div>
</div><div class="row"><div class="col-sm-4">
<label style="color: blue">Contraseña:</label></div><div class="col-sm-4">
<input type="password" name="login_userpass" id="login_userpass" style="color:blue" />
</div>
</div>
<div class="row"><div class="col-sm-4">
<span class="timer" id="timer"></span><button id="login_userbttn" class="btn btn-primary">Login</button></div>
</div> </div>
</div>
';
}
?>
</body>
</html>
And in process login:
<?php
session_start();
include_once ($_SERVER['DOCUMENT_ROOT'].''/models/claseLogin.php');
error_reporting(E_ALL);
ini_set('display_errors', '1');
$U1=new Login();
$usuario=$_POST['login_username'];
$pass=$_POST['login_userpass'];
$arrayu=$U1->User($usuario,$pass);
if (count($arrayu)>0){
foreach ($arrayu as $n){
$_SESSION['username']=$n['nombre'];
$_SESSION['userid']=$n['iduser'];
$_SESSION['rol']=$n['rol'];
$id=$U1->registroSesion($_SESSION['userid']);
foreach ($id as $i){
$idmax=$i['max'];
$_SESSION['idsesion']=$idmax;}
}echo 1;
}
else{
echo 0;}
?>
I actually use the $ _SERVER variable, I also use PDO.