WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - השוואת מחירים בסופר
ZeroLag.com
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : This is a very simple BBS that uses MySQL
Categories : MySQL, Databases, Complete Programs, PHP Update Picture
Leon Atkinson
Date : Jan 17th 1999
Grade : 1 of 5 (graded 1 times)
Viewed : 10989
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Leon Atkinson
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<HTML>
<HEAD>
<TITLE>Leon's BBS</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?
/******************************************************
BBS v1.0
Code: PHP 3
Author: Leon Atkinson <[email protected]>

Simple BBS system using MySQL. Make the following
table:

CREATE TABLE bbsMessage
(
ID INT NOT NULL AUTO_INCREMENT,
Title VARCHAR(64),
Poster VARCHAR(64),
Created DATETIME,
Parent INT,
Body BLOB,
PRIMARY KEY(ID)
);

*******************************************************/

printf( "<H1>Leon's BBS</H1>\n");

/* set up database */
mysql_pconnect( "www.yoursever.com", "httpd");
$Database = "yourdb";

/****************************************************************
recursive function that spits out all descendent messages
****************************************************************/
function showMessages($parentID)
{
global $Database;

$dateToUse = Date( "U");

echo "<UL>\n";

/* show all the wings */
$Query = "SELECT * FROM bbsMessage ";
$Query = $Query . "WHERE Parent=$parentID ";
$Query = $Query . "ORDER BY Created ";

$result = mysql($Database,$Query);
$numRows = mysql_NumRows($result);
$RowCount = 0;
while($RowCount < $numRows)
{
$messageID = mysql_result($result,$RowCount, "ID");
$messageTitle = mysql_result($result,$RowCount,
"Title");
$messageCreated = mysql_result($result,$RowCount,
"Created");
$messageParent = mysql_result($result,$RowCount,
"Parent");

/* put a line telling what the wing is
*/
printf( "<LI>($messageCreated) <A HREF=
\"bbs.htma?messageID=$messageID\">$messageTitle</A><BR>\n");

/* call getWingContents to get this branch */
showMessages($messageID);

$RowCount++;
}

echo "</UL>\n";
}

