shorty3 Posted September 13, 2009 Share Posted September 13, 2009 <? 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); Quote Link to comment https://forums.phpfreaks.com/topic/174038-bb-code-help-php-complex/ Share on other sites More sharing options...
mikesta707 Posted September 13, 2009 Share Posted September 13, 2009 $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; ? Quote Link to comment https://forums.phpfreaks.com/topic/174038-bb-code-help-php-complex/#findComment-917442 Share on other sites More sharing options...
shorty3 Posted September 13, 2009 Author Share Posted September 13, 2009 bump Quote Link to comment https://forums.phpfreaks.com/topic/174038-bb-code-help-php-complex/#findComment-917610 Share on other sites More sharing options...
shorty3 Posted September 13, 2009 Author Share Posted September 13, 2009 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"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/174038-bb-code-help-php-complex/#findComment-917618 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.