dadamssg Posted March 8, 2009 Share Posted March 8, 2009 im trying to protect my database from getting sql inserted into via the url. I want to check the number im passing through $_GET to see if is a number. if it is a number--do nothing, if its not---send to homepage. and im using ctype_digit to check to see if it is a number. heres the section right now. if (! ctype_digit($postid)) { header("Location: http://www.homepage.com"); } it works if theres a number but if i type a bunch of nonsense letters in the url i get an error that says i cannot modify the header info anyone got some advice? Quote Link to comment https://forums.phpfreaks.com/topic/148536-solved-ctype_digit-if-statement-help/ Share on other sites More sharing options...
corbin Posted March 9, 2009 Share Posted March 9, 2009 http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Quote Link to comment https://forums.phpfreaks.com/topic/148536-solved-ctype_digit-if-statement-help/#findComment-780008 Share on other sites More sharing options...
dadamssg Posted March 9, 2009 Author Share Posted March 9, 2009 yeah i don't really understand that article. i just tried putting that section at the VERY top of my page/script and still error. Quote Link to comment https://forums.phpfreaks.com/topic/148536-solved-ctype_digit-if-statement-help/#findComment-780013 Share on other sites More sharing options...
dadamssg Posted March 9, 2009 Author Share Posted March 9, 2009 just kidding im an annoying idiot...sorry, i figured it out. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/148536-solved-ctype_digit-if-statement-help/#findComment-780017 Share on other sites More sharing options...
Maq Posted March 9, 2009 Share Posted March 9, 2009 yeah i don't really understand that article. i just tried putting that section at the VERY top of my page/script and still error. Hmm, that's weird, this problem almost always is caused by output, even whitespace, before you invoke this method. Quote Link to comment https://forums.phpfreaks.com/topic/148536-solved-ctype_digit-if-statement-help/#findComment-780102 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.