Comunitatea PHP Romania
MightyDeals

Prima pagină PHP General PHP Incepători AES Login problem

AES Login problem

Secţiune dedicată începatorilor.

Mesaj Sâm Iul 21, 2012 7:38 am
otsaki PHPRomania Supporter

Mesaje: 15
De ce nu imi merge loginul la password nu merge, nu fac ceva bine...? nu decryptez, nush?? ce gresesc cu aes'u asta:|:|?

<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Joshua
 * Date: 7/20/12
 * Time: 3:36 PM
 * To change this template use File | Settings | File Templates.
 */
session_start();
session_regenerate_id(TRUE);
include ('core/config.php');
include ('core/wCrypt_AES.php');

    if(isset($_POST['login']))
{
    $username = substr($_POST['username'], 0, 15);
    $aes = new wCrypt_AES;
    $key = "12345";
    $password = trim(strip_tags($_POST['password']));
    $blowfish = $aes->AESDecrypt($password,$key,256);


    $sql = "SELECT * FROM members where username=:username AND password=:password ";
    $stmt = $dbconnect->prepare($sql);
    $stmt->execute(array(':username' => $username, ':password' => $blowfish));
    if($stmt->rowCount() == 1)
    {
        $_SESSION['on'] = $username;
        header('location:index.php');
    }
    else
    {
        echo "Error message here...";
    }
}
?>

<html>
<head>
    <title>MLM - Login</title>
</head>
<body>
<form action="" method="post">
    <input type="text" name="username">
    <input type="password" name="password">
    <input type="submit" name="login" value="Login">
</form>
</body>
</html>

Mesaj Sâm Iul 21, 2012 10:21 am
Birkoff Avatar utilizator
Senior Member

Mesaje: 5885
Localitate: Bucuresti

ti-am mai zis de 3 ori de ce vrei sa decriptezi un sir decriptat deja?

$password = trim(strip_tags($_POST['password']));
$blowfish = $aes->AESDecrypt($password,$key,256);

daca in post password iti vine parola de forma "aaa" tu vrei sa decriptezi aaa-ul?

Mesaj Sâm Iul 21, 2012 10:24 am
otsaki PHPRomania Supporter

Mesaje: 15
Nu aia e problema... stiu era o solutie sa fac Encrypt la AAAA care imi vine si sa o compar cu parola encryptata din baza de date, problema e ca AES face tot timpul alta parola :p cand o encrypteaza.. :| asa ca nu merge solutia asta si am rezolvat-o cu


    if($stmt->rowCount() == 1)
    {
        $aes = new wCrypt_AES;
        $key = "12345";
        $decrypt = $aes->AESDecrypt($row['password'],$key,256);

        if($decrypt == $password)
        {
            $_SESSION['on'] = $username;
            header('location:index.php');
        }



ai avut dreptate :D nu exista alta solutie doar cu... :( comparat row :( nasol :D din cauza ca face tot timpu alt encrypt[/code]

Mesaj Dum Apr 14, 2013 12:55 am
Google Bot New Member

Mesaje: 1

Înapoi la PHP Incepători

Copyright © 2001-2013 PHP Romania Gazduire web | Haine online | Gazduire web | Campanii SMS | Gazduire Claus Web | Inregistrare Domenii | Anunturi | Jocuri cu bile
Furnizat de phpBB® Forum Software © phpBB Group
Translation/Traducere: phpBB România
Powered by Simplis