[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 05-18-2005, 11:25 AM   #1 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
 
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,648
0.00 NP$ (Donate)

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']);
    
$_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, 01:11 PM   #2 (permalink)
RyanPrice.ca - Developer
 
Join Date: Dec 2003
Posts: 1,331
34.00 NP$ (Donate)

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-18-2005, 11:51 PM   #3 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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, 08:13 AM   #4 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
 
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,648
0.00 NP$ (Donate)

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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 09:48 AM
Domain Rating Script for Sale : $200.00 - only 10 scripts will be sold fonzerelli_79 Scripts For Sale 3 08-31-2003 08:41 AM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 10:38 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85