this biznitch works fine with one exception. when a user tries to register, it returns that he has been successfully registered, but it doesn't seem to insert the user's information. help!
PHP Code:
<?
function dbstart () {
mysql_connect("localhost", "xxxxxxx", "xxxxxxx");
mysql_select_db("xxxxxxx");
}
function dbquit () {
mysql_close();
}
if ($action=="register") {
if ($yim=="YIM") {
$yim="";
}
if ($aim=="AIM") {
$aim="";
}
if ($icq=="ICQ") {
$icq="";
}
if ($msn=="MSN") {
$msn="";
}
$email=addslashes($email);
$msn=addslashes($msn);
$aim=addslashes($aim);
$yim=addslashes($yim);
dbstart();
mysql_query("INSERT INTO shoutboxuser (userid, username, password, email, homepage, yim, aim, icq, msn) VALUES ('0', '$username', '$password', '$email', '$homepage', '$yim', '$icq', '$msn')");
$msg="You have been successfully registered. You may now post shouts.";
dbquit();
}
if ($action=="regform") {
$msg.="<form action=\"shoutbox.php?action=register\" method=\"post\"><table border=0 cellpadding=2 cellspacing=1>";
$msg.="<tr><td bgcolor=\"#000033\" align=center><font color=\"#FFFFFF\" face=\"verdana, arial, sans-serif, helvetica, times\" size=2><b>sign up</b></font></td></tr>";
$msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"username\" size=30 maxlength=20 value=\"username\"></td></tr>";
$msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"password\" size=30 maxlength=20 value=\"password\"></td></tr>";
$msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"email\" size=30 maxlength=150 value=\"your email\"></td></tr>";
$msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"yim\" size=15 maxlength=50 value=\"YIM\"><input onFocus=\"this.value=''\" type=text name=\"aim\" size=15 maxlength=50 value=\"AIM\"></td></tr>";
$msg.="<tr><td bgcolor=\"#0066FF\"><input onFocus=\"this.value=''\" type=text name=\"icq\" size=15 maxlength=50 value=\"ICQ\"><input onFocus=\"this.value=''\" type=text name=\"msn\" size=15 maxlength=50 value=\"MSN\"></td></tr>";
$msg.="<tr><td align=center><input type=submit onClick=\"this.value=' please wait... '\" value=\" sign up \"></td></tr></table></form>";
}
if ($action=="shout" && $username!="" && $password!="") {
dbstart();
$uinfo = mysql_fetch_array(mysql_query("SELECT userid FROM shoutboxuser WHERE username = '$username' AND password = '$password'"));
$uid = $uinfo[userid];
if ($uid=="") {
$msg="Error! Your username and password combination were not accepted.";
} else {
$dateline=time();
mysql_query("INSERT INTO shoutbox (id, uid, shout, dateline) VALUES ('0', '$uid', '$shout', '$dateline')");
$msg="";
}
dbquit();
}
?>
<html>
<head>
<title>shoutbox - get back in the frames ;)</title>
</head>
<body bgcolor="#0099FF" text="#000033" link="#000099" vlink="#000099">
<img src="/images/titles/shoutbox.gif" width="225" height="67">
<p>
<font face="verdana, arial, sans-serif, helvetica, times" size="2">
<?
if ($msg!="") {
echo "<center><font face=\"#0000FF\"><b>" . $msg . "</b></font></center><p>";
}
?>
<table border="0" cellpadding="2" cellspacing="1" width="100%">
<tr><td bgcolor="#000033"><font face="verdana, arial, sans-serif, helvetica, times" size="1" color="#FFFFFF"><b>user</b></font></td><td bgcolor="#000033"><font face="verdana, arial, sans-serif, helvetica, times" size="1" color="#FFFFFF"><b>shout</b></font></td></tr>
<?
dbstart();
$sq=mysql_query("SELECT shoutbox.*,shoutboxuser.* FROM shoutbox LEFT JOIN shoutboxuser ON (shoutbox.uid = shoutboxuser.userid) ORDER BY shoutbox.id DESC LIMIT 30");
while ($shout=mysql_fetch_array($sq)) {
?>
<tr><td bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="2"><? echo $shout[username]; ?></font></td><td bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="2"><? echo $shout[shout]; ?></font></td></tr>
<?
}
?>
</table>
<p>
<center><form action="shoutbox.php?action=shout" method="post">
<table border="0" cellpadding="2" cellspacing="1">
<tr><td colspan="2" bgcolor="#000033" align="center"><font face="verdana, arial, sans-serif, helvetica, times" size="2" color="#FFFFFF"><b>Leave a Shout</b></font></td></tr>
<tr><td bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="2">Username:</font></td><td bgcolor="#0066FF"><input type="text" name="username" size="30" maxlength="20"></td></tr>
<tr><td bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="2">Password:</font></td><td bgcolor="#0066FF"><input type="password" name="password" size="30" maxlength="20"></td></tr>
<tr><td colspan="2" align="center" bgcolor="#0066FF"><font face="verdana, arial, sans-serif, helvetica, times" size="1">Not registered? <a href="shoutbox.php?action=regform">Click here.</a></font></td></tr>
<tr><td bgcolor="#0066FF" valign="top"><font face="verdana, arial, sans-serif, helvetica, times" size="2">Shout:</font></td><td bgcolor="#0066FF"><textarea rows="5" cols="28" name="shout" WRAP></textarea></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value=" shout! "></td></tr>
</table></form></center>
<?
dbquit();
?>
</body>
</html>