2.3.x version
What this script is supposed to do is allow a member of the view only usergroup the right to post on the forums after this script is run. When a user registers they are placed in a view only usergroup (9.)
Once a user decides they want to post, they click on a link that runs this script.
This script was written to check that users ipaddress against those in the registered usergroup, post. ipaddress and the banned usergroup.(The banned usergroup(8) check isnt in place as I'm not sure how to add that to this query)
This script doesnt cause any mqsql errors, but also doesnt work. Anyone know what I'm doing wrong?
PHP Code:
require("./global.php");
global $DB_site,$session,$ipaddress;
print "Checking for Posting Permissions<br>";
$userid = $bbuserinfo['userid'];
print "$userid<br>";
print "$ipaddress<br>";
$tmpipcheck=$ipaddress
$result=$DB_site->query("SELECT user.*,post.* FROM user LEFT JOIN post on user.id = post.userid WHERE usergroupid=2 AND ipaddress='$tmpipcheck'");
if ($myrows=mysql_fetch_row($result));{
}WHILE ($myrows=mysql_fetch_row($result));{
eval("standarderror(\"".gettemplate("error_sorrynoposting")."\");");
exit;
}Else{
If ($bbuserinfo['usergroupid']==9){
$DB_site->query("UPDATE user SET usergroupid=2 WHERE userid='$userid'");
eval("standarderror(\"".gettemplate("error_youcanpostnow")."\");");
}else{
eval("standarderror(\"".gettemplate("error_alreadyregistered")."\");");
exit;
}
}
}
mods, if this thread is in the wrong place, please move it, just let me know where