Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    North East England
    Thanked 0 Times in 0 Posts

    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.

  2. #2
    Senior Coder
    Join Date
    Jun 2002
    frankfurt, german banana republic
    Thanked 0 Times in 0 Posts
    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.

    Use it like

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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts