Raised This Month: $51 Target: $400
 12% 

Admin Display from SB


Post New Thread Reply   
 
Thread Tools Display Modes
Rizla
SourceMod Donor
Join Date: Jun 2010
Old 11-03-2010 , 21:55   Re: Admin Display from SB
Reply With Quote #31

this guy is a genius^
Rizla is offline
8088
Veteran Member
Join Date: Jan 2008
Old 11-03-2010 , 22:15   Re: Admin Display from SB
Reply With Quote #32

Ha, sometimes I wish I was :)
Credits for the query go to Scuzzy.
__________________
steamID converter with OpenSearch browser plugin
8088 is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 11-04-2010 , 07:26   Re: Admin Display from SB
Reply With Quote #33

i double checked everything its filled in correctly

admins.php:
PHP 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>Onlyfriends 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 sb_admins WHERE srv_group = 'SERVER GROUP 1' OR srv_group = 'SERVER GROUP 2' OR srv_group = 'SERVER GROUP 3' 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://onlyfriends.be/admins/admins.php">
<img src="http://www.onlyfriends.be/bans/images/logos/jblogov4.png" alt="" title=""></a></div>

<p>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'], 81));

$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 TmF Gaming</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>
Groger is offline
Rizla
SourceMod Donor
Join Date: Jun 2010
Old 11-04-2010 , 09:24   Re: Admin Display from SB
Reply With Quote #34

Code:
$sql = "SELECT user,authid,srv_group,gid FROM sb_admins WHERE srv_group = 'SERVER GROUP 1' OR srv_group = 'SERVER GROUP 2' OR srv_group = 'SERVER GROUP 3' ORDER BY gid ASC";


You need to change your server groups to their real names. Lets say you have one called server admins and one called donators, you need to change it so it looks like:

Code:
$sql = "SELECT user,authid,srv_group,gid FROM sb_admins WHERE srv_group = 'server admins' OR srv_group = 'donators' ORDER BY gid ASC";


Type in the name exactly, thats why its connecting fine and not showing any results. If you have 10 groups and want all but one to be shown then the one you dont want shown use:

WHERE srv_group <> "GROUP NAME"
Rizla is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 11-04-2010 , 10:35   Re: Admin Display from SB
Reply With Quote #35

Thx its working fine now!

Whene I was looking to adress "body" in the stylesheet i noticed you closed the body tag in admins.php but you didint open the body tag. Is this something with php i dont know about or is it a mistake?
Groger is offline
Rizla
SourceMod Donor
Join Date: Jun 2010
Old 11-04-2010 , 10:58   Re: Admin Display from SB
Reply With Quote #36

mistake :O

that must have been from my current project where im including a header which has the tags (c&p ftw)

have noticed that your getting the same problem with the links:

E+12 at the end, you need to use the bc math or the sql version. now that 8088 has posted the code i can help you with it if you run into any more trouble

Last edited by Rizla; 11-04-2010 at 11:00.
Rizla is offline
PabloP
SourceMod Donor
Join Date: Feb 2010
Old 11-04-2010 , 19:35   Re: Admin Display from SB
Reply With Quote #37

This is awesome thanks guys
__________________
Beware, Im a dummy
PabloP is offline
bouncer
Veteran Member
Join Date: Apr 2009
Old 11-04-2010 , 19:52   Re: Admin Display from SB
Reply With Quote #38

nvm
__________________



Last edited by bouncer; 11-04-2010 at 19:57.
bouncer is offline
Rizla
SourceMod Donor
Join Date: Jun 2010
Old 11-04-2010 , 21:29   Re: Admin Display from SB
Reply With Quote #39

glad to see its working bouncer and im happy to see that a few of you are using it! my effort was not in vein

although i am confused how my page worked fine on the code yet it displayed incorrect ids on others. 8088 can you explain?
Rizla is offline
Gippo
AlliedModders Donor
Join Date: Oct 2008
Old 11-04-2010 , 21:42   Re: Admin Display from SB
Reply With Quote #40

Probably because the webhost did not have their php supporting the script.
Gippo is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:55.


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