Text Check Error
Posted: Fri May 18, 2012 10:04 pm
I'm trying to check texts from files, I get sucess in the first check, but the second, Error!
Here's the code
Here's the page of check: www.ibpalavraevida.com.br/index.php
Here's the code
Code: Select all
<?php
function CheckU($i)
{
global $usrs;
if ($i != '')
$usrs = true;
else
$usrs = false;
}
function CheckP($i)
{
global $pks;
if ($i != '')
$pks = true;
else
$pks = false;
}
function PassKey()
{
global $usr,$datas;
$pk1 = './database/password.data';
$pk2 = fopen($pk1,'r');
$pk = fread($pk2, filesize($pk1));
$rr = $pk . "<" . $usr . ">";
$res = strstr($datas,$rr);
CheckP($res);
$pks="";
/*$fp = fopen("bloco1.txt", "a");
$escreve = fwrite($fp, $rr.$res);
fclose($fp);*/
if ($pks == true){
echo "Wow, it's really works!!!2" ;
}
if ($pks == false){
echo "<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>, something looks wrong.2" ;
}
}
//abrimos o arquivo em leitura
$usr1 = './database/user.data';
$usr2 = fopen($usr1,'r');
//lemos o arquivo
$usr = fread($usr2, filesize($usr1));
$usr1 = './database/users.db';
$usr2 = fopen($usr1,'r');
$datas = fread($usr2, filesize($usr1));
//transformamos as quebras de linha em etiquetas <br>
//$datas = nl2br($datas);
$len = strstr($datas,$usr);
$len = substr($len,0,strlen($usr));
CheckU($len);
if ($usrs == true){
echo "Wow, it's really works!!!" ;
PassKey();
}
if ($usrs != true){
echo "<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>, something looks wrong." ;
}
?>