MyBB Community Forums

Full Version: regnick on irc
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey

im working on script that enables the opportunity so

when i user signup at a mybb

and then will join the irc chat as well they need to !regnick
så the bot gives a person a random md5 key thay need to submit on a page and then adds the uid to the sql i have made...

but the problem is i don't know mybb source that well to add that to my code so i thought maybe one of you guys inhere could help...

Just so you all understand Toungue

1.
Signup at mybb forum

2.
Join IRC chat

3.
!regnick (the chan is +m (moderated)
- The bot gives a random md5 key

4.
you logon to the site the bot tells you to. and put in the key the bot gave you

5.
next time you join irc (when i get it working) the bot should give auto +v before they can talk...

maybe some of the below code is not right but please change it to help me Smile

$res = mysql_query("SELECT * FROM nicks WHERE id = $id");
//$row = mysql_fetch_row($res);
?>
<h2>IRC-Register - Tilknyt et nyt ircnick til din bruger</h2>
<?
function sqlesc($x) {
    return "'".mysql_real_escape_string($x)."'";
}

function sqlerr($file = '', $line = '')
{
  print("<table border=0 bgcolor=blue align=left cellspacing=0 cellpadding=10 style='background: blue'>" .
    "<tr><td class=embedded><font color=white><h1>SQL Error</h1>\n" .
  "<b>" . htmlspecialchars(mysql_error()) . ($file != '' && $line != '' ? "<p>in $file, line $line</p>" : "") . "</b></font></td></tr></table>");
  die;
}

if ($res) {
print("Du har følgende nicks tilknyttet din konto:");
if ($row = mysql_fetch_array($res)) {
do {
$nick = $row['nick'];
print($nick.', ');
} while($row = mysql_fetch_array($res));
}
}
print("IRC-Register - Tilknyt et nyt ircnick til din bruger");
if ($_GET["act"] == "add") {
$regkode = sqlesc($_POST['regkode']);

//Check om koden eksisterer
$res = mysql_query("SELECT id,regkode FROM nicks WHERE regkode = '$regkode'") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_assoc($res);
if (!$row) {
print('Registreringskoden du har indtastet eksisterer ikke!<br>Du skal skrive !regnick inde på vores irc-kanal for at få regkoden.');
exit;
}
mysql_query("UPDATE nicks SET id = $id WHERE regkode = '$regkode'") or sqlerr(__FILE__, __LINE__);
$res = mysql_query("SELECT nick FROM nicks WHERE regkode = '$regkode'");
$row = mysql_fetch_assoc($res);
$nick = $row['nick'];
if ($error == 'yes'){
print('<div allign=center>Der skete en uventet fejl!</div>');
} else {
print('<div allign=center>Du har nu tilknyttet nicket '.$nick.' til din konto!</div>');
}
print('<meta http-equiv="refresh" content="3;URL=/irc.php" />');
} else {
print('<div allign=center><form method="post" action="irc.php?act=add">Indtast den kode du fik af botten: <input type="text" size=40 name="regkode" /><input type="submit" value="OK" style="height: 25px"></form></div>');
}