Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('pini.php'); //includes Pini :)
- //Example of how to use Pini in PHP
- $ftp_server = "***"; //Server
- $ftp_user = "***"; //User
- $ftp_pass = "***"; //Pass
- $fextention = ".sav"; //File Extention
- //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]).$fextention);
- 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]).$fextention, 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
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement