TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,236
  • Total Topics: 21,353
  • Online today: 340
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 198
  • Total: 198

how do I limit shoutbox text entry?

Started by omapie, December 11, 2007, 03:53:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dragooon

What do you want is to limit the no. of characters which can be posted in shoutbox? Something like 200?

I don't think so this should be hard.

omapie

That was my thought -- around 200 or so. I'd kinda thought it wouldn't be so hard at first but the more I looked at the link given earlier by IchBin, the more I decided maybe I should just talk to her for now and come back to that later! Little overwhelmed at the moment. OY!
:o

Yes. I was kinda thinking it wouldn't be so hard too .. but obviously (for my current skillset! LOL)... I'm just NOT quite there right now! LOL :2funny:

;)

Lori

Dragooon

OK here is a quick hack
in TPmodules.php
find
  $shout=strip_tags(substr($_POST['tp-shout'],0,300),'<b><u><i>');
And add before
                global $func;
if($func['strlen']($_REQUEST['to-shout']) > 200)
redirectexit($scripturl);

Didn't tested it though,

omapie

Found that line but not sure what this part means.
Quote
And add before
Code:

                global $func;
            if($func['strlen']($_REQUEST['to-shout']) > 200)
               redirectexit($scripturl);

Does that mean to add that section of code before the line of code just found or ???  Sorry. Been up way too many hours running and my head is just ... being ... dense! LOL

There ya go -- an if statement is what was going through my head when I thought it might not be so hard to change...

Understand not tested... One way or the other, TY for trying. ;)

Lori

Dragooon

Yes, Add that code before that line of code.

omapie


omapie

Okay. So if I understood correctly,

the line of code:
  $shout=strip_tags(substr($_POST['tp-shout'],0,300),'<b><u><i>');



would change to:

     global $func;
            if($func['strlen']($_REQUEST['to-shout']) > 200)
               redirectexit($scripturl);

    $shout=strip_tags(substr($_POST['tp-shout'],0,300),'<b><u><i>');


Is that correct?


omapie

Okay. If I got that correct, then it may be close... LOL

1. I have a line of 20 characters. Can't remember if a hard return counts as a character in counting (LOL).
2. I entered that line 10x for a total of 200 char (w/hard return NOT counting as a character).
3. Then it allowed another 30, 2 more lines @20 and the final line before it cut me off was 3 char.
4. So let's see if I can count here! NOT counting hard returns, that's the original 200 + 73 = 273
   ---  I believe 13 hard returns if that matters. checking it again now...

Well just did it again -- a couple more times actually! Think it let me get something like 79 or so over. My eyes are crossing so I'm probably miscounting at this point! LOL

I think 270 on this last one. ugh.

Logic check though: Shouldn't it be the same number each time -- the same as:  if you were counting some specific number of coins 5 different times, then should return the same quantity each time?

It let me keep typing -- just didn't put out in shoutbox more than that! Cool! I'm liking this! LOL
:2funny:
(control freak that I am huh!)
:laugh:

So that's where we're at! Making ANY sense here?
::)

Lori

Dragooon

It should be                 global $func;
if($func['strlen']($_REQUEST['tp-shout']) > 200)
redirectexit($scripturl);

Lol :P

yay 500th post! :P

This website is proudly hosted on Crocweb Cloud Website Hosting.