Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- // --------------------------------------------------------------------
- $ranking = "Score";
- $pasta = "Contas";
- $playerInfo = Array( "Kills", "Money", "Deaths" );
- // ---------------------------------------------------------------------
- $ftpenabled = 0; // usar ftp?
- $ftp_user_name = "Bruno"; // login ftp
- $ftp_user_pass = "Senha"; // senha ftp
- $ftp_server = "brunodasilva.com.br"; // server ftp
- // -------------------------------------------------------------------------------
- $players = Array();
- $informacoes = Array();
- // -------------------------------------------------------------------------------
- if($ftpenabled) {
- $conn_id = ftp_connect($ftp_server);
- $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
- $contents = ftp_nlist($conn_id, $pasta);
- foreach($contents as $player) {
- if(strstr($player, ".ini")) {
- $dados = parse_ini_string(file_get_contents("ftp://" .$ftp_user_name . ":" . $ftp_user_pass . "@" . $ftp_server . "/" . $pasta . "/" . $player));
- $nickname = substr( $player, 0, -4 );
- $players [ $nickname ] = $dados [ $ranking ];
- foreach ( $playerInfo as $key ) {
- if ( $key != $ranking ) {
- $informacoes [ $nickname ] [ $key ] = $dados[ $key ];
- }
- }
- }
- }
- }
- else {
- $dir = opendir($pasta);
- while(false !== ($player = readdir($dir))){
- if(strstr($player, ".ini")) {
- $dados = parse_ini_file ( $pasta . "/". $player );
- $nickname = substr( $player, 0, -4 );
- $players [ $nickname ] = $dados [ $ranking ];
- foreach ( $playerInfo as $key ) {
- if ( $key != $ranking ) {
- $informacoes [ $nickname ] [ $key ] = $dados[ $key ];
- }
- }
- }
- }
- }
- arsort($players);
- $i = 0;
- foreach ($players as $key => $valor) {
- $i ++;
- echo "[" . $i . "°] Jogador: $key tem $valor de $ranking "; // imprimir o ranking dele
- foreach ( $playerInfo as $keys ) {
- if ( $keys != $ranking ) {
- echo " | $keys: " . $informacoes [ $key ] [ $keys ]; // as outras infos
- }
- }
- echo "<br />"; // pular linha para próximo jogador
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement