Nu stiu daca am voie sa postez aici, in fine.
Am o problema la un panel la login, in baza de date parolele sunt criptate dar in panel cand dai login iti spune ca parola e incorecta, din ce am inteles eu cu mintea mea de gaina e problema de la login.p.php unde codu nu citeste parolele criptate.
V-am lasat codul mai jos, mersi de ajutor.
<?php if(Config::isLogged()) { ?>
<?php
$_SESSION['HomeAlert'] = "<script>setTimeout(myFunction, 10);function myFunction() {swal('Succes','You are logged in!','error');}</script>";
$_SESSION['AlertTime'] = time();
?>
<script>window.location.href = '<?php echo Config::$URL ?>';</script>
<?php die(); } ?>
<?php if(isset($_POST['login'])) {
$username = Config::antiXSS($_POST['username']);
$password = Config::antiXSS(md5($_POST['password']));
$passwordno = Config::antiXSS($_POST['password']);
date_default_timezone_set('Europe/Bucharest');
$timex = time();
if(!$username || !$password) {
echo General::alertView("danger","Complete all fields (name / password).");
} else {
$kenny = Config::$g_con->prepare('SELECT * FROM `users` WHERE `name` = ? AND `password` = ?');
$kenny->execute(array($username,$passwordno));
if($kenny->rowCount()) {
$account = $kenny->fetch(PDO::FETCH_OBJ);
if ($checksuspend == 0) {
unset($_SESSION['pin_session']); // REMOVE SESSION PIN
$_SESSION['HomeAlert'] = "<script>setTimeout(myFunction, 10);function myFunction() {swal('Succes','You have successfully logged in.','error');}</script>";
$_SESSION['AlertTime'] = time();
echo "<script>window.location.href = '".Config::$URL ."profile/".$account->name."';</script>";
$_SESSION['login_session'] = $account->id; // ADD SESSION LOGIN
} else {
if ($suspend->Permanent == 0) {
if ($suspend->ExpireDate < date('Y-m-d H-i', $timex)) {
$_SESSION['HomeAlert'] = "<script>setTimeout(myFunction, 10);function myFunction() {swal('Error','Your suspend has expired, congrats!','error');}</script>";
$_SESSION['AlertTime'] = time();
echo "<script>window.location.href = '".Config::$URL ."profile/".$data->name."';</script>";
$_SESSION['login_session'] = $account->id; // ADD SESSION LOGIN
} else {
$_SESSION['HomeAlert'] = Config::alertView("danger","You are suspended by ".$suspend->AdminName." for ".$suspend->Days." days. Reason: ".$suspend->Reason.". Expire at: ".$suspend->ExpireDate."!");
$_SESSION['AlertTime'] = time();
echo "<script>window.location.href = '<?php echo Config::$URL ?>';</script>";
}
}
$_SESSION['HomeAlert'] = "<script>setTimeout(myFunction, 10);function myFunction() {swal('Error','You are suspended by'.$suspend->AdminName.' permanently. Reason: '.$suspend->Reason.The user or password is incorrect','error');}</script>";
$_SESSION['AlertTime'] = time();
echo "<script>window.location.href = '".Config::$URL ."profile/".$account->name."';</script>";
}
}
/* - - - */
/* - - - */
}
echo "<script>setTimeout(myFunction, 10);function myFunction() {swal('Error','The user or password is incorrect','error')};</script>";
}
?>
<div style="width: 60%; margin-left:24%;" class="row card has-shadow">
<div class="col-lg-12">
<div class="card-body">
<form method="POST">
<div class="form-group">
<label class="form-control-label">Username</label>
<input type="text" class="form-control" name="username" required>
</div>
<div class="form-group">
<label class="form-control-label">Password</label>
<input type="password" class="form-control" name="password" required>
</div>
<div class="form-group">
<input type="submit" value="Login" class="btn btn-primary btn-block" name="login">
<br>
<p style="text-align:center;">Forgot your password? Click <a href="<?php echo Config::$URL ?>recovery">here</a>.</p>
</div>
</form>
</div>
</div>
</div>