2
Hello, I’m new to PHP and am having the following error:
Call to Undefined Function Realizarlogin()
What can it be ?
Code to call the function:
if(isset($_POST["btn-logar"]))
{
include_once('../Controller/Login/Logar.php');
RealizarLogin();
}
Code of the Function:
class Logar{
var $usuario;
var $senha;
function RealizarLogin($usuario, $senha)
{
$this->$usuario = $_POST['usuario'];
$this->$senha = $_POST['senha'];
$login = $conn->prepare('SELECT count(1) as qtd FROM login WHERE usuario=:usuario AND senha=:senha');
$login->bindParam(':usuario',$usuario);
$login->bindParam(':senha',$senha);
$login->execute();
$retorno = $login->fetchAll();
if($retorno[0]['qtd'] > 0)
{
session_start();
$_SESSION['usuario'] = $usuario;
$_SESSION['senha'] = $senha;
print "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=../View/System/Home.php'>";
} else {
print "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=../View/Error/Error1.php'>";
}
}
Function does not exist or name has been typed wrong.
– rray
The name is correct, but I think I’m wrong when calling the function.
– João Victor
add the code to the question otherwise it is impossible to answer
– rray
Puts the file the function is also, this using linux?
– rray