R0CKY Posted July 6, 2008 Share Posted July 6, 2008 I'm looking to return false for any form submitted comment that was a url in it. I thought the following code would do it, but apparently not...? if (strpos(xhtml_convert($_POST['comment']), "http") === false) Link to comment https://forums.phpfreaks.com/topic/113425-whats-wrong-with-this-strpos-line/ Share on other sites More sharing options...
sasa Posted July 6, 2008 Share Posted July 6, 2008 can you echo xhtml_convert($_POST['comment']); before if Link to comment https://forums.phpfreaks.com/topic/113425-whats-wrong-with-this-strpos-line/#findComment-582790 Share on other sites More sharing options...
R0CKY Posted July 6, 2008 Author Share Posted July 6, 2008 Sorry no I can't because the check happens after the form is submitted and the webpage refreshes, here's that section.. if (strpos(xhtml_convert($_POST['comment']), "http") === false) { if (strpos(xhtml_convert($_POST['comment']), "www") === false) { $db->Execute("INSERT INTO ".$dbPrefix."comments (comment_userid, comment_fileid, comment_time, comment_poster, comment_ip, comment_text) VALUES (".$userinfo[0]['user_userid'].", ".intval($_GET['file']).", ".time().", '".xhtml_convert($_POST['poster'])."', '".$_SERVER['REMOTE_ADDR']."', '".smart_slashes(str_replace("\n", "<br />", $commentText))."')"); Link to comment https://forums.phpfreaks.com/topic/113425-whats-wrong-with-this-strpos-line/#findComment-583065 Share on other sites More sharing options...
Barand Posted July 6, 2008 Share Posted July 6, 2008 Sorry no I can't ... Then we can't help. Good luck. Link to comment https://forums.phpfreaks.com/topic/113425-whats-wrong-with-this-strpos-line/#findComment-583138 Share on other sites More sharing options...
Lodius2000 Posted July 7, 2008 Share Posted July 7, 2008 rocky put this: echo xhtml_convert($_POST['comment']); right before your first if() in the code you last supplied, your code will look ugly but it will print out what you need Link to comment https://forums.phpfreaks.com/topic/113425-whats-wrong-with-this-strpos-line/#findComment-583192 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.