Pini: PHP Ini File System | v1.1 (Dini in PHP)
#1

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
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)