Hello everyone, im using ActionScript and PHP to do some simple/basic file saving into my server.
$file = fopen("users.ini","a");
fwrite($file,"user=".$UserTXT.
"\ntotal=".$_POST["totnum"].
"\nfilter=".$_POST["ffilter"].
"\ntext=".$_POST["ttext"].
"\nlocal=".$_POST["tolocal"].
"\nremote=".$_POST["toremote"].
"\n");
fclose($file);
print "done=saveduser";
print "&msg=".$UserTXT." was saved successfully";
this above is my saving into file that actually works pretty well. using \n to save into new line.
the document comes out sorted and everything is working.
the real problem for me, is reading this.
i dont know why, but the next function returns also “false”
function CheckIfUserExists($user){
if (!file_exists("users.ini")){
return false;
}
$file = fopen("users.ini","r");
while(!feof($file)){
$tmp = fgets($file);
if ($tmp == "user=".$user){ //this line doesnt work?
fclose($file);
return true;
}
}
fclose($file);
return false;
}
please help me solve this “if ($tmp == “user=”.$user)” line.
i think im doing something wrong, but i cant figure it out.