In short, instead of typing '!setuser <hostmask> <level>', I'd like to be able to type '!setuser <nick> <level>', and have to bot grab the hostmask to insert it into the database. As a show of good faith, and per the rules here at DIC, I've included some source for adding the hostmask to the DB.
function set_user($host, $level) {
$con = mysql_connect("<removed>", "<removed>", "<removed>");
mysql_select_db("<removed>", $con);
$result = mysql_query("SELECT * FROM users");
while($row = mysql_fetch_array($result)) {
if($row['hostmask'] == $host) {
mysql_query("UPDATE users SET level = '$level' WHERE hostmask = '$host'");
$match = true;
}
}
if($match == false) {
mysql_query("INSERT INTO users (hostmask, level) VALUES ('$host', '$level')");
}
mysql_close($con);
return;
}
Thanks in advance for any help on this.

New Topic/Question
Reply



MultiQuote





|