Erro Undefined index ao realizar login.
Notice: Undefined index: login in C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\phpteste1\login.php
on line 18
Notice: Undefined index: senhain C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\phpteste1\login.php
on line 19
form:
<form name="login" method="post" action="login.php">
<table id="login_table">
<tr>
<td>Email:</td>
<td><input type="text" name="login" id="id_login" class="txt" maxlength="25" /></td>
</tr>
<tr>
<td>Senha:</td>
<td><input type="password" name="senha" id="id_senha" class="txt" maxlength="20" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Entrar" class="btn" id="btnEntrar" name="btnEntrar">
<a href="pagina-do-cliente-cad.php"><input type="button" value="Cadastre-se" class="btn" id="btnCad" name="btnCad"></a></td>
</tr>
</table>
</form>
login.php:
<?php
class Sql{
public $host, $user, $pass, $query;
public function __construct(){
mysql_connect($this -> host = 'localhost', $this -> user = 'root', $this -> pass = '1234' );
mysql_select_db('cadastro');
}
public function query($qr){
$this -> query = mysql_query($qr);
return $this -> query;
}
public function retornar(){
return $this -> query;
}
}
$sql = new sql;
$login = $_POST['login'];
$pwd = $_POST['senha'];
$selecionar = $sql -> query("SELECT * FROM USUARIO WHERE LOGIN = '$login' AND SENHA = '$pwd'");
$c = mysql_num_rows($selecionar);
if($c){
echo "<meta http-equiv='refresh' content='0, url='pagina-do-cliente-interface.php'>";
echo 'logado';}else{
echo "<script>alert('Email ou senha incorretos.'); history.back();</script>";
echo 'deslogado';
}
?>Discussão (7)
Carregando comentários...