|
Posted by Mike Youell on 04/09/06 23:47
1) I would limit it with javascript (note some people forget to test
for paste when implementing this).
2) But also limit the max size allowed server side with PHP aswell
(although I rarely bother with javascript as not everyone has it
enabled in their web browser and also people are used to having the
form re-displayed with errors to tell them where they went wrong
filling in the form).
e.g.
if (count($_POST['code']) > MAX_CODE_SIZE)
{
// Give feedback to the user that the code size is too large, and
display the form again.
// You could either make the textarea background red as feedback or
put a message at the top of the form which is highly visible. But
that's up to you :o)
}
else
{
// Put the code into the database.
}
Let me know if you have any problems,
Cheers,
Mike Youell.
Navigation:
[Reply to this message]
|