Jump to content

BB code help php complex


shorty3

Recommended Posts

<?

function replace($txt) {
$txt = str_replace(":sup:", "<img src=\"smiles/newbie.gif\">", $txt);
$txt = str_replace("", "<img src=\"smiles/content.gif\">", $txt);
$txt = str_replace("", "<img src=\"smiles/clin-oeuil-langue.gif\">", $txt);
$txt = str_replace(":%", "<img src=\"smiles/pukeface.gif\">", $txt);
$txt = str_replace(":!:", "<img src=\"smiles/argh.gif\">", $txt);
$txt = str_replace("[A]", "<img src=\"smiles/ange.gif\">", $txt);
$txt = str_replace("", "<img src=\"smiles/sourire.gif\">", $txt);
$txt = str_replace("", "<img src=\"smiles/pleure.gif\">", $txt);
$txt = str_replace(":8", "<img src=\"smiles/cool.gif\">", $txt);
$txt = str_replace("", "<img src=\"smiles/clin-oeuil.gif\">", $txt);
$txt = str_replace("[beer]", "<img src=\"smiles/biere.gif\">", $txt);
$txt = str_replace(":omg:", "<img src=\"smiles/OH-3.gif\">", $txt);
$txt = str_replace("[PC]", "<img src=\"smiles/ordi.gif\">", $txt);
$txt = str_replace("8-)", "<img src=\"smiles/rolleyes.gif\">", $txt);
$txt = str_replace("[lovestruck]", "<img src=\"smiles/lovestruck.gif\">", $txt);
$txt = str_replace("[evil]", "<img src=\"smiles/evil.gif\">", $txt);

?>

 

Right ive code this code this works fine but how can i have a bb code with this

 

<?php 

$selects = mysql_query("SELECT * FROM users WHERE username = '$viewuser'");
$is = mysql_fetch_object($selects);
if ($is->new text > time()){
$status="Unavailable";
}else{
$status="Available";
}
echo "$status"; ?>
<?

 

 

example which doesnt work but might give you a better idea of what im asking for

 

$txt = str_replace("[status]", "
$selects = mysql_query("SELECT * FROM users WHERE username = '$viewuser'");
$is = mysql_fetch_object($selects);
if ($is->new text > time()){
$status="Unavailable";
}else{
$status="Available";
}
echo "$status";", $txt);

Link to comment
https://forums.phpfreaks.com/topic/174038-bb-code-help-php-complex/
Share on other sites

 

$selects = mysql_query("SELECT * FROM users WHERE username = '$viewuser'");
$is = mysql_fetch_object($selects);
if ($is->new text > time()){
$status="Unavailable";
}else{
$status="Available";
}
$txt = str_replace("[status]", $status);
echo $text;

 

?

or maybe have something like this which doesn`t work but maybe you cud expand on it

 

$txt = str_replace("[status]", "echo "require_once'status.php'";", $txt);

 

and have a seperate script with the php code

 

status.php

 

<?php 

$selects = mysql_query("SELECT * FROM users WHERE username = '$viewuser'");
$is = mysql_fetch_object($selects);
if ($is->status > time()){
$status="Unavailable";
}else{
$status="Available";
}
echo "$status"; ?>

Archived

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

×
×
  • Create New...

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.