PHP Classes

quick n dirty way to add a password fiel in crud class

Recommend this page to a friend!

      CRUD Class  >  All threads  >  quick n dirty way to add a password...  >  (Un) Subscribe thread alerts  
Subject:quick n dirty way to add a password...
Summary:change to be done in order to handle passwd field
Messages:1
Author:Yohann Rebattu
Date:2008-10-30 16:53:34
 

  1. quick n dirty way to add a password...   Reply   Report abuse  
Picture of Yohann Rebattu Yohann Rebattu - 2008-10-30 16:53:34
in crud.php:

add a define for PASSWORD
define (PASSWORD, "passwdwsdlksjfpsodfkskjdc");

add the fallowing at line 188 to crypt pwd before we pass it to database:

foreach ($_POST as $k => $v) {
if ($this->tableDefinition[$k][PASSWORD] === true) {
if ($v == "") {
//nothing to do
}
else {
//changing password
$_POST['USE_PWD'] = md5($_POST['USE_PWD']);
}
}
}

at line 387 to have a password field instead of a text field:

else if ( isset($actInfo[PASSWORD]) && $actInfo[PASSWORD] ){
$form["TYPE"] = "password";


then we just have to use the PASSWORD as a marker for a field as we did for
SHOWCOLUMN or UPDATE_READ_ONLY: PASSWORD => true;
hop you liked it,

it would maybe be nicer with a double check as in most of webstes when you need to change password.

thanks and good luck.