Dean C
04-30-2003, 06:40 PM
I have this one user on my forums. Lets call him Bob. Now in his profile with the awards each award is listed 5 times. Now as far as i can tell from editing some people's profiles in the ACP it is only happening to this user. I just can't pick up on why this happening.
Now one thing i can confirm is that each award appears 5 times. Now if i click the one awards tick box once out of the five times it appears - when going back to the page all five tickboxes are clicked for that award. So it's definately a case of a faulty loop of some sort.
Here is the code from user.php to generate the list of awards. Can someone perhaps pinpoint any possible problems with a certain users name or if the email contains special characters or something like that...
// award/medals/card hack by lesane
maketableheader("Awards");
makeyesnocode("Enable awards for $user[username]?","hasaward",$user[award]);
$result = mysql_query("SELECT * FROM useraward where userid='$user[userid]'");
if ($row = mysql_fetch_array($result)) {
$toegang="yes";
} else {
$toegang="no";
}
if ($toegang=="yes") {
$result=$DB_site->query("SELECT awardsid,name,url,userid,aw FROM useraward where userid=$user[userid]");
while($award = mysql_fetch_array($result) ) {
$lesane="yes";
$id = $award[awardsid];
if($award[aw] == "$id" and $award[userid] == "$user[userid]") {
$lala=" checked";
$up="equal";
} else {
$lala="";
$up="not_equal";
}
echo "<tr class='".getrowbg()."'><td><input type='checkbox' name='aw[$id]' value='yes'";
echo "$lala>$award[name]</td><td nowrap>";
echo "<input type=\"hidden\" name=\"all[$id]\" value=\"$up\">";
echo "<img src=\"$award[url]\"> </td>";
}
echo "<input type=\"hidden\" name=\"lessie\" value=\"$lesane\">";
} elseif ($toegang=="no") {
$noawa=$DB_site->query("SELECT awardsid,name,url,aw FROM award");
while($useraward = mysql_fetch_array($noawa) ) {
$id = $useraward[awardsid];
$lesane="no";
echo "<tr class='".getrowbg()."'><td><input type='checkbox' name='uaw[$id]' value='yes'";
if ($uaw =='yes') {
echo " checked>$useraward[name]</td><td nowrap>";
$userup='equal';
} else {
echo ">$useraward[name]</td><td nowrap>";
$userup='not_equal';
}
echo "<input type=\"hidden\" name=\"uall[$id]\" value=\"$userup\">";
echo "<img src=\"$useraward[url]\"> </td>";
echo "<input type=\"hidden\" name=\"userhomes[$id]\" value=\"$useraward[name]\">";
echo "<input type=\"hidden\" name=\"userurls[$id]\" value=\"$useraward[url]\">";
}
echo "<input type=\"hidden\" name=\"lessie\" value=\"$lesane\">";
}
// end award/medals/card hack by lesane
Thanks in advance :)
- Dean
Now one thing i can confirm is that each award appears 5 times. Now if i click the one awards tick box once out of the five times it appears - when going back to the page all five tickboxes are clicked for that award. So it's definately a case of a faulty loop of some sort.
Here is the code from user.php to generate the list of awards. Can someone perhaps pinpoint any possible problems with a certain users name or if the email contains special characters or something like that...
// award/medals/card hack by lesane
maketableheader("Awards");
makeyesnocode("Enable awards for $user[username]?","hasaward",$user[award]);
$result = mysql_query("SELECT * FROM useraward where userid='$user[userid]'");
if ($row = mysql_fetch_array($result)) {
$toegang="yes";
} else {
$toegang="no";
}
if ($toegang=="yes") {
$result=$DB_site->query("SELECT awardsid,name,url,userid,aw FROM useraward where userid=$user[userid]");
while($award = mysql_fetch_array($result) ) {
$lesane="yes";
$id = $award[awardsid];
if($award[aw] == "$id" and $award[userid] == "$user[userid]") {
$lala=" checked";
$up="equal";
} else {
$lala="";
$up="not_equal";
}
echo "<tr class='".getrowbg()."'><td><input type='checkbox' name='aw[$id]' value='yes'";
echo "$lala>$award[name]</td><td nowrap>";
echo "<input type=\"hidden\" name=\"all[$id]\" value=\"$up\">";
echo "<img src=\"$award[url]\"> </td>";
}
echo "<input type=\"hidden\" name=\"lessie\" value=\"$lesane\">";
} elseif ($toegang=="no") {
$noawa=$DB_site->query("SELECT awardsid,name,url,aw FROM award");
while($useraward = mysql_fetch_array($noawa) ) {
$id = $useraward[awardsid];
$lesane="no";
echo "<tr class='".getrowbg()."'><td><input type='checkbox' name='uaw[$id]' value='yes'";
if ($uaw =='yes') {
echo " checked>$useraward[name]</td><td nowrap>";
$userup='equal';
} else {
echo ">$useraward[name]</td><td nowrap>";
$userup='not_equal';
}
echo "<input type=\"hidden\" name=\"uall[$id]\" value=\"$userup\">";
echo "<img src=\"$useraward[url]\"> </td>";
echo "<input type=\"hidden\" name=\"userhomes[$id]\" value=\"$useraward[name]\">";
echo "<input type=\"hidden\" name=\"userurls[$id]\" value=\"$useraward[url]\">";
}
echo "<input type=\"hidden\" name=\"lessie\" value=\"$lesane\">";
}
// end award/medals/card hack by lesane
Thanks in advance :)
- Dean