mforan Posted June 9, 2010 Share Posted June 9, 2010 <?php $info[92] ="test"; if ($info[92] =="%test%") { $reason = "Blah."; } ?> it doesnt work, lol. any idea? (when echo'd $reason doesn't show anything.) Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 9, 2010 Share Posted June 9, 2010 "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. Quote Link to comment Share on other sites More sharing options...
mforan Posted June 9, 2010 Author Share Posted June 9, 2010 basically got a list of data that i wanna output, but the same data is in $info[92] (like "test - blah blah blah") thought a wildcard would work, hmmm lol.... Quote Link to comment Share on other sites More sharing options...
ignace Posted June 9, 2010 Share Posted June 9, 2010 Use strpos Quote Link to comment Share on other sites More sharing options...
mforan Posted June 11, 2010 Author Share Posted June 11, 2010 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.";} ?> Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 11, 2010 Share Posted June 11, 2010 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); } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.