This topic is locked

Encrpting passwords

8/15/2006 9:32:26 AM
PHPRunner General questions
A
amirgulamali author

Hi,
I dont have a Register page for my users since i am controlling the number of users. I have a table _users where I add usernames and passwords for my users.
Now the database table _users shows the username and passwords to all users of the database from MYSQL...
Is there anyway I could encrypt the passwords when adding users manually? (without the register page?)

A
amirgulamali author 8/15/2006

i know i have to use the MD5 SQL funtion but where and what line should be modified? Also, would the same password be retrived when a user "reminds" himself of a forgotten password...
thnx

A
amirgulamali author 8/15/2006

nevermind,after playing around with before add events... i figured it out <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=10412&image=1&table=forumreplies' class='bbc_emoticon' alt='B)' /> <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=10412&image=2&table=forumreplies' class='bbc_emoticon' alt='B)' /> <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=10412&image=3&table=forumreplies' class='bbc_emoticon' alt='B)' />

A
amirgulamali author 8/15/2006

I take that back <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=10413&image=1&table=forumreplies' class='bbc_emoticon' alt=':huh:' />
I tried using:

<?php

function BeforeAdd(&$values)

{
// Parameters:

// $values - Array object.

// Each field on the Add form represented as 'Field name'-'Field value' pair
//********** Custom code ************

$values["password"] = "md5(".$values["password"].")";

return true;
// return true if you like to proceed with adding new record

// return false in other case
}
function BeforeEdit(&$values, $where)

{
// Parameters:

// $values - Array object.

// Each field on the Edit form represented as 'Field name'-'Field value' pair

// $where - string with WHERE clause pointing to record to be edited
//********** Custom code ************

$values["password"] = "md5(".$values["password"].")";

return true;
// return true if you like to proceed with editing this record

// return false in other case
}
?>


IT sure does encrypt passwords but since the Original (before encyption) password doesnt match with the one stored in my db, login fails... any thoughts???

Alexey admin 8/16/2006

Amir,
to use encrypted passwords you need to check off "Encrypt passwords" box in User login settings dialog on Security tab in PHPRunner.