I downloaded a simple help desk system, but it is returning the following error after login:
Parse error: syntax error, unexpected '}' in C:\wamp\www\helpdesk\login.php on line 48
login.php
<?
include "config.php";
$date = date("d/m/y");
$hora = date("H:i");
@session_start();
if (!mysql_connect($Host, $Usuario, $Senha)) {
echo mysql_error();
exit();
}
mysql_select_db($Base);
$user = $HTTP_POST_VARS["username"];
$pwd = $HTTP_POST_VARS["senha"];
$sQuery = "select cod_usuario, nom_usuario, login, pwd_usuario, nivel
from usuarios
where login = '" . $user . "'";
$oUser = mysql_query($sQuery)
or die("Query invalida: " . mysql_error());
$row = mysql_fetch_object($oUser);
if ($num_rows = mysql_num_rows($oUser) == 1) {
if ($row->pwd_usuario == $pwd) {
if ($row->nivel == $Nivel) {
$_SESSION["log_usuario"] = $user;
$_SESSION["pwd_usuario"] = $pwd;
$_SESSION["nom_usuario"] = $row->nom_usuario;
$_SESSION["cod_usuario"] = $row->cod_usuario;
$sQuery1 = "insert into acesso (cod_user, nome_user, data, hora)
values ('" . $row->cod_usuario . "',
'" . $user . "',
'" . $date . "',
'" . $hora . "')";
mysql_query($sQuery1);
echo "<script>window.location='index_2.php'</script>";
} else {
?>
<script language="JavaScript">
<!--
alert("Nivel acesso incorreto!");
window.location = '"index.php';
//-->
</script>
<?php
} //linha do erro
} else {
?>
<script language="JavaScript">
<!--
alert("Senha incorreta!");
window.location = 'index.php';
//-->
</script>
<?php
}
} else {
?>
<script language="JavaScript">
<!--
alert("Usuário não encontrado!");
window.location = 'index.php';
//-->
</script>
<?php
}
?>