Jump to content

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"; ?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.