PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if(strpos($username, $curse) !== false) { echo "<center><font color=#FF0000>No curse words allowed in user name.</font></center>"; }
If I echo $username and $curse I get an answer. $curse resides in $username. I wanted to say basically, if $curse is anywhere in $username, then an error will apear. I'm just doing it this simple for now trying to get the sob to work, but no good! Any help would be appreciated. Thanx!!
$username = 'thecurseman';
$curse = 'curse';
if(strpos($username, $curse) !== false) { echo "<center><font color=#FF0000>No curse words allowed in user name.</font></center>"; }
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
wth, that's what I had. Does not work at all! I don't understand? But, username is a55hole and curse is a55 and it does not pop the warning? That's totally what I had.. My other code all works fine this is just a frustrating one.. does not work.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
joebasolo wrote:ok, tyvm.. will do, but 1st gotta get kids to bed.. thank you again.
Aaaaaaaawwwwe, it's Friday. Mine are still up.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
ok.. had a quick minute, when ran.. No error with the code added you gave me.. Weird huh? Wonder if it's in a php.ini setting? Just dunno... Sorry to bug ya. My code is the same and no warning display.
if(isset($username))
{
$lines = file("badwords.txt");
foreach($lines as $curse)
{
if(strpos($username, $curse) !== false) { echo "<center><font color=#FF0000>No curse words allowed in user name.</font></center>"; }
}
}
If I add a new line(s) within the foreach to echo both the username aswell as the curse they show that username is a55hole and curse is a55.... so I really don't know why it is not working. Plan on making echo reply a var l8r but for testing purposes this is my code...
PHP function reference wrote:Note: Each line in the resulting array will include the line ending, unless FILE_IGNORE_NEW_LINES is used, so you still need to use rtrim() if you do not want the line ending present.