Jump to content

Strange wildcard problem


mforan

Recommended Posts

"test" != "%test%"

 

They are two different strings and are not equal. I think you are confusing the MySQL functionality when using LIKE. E.g.

SELECT * FROM table WHERE field LIKE '%test%'

 

That would match records where the field1 value is 'test'. The same does not hold true when doing a string comparison in PHP.

 

I think you are looking for a regex solution. But, since you have not provided details of what you are trying to accomplish I can't say for sure.

Link to comment
Share on other sites

that works just means you have to write something like this:

<?php 
$findme= 'Hacking';
$hacking = strpos($info[92], $findme);
$findme= 'Farming';
$farming = strpos($info[92], $findme);
$findme= 'Multiple Accounts';
$multiple = strpos($info[92], $findme);
$findme= 'Glitch abuse';
$glitch = strpos($info[92], $findme);
$findme= 'Verbal Abuse';
$verbal = strpos($info[92], $findme);
$findme= 'Proxy';
$proxy = strpos($info[92], $findme);
$findme= 'Other';
$other = strpos($info[92], $findme);
if ($hacking !== false) {$reason = "Banned for hacking into someone elses account and/or farming/deleting the user.";}
if ($farming !== false) {$reason = "Banned for merging two or more of your accounts together into one account.";}
if ($multiple !== false) {$reason = "Having more than one account constitutes an immediate ban of all the users account's. If you feel this has happened unjustly, contact support.";}
if ($glitch !== false) {$reason = "Banned for abusing in-game glitches and using them to your advantage without informing Admin.";}
if ($verbal !== false) {$reason = "Banned for using foul or inappropriate language within the game.";}
if ($proxy !== false) {$reason = "Banned for use of proxy's and potential multiple account usage.";}
if ($other !== false) {$reason = "Banned at Admin discretion.";}
?>

Link to comment
Share on other sites

No, that would be overkill. If you had simply stated in your first post what you were trying to achieve this would have been solved days ago.

 

<?php

$banList = array(
    'Hacking' => "Banned for hacking into someone elses account and/or farming/deleting the user.",
    'Farming' => "Banned for merging two or more of your accounts together into one account.",
    'Multiple Accounts' => "Having more than one account constitutes an immediate ban of all the users account's. If you feel this has happened unjustly, contact support.",
    'Glitch abuse' => "Banned for abusing in-game glitches and using them to your advantage without informing Admin.",
    'Verbal Abuse' => "Banned for using foul or inappropriate language within the game.",
    'Proxy' => "Banned for use of proxy's and potential multiple account usage.",
    'Other' => "Banned at Admin discretion."

);

$userBanReasons = array();
foreach($banList as $banTitle => $banReason)
{
    if(preg_match("/$banTitle/i", $info[92])>1)
    {
        $userBanReasons[] = $banReason;
    }
}

if(count($userBanReasons)>0)
{
    $reasons = "You were banned for the following reason(s):<br />\n" . implode("<br />\n", $userBanReasons);
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.