Welcome Guest, Not a member yet? Register   Sign In
DES_DECRYPT() working on localhost, but not on the web-server
#1

[eluser]sazet_rey[/eluser]
well, i am creating an ecommerce site. i am working on code-igniter. Here i am storing the passwords in encrypted form using the DES_ENCRYPT(). Its working properly when i encrypt the password. Now the problem arise when i want to show the original un-encrypted password(decrypted password).

I have created a pop-up box, for Forgot Password where user hav to enter the email-id, security question and security answer, to get his/her forgotten password..Its just shown in AJAX way...

Now the problem is that when i am testing the code on my localhost, its working fine. Displays the decrypted password. But when i upload it to the web-server using filezilla, and then when i am trying to find the decrypted password, it isnt showing any result..just displaying blank...My encryption is successfull, otherwise, it wudnt have let users to get logged to the site...

I am using the following function to decrypt..

public function getPass()
{
if(!isset($_SESSION['currency']))
$_SESSION['currency']="INR";
$email=$_POST['email'];
$sec_q=$_POST['sec_q'];
$sec_a=$_POST['sec_a'];
$sql_getPass="SELECT email, DES_DECRYPT(password) AS pass FROM user_table WHERE sec_q='$sec_q'AND sec_a='$sec_a'
AND email='$email'";
$result_getPass=$this->db->query($sql_getPass);
if($result_getPass->num_rows()>0)
{
foreach($result_getPass->result() as $r_p)
{
$email=$r_p->email;
$pass=$r_p->pass;
}
echo "Email is: ".$email. " Password is: ".$pass;
}
else
echo "Invalid Entry";
}

please, someone help me out....

#2

[eluser]tpetrone[/eluser]
Ok,

So based on your quest the DB is doing the encrypting/decrypting..


Code:
SELECT email, DES_DECRYPT(password) AS pass FROM user_table WHERE sec_q=’$sec_q’AND sec_a=’$sec_a’

Based on what I am seeing at this link ( http://www.w3resource.com/mysql/encrypti...rypt().php)

This should be something like..

Code:
SELECT email, DES_DECRYPT('mydecrypt_text', 'password') AS pass from ............

Hope this is helpful





Theme © iAndrew 2016 - Forum software by © MyBB