MemphiS Posted July 22, 2007 Share Posted July 22, 2007 I have a forum which i made and i wish to check the input to stop any SQL injections being made. IN the db i have the column set to TEXT. How can i make sure that what the user inputs is safe... i know i could ereg or ctype it but if i write the text then press enter it doesnt allow it. Without the enter it works fine but with a enter space it doesnt... Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/ Share on other sites More sharing options...
redarrow Posted July 22, 2007 Share Posted July 22, 2007 try nltbr() function Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-304577 Share on other sites More sharing options...
MemphiS Posted July 22, 2007 Author Share Posted July 22, 2007 Hmm that should work.. ahh so many php functions i dont know about Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-304585 Share on other sites More sharing options...
redarrow Posted July 22, 2007 Share Posted July 22, 2007 nl2br() http://uk2.php.net/nl2br sorry wrong syntex Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-304586 Share on other sites More sharing options...
MemphiS Posted July 22, 2007 Author Share Posted July 22, 2007 hmm i was thinking along the lines of something like: <?php $text = $_POST['text']; if (!nltbr(!ctype_alpha($text))){ echo "Bad data entered"; }else{ echo "good data"; } ?> no problem redarrow i found it Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-304590 Share on other sites More sharing options...
redarrow Posted July 22, 2007 Share Posted July 22, 2007 should work m8 Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-304592 Share on other sites More sharing options...
MemphiS Posted July 23, 2007 Author Share Posted July 23, 2007 Hmm Didnt work... Anyone else have an idea? Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-305164 Share on other sites More sharing options...
MemphiS Posted July 23, 2007 Author Share Posted July 23, 2007 bumP Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-305173 Share on other sites More sharing options...
MemphiS Posted July 23, 2007 Author Share Posted July 23, 2007 ,... Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-305232 Share on other sites More sharing options...
MemphiS Posted July 23, 2007 Author Share Posted July 23, 2007 ??? Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-305818 Share on other sites More sharing options...
redarrow Posted July 23, 2007 Share Posted July 23, 2007 try <?php $text = $_POST['text']; if (nltbr(!ctype_alpha($text))){ echo "Bad data entered"; }else{ echo "good data"; } ?> Link to comment https://forums.phpfreaks.com/topic/61217-validating-text-inputs/#findComment-305829 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.