SA-MP Forums Archive
how to display bans on website - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: how to display bans on website (/showthread.php?tid=84018)



how to display bans on website - CJ101 - 28.06.2009

i have no knoledge of php or anything like that.

how would i open samp.bans and show it on a website?


Re: how to display bans on website - refshal - 28.06.2009

Open your samp.ban in your Notepad. Then Copy the text from your opened File.


Re: how to display bans on website - Danny_Costelo - 28.06.2009

You need PHP knowledge, this can be done using MySQL.


Re: how to display bans on website - andersffs - 29.06.2009

Well it's easy made with PHP.. I'll see what I can do

edit:
Here you got!
Change the "samp.ban" to the exact source.
Код:
<?php
$file = "samp.ban";
$handle = fopen($file, 'r');
$data = fread($handle, filesize($file));
fclose($handle);
echo nl2br($data);
?>
You can also do this if you're using Godfather servermode. But then you have to link to the "ban.log" file whos in the dir "scriptfiles".


Re: how to display bans on website - godforbid - 29.06.2009

thanks this could come in handy some day


Re: how to display bans on website - Fish - 29.06.2009

I want to do this too .... I use SPruz.com as a host of website, can i do this?

Is there also a way to make a search bar for this ? like a entire archived database of bans which i can allow anyone to search for their ips to see there ban reason for when they want to ban appeal or w.e


Re: how to display bans on website - andersffs - 29.06.2009

Everything is possible with code! =)
I'll see what I cant do

Edit:
So this should do it!
Код:
<form action="bans.php" method="post">
Search:
<input type="text" name="keyword">
<input type="submit" name="search">
</form>

<?php
$keyword = $_POST['keyword'];
if(isset($_POST[search]) == null)
{
 $file = "samp.ban";
 $handle = fopen($file, 'r');
 $data = fread($handle, filesize($file));
 fclose($handle);
 echo nl2br($data);
}

else
{
 $file = "samp.ban";
 $handle = fopen($file, 'r');
 $data = fread($handle, filesize($file));
 fclose($handle);
 $line = explode("<br />", nl2br($data));
 $limit = count($line) - 1;

 $i = 0;
 while($i != $limit)
 {
  $find = strpos($line[$i], $keyword);
   if($find != false)
		{echo $line[$i].'<br>';}
  $i++;
 }
}
?>
Now you're able to search. You have to think about if it's a small or big character!


Re: how to display bans on website - iLinx - 01.07.2009

Quote:
Originally Posted by andersffs
Well it's easy made with PHP.. I'll see what I can do

edit:
Here you got!
Change the "samp.ban" to the exact source.
Код:
<?php
$file = "samp.ban";
$handle = fopen($file, 'r');
$data = fread($handle, filesize($file));
fclose($handle);
echo nl2br($data);
?>
You can also do this if you're using Godfather servermode. But then you have to link to the "ban.log" file whos in the dir "scriptfiles".
wow nice script, if you dont mind i added onto it alittle bit for my usage.
just so that it retrieves the ban list every time you run the script

Код:
<?php
$conn = ftp_connect("your servers ftp address here") or die("Could not connect");
ftp_login($conn,"user ftp login"," user password login");
ftp_get($conn,"samp.ban","directory/file where samp.ban is located on your ftp",FTP_ASCII);
$file = "samp.ban";
$handle = fopen($file, 'r');
$data = fread($handle, filesize($file));
fclose($handle);
ftp_close($conn);
echo nl2br($data);
?>
just put in what you need and youve got a banlist on your website ^^


Re: how to display bans on website - andersffs - 01.07.2009

Yeah, that's really useful =)