marklarah Posted March 9, 2008 Share Posted March 9, 2008 Code: <?php // // Edit below "if" if you want this feature available only to certain levels, or if they need a qwid shop item etc. // if (isset($username)) { if ((isset($_POST['song'])) || (isset($_POST['score'])) || (isset($_POST['song'])) || (isset($_POST['game'])) || (isset($_POST['difficulty']))){ if (!is_int($_POST['score'])){ echo "No."; exit; } // // Below query may need editing // $game =$_POST['game']; $difficulty =$_POST['difficulty']; $score =$_POST['score']; $song = htmlentities($_POST['song']); $resultb="INSERT INTO `Score` (ID, Game, Difficulty, Score, Song, Date, userid, ) VALUES(NULL, '$game', '$score', '$song', NOW(), '$useridm')"; mysql_query($resultb) or die(mysql_error()); echo "<h2>Score submitted."; echo '</h2><br><br>'; } ?> <font size="+1">Insert your game/score etc</font><br><small>Also dudes, don't be a faggot with it. Please be honest and such, otherwise it messes up the system, and everyone will hate you. So please, don't. Just don't.<br><br> <form method="post" action="scores.php"> <b>Game</b> <select name="game"> <option value ="1">Rock Band</option> <option value ="2">Guitar Hero 1</option> <option value ="3" selected="selected">Guitar Hero 2</option> <option value ="4">Guitar Hero 3</option> </select><br> <b>Difficulty</b> <select name="difficulty"> <option value ="1">Easy</option> <option value ="2">Medium</option> <option value ="3">Hard</option> <option value ="4" selected="selected">Expert</option> </select><br> <b>Score</b> <input type="text" name="score" size="20" maxlength="6"><br> <b>Song</b> <input type="text" name="song" size="20" maxlength="20"> <br><br> <input type="submit" name="butt" value="Submit"></center> </form> <br><br> <br><br><? include 'links.php'; ?> </td></tr></table> <?php }else{ echo 'Authorization Required.'; } require 'footer.inc.php'; ?> The elses at the bottom are from the header (above the posted code) Anyway, whenever I enter a legit score, it says "no" (meaning php things it aint a integer value) Help please? Link to comment https://forums.phpfreaks.com/topic/95198-integer-value-help/ Share on other sites More sharing options...
trq Posted March 9, 2008 Share Posted March 9, 2008 Everything within the $_POST and $_GET arrays are strings. For this to work, use is_numeric() instead of is_int(). Link to comment https://forums.phpfreaks.com/topic/95198-integer-value-help/#findComment-487606 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.