/****************************************************************
print out a form for adding a message with parent id given
****************************************************************/
function postForm($parentID, $useTitle)
{
printf( "<FORM ACTION=\"bbs.htma\" METHOD=\"post\">\n");
printf( "<INPUT TYPE=\"hidden\" NAME=\"inputParent\" VALUE=
\"$parentID\">");
printf( "<INPUT TYPE=\"hidden\" NAME=\"ACTION\" VALUE=
\"POST\">");
printf( "<TABLE BORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=
\"5\" WIDTH=\"400\">\n");
printf( "<TR><TD WIDTH=\"100\"><B>Title</B></TD>");
printf( "<TD WIDTH=\"300\"><INPUT TYPE=\"text\" NAME=
\"inputTitle\" SIZE=\"35\" MAXLENGTH\"64\" VALUE=\"$useTitle\"></TD></TR>
\n");
printf( "<TR><TD WIDTH=\"100\"><B>Poster</B></TD>");
printf( "<TD WIDTH=\"300\"><INPUT TYPE=\"text\" NAME=
\"inputPoster\" SIZE=\"35\" MAXLENGTH\"64\"></TD></TR>\n");
printf( "<TR><TD COLSPAN=\"2\" WIDTH=\"400\">");
printf( "<TEXTAREA NAME=\"inputBody\" COLS=\"45\" ROWS=\"5
\"></TEXTAREA></TD></TR>\n");
printf( "<TR><TD COLSPAN=\"2\" WIDTH=\"400\"><CENTER><INPUT
TYPE=\"submit\" VALUE=\"Post\"></CENTER></TD></TR>\n");
printf( "</TABLE>\n");
printf( "</FORM>\n");

}

/******************************************************
perform actions
******************************************************/
if($ACTION != "")
{
if($ACTION == "POST")
{
$inputTitle = ereg_replace( "'", "''",
$inputTitle);
$inputBody = ereg_replace( "'", "''", $inputBody);

$Query = "INSERT INTO bbsMessage ";
$Query .= "VALUES(0, '$inputTitle', ";
$Query .= "'$inputPoster', ";
$Query .= "now(), $inputParent, ";
$Query .= "'$inputBody')";

$result = mysql($Database,$Query);


}

}


/******************************************************
Show Message or show list of messages
******************************************************/
if($messageID > 0)
{
$Query = "SELECT * FROM bbsMessage ";
$Query = $Query . "WHERE ID=$messageID ";

$result = mysql($Database,$Query);
$numRows = mysql_NumRows($result);
$RowCount = 0;
if($RowCount < $numRows)
{
$messageID = mysql_result($result,$RowCount, "ID");
$messageTitle = mysql_result($result,$RowCount,
"Title");
$messagePoster = mysql_result($result,$RowCount,
"Poster");
$messageCreated = mysql_result($result,$RowCount,
"Created");
$messageParent = mysql_result($result,$RowCount,
"Parent");
$messageBody = mysql_result($result,$RowCount,
"Body");

printf( "<TABLE BORDER=\"1\" CELLSPACING=\"0\"
CELLPADDING=\"5\" WIDTH=\"400\">\n");
printf( "<TR><TD WIDTH=\"100\"><B>Title</B></TD><TD
WIDTH=\"300\">$messageTitle</TD></TR>\n");
printf( "<TR><TD WIDTH=\"100\"><B>Poster</B></TD><TD
WIDTH=\"300\">$messagePoster</TD></TR>\n");
printf( "<TR><TD WIDTH=\"100\"><B>Posted</B></TD><TD
WIDTH=\"300\">$messageCreated</TD></TR>\n");
printf( "<TR><TD COLSPAN=\"2\" WIDTH=\"400\">
$messageBody</TD></TR>\n");
printf( "</TABLE>\n");

postForm($messageID, "RE: $messageTitle");

}


echo "<A HREF=\"bbs.htma\">List of Messages</A><BR>";

}
else
{
printf( "<H2>List of Messages</H2>\n");

/* call recursive function */
showMessages(0);

postForm(0, "");

}

?>

</BODY>
</HTML>



bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server.
Categories : Databases, MySQL, Complete Programs, PHP, Databases
Education Center is a set of PHP-scripts to administer a corporate education and examination system via Internet/intranet written in PHP for MySQL.
Categories : PHP, Databases, MySQL, Complete Programs
Browse a MySQL database & draw a tree view & load final items into a template page.
Categories : MySQL, Complete Programs, Algorithms, PHP, Databases
myCSV-dump converts a simple CSV-flatfile-database into an MySQL-dump.
Categories : PHP, MySQL, Databases, Complete Programs
Shopping Basket On-Line Ordering System.
Categories : Complete Programs, MySQL, PHP, Ecommerce, Databases
BBS system for easy customization. Utilizes mySQL.
Categories : Complete Programs, MySQL, PHP, Databases
Simple Mini Poll class library (SimPoll)
Categories : PHP, PHP Classes, Databases, MySQL, Complete Programs
Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs.
Categories : Databases, PHP, MySQL, Complete Programs
Point and Click Interface ala MS Access for creating SQL statements.
Categories : MySQL, Complete Programs, General SQL, PHP, Databases
Example voting script. Lets people enter suggestions and vote for existing ones.
Categories : MySQL, PHP, Cookies, Complete Programs, Databases
phpAds, a complete banner and ad management system with detailled tracking and stats.
Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases
free, search engine, indexing, system, information, web, ftp, http, free, software, cgi, php, MySQL, database, php3, FreeBSD, Linux, Unix, UdmSearch
Categories : MySQL, Complete Programs, PHP, Databases, Search
complete, simple, working example of a login screen/system using php functions, cookies, and a mysql database for begginers.
Categories : Authentication, Complete Programs, PHP, MySQL, Databases
phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL over the World Wide Web.
Categories : Databases, MySQL, Complete Programs, PHP