Try this:
if (is_numeric($txt1) && (float)$txt1<24 &&
(strlen($txt1)-strpos($txt1,"."))<=3) {
echo "True";
}
else {
echo "False";
};
Misha
PHP Genie
"Electroteque" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> is_numeric and strlen ?
>
> -Original Message-
On Tue, 2003-06-03 at 02:46, Sichta Daniel wrote:
> Another way is to do it on client side (javascript)
>
> DS
Indeed, but then you have to be prepared for it not to work if
the user doesn't have js enabled.
Torben
> -Original Message-
> From: Shaun [mailto:[EMAIL PROTECTED]
> Sent:
> -Original Message-
> From: Shaun [mailto:[EMAIL PROTECTED]
> Sent: 03 June 2003 10:21
>
> I am creating a timesheet application, how can I make sure
> that a user has
> entered a number, and that the number is a whole number or a
> decimal up to 2
> places, and that the number is less
Another way is to do it on client side (javascript)
DS
-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 03, 2003 11:21 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Validating user input
Hi,
I am creating a timesheet application, how can I make sure that a user ha
Try this... I don't know if this will suit your needs but it'll give you
an idea:
0 && $a < 24) {
$time = number_format($a, 2, '.', '');
echo "Time: $time\n\n";
} else {
echo "Invaild Time.\n\n";
}
?>
Regards,
J
is_numeric and strlen ?
-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 03, 2003 7:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Validating user input
Hi,
I am creating a timesheet application, how can I make sure that a user has
entered a number, and that the
Hi Drouet, I've been asking about this too and here's what I've been working
on. It checks for letters, numbers, puncuation, and max and min length. I
was told any of the puncation was safe as long as you addslashes before you
put it into the database.
function check_input($user_input, $min=0,
On Fri, 19 Apr 2002, SP wrote:
> Now should I include all those special characters? I want it to be hack
> proof so I don't want to add the user input into my database and have
> something bad happen.
>
> Which ones are safe?
> ~ ` ! @ # $ % ^ & * ( ) _ + - = [ ] \ { } | : " ; ' < > ? , . /
All
; ? , . /
-Original Message-
From: Danny Shepherd [mailto:[EMAIL PROTECTED]]
Sent: April 19, 2002 9:32 AM
To: Php
Subject: Re: [PHP] Validating User Input
Hi,
\?\,\.
\/';
$regexp='^['.$pattern.']{'.$min.','.$max.'}$';
if (e
Hi,
\?\,\.
\/';
$regexp='^['.$pattern.']{'.$min.','.$max.'}$';
if (ereg($regexp,$user_input))
return $user_input;
else
return $default;
}
?>
That should take care of everything except the square brackets - not sure
how to go about getting them (
10 matches
Mail list logo