SA-MP Forums Archive
Pini: PHP Ini File System | v1.1 (Dini in PHP) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: Pini: PHP Ini File System | v1.1 (Dini in PHP) (/showthread.php?tid=149775)



Pini: PHP Ini File System | v1.1 (Dini in PHP) - DowNlOaD_ - 23.05.2010

As you can see in title, it's PHP Ini File System, you can manage your files with PHP. It's originaly created by DracoBlue and it's wrapped into PHP by DowNlOaD_(Me) and Gamer_Z.

A lot of people are happy to hear that MySQL Plugin exists for SA-MP and want to use it, but files are much better and quicker, databases would totally lag your server if it would not be on the same host.

Functions:
• pini_Exists($filename);
• pini_Remove($filename);
• pini_Create($filename);
• pini_Get($filename, $key);
• pini_IntGet($filename, $key);
• pini_Set($filename, $key, $value);
• pini_IntSet($filename, $key, $value);
• FTP_pini_Exists($filename, $host, $user, $password, $path);
• FTP_pini_Remove($filename, $host, $user, $password, $path);
• FTP_pini_Create($filename, $host, $user, $password, $path);
• FTP_pini_Get($filename, $key, $host, $user, $password, $path);
• FTP_pini_IntGet($filename, $key, $host, $user, $password, $path);
• FTP_pini_Set($filename, $key, $value, $host, $user, $password, $path);
• FTP_pini_IntSet($filename, $key, $value, $host, $user, $password, $path);
• udb_encode($nickname);
• udb_decode($nickname);
• udb_hash($buf);

Example:

Code:
<?php

include('pini.php'); //includes Pini :)

//Example of how to use Pini in PHP

$ftp_server = "***"; //Server
$ftp_user = "***"; //User
$ftp_pass = "***"; //Pass

//Connecting with FTP
$conn_id = ftp_connect($ftp_server);
ftp_login($conn_id, $ftp_user, $ftp_pass);

if(!empty($_POST[submit])) //Checks if submit button has been pressed
{
	$res = ftp_size($conn_id, 'scriptfiles/'.udb_encode($_POST[nick]));
	if ($res != -1) //checks if file exists, you could use pini_Exists if the file would be on the same host
	{
		ftp_get($conn_id, udb_encode($_POST[nick]), 'scriptfiles/'.udb_encode($_POST[nick]), FTP_BINARY); //saves the file
		echo 'You are viewing stats of '.$_POST[nick].'<br />';
		echo 'Player has $'.pini_Get(udb_encode($_POST[nick]), "Money").' dollars!'; //reads the ammount of money
		unlink(udb_encode($_POST[nick])); //deletes the file
	}
	else //if file does not exist, this message shows up :)
	{
		echo 'User '.$_POST[nick].' is not registered!';
	}
}
else //if submit button has not been pressed
{
	echo '<form action="'.basename($_SERVER['SCRIPT_FILENAME']).'" method="post">Enter player\'s nickname: <input type="text" name="nick"><br /><input type="submit" 

value="Submit" name="submit"></form>';
}

ftp_close($conn_id); //closes the connection

?>
Downloads:

v1.0
Download 1 (If that doesn't work, try the other one)
Download 2

v1.1
Download 1
Download 2


More functions will be added in few days

PLEASE REPORT ANY BUGS


Re: Pini: PHP Ini File System | v1.0 Beta - Johndaone - 23.05.2010

What does that example do?
Check the submitted players money? If no then sorry for being a retard.


Re: Pini: PHP Ini File System | v1.0 Beta - DowNlOaD_ - 23.05.2010

it shows how you can use some functions

regards, DowNlOaD_

//edit:

you enter player's nickname and it shows how much money he has
and it's not pawn, its PHP for website


Re: Pini: PHP Ini File System | v1.0 Beta - luigifan9 - 23.05.2010

i its not pawn, why on pawno forums anyway looks cool tho i will use maybe


Re: Pini: PHP Ini File System | v1.0 Beta - Johndaone - 23.05.2010

Yeah i noticed, very nice !
We need more of these php stuff nowadays, great release.


Re: Pini: PHP Ini File System | v1.0 Beta - DowNlOaD_ - 23.05.2010

Quote:
Originally Posted by luigifan9
i its not pawn, why on pawno forums anyway looks cool tho i will use maybe
well, it's like a addon to dini and dudb includes


Re: Pini: PHP Ini File System | v1.0 Beta (Dini in PHP) - [MWR]Blood - 23.05.2010

SA-MP Scripting and Plugins


Re: Pini: PHP Ini File System | v1.0 Beta (Dini in PHP) - Gamer_Z - 23.05.2010

Quote:
Originally Posted by ikarus❶❸❸❼
SA-MP Scripting and Plugins
This is mainly meant FOR SA-MP


Re: Pini: PHP Ini File System | v1.0 Beta (Dini in PHP) - FakeMan - 23.05.2010

Great Job DowNlOaD_ and Gamer_Z


Re: Pini: PHP Ini File System | v1.0 Beta (Dini in PHP) - DowNlOaD_ - 23.05.2010

Quote:
Originally Posted by FakeMan
Great Job DowNlOaD_ and Gamer_Z
thx