AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   Admin Display from SB (https://forums.alliedmods.net/showthread.php?t=142123)

Rizla 11-01-2010 16:03

Admin Display from SB
 
1 Attachment(s)
This is a simple script I wrote with help from 8088, using voogrus ID convertor

I am no php pro, this is the first thing like this I have released as I wanted something like this to ease my workload when adding new admins. Anyone experienced enough should know what to do with this and anyone who isn't shouldnt have trouble.

This will display all admins on sourcebans that are in the group(s) you select. It will also cache the page as large databases will cause slow loading (30mins, can be increased)

Requirements:
Website/server
Webshortcuts
Sourcebans

Installing:
Download the file

Unzip and open up connect.php

Find:

mysql_connect("ENTER YOUR DB LOCATION, NORMALLY LOCALHOST", "DB USERNAME", "DB PASSWORD")

Enter your DB location, typically localhost. You can also enter an IP.
Put in your db username and db password

Then find:

mysql_select_db("SELECT SB DB")

Enter the name of your SB database

Save and close.

Open up admins.php
Find:
$sql = "SELECT user,authid,srv_group,gid FROM ADMINS_TABLE WHERE srv_group = 'SERVER GROUP 1' OR srv_group = 'SERVER GROUP 2' OR srv_group = 'SERVER GROUP 3' ORDER BY gid ASC";

Edit ADMINS_TABLE to represent the name of your admins table (default is sb_admins)

If you want to only include certain server groups then edit:

srv_group = 'SERVER GROUP 1'


so that SERVER GROUP 1 is replaced by the exact name of the group you want to display (ex. Server Admins)

If you have multiple groups then continue in this fashion editing where it says group 2 etc. You can have as many as you want. If you want to show all then just delete:

WHERE srv_group = 'SERVER GROUP 1' OR srv_group = 'SERVER GROUP 2' OR srv_group = 'SERVER GROUP 3'

That entire section

I have set it to order by group id ascending (ORDER BY gid ASC) this displays my higher levelled admins first, again you can remove this or change to DESC to display in reverse order.

This next part is all for aesthetics.


Find:
<a href="LINK TO YOUR SITE"> and enter the link to your site

Find:
<img src="YOUR BANNER SRC" alt="" title="">

Enter the url to your banner, give it an alternative (for text only) and a title (for mouse over)

Find:
<p>ENTER YOUR INTRO TEXT HERE</p>
You can enter some text here if you want.

Find:
<p><small>ENTER FOOTER<br><br>&copy; YOUR COPYRIGHT</p>

You can add some footer text here and a copyright, if you want. I am not going to hold copyright over this and allow anyone to edit as they please.

The above can all be deleted if you don't want to show it.

If you want to edit the cache time then open cache.php and find:
var $cache_time = 1800

Change the 1800 to how many seconds you want to cache for.

I kinda cheated for the css. I just robbed the one from my forum and then included it. I have kept it in the file, edit as you wish or include your own.

As I cheated on this I won't go into editing as it is such a big file, I would grab your own from your site (or create your own) and replace the one in the folder (renaming it to index.css for simplicitys sake)

Finally:
Upload the whole file to where you want it stored. Make sure the cache folder is CHMOD to 777

Go to the address where you uploaded it to and it *SHOULD* work :)



I hope I have helped some of you. I'll be here to try and help if anyone needs it.

Like I say, this is the first thing like this I have released, so be nice please!

bouncer 11-01-2010 19:11

Re: Admin Display from SB
 
Any pictures? To get a better idea please? Thanks.

Rizla 11-01-2010 19:15

Re: Admin Display from SB
 
http://www.tmfgaming.com/main/admins/admins.php <-- in action

bouncer 11-02-2010 00:25

Re: Admin Display from SB
 
Amazing! Installing!

bouncer 11-02-2010 00:46

Re: Admin Display from SB
 
Getting an error:

