Ulysses
Ulysses Stuff => General Chat & Help and Support => Topic started by: Sc00by22 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
-
Looks like they are using UBan, or something similar.
G4P Ban List (http://theslickwizard.com/MrPresident/bans.php)
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.
-
All these people doing fun things with UBan should release 'em to the community! :)
-
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.
<?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.
<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...)
-
Thanks MrPresident! :)
-
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. :)
-
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 =)
-
The problem is is that my server is not on the same server as my webhost, which makes it impossible to send across?
-
Not if you open up the MySQL DB to your webhost.
-
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.
-
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