Check for Numeric Value???

Forum
Last Post
Threads / Messages

dlithehil

Member
Member
Joined
Jun 10, 2022
Messages
84
Points
18
Mysidian Dollar
709
So, I asked some of my friends to break my site. And boy did I get my wish.

Anyway, one goofball put a non-numeric character into the shop's quantity space to buy things and got this result.
1725337060460.png
Is there any way to check that a character entered is numeric? I would also need to throw this into my higher/lower game...
 
I'm super late to the party here, but in case you still need it, for the shop bug, go to the shop controller file and add this at the top with the other namespace lists:

use Resource\Exception\InvalidActionException;

then go to the purchase function and after this:

if(!$mysidia->input->post("buy")) throw new InvalidIDException("global_id");

add this:

if(!is_numeric($mysidia->input->post("quantity"))) throw new InvalidActionException("Quantity must be a valid number");


adding a check using is_numeric for any post data like the above example can be used to stop non-numeric input on any controller page.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,305
Messages
33,289
Members
1,611
Latest member
razorbladekitty
BETA

Latest Threads

Latest Posts

Top