Hi
I have the following code:
<?php $current = $_POST['user']; $poza = $_POST['poza']; $cauta = $poza; // Read from file 222222222222222222 $linies = file('username.txt'); foreach($linies as $linie) if(strpos($linie, $cauta) !== false) list($idd,$usr)=explode('%%',$linie); echo 'Comparing '.$current.' and '.$usr.''; if ($usr === $current) { echo "THEY ARE THE SAME
"; } elseif ($usr != $current) { echo "THEY DON'T MATCH
"; } ?>
The echo 'Comparing ‘.$current.’ and ‘.$usr.’
'; prints the following message:
Comparing admin and admin
but
The if function returns that they are not the same
$usr comes from a txt file
$current and $poza are defined in a form
$currentuserr =& JFactory::getUser()->username;
So this basicaly gets the Joomla username and is supposed to compare it to a list of usernames in a txt file after finding the desired $idd
The .txt file looks like this
1%%admin
2%%admin
3%%test
etc
What am i doing wrong? (PS: i am new to PHP)