PHP Trouble
|
| Posted: 10/19/2005, 3:25 PM |
|
I know people might find this thread a copy of previous ones but.... I have researched CodeCharge Studio and MD5 hashing on the forum site and i tried all the results with no sucess.
I am trying to md5 hash the passwords stored in the database
I am using the PHP 4.0 with Templates and the "Tasks" template pages
On the page EmployeeMaint page (also adds to employeeMaint_events page) i added the following custom code for BeforeUpdate and Before insert:
$fldpassword=md5($fldpassword);
access the page and add a user yet the password is still stored in plain text, as you can imagine this is very fustrating. I have been searching the net for about 4 days.
Note: I havent added a verify to the login page to check the password against the md5 hash in the database, i was trying just to get it to store the md5 hashed password first. Any suggestions on adding md5 verifying to the login page is also welcome.
thankx in advance for any suggestions
Earl
|
|
|
 |
DonB
|
| Posted: 10/19/2005, 4:58 PM |
|
The code you entered won't update the field, it instead creates a variable.
User this concept in the Validate event:
$EmployeeMaint->fldpassword->SetValue(md5($EmployeeMaint->fldpassword->GetVa
lue()));
( I say 'concept' because I don't know the names of your page's objects)
--
DonB http://www.gotodon.com/ccbth
|
|
|
 |
Objects...
|
| Posted: 10/19/2005, 6:29 PM |
|
Refering to the pages objects...to my understanding its the field name ids "password" or "login_id"...
Thank you for the revised code...i am getting somewhere because now i have a break error i like that now atleast i get an error, shows me the script is trying to do something
Fatal error: Call to a member function on a non-object in /home/bhshelpd/public_html/workorders/tasks/EmployeeMaint_events.php on line 41
line 41 is where i added the script in "on Validate" like you suggested.
I tried EmployeeMaint, password, emp_password with no luck
a little more info
Database: Tasks
Table: Employees
Row: emp_password
on the php page there are the fields with ids (ids are after equals sign)
Name = full_name
Email = email
Login = login
Password = passowrd
Security Level = security_group_id
Thankx
Earl
|
|
|
 |
ziggetty (not logged on)
|
| Posted: 10/20/2005, 3:44 AM |
|
a pity that hashing password etc didn't make it high on the wishlist and did not became a standard option on the login function.
i presume many developers are adding this and modifying the common function!!
so another WISH for the next release
|
|
|
 |
ah ha
|
| Posted: 10/20/2005, 8:10 AM |
|
Quote ziggetty (not logged on):
a pity that hashing password etc didn't make it high on the wishlist and did not became a standard option on the login function.
i presume many developers are adding this and modifying the common function!!
so another WISH for the next release
Your quite right. I would make sense to have md5 or any such crypt integrated into the software!!!
However i did find a solution. after tearing apart the EmployeeMaint.php and EmployeeMaint_events.php i found a simpilar way to add md5 hashing to the password storage into the database. I think that it was much easier then adding Before Insert, Before Update, or On Validate custom events to the page. I believe that just muddied the waters so to speak. Now i am just having trouble getting the login page to hash the password to validate it.
so far i have:
//Validate Method @3-DC81CDE9
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->login->Validate() && $Validation);
$Validation = (md5($this->password->Validate() && $Validation));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
$Validation = $Validation && ($this->login->Errors->Count() == 0);
$Validation = $Validation && (md5($this->password->Errors->Count()) == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
This part of the script doesnt break the page, but doesnt work either...I was up till 1am getting the EmployeeMaint page to work. Hopefully with a little time this page will also work.
Any Suggestions are still welcome
Thankx
Earl
|
|
|
 |
|