Rúben Periquito Developer Posted May 21, 2020 at 12:57 AM Report Share #618179 Posted May 21, 2020 at 12:57 AM (edited) onde está o erro neste login.php? <?php error_reporting(1); include("connection.php"); //grab values email and password from login form $login_email = $_POST('login_email'); $login_password = $_POST('login_password'); //create the query and number of rows returned from the query $query = mysqli_query($dbc, "SELECT * FROM users WHERE email='".$login_email."'"); $numrows = mysqli_num_rows($query); if ($_SERVER['REQUEST_METHOD'] == 'POST') { //created condition to check if there is 1 row with that email if ($numrows != 0) { //grab the email and password from that row returned before while ($row = mysqli_fetch_array($query)) { $dbemail = $row['email']; $dbpass = $row['password']; } //create condition to check if email and password are equal to the returned row if ($login_email==$dbemail) { if ($login_password==$dbpass) { echo "You are in"; }else{ echo "Your password is incorrect"; } }else{ echo "Your email is incorrect!"; } }else{ echo "You are not registered. Please register bellow..."; } }else{ echo "Please Login..."; } ?> <html lang="en"> <head> <title></title> </head> <body> <form method="post" action="login1.php"> <p>Email<input type="text" name="login_email"></p> <p>Password<input type="password" name="login_password"></p> <p><input type="submit" name="Login"></p> </form> </body> </html> Edited May 21, 2020 at 06:32 PM by Rúben Periquito Developer Rúben Periquito Link to comment Share on other sites More sharing options...
XsTeAl Posted May 22, 2020 at 11:14 AM Report Share #618194 Posted May 22, 2020 at 11:14 AM Que tipo de erros estás à procura? Sintax? Semântica? Qualquer IDE pode-te ajuda a detectar erros se souberes que erros andas à procura... Link to comment Share on other sites More sharing options...
Rúben Periquito Developer Posted May 22, 2020 at 11:55 AM Author Report Share #618197 Posted May 22, 2020 at 11:55 AM 40 minutos atrás, XsTeAl disse: Que tipo de erros estás à procura? Sintax? Semântica? Qualquer IDE pode-te ajuda a detectar erros se souberes que erros andas à procura... deve ser Sintax, sei que o comportamento do site não é o que eu queria Rúben Periquito Link to comment Share on other sites More sharing options...
XsTeAl Posted May 27, 2020 at 01:11 PM Report Share #618232 Posted May 27, 2020 at 01:11 PM Primeiro, o teu form está a fazer submir para o ficheiro login1.php (não sei o que lá está, mas se calhar era para o login.php). Segundo, após validação de username/email e password, convem guardar em sessão/cookie que estás com login efectuado... Depois é validar se tens sessão/cookie, se tiveres mostras o que queres mostrar com login feito, se não mostra o nomal se login. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now