Author Topic: Ban Page  (Read 4497 times)

0 Members and 1 Guest are viewing this topic.

Offline Sc00by22

  • Jr. Member
  • **
  • Posts: 98
  • Karma: 0
Ban Page
« on: May 07, 2008, 11:23:14 AM »
Is there a way to automatically import my bans into a .html page? Like this

http://www.darklandservers.com/banlist.php

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Ban Page
« Reply #1 on: May 07, 2008, 12:40:44 PM »
Looks like they are using UBan, or something similar.

G4P Ban List

We do something similar to this as well. If you use UBan, it puts bans on a database which is quite easily parsed with some knowledge of php and MySQL.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ban Page
« Reply #2 on: May 07, 2008, 04:27:04 PM »
All these people doing fun things with UBan should release 'em to the community! :)
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Ban Page
« Reply #3 on: May 07, 2008, 05:22:04 PM »
I suppose =)


This is the page that shows all of the bans.
in teh query where it pulls data from gbans.. that is the name of the table I used for UBan.
Code: [Select]
<?php
$username 
"YOUR USER NAME";
$password "YOUR PASSWORD";
$database "YOUR DATABASE BAME";

mysql_connect("YOUR DATABASE NAME",$username,$password);
@
mysql_select_db($database) or die("Unable to select database.");
$result mysql_query("SELECT * FROM gbans"
or die(
mysql_error()); 

echo 
"<table class='bans'>";
echo 
"<tr> <th>Name</th> <th>SteamID</th> <th>Ban Lifted On</th></tr>";
while(
$row mysql_fetch_array$result )) {
echo "<tr><td>";
$var $row['name'];
if(
trim($var)=='<Unknown>' || trim($var)=='')
{
$nam "<font color=#663333><i>Unknown</i></font>";
}
else
{
$nam $var;
}
 
echo $nam;
echo "</td><td>"
$steamid $row['steamid'];
$name2 urlencode$nam);
$com $row['comment'];
if(
trim($com)=='')
{
$com2 "<font color=#663333><i>No Information Provided</i></font>";
}
else
{
$com2 $com;
}
$comm urlencode($com2);
$admin $row['adminname'];
if(
trim($admin)=='' || trim($admin)=='<Console>')
{
$admin3 "Console";
}
else
{
$admin3 $admin;
}
$admin2 urlencode($admin3);
$time $row['unban_time'];
if(
trim($time)=='0000-00-00 00:00:00')
{
$ban "Perma-Ban";
}
else
{
$time2 urlencode($time);
$ban $time2;
}

echo "<a href='#' onClick=window.open('baninfo.php?steamid=$steamid&comm=$comm&name2=$name2&admin2=$admin2&ban=$ban','popUpWindow','width=750,height=215,left=50,top=100,status=no,toolbar=no,location=no,menubar=no,titlebar=no');>$steamid</a>";

echo "</td><td>"

 
echo urldecode($ban);
echo "</td>";


echo 
"</table>";
?>





This is the code for the popup page.
Code: [Select]
<body>
<center><span class="style2">Ban Details</span></center><br />

<?php

$name 
$HTTP_GET_VARS['name2'];
$steam $HTTP_GET_VARS['steamid'];
$ban $HTTP_GET_VARS['ban'];
$comm $HTTP_GET_VARS['comm'];
$admin2 $HTTP_GET_VARS['admin2'];


echo 
"<table align=center class='bans'>";
echo 
"<tr> <th>Name</th> <th>SteamID</th> <th>Ban Lifted On</th> <th>Comment</th> <th>Banning Admin</th></tr>";
echo "<tr><td>"
echo $name;
echo "</td><td>"

echo $steam;
echo "</td><td>"

echo $ban;
echo "</td><td>"

echo $comm;
echo "</td><td>"

echo $admin2;
echo "</td>"
echo 
"</table>";

?>

</body>


Edit: This code is unsupported... It works for us.. but none of this is for the light hearted or the ignorant (by ignorant I simply mean people who don't know...)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ban Page
« Reply #4 on: May 07, 2008, 05:45:17 PM »
Thanks MrPresident! :)
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Ban Page
« Reply #5 on: May 07, 2008, 05:58:53 PM »
Good work Mr. Pres.
Yours is perfectly simple and gets the job done.
I don't know SQL. Perhaps I'll find motivation to learn it one of these days.
It's been (thinking... 5-6?) years since I played with PHP v4.

I would have so over complicated that. Just my nature I think.
I'd have the code condensed down to half the lines using a foreach loop, an array(), and a few other variables.
Hardly anyone would be able to tell what the output was just looking at the PHP though. :)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Ban Page
« Reply #6 on: May 07, 2008, 06:18:18 PM »
I didn't make that script. One of my admins came up with it for me, he didn't know any SQL or PhP until he started on this script. Took a few days, but that is what he came up with =)

Offline Sc00by22

  • Jr. Member
  • **
  • Posts: 98
  • Karma: 0
Re: Ban Page
« Reply #7 on: May 08, 2008, 07:43:54 AM »
The problem is is that my server is not on the same server as my webhost, which makes it impossible to send across?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ban Page
« Reply #8 on: May 08, 2008, 10:56:17 AM »
Not if you open up the MySQL DB to your webhost.
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Ban Page
« Reply #9 on: May 08, 2008, 12:50:00 PM »
no.. lol. Get this..

Our game server, our web host, and our MySQL server are all on seperate hosts. My web host gives me unlimited MySQL databases, but then they screw me over by not giving me access to it outside of the local machine... (meaning, I cant connect to it via my game server)

If you need a MySQL host, I recommend hostdepartment.com. I think Im paying like... $3 or $4 a month for this database. Which may seem like a lot for the amount I use it (only for my uban) but meh.

Offline Sc00by22

  • Jr. Member
  • **
  • Posts: 98
  • Karma: 0
Re: Ban Page
« Reply #10 on: May 08, 2008, 12:55:23 PM »
Heh, I will probably have to read the instructions like 5 times, But i do know how to use mysql databases just not very good at the lua part for gmod, My host also allows remote mysql connections