so, what i want to do is change the forum so you have to login before you can post in the shout box, and all you have to do is enter the message
heres the code:
<?php $db_host = "localhost"; $db_user = "edited"; $db_password = "edited"; $db_name = "edited"; if($_POST['submit']) { if(!$_POST['author']) { echo 'Error ! : No name entered'; die; } if(!$_POST['email']) { echo 'Error ! : No email entered'; die; } if(!$_POST['message']) { echo 'Error ! : No message entered'; die; } $message = strip_tags($_POST['message'], ''); $email = strip_tags($_POST['email'], ''); $author = strip_tags($_POST['author'], ''); $message_length = strlen($message); $author_length = strlen($author); if($message_length > 200) { echo "Error ! : Your message was too long, messages must be less than 200 chars"; die; } if($author_length > 20) { echo "Error ! : Your name was too long, names must be less than 20 chars"; die; } mysql_connect($db_host,$db_user,$db_password) or die(mysql_error()); mysql_select_db($db_name) or die(mysql_error()); $date = date("D j h:i a"); $query = "INSERT INTO shoutbox (message, author, email, date, ip) VALUES ('$message','$author','$email','$date','$_SERVER[REMOTE_ADDR]')"; mysql_query($query); mysql_close(); echo "Thanks for your post<BR>"; echo "<A HREF=\"index.php\">Back Home</A> or <A HREF=\"shoutbox.php\">View Shoutbox</A>"; } else { mysql_connect($db_host,$db_user,$db_password) or die(mysql_error()); mysql_select_db($db_name) or die(mysql_error()); $query = "SELECT message, author, email, date, ip FROM shoutbox order by id DESC LIMIT 5"; $result = mysql_query($query); echo "<TABLE>"; while($r=mysql_fetch_array($result)) { // To modify the appearance, edit this : echo "<TR> <TD><font class=shoutbox> Posted $r[date] by <A HREF=\"mailto:$r[email]\"> $r[author]</A></font></TD> </TR> <TR> <TD><font class=shoutbox>$r[message]</font></TD> </TR> <TR> <TD><HR></TD> </TR>"; } echo "</TABLE>"; ?> <FORM METHOD=POST ACTION="shoutbox.php"> <TABLE> <TR> <TD>Username:</TD> <TD><INPUT TYPE="text" NAME="author"></TD> </TR> <TR> <TD>Email:</TD> <TD><INPUT TYPE="text" NAME="email"></TD> </TR> <TR> <TD>Message:</TD> <TD><INPUT TYPE="text" NAME="message"></TD> </TR> <TR> <TD> </TD> <TD><INPUT TYPE="submit" name="submit" value="submit"></TD> </TR> </TABLE> </FORM> <?php } ?>
i can change the form to just say "message" easily... its the php login integration i need help with
i want them to be able to login using my phpbb forum database (so they dont have to register twice), is there any possibility of being able to do this? (there should be, ive seen sites that've done it)
thanks for any help
p.s. i of course got the whole script from a tutorial and just edited the db connect part (works great, just want to restrict the access)