• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Simple PHP question, i know you guys can help!

WarDemon666

Platinum Member
Ok heres part of the script, not the full thing:

for($i=0; $i<count($file_array); $i++) {
$found = count(explode($user_str, $file_array[$i]))-1; //$user_str is the Username

if ($found > 0) {
$i++;
$user_fail = 0;
$temp = count(explode($oldpassword, $file_array[$i]))-1; //$oldpassword is the old password
if ($temp > 0) {
$file_array[$i] = str_replace($oldpassword,$newpassword,$file_array[$i]); //$newpassword is the new password
$success = 1;
}
}
$temp = 0;
$found = 0;
}


This is a change password script, but theres a problem with it, it does not search the old password entirely (Ex. "Username:test Old pass: t New pass: testing" would change the password, i want it to search the whole password, so that t does not change the password, unless the full "test" was entered) In other words, if i type only the first character of the old password, it will continue the script and change the password. Not too good! Someone told me i should use "preg_match_all()" function to get it going, i cant seem to understand the function fully, if someone could help me, i would really apprechiate it!

Thanks a lot!
 
Up

Really need some help guys, what would i do for it to search the whole old password instead of only the first letter?

Thanks!
 
Yes i have, i dont know how to insert that in my code so it actually searches the whole phrase instead of just the first character, someone must know how to do this!

Thanks
 
Back
Top