Forum Moderators: coopster

Message Too Old, No Replies

Determine if a variable is positive Integer

         

ukgimp

11:33 am on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have found the is_integer() [php.net] but I cant figure out how to check if it is possible to check for a positive number withing a range. I intend to stop users trying to knacker the system by messing with the querystring parameter.

Do I need to do anything else to protect my db from nasty folk?

Cheers

outrun

11:47 am on Jun 18, 2003 (gmt 0)

10+ Year Member



Just check if its greater then zero and if its an integer and if its within a range using an if loop.

regards,
Mark

ukgimp

11:59 am on Jun 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cheers outrun

I was trying this yesturday, now it worked when I said:

> 5

but it did not seem to work when I looked for

>= 0

it did not work.

I will have to try this again

outrun

12:32 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



You could always replace 0 with 1 and or ==0 for e.g

variable>=1 ¦¦ variable==0
if your using php I think thats "or" in php, but you get my drift I hope.

regards,
Mark