Prit,
I'm trying to implement the ban author feature, and I found a bug in the administration page:
adminPageAuthors()
- in the foreach loop that generates the form for editing existing authors
- password fields use name and id = newpass'.$i.'1 and newpass'.$i.'2
adminAuthorsEdit()
- BUG: when submitting the form, validation will always indicate lenght error no matter if using > 5 chars
if ($_POST['newpass1'] != $_POST['newpass2']) {
echo $lang['errorNewPasswordsMatch']."";
$do = 0;
}
if (strlen($_POST['newpass1']) < 5) {
echo $lang['errorPassLength'].'';
- it seems to me that $_POST['newpass1'] and $_POST['newpass2'] never get the values from the form (ie. when editing the 3rd existing author, pass fields would be posted as newpass21 and newpass22
- I guess one solution is to add a hidden field with the "$i part" to get the correct field name/id. It also seems that validation could be removed in adminAuthorsEdit() as those fields are already validaded before submitting the form.
1. I added to adminPageAuthors():
echo '<input name="i" type="hidden" id="i" value="'.$i.'">';
2. modified adminAuthorsEdit() to use:
$i= $_POST['i'];
$newPass1='newpass'.$i.'1';
$newPass2='newpass'.$i.'2';
and finally replaced $_POST['newpass1'] with $_POST[$newpass1] (same for newpass2)