SA-MP Forums Archive
Serious PHP question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: Serious PHP question (/showthread.php?tid=327369)



Serious PHP question - Dripac - 20.03.2012

Код:
$data = parse_ini_file($file);
Will this only load if the file is .ini? Because i am saving accounts as .acc and now i can't login to the UCP.


Re: Serious PHP question - Max_Coldheart - 20.03.2012

Yes, it only parses (.)ini (initialization) files.


Re: Serious PHP question - Dripac - 20.03.2012

What do i have to change it to if i use .acc?


Re: Serious PHP question - titanak - 20.03.2012

$data = parse_ini_file('users/user.acc'); ??


PHP код:

$ini_array 
parse_ini_file("user.acc"true);
print_r($ini_array); 
something like that


Re: Serious PHP question - Dripac - 20.03.2012

Quote:
Originally Posted by titanak
Посмотреть сообщение
$data = parse_ini_file('users/user.acc'); ??


PHP код:

$ini_array 
parse_ini_file("user.acc"true);
print_r($ini_array); 
something like that
No it doesn't work

Here is the whole part

Код:
	function GetPlayerInfo($user)
	{
		require "config.php";
		$file="$GameDir/scriptfiles/accounts/$user.acc";
		if(!file_exists($file)) return false;
		$data = parse_ini_file($file);
		return $data;
	}



Re: Serious PHP question - titanak - 20.03.2012

why are you using: $file="$GameDir/scriptfiles/accounts/$user.acc";

$ before the user.acc and before the GameDir ?

Try:

PHP код:

    
function GetPlayerInfo($user)
    {
        require 
"config.php";
        
$file="$GameDir/scriptfiles/accounts/"$user.".acc";
        if(!
file_exists($file)) return false;
        
$data parse_ini_file($file);
        return 
$data;
    } 
and also if you got gamedir too a var so use:

PHP код:
    function GetPlayerInfo($user)
    {
        require 
"config.php";
        
$file""$GameDir."/scriptfiles/accounts/"$user.".acc";
        if(!
file_exists($file)) return false;
        
$data parse_ini_file($file);
        return 
$data;
    }