[Tool/Web/Other] [PHP] GetBan (display the banlist on your website)
#1

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.

Код:
<?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);

?>
CRON : if you want to run this script in a cron just run this as a crontab every say 5 minutes
Код:
<?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); ?>
and run this for retrieving the actual ban list
Код:
<?php $file = fopen("ban.txt", "r");
	$bans = fread($file, filesize("ban.txt"));
	fclose($file);
	
	echo nl2br($bans); ?>
Reply


Messages In This Thread
[PHP] Show your banlist on your website w/ FTP - by iLinx - 12.10.2009, 00:23
Re: [PHP] GetBan (display the banlist on your website) - by [mad]MLK - 12.10.2009, 00:25
Re: [PHP] GetBan (display the banlist on your website) - by MadFlavor - 12.10.2009, 02:02
Re: [PHP] GetBan (display the banlist on your website) - by kokkie20 - 12.10.2009, 06:35
Re: [PHP] GetBan (display the banlist on your website) - by getAlife - 12.10.2009, 12:59
Re: [PHP] GetBan (display the banlist on your website) - by Correlli - 12.10.2009, 13:01
Re: [PHP] GetBan (display the banlist on your website) - by kennyist - 12.10.2009, 14:33
Re: [PHP] GetBan (display the banlist on your website) - by evanx10 - 12.10.2009, 15:13
Re: [PHP] GetBan (display the banlist on your website) - by [mad]MLK - 12.10.2009, 15:23
Re: [PHP] GetBan (display the banlist on your website) - by evanx10 - 12.10.2009, 15:28
Re: [PHP] GetBan (display the banlist on your website) - by SanMarinoRP - 12.10.2009, 15:57
Re: [PHP] GetBan (display the banlist on your website) - by evanx10 - 12.10.2009, 16:03
Re: [PHP] GetBan (display the banlist on your website) - by RoamPT - 12.10.2009, 22:17
Re: [PHP] GetBan (display the banlist on your website) - by iLinx - 13.10.2009, 00:32
Re: [PHP] GetBan (display the banlist on your website) - by Calgon - 13.10.2009, 00:49
Re: [PHP] GetBan (display the banlist on your website) - by SergiKirov - 13.10.2009, 01:00
Re: [PHP] GetBan (display the banlist on your website) - by Jakku - 13.10.2009, 12:07
Re: [PHP] GetBan (display the banlist on your website) - by Fj0rtizFredde - 13.10.2009, 12:38
Re: [PHP] GetBan (display the banlist on your website) - by dirkblok - 13.10.2009, 14:20
Re: [PHP] GetBan (display the banlist on your website) - by [mad]MLK - 13.10.2009, 14:55
Re: [PHP] GetBan (display the banlist on your website) - by aspire5630 - 13.10.2009, 16:04
Re: [PHP] GetBan (display the banlist on your website) - by Westie - 13.10.2009, 17:24
Re: [PHP] GetBan (display the banlist on your website) - by iLinx - 13.10.2009, 19:46
Re: [PHP] GetBan (display the banlist on your website) - by PureLuck - 13.10.2009, 21:00
Re: [PHP] GetBan (display the banlist on your website) - by BlueRey - 14.10.2009, 00:32
Re: [PHP] GetBan (display the banlist on your website) - by CJ101 - 14.10.2009, 05:32
Re: [PHP] GetBan (display the banlist on your website) - by ev0lution - 14.10.2009, 06:59
Re: [PHP] GetBan (display the banlist on your website) - by iLinx - 14.10.2009, 20:52
Re: [PHP] GetBan (display the banlist on your website) - by RoamPT - 14.10.2009, 23:39
Re: [PHP] GetBan (display the banlist on your website) - by coole210 - 15.10.2009, 00:42
Re: [PHP] GetBan (display the banlist on your website) - by 26_RUSSS - 07.06.2013, 19:39
Re: [PHP] GetBan (display the banlist on your website) - by BlonduX - 14.08.2014, 18:57

Forum Jump:


Users browsing this thread: 5 Guest(s)