Jump to content

Major Strpos Failure


MDCode

Recommended Posts

Ok so I've recently added strpos checking. I got username to work, added more names to check, check first name and last name too, etc. Anyways, It's not working anymore >:(

 

<?php

$firstname = mysql_real_escape_string(htmlentities($_POST['firstname']));

$lastname = mysql_real_escape_string(htmlentities($_POST['lastname']));

$username = mysql_real_escape_string(htmlentities($_POST['username']));

$password = mysql_real_escape_string(htmlentities($_POST['password']));

$confirm = mysql_real_escape_string(htmlentities($_POST['confirm']));

$email = mysql_real_escape_string(htmlentities($_POST['email']));

// prohibited words
$words = array("1", "2", "3", "20 more after this");

// check if username contains prohibited words
if(strpos("$username", "$words")) {
$errors = "<font color='red'>* Username contains prohibited words</font><br>";
}

// check if first name contains prohibited words
if(strpos("$firstname", "$words")) {
$errors = "<font color='red'>* First name contains prohibited words</font><br>";
}

// check if lastname contains prohibited words
if(strpos("$lastname", "$words")) {
$errors = "<font color='red'>* Last name contains prohibited words</font><br>";
}
?>

 

No errors but it seems to not be checking right anymore as the errors do not display. I have not touched anywhere below this section of filtering; every other filter is working right, so display isn't an issue

 

Any help would be appreciated!

Link to comment
https://forums.phpfreaks.com/topic/269875-major-strpos-failure/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.