NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page php/mysql parsing smilies for forum script

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-18-2005, 12:25 PM THREAD STARTER               #1 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,693
liam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to all
 




php/mysql parsing smilies for forum script


Hi all im trying to do a thing to parse my smilies correctly and this is my post parsing thing;

PHP Code:
// post body bbcode stuff
function main_bbcode()
{
    global 
$site_config;
    
    
// Strip the old tags!
    
$_POST['body1'] = htmlspecialchars($_POST['body1']);
    
    
// Smilies
    
$grab_smilies mysql_query("SELECT * FROM `smilies` ORDER BY `id`");
    while (
$echo_smilies mysql_fetch_array($grab_smilies))
    {
        
$_POST['body1'] = str_replace($echo_smilies['code'],"<img src='{$site_config['site_url']}{$echo_smilies['image']}' />",$_POST['body1']);
    }
    
    
// Bold code
    
$_POST['body1'] = str_replace("[b]","<strong>",$_POST['body1']);
    
$_POST['body1'] = str_replace("[/b]","</strong>",$_POST['body1']);
        
    
// Underline code
    
$_POST['body1'] = str_replace("[u]","<u>",$_POST['body1']);
????: NamePros.com http://www.namepros.com/programming/91174-php-mysql-parsing-smilies-forum-script.html
????: NamePros.com http://www.namepros.com/showthread.php?t=91174
    
$_POST['body1'] = str_replace("[/u]","</u>",$_POST['body1']);
        
    
// Italic code
    
$_POST['body1'] = str_replace("[i]","<em>",$_POST['body1']);
    
$_POST['body1'] = str_replace("[/i]","</em>",$_POST['body1']);
        
    
// New line code
    
$_POST['body1'] = str_replace("\n","<br />",$_POST['body1']);
    
    
// Urls
    
$_POST['body1'] = preg_replace("`(?<=^|[\n ]|\.)http://([\w]*[\w\.\?\/&=\;-]+)`","[url=http://\\1]http://\\1[/url]",$_POST['body1']);
    
$_POST['body1'] = preg_replace("`(?<=^|[\n ]|\.)www\.([\w\.\?\/&=\;-]+)`","[url=http://www.\\1]www.\\1[/url]",$_POST['body1']);
    
    
$_POST['body1'] = preg_replace("`\[url\]([\w]*[:\/\/]*[\w\.\?\/&=\;, -@]+)\[/url\]`sUi","<a href='\\1' rel='nofollow'>\\1</a>",$_POST['body1']);
    
$_POST['body1'] = preg_replace("`\[url\=([\w]*[:\/\/]*[\w\.\?\/&=\;, -@]+)\](.*)\[/url\]`sUi","<a href='\\1' rel='nofollow'>\\2</a>",$_POST['body1']);

    
// addlsashes dont want no errors or sql injection
    
$_POST['body1'] = addslashes($_POST['body1']);

Say one of smilie codes is [<] well <] doesnt get entered in the database is there a way for it to pick up all things its replacing coze i think its deleting it or something?
liam_d is offline  
Old 05-18-2005, 02:11 PM   #2 (permalink)
RyanPrice.ca - Developer
Join Date: Dec 2003
Posts: 1,328
Jeanco is a jewel in the roughJeanco is a jewel in the roughJeanco is a jewel in the rough
 



Please explain your problem more thoroughly.. I'm not sure what the problem is.
__________________
Ryan Price - Webmaster
www.HostDurham.com - For Hosting | www.jeanco.ca - For Webdesign
Jeanco is offline  
Old 05-19-2005, 12:51 AM   #3 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
your best bet will be to echo the query and try running it in phpmyadmin makes life a bit easier seeing the code that needs to be executed and the error phpmyadmin gives (if any).
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 05-19-2005, 09:13 AM THREAD STARTER               #4 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,693
liam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to all
 




Solved with help from xeo on devshed and my smart thinking after a nights sleep
liam_d is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
60.000 Templates, scripts, fonts, banners etc. $9.95 atkims Web Development Wanted 19 11-16-2004 10:48 AM
Domain Rating Script for Sale : $200.00 - only 10 scripts will be sold fonzerelli_79 Scripts For Sale 3 08-31-2003 09:41 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 06:42 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger