Jump to content

Archived

This topic is now archived and is closed to further replies.

schme16

can anyone add bbcode (or bbtag whichever you prefer to call it) to this code?

Recommended Posts

hi all, this is my first or second post here, and i was wondering if anyone out there in teh interwebs was willing to add to a peice of code for me, its a posting system for me to add new update posts to my hompage....but i want to be able to use bb code in it as well as html...no luck so far...


heres the code...entirely except of bbcode implementation (thought it'd be easier for you guys to start fro scratch ^_^.

[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<link href="css/editpage.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style6 {
font-size: 24px;
font-weight: bold;
}
-->
</style>
</head>

<body>

<p>
  <?php
ob_start();
// allows you to use cookies
include("configs/config.php");
include("time.php");
$userlvl = $logged[userlevel];

if (($userlvl)==(2))
{

//gets the config page
if ($_POST[post]) {
// the above line checks to see if the html form has been submitted
$username = $logged[username];
$message = $_POST[message];


$realname = $logged[realname];
$email = $logged[email];

//the above lines set variables with the user submitted information
if($message==NULL) {
//checks to make sure no fields were left blank
echo "Type a damned message ya idiot!.";
}else{
//Everything seems good, lets insert.
$query = mysql_query("INSERT INTO posts (title, realname, username, message, email, date) VALUES('$title','$realname','$username','$message','$email','$date')");
// inserts the information into the database.
echo "You have successfully posted! Now redirecting you to you to view your post";
echo ("<meta http-equiv=Refresh content=2;URL=\"posts.php\" />");
}
}
else
{
   

echo ("<form method=\"POST\"><br />
<div align=center><span class=header>Hello $logged[realname]!
    </span><br /><br />
<span class=dingbat>Type the title of your post:</span>
<input type=\"text\" size=60 name=\"title\" maxlength=\"45\" /><br /><br />
<span class=dingbat>Type the body of your post:</span><br />
    <textarea name=\"message\" cols=\"80\" rows=\"15\" class=\"Viner-Pargraph\"></textarea><br />
    *Note that Full Html may be used and is most casses encouraged until the BBCode system has been implemented!

  <br />
<input name=\"post\" type=submit class=title value=\"post\">
  </div><br />
  </form>
");
}
}
else
{

echo'Sorry but you are not authorized to enter this area!';
}
?>
</p>
</body>
</html>
[/code]

Share this post


Link to post
Share on other sites
Therre are plenty of posts about bbcode systems in the Regex board. Take a look at  [url=http://www.phpfreaks.com/forums/index.php/topic,101566.msg402102.html#msg402102]this post[/url].

Also we are not here to write scripts for you. We'll provide code snippets but not full scripts. If you want someone to build a fully fledged bbcode system then ask in the freelance forum.

Share this post


Link to post
Share on other sites
it would hardly be building the entire script, and i'd be just as happy with a detailed explanation as to where the preg-something function goes and how to actually make it work...most of the tutorials out their are comprehensive...but never show you where in the code it has to sit and what the variables should be set to.....

Share this post


Link to post
Share on other sites
[quote author=schme16 link=topic=110233.msg445335#msg445335 date=1159804761]
i'd be just as happy with a detailed explanation as to where the preg-something function goes and how to actually make it work...
[/quote]

then, you should be very pleased with the thread that wildteen pointed you to ;)

it's a very detailed explanation, and it also includes the code needed to make it work.

good luck

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.