Jump to content


Photo

Altering a inputted message


  • Please log in to reply
2 replies to this topic

#1 craigbabe

craigbabe
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 13 April 2006 - 05:46 AM

hey I have a site where you can bet on things. But people are cheating in some scripts by betting 100% or 100* or something like that..

If it was called
$bet = 100* ;

how can I alter the string so it only outputs the 100 and not the * ?

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 13 April 2006 - 05:59 AM

You can use ereg and preg functions but the simplest to validate input is a numeric integer is to use:

[a href=\"http://us2.php.net/manual/en/function.ctype-digit.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.ctype-digit.php[/a]

#3 craigbabe

craigbabe
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 13 April 2006 - 06:16 AM

So this should work for characters like Â?

if (!ctype_digit($price)) {
exit;
}






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users