http://www.brotherhoodofgamers.com/admins/admins.php

Rizla 11-02-2010 07:03

Re: Admin Display from SB
 
'No results' i see it says

post up your admins.php and ill take a look

bouncer 11-02-2010 09:53

Re: Admin Display from SB
 
Code:

<?php /*
Rizlas Admin Display
*/
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
        <head>
                <meta http-equiv="content-type" content="text/html; charset=utf-8">
                <title>SB Admins Page</title>
        </head>

<STYLE TYPE='text/css' media='all'>@import "index.css";</style>
 
                <?php
// the cache
include "cache.php";

// includes the connection file
include "connect.php";

$ch = new cache();
//find the data


//prepare the query
$sql = "SELECT user,authid,srv_group,gid FROM ADMINS_TABLE WHERE srv_group = 'Managers' OR srv_group = 'Council' OR srv_group = 'Honor Members' OR srv_group = 'Members' OR srv_group = 'Recruits' OR srv_group = 'Premium Gamers' ORDER BY gid ASC";

//perform the query and store the resource in '$query'
$query = mysql_query($sql);

//see if there are any results at all
if(mysql_num_rows($query) > 0)
{
    //there is one or more results, start printing the table
    print '<div align="center">
<a href="http://www.brotherhoodofgamers.com">
<img src="http://www.brotherhoodofgamers.com/bans/images/logos/sb-large.png" alt="Sourcebans Admins" title="[B-O-G] Admins & Premium Gamers"></a></div>

<p>This is some text test</p></div align="center"><table border="0" cellpadding="2" cellspacing="2" width="100%">';
   
    //fetch every possible row from the resource and do nice stuff with it
  while($info = mysql_fetch_assoc($query))
    {
        //convert the steamid into a community id
        $community_id = ((substr($info['authid'], 10)) * 2) + 1197960265728 + (substr($info['authid'], 8, 1));

$community_id = '7656'.$community_id;
       
        //create a link to the Steam community profile
        $site = 'http://steamcommunity.com/profiles/'.$community_id;

       
        //print the table row with all the info
        print '<tr><td><img src="http://www.steamprofile.com/profile/simple/steam/'.$info['authid'].'.png" ></td><td align="center"><a href="steam://friends/add/'.$community_id.'">Add as Friend</a></td><td align="center"><a href='.$site.'>Steam Community Page</a></td><td>'.$info['srv_group'].'</td></tr><tr><td colspan="4"><hr></td></tr>';
    }
    //close the table
    print '</table><br><div align="center"><p><small>Special thanks to Voogru for the conversions, 8088 on Allied Modders for helping to fix. Steamprofile.com for their images. Depictation.net for their cache and whoever else I forgot! Sorry.<br><br>&copy; 2010 Brotherhood Of Gamers</p></small><br><br></div></div>';
}
//there are no results
else print 'No results';

echo date("D M j G:i:s T Y");
$ch->close();
       
?>
        </body>
</html>


Rizla 11-02-2010 10:02

Re: Admin Display from SB
 
Code:

$sql = "SELECT user,authid,srv_group,gid FROM ADMINS_TABLE WHERE srv_group = 'Managers' OR srv_group = 'Council' OR srv_group = 'Honor Members' OR srv_group = 'Members' OR srv_group = 'Recruits' OR srv_group = 'Premium Gamers' ORDER BY gid ASC";
Your issue lies in there; you need to change ADMINS_TABLE to the name of your SB admins table, normally it will be sb_admins

Rizla 11-02-2010 11:46

Re: Admin Display from SB
 
btw how many groups do you have? like the honor members etc. If you are displaying all groups then you don't need the WHERE clause, if your displaying all but one or two groups then use:

WHERE srv_group <> 'Group' OR srv_group <> 'group'

bouncer 11-02-2010 12:00

Re: Admin Display from SB
 
yeah it works now, except the add friend is not working right.


All times are GMT -4. The time now is 23:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.