This topic is locked

Changes to php syntax with phprunner3.11/mysql5/php5

3/10/2007 5:55:41 AM
PHPRunner General questions
G
giles author

Hi,

I have an installed working system built with phprunner2, using mysql4 and php4, that has been working well for some time.
I am in the process of installing a new server and decided to upgrade to mysql5/php5 and start using phprunner3.11.
But...I am encountering some problems with php coded events with 3.11. For example:
I used the following code in a "before record update" event on an edit of a record in a "user" table to check if the user or Admin had changed a password. If changed it is supposed to MD5 encrypt the new value.
// If the password has changed then md5 encode it...

if (strcmp("'".$data["Password"]."'",$values["Password"])!=0)

{

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

}

The password field is Varchar, length 32.
This worked fine under phprunner2 but has stopped working with phprunner 3.11 and mysql5/php5. It seems to always update the password, even if it has not changed. And instead of MD5 encrpyting, it saves the value as "md5(whateverthepasswordwas)". For example if the password was "fred" then what is stored is literally "md5(fred)".
Hints on ho to get around this would be appreciated.
Giles

Alexey admin 3/12/2007

Giles,
yes, the $values array has been changed from version 3.0

It doesn't contain quotes now.

So your code should look like:

// If the password has changed then md5 encode it...

if (strcmp($data["Password"],$values["Password"])!=0)

{

$values["Password"]=md5($values["Password"]);

}

G
giles author 3/12/2007

Hi Alexey,

Yes, that worked perfectly. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=16166&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' /> Thank you for the quick response.
Also noticed one other issue...

I built the system originally with phprunner2. For the password I set the display format to password and the password field displayed with the characters as expected. It worked as expected when the system was borught up to 3.11.
However, I tried re-doing the format on that Password field in 3.11. It does not take any notice of the request to display as a password field (shows the real characters, not the
characters) even when the password checkbox is selected. And it does not save the selection (the checkbox is unchecked when I come back to that form).
The required field checkbox does work as expected so I know I'm changing the correct field and updating the server's php page.
Have a great day,
Giles

J
Jane 3/12/2007

Giles,
thank you for pointing me to this issue.

We'll fix it in the next PHPRunner update.
To select Password field just choose Password in the left menu on the "Edit as" settings dialog on the Visual Editor tab.