Erreur connexion (rowCount je pense)
- Accueil
- Forum
- Programmation
- PHP
- Erreur connexion (rowCount je pense)
Tom0808 Le 16 octobre 2021 à 01:37 (Édité le 1 janvier 1970 à 01:00)
Bonjour j'ai un problème ma variable userexist != à 1 alors que les infos sont bonnes voici mon code : `<?php
session_start();
if (isset($_POST['formlogin'])) {
extract($_POST);
if (!empty($_POST['lemail']) && !empty($_POST['lpassword']))
{
$requser = $db->prepare("SELECT * FROM user WHERE email = ? AND password = ?");
$requser->execute(array($lemail, $lpassword));
$userexist = $requser->rowCount();
if ($userexist > 0) {
$userinfo = $requser->fetch();
$_SESSION['id'] = $userinfo['id'];
$_SESSION['pseudo'] = $userinfo['pseudo'];
$_SESSION['mail'] = $userinfo['mail'];
header('location:https://techonline.ovh/oxygen');
}else{
echo $userexist;
}
} }
?>
Le code de mon index :
<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link href="https://fonts.googleapis.com/css?family=Poppins:600&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/a81368914c.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<?php include 'includesbase/database.php';
global $db;
?>
<img class="wave" src="img/wave.png">
<div class="container">
<div class="img">
<img src="img/bg.svg">
</div>
<div class="login-content">
<form class="box" method="post">
<img src="img/avatar.svg">
<h2 class="title">Welcome</h2>
<div class="input-div one">
<div class="i">
<i class="fas fa-user"></i>
</div>
<div class="div">
<h5>Email</h5>
<input type="email" name="lemail" id="lemail" class="input">
</div>
</div>
<div class="input-div pass">
<div class="i">
<i class="fas fa-lock"></i>
</div>
<div class="div">
<h5>Password</h5>
<input type="password" class="input" name="lpassword" id="lpassword">
</div>
</div>
<a href="#">Forgot Password?</a>
<input type="submit" name="formlogin" id="formlogin" class="btn" value="Login">
</form>
<?php include 'includesbase/loginrac.php';
?>
</div>
</div>
<script type="text/javascript" src="js/main.js"></script>
</body> </html>
` Merci de me répondre, merci