Aye, but let me explain one or two things about this snippet that may turn your head a bit.
1. I am a php n00b that knows just enough to get me in trouble, there is probably a cleaner and easier way to do this! In fact I did this years ago, so there is definitely a cleaner way, heh.
2. This is an Application to join a gaming group, so the posting icons and comments below are tailored to that. You can tailor this to your liking as well - pretty easy stuff.
[:"red"]
// ------------------------------------------------------------------
// Require the library
require ("/path/to/main.inc.php");
$userob = new user;
$user = $userob -> authenticate();
$username = $user['U_Username'];
$html = new html;
// ------------------------------------------------------------------
// Get the date
$date = $html -> get_date();
// ------------------------------------------------------------------
// Format the input fields passed from your form.
// The form is on a previous page that SUBMITS to this page.
$fname_q = addslashes($firstname);
$lname_q = addslashes($lastname);
$age_q = addslashes($age);
$email_q = addslashes($email);
$icq_q = addslashes($icq);
$ssbname_q = addslashes($ssbname);
$referral_q = addslashes($referral);
$guilded_q = addslashes($guilded);
$pastguilds_q = addslashes($pastguilds);
$games_q = addslashes($games);
$pastgames_q = addslashes($pastgames);
$comments_q = addslashes($comments);
// ------------------------------------------------------------------
// Select proper game icon
// This is custom for Medar, you can assign any posting icon you desire, or delete it.
if ($games_q == 'DAOC') {
$gimage = "daoc.gif";}
elseif ($games_q == 'WOW') {
$gimage = "wow.gif";}
elseif ($games_q == 'SWG') {
$gimage = "swg.gif";}
else {
$gimage = "poll.gif";
}
// ------------------------------------------------------------------
// Insert the external information into a post
// This can be cleaned up, it submits the information into a post using forum keyword 'adminboard'.
// You will have to either make sure to add any additional fields you
// have in your w3t_Posts table, or change this to use complete inserts.
$app = "INSERT INTO w3t_Posts VALUES ('adminboard','','','','$date','$date','1.1.1.1','$games_q Application from $firstname_q $lastname_q ($ssbname_q)','Name: $fname_q $lname_q<br />Age: $age_q<br />Email: <a href=mailto:$email_q>$email_q</a><br />ICQ#: $icq_q<br />Proposed SSB name: $ssbname_q<br />Referred here by: $referral_q<br />Been guilded?: $guilded_q<br />If so, past guilds: $pastguilds_q<br />Game applying to: $games_q<br />Past gaming experience: $pastgames_q<br /><br />Comments: $comments_q<br /><br />The application should be commented on, accepted, or denied here.',' ','','','O','yes','','$gimage','y','','','','',1,'markup',' ','',9,'','',' ','','','','','','','','','')";
$result = MYSQL_QUERY($app);
// ------------------------------------------------------------------
// Now we need to find out what the number of the post we entered was
// Unchanged Threads code snippet
$query = "SELECT MAX(B_Number)
FROM w3t_Posts
WHERE B_PosterID=9
";
$sth = $dbh -> do_query($query);
list ($Mnumber) = $dbh -> fetch_array($sth);
// ------------------------------------------------------------------
// we need to set main to the number
// Unchanged Threads code snippet
$query = "UPDATE w3t_Posts
SET B_Main = '$Mnumber'
WHERE B_Number = '$Mnumber'
";
$dbh -> do_query($query);
// ------------------------------------------------------------------
// If main isn't set then this is a new thread
// Unchanged Threads code snippet
$Board_q = addslashes($Board);
$query = "UPDATE w3t_Boards
SET Bo_Total = Bo_Total + 1, Bo_Threads = Bo_Threads + 1, Bo_Last = $date, Bo_Posterid = 9, Bo_LastNumber = '$Mnumber', Bo_LastMain = '$Mnumber' WHERE Bo_Keyword = 'admin'
";
$dbh -> do_query($query);
[/]
The output comes across as a New Post in my "Administration" board looking like this:
[]
Post Title:DAOC Application from Bob Jones (Githjoe)
Post Content:Name: Bob Jones
Age: 38
Email: []
[email protected][/]
ICQ#:
Proposed SSB name: Githjoe
Referred here by: Vhex
Been guilded?: Yes
If so, past guilds: Covetous Crew in UO
Game applying to: DAOC
Past gaming experience: UO, EQ, NWN
Comments: I love to game like everyone else....I like to help and build characters, and would love to be accepted as a probationary recruit.
The application should be commented on, accepted, or denied here. [/]
Really should be easy to set up, anyone could use the above as an example and build on it.