Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-22-2002, 02:19 AM   PM User | #1
mouse
Regular Coder


 
Join Date: Jun 2002
Location: North East England
Posts: 853
Thanks: 0
Thanked 0 Times in 0 Posts
mouse is an unknown quantity at this point
Restricting instances in data

I'm making a small message board where peeps can buy/sell or place wanted ads, being incapable of installing 3rd party scripts I'm coding it myself ...actually learnin' stuff too

Two things:

1) spaces in data, how do I keep 'em as spaces rather than regurgitating them as %20 or whatever?

2) I'd like to restrict smilie useage in a similar way to this site, limiting to 8 or so per post, my smilie code is like so: [smilie=1], [smilie=2] and so on.
__________________
[+] Computer/PC issues [+] Silverpaw3D
------------------------------------------------
Never buy a dwarf with learning disabilities...

...it's not big, and it's not clever.
mouse is offline   Reply With Quote
Old 07-22-2002, 12:28 PM   PM User | #2
mordred
Senior Coder


 
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
mordred is an unknown quantity at this point
I don't get the part with the %20 as substitutes for spaces. How does that happen - do you treat the data with urlencode()?

As for the instances of smiley code, you have a look at substr_count(), I think that does exactly what you want.
http://za2.php.net/manual/en/function.substr-count.php

Use it like

PHP Code:
$numberOfSmileys substr_count($data"[smilie=");
if (
$numberOfSmileys 8) {
   echo 
"that's too much, I'm afraid.";

mordred is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 03:12 AM.


Advertisement
Log in to turn off these ads.