1
I downloaded a simple help desk system, but this returning me 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
}
?>
Do not use this system, it is not good, play it out, it uses features removed from php. If you can highlight which line of error helps a lot.
– rray
Yeah, I tried a bunch of amendments, and I actually thought the problem was he was really old.
– Lucas L
This code is totally obsolete.
– rray
What is line 48?
– rray
@session_start();
how sad to see that :(– user28595
It doesn’t solve, I’ve seen and reviewed these keys.
– Lucas L
The problem is the 42 where you open a
<!--
and on line 45 is commented the closing//-->
– Jorge B.
Same case
– rray
@Jorgeb. the problem is the same or is the answer below?
– Math
@Math is one of the problems. But in this case it is not the cause of the error.
– Jorge B.