how to display bans on website
#1

i have no knoledge of php or anything like that.

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

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

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

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".
Reply
#5

thanks this could come in handy some day
Reply
#6

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
Reply
#7

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!
Reply
#8

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 ^^
Reply
#9

Yeah, that's really useful =)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)