12.10.2009, 00:23
(
Последний раз редактировалось iLinx; 01.08.2011 в 16:08.
)
Note: If you are getting errors regarding to the ftp_ functions etc, etc, thats becuase your host hasnt enabled them on their version of php. You can either ask them to do it for you, if you have access to the php you can add it in yourself or you can switch hosts.
This script is just an example to show how you could retrieve your samp.ban file from your server using an FTP connection to your web host and then display it.
CRON : if you want to run this script in a cron just run this as a crontab every say 5 minutes
and run this for retrieving the actual ban list
This script is just an example to show how you could retrieve your samp.ban file from your server using an FTP connection to your web host and then display it.
Код:
<?php $ftp_host = "serverhostname ex: could be a ip address"; //put the ip / hostname to your ftp here $ftp_user = "ftp login"; //put your login here $ftp_pass = "ftp password"; //put your password here $banfile = "samp.ban"; $con = ftp_connect($ftp_host) or die("Couldnt connect to your ftp (check your settings!"); ftp_login($con, $ftp_user, $ftp_pass); ftp_get($con, "ban.txt", $banfile, FTP_ASCII); ftp_close($con); $file = fopen("ban.txt", "r"); $bans = fread($file, filesize("ban.txt")); fclose($file); echo nl2br($bans); ?>
Код:
<?php $ftp_host = "serverhostname ex: could be a ip address"; //put the ip / hostname to your ftp here $ftp_user = "ftp login"; //put your login here $ftp_pass = "ftp password"; //put your password here $banfile = "samp.ban"; $con = ftp_connect($ftp_host) or die("Couldnt connect to your ftp (check your settings!"); ftp_login($con, $ftp_user, $ftp_pass); ftp_get($con, "ban.txt", $banfile, FTP_ASCII); ftp_close($con); ?>
Код:
<?php $file = fopen("ban.txt", "r"); $bans = fread($file, filesize("ban.txt")); fclose($file); echo nl2br($bans); ?>