Made for another site, which closed. Code (Text): <?php mysql_connect("SERVER", "USERNAME", "PASSWORD"); mysql_select_db("DATABASE"); $username =mysql_real_escape_string( $_REQUEST['u']); $password = $_REQUEST['p']; $level = $_REQUEST['lv']; $repreq = "0"; $repreq = $_REQUEST['rep']; $postreq = "0"; $postreq = $_REQUEST['posts']; $result = mysql_query( "SELECT `salt` FROM `user` WHERE `username` = '{$username}'") OR die(mysql_error()); $row = mysql_fetch_array($result); $getsalt = $row['salt']; if($getsalt == ""){ $errcode = "1"; $error = "Invalid username"; } else{ $mkpass = md5(md5($password) . $getsalt); $result = mysql_query( "SELECT `password` FROM `user` WHERE `username` = '{$username}'") OR die(mysql_error()); $row = mysql_fetch_array($result); $chkpass = $row['password']; if($mkpass != $chkpass){ $errcode = "2"; $error = "Invalid password"; } else{ $sideranks = mysql_fetch_assoc(mysql_query("SELECT membergroupids FROM user WHERE username = '$username'")); $sideranks = $sideranks['membergroupids']; $userid = mysql_query("SELECT userid FROM user WHERE username = '$username'"); $mainrank = mysql_fetch_assoc(mysql_query("SELECT usergroupid FROM user WHERE username = '$username'")); $mainrank = $mainrank['usergroupid']; $result = mysql_query( "SELECT `posts` FROM `user` WHERE `username` = '{$username}'") OR die(mysql_error()); $row = mysql_fetch_array($result); $posts = $row['posts']; $result = mysql_query( "SELECT `reputation` FROM `user` WHERE `username` = '{$username}'") OR die(mysql_error()); $row = mysql_fetch_array($result); $rep = $row['reputation']; /* 12 = Moderators and Platinum 11 = Twilight and programmer 10 = level 10 9 = level 9 8 = level 8 7 = level 7 6 = level 6 5 = level 5 4 = level 4 3 = level 3 2 = level 2 1 = level 1*/ if (stristr($sideranks, "6,") OR stristr($sideranks, ",6") OR $sideranks == "6" OR $mainrank == "6") { $userlevel = 12; } elseif (stristr($sideranks, "7,") OR stristr($sideranks, ",7") OR $sideranks == "7" OR $mainrank == "7") { $userlevel = "12"; } elseif (stristr($sideranks, "5,") OR stristr($sideranks, ",5") OR $sideranks == "5" OR $mainrank == "5") { $userlevel = "12"; } elseif (stristr($sideranks, "20,") OR stristr($sideranks, ",20") OR $sideranks == "20" OR $mainrank == "20") { $userlevel = "12"; } elseif (stristr($sideranks, "16,") AND $level = "p" OR stristr($sideranks, ",16") AND $level = "p" OR $sideranks == "16" AND $level = "p" OR $mainrank == "16" AND $level = "p") { $userlevel = "p"; } elseif (stristr($sideranks, "19,") OR stristr($sideranks, ",19") OR $sideranks == "19" OR $mainrank == "19") { $userlevel = "12"; } elseif (stristr($sideranks, "14,") OR stristr($sideranks, ",14") OR $sideranks == "14" OR $mainrank == "14") { $userlevel = "11"; } elseif (stristr($sideranks, "29,") OR stristr($sideranks, ",29") OR $sideranks == "29" OR $mainrank == "29") { $userlevel = "11"; } elseif (stristr($sideranks, "34,") OR stristr($sideranks, ",34") OR $sideranks == "34" OR $mainrank == "34") { $userlevel = "11"; } elseif (stristr($sideranks, "28,") OR stristr($sideranks, ",28") OR $sideranks == "28" OR $mainrank == "28") { $userlevel = "10"; } elseif (stristr($sideranks, "27,") OR stristr($sideranks, ",27") OR $sideranks == "27" OR $mainrank == "27") { $userlevel = "9"; } elseif (stristr($sideranks, "26,") OR stristr($sideranks, ",26") OR $sideranks == "26" OR $mainrank == "26") { $userlevel = "8"; } elseif (stristr($sideranks, "25,") OR stristr($sideranks, ",25") OR $sideranks == "25" OR $mainrank == "25") { $userlevel = "7"; } elseif (stristr($sideranks, "24,") OR stristr($sideranks, ",24") OR $sideranks == "24" OR $mainrank == "24") { $userlevel = "6"; ; } elseif (stristr($sideranks, "23,") OR stristr($sideranks, ",23") OR $sideranks == "23" OR $mainrank == "23") { $userlevel = "5"; } elseif (stristr($sideranks, "22,") OR stristr($sideranks, ",22") OR $sideranks == "22" OR $mainrank == "22") { $userlevel = "4"; } elseif (stristr($sideranks, "21,") OR stristr($sideranks, ",21") OR $sideranks == "21" OR $mainrank == "21") { $userlevel = "3"; } elseif (stristr($sideranks, "12,") OR stristr($sideranks, ",12") OR $sideranks == "12" OR $mainrank == "12") { $userlevel = "2"; } elseif (stristr($sideranks, "11,") OR stristr($sideranks, ",11") OR $sideranks == "11" OR $mainrank == "11") { $userlevel = "1"; } else { $userlevel = "0"; } if($userlevel == "p"){ $errcode = "0"; $error = "Authorized"; } else{ if($level == "p"){ $errcode = "6"; $error = "Not Platinum member"; } else{ if($userlevel >= $level){ if($posts >= $postreq){ if($rep >= $repreq){ $errcode = "0"; $error = "Authorized"; } else{ $errcode = "5"; $error = "Not Enough Rep"; } } else{ $errcode = "4"; $error = "Not Enough Posts"; } } else{ $errcode = "3"; $error = "Level not high enough"; } } } } } echo('<errcode>' . $errcode . '</errcode>;<error>' . $error . '</error>'); ?>