- Readme First! - Read and follow the rules, otherwise your posts will be closed
There are currently, 52 guest(s) and 1 member(s) that are online. You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - sig generator for my site [ ]
Author
Message
McKooter
Sergeant
Joined: Nov 22, 2003
Posts: 101
Posted:
Thu May 26, 2005 3:27 am
I have tried, thats why i wanted just one basic example of something i wasnt really interested in at having, just to see how it works
ill let you know where i think i need to be at:
Code:
$sql = "SELECT u.username, u.user_id, s.session_logged_in, s.session_ip
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 3600 ) . "
$user_forum_sql
ORDER BY u.username ASC, s.session_ip ASC";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
}
im pretty sure i need to add more query items in there, but im also fairly sure that whatever ive been trying to do is entirely wrong,
but i cant see how they grabbed any of the information and from where,
BrainSmashR
Support Mod
Joined: Jan 05, 2004
Posts: 1390
Location: Louisiana, USA
Posted:
Thu May 26, 2005 8:01 am
It's almost in plain English
SELECT u.username, u.user_id, s.session_logged_in, s.session_ip
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
Below is a condition so all information is not selected
WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 3600 ) . "
Below is the order in which the information will be stored for display
ORDER BY u.username ASC, s.session_ip ASC";
somewhere else in the code (that you have not included) is where the content is displayed.
_________________
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
McKooter
Sergeant
Joined: Nov 22, 2003
Posts: 101
Posted:
Thu May 26, 2005 7:17 pm
i understand the basics. let me show you what i think and you can tell me how i messed it up(if you would, )
Code:
$sql = "SELECT u.username, u.user_id, s.session_logged_in, s.session_ip
i assume the u. and s. are to seperate the two tables from the query, so my new one would be somthing like
Code:
$sql = "SELECT u.username, u.user_id, s.session_logged_in, s.session_ip, b.ip_address
now i have to tell it which table to get the b. from that is here:
Code:
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
i need to make it more like this:
Code:
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s, "nuke_banned_ip" b
thats what ive got, now i know that ive (if im anywhere close) selected the ip_address column from the nuke_banned_ip table. But i need to select the newest one, thats where i get lost, how to select a specific one, i understand its in teh WHERE and AND statement but im confused on how to run it and am pretty sure the script ive tried up untill this point may be wrong,
so if you could guide me a little more it would be great, btw thanks for the help
BrainSmashR
Support Mod
Joined: Jan 05, 2004
Posts: 1390
Location: Louisiana, USA
Posted:
Fri May 27, 2005 2:31 am
I don't seem to have a banned_ip table in my database, so it's hard forme to say......but there should be a field in there somewhere indicating a time they were banned, or an id indicating which order they were banned in.....you'll have to reference that for your order.
Warning: I am not a coder by any stretch of the imagination....you are on the line of my knowledge limit. I can explain why and how something works.....very rarely can I create something new that works....but I'll certainly continue to offer my assistance as long as I can.....
_________________
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
McKooter
Sergeant
Joined: Nov 22, 2003
Posts: 101
Posted:
Mon May 30, 2005 6:07 pm
okay ive been playing with it for days, no luck
so if someone could please show me what code you would add to show...
the last post in the forum, (just random out of the hat idea for learning purposes)
that would be awesome
im not sure if i modify that select or make a new one, and either way i try it it just loads normal or dosent load at all. i have a book (trying to learn) but i just cant seem to grasp this idea (i know its simple but im just at a bump in the road)
thanks
BrainSmashR
Support Mod
Joined: Jan 05, 2004
Posts: 1390
Location: Louisiana, USA
Posted:
Tue May 31, 2005 2:31 am
Code:
<?php
$phpbb_root_path = 'modules/Forums/';
define('IN_PHPBB', true);
include ('config.php');
include ('db/db.php');
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$sql = "SELECT g.* , u.username FROM ".$prefix."_bbgames g, ".$prefix."_users u WHERE g.game_highuser = u.user_id ORDER BY game_highdate DESC LIMIT 0,1 " ;
if(!($result = $db->sql_query($sql)))
{
die("Could not query games user information");
}
$row = $db->sql_fetchrow($result);
$lastScore = $row['game_highscore'];
$lastGame = $row['game_name'];
$lastUser = $row['username'];
$lastgameid = $row['game_id'];
$lastgamepic = $row['game_pic'];
$lastuserid = $row['game_highuser'];
$sql = "SELECT uname FROM $user_prefix"._users." ORDER BY uid DESC LIMIT 0,1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$lastuser = $row[uname];
$numrows = $db->sql_numrows($db->sql_query("SELECT uid FROM $user_prefix"._users.""));
$sql = "SELECT uname, guest FROM $prefix"._session." WHERE guest=0";
$result = $db->sql_query($sql);
$member_online_num = $db->sql_numrows($result);
$who_online_now = "";
$i = 1;
while ($session = $db->sql_fetchrow($result)) {
if (isset($session["guest"]) and $session["guest"] == 0) {
if ($i < 10) {
$who_online_now .= "0$i: <A HREF=\"modules.php?name=Your_Account&op=userinfo&uname=$session[uname]\">$session[uname]</a><br>\n";
} else {
$who_online_now .= "$i: <A HREF=\"modules.php?name=Your_Account&op=userinfo&uname=$session[uname]\">$session[uname]</a><br>\n";
}
$who_online_now .= ($i != $member_online_num ? " " : "");
$i++;
}
}
$guest_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest=1"));
$member_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest=0"));
$who_online_num = $guest_online_num + $member_online_num;
$ip_address = $_SERVER['REMOTE_ADDR'];
// get the forum_ids which aren't allowed
$sql = "SELECT forum_id
FROM ". FORUMS_TABLE ."
WHERE auth_view >= 3";
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Could not get forum_ids", "", __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result))
{
$forum_ids[] = $row['forum_id'];
}
if ($forum_ids[0] != '')
{
$forum_ids = implode(" AND forum_id != ",$forum_ids);
$forum_ids = "forum_id != " . $forum_ids ;
$sql = 'SELECT max(topic_id)
FROM ' . TOPICS_TABLE . '
WHERE ' . $forum_ids;
}
else
{
$sql = 'SELECT max(topic_id)
FROM ' . TOPICS_TABLE;
}
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn\'t retrieve max of Topic_id data', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result))
{
$max_topic_id = $row['max(topic_id)'];
}
$sql = 'SELECT topic_title
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $max_topic_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn\'t retrieve Topic_id data', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result))
{
$latest_topic = $row['topic_title'];
}
$result=mysql_query("select * from $prefix"._downloads_downloads."");
$numrows =mysql_num_rows($result);
$sql = "SELECT lid, title, hits
FROM $prefix"._downloads_downloads." order by date DESC limit 0,1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn\'t retrieve newest of Download', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result))
{
$downloadtitle = $row['title'];
}
$version = '2'.$board_config['version'];
$description = $board_config['site_desc'];
$image = "signature.png";
$im = imagecreatefrompng($image);
$yel = ImageColorAllocate ($im, 224, 255, 0);
$tc = ImageColorAllocate ($im, 255, 255, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$blue = ImageColorAllocate ($im, 0, 255, 255);
$grn = ImageColorAllocate ($im, 0, 221, 0);
$sitename = $board_config['sitename'];
list($count) = $db->sql_fetchrow($db->sql_query("SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'"));
$total_users = get_db_stat('usercount');
$total_posts = get_db_stat('postcount');
$total_topics = get_db_stat('topiccount');
$j = strlen($total_users);
$leerzeichen = $j*6+175;
$j2 = strlen($latest_topic);
if ($j2>48)
{
$words = explode (" ", $latest_topic);
$text = '';
$latest_topic = '';
for($i=0;strlen($text) < 42;$i++) {
$text = $text . $words[$i] . " ";
}
$latest_topic = str_replace($words[$i-1],"...",$text);
}
$now = date("M d,Y H:i:s");
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$lines = file("play.txt");
$artist = trim($lines[0]);
$title = trim($lines[1]);
$play = trim($lines[2]);
if ($play) $header = "Banging my head to:";
else $header = "Last tune played:";
if (strlen($artist)>23) $artist = substr($artist, 0, 30);
if ($artist == "-"){
$artist=substr($title, 0, strpos($title, "-")+1);
$title=substr($title, strpos($title, "-")+1, strlen($title));
}
if (strlen($title)>23) $title = substr($title, 0, 70);
$max = max(strlen($artist), strlen($title));
$font = 2;
$artist_width = strlen($artist) * imagefontwidth($font);
$title_width = strlen($title) * imagefontwidth($font);
$background = imagecolorallocate($im,0,0,0);
$text_color = imagecolorallocate($im, 255,255,0);
$ax = 100-($artist_width/2);
$tx = 100 -($title_width/2);
$y=18;
//ImageString($im, 5, 15, 65, "Click here to visit BrainSmashR.com", $yel);
ImageString($im, 2, 70, 35, "$lastScore", $red);
ImageString($im, 2, 1, 35, "High Score:", $tc);
ImageString($im, 2, 115, 35, "set on:", $tc);
ImageString($im, 2, 160, 35, "$lastGame", $red);
ImageString($im, 2, 265, 35, "by:", $tc);
ImageString($im, 2, 285, 35, "$lastUser", $red);
ImageString($im, 2, 1, 12, "Total Members:", $blue);
ImageString($im, 2, 90, 12, "$total_users", $grn);
ImageString($im, 2, 115, 12, "Users Online:", $blue);
ImageString($im, 2, $leerzeichen, 12, " $who_online_num", $grn);
ImageString($im, 2, 215, 12, "Newest:", $blue);
//ImageString($im, 2, 1, 31, "----------------------------------", $yel);
ImageString($im, 3, 1, 1, "$sitename", $yel);
//ImageString($im, 2, 216, 60, "$now", $blue);
ImageString($im, 2, 120, 1, "$count", $red);
ImageString($im, 2, 155, 1, "page views since", $tc);
ImageString($im, 2, 255, 1, "May 19, 2005.", $red);
ImageString($im, 2, 260, 12, "$newest_user", $grn);
ImageString($im, 2, 180, 23, "Latest:", $yel);
ImageString($im, 2, 230, 23, "$latest_topic", $grn);
ImageString($im, 2, 1, 23, "Forum:", $yel);
ImageString($im, 2, 42, 23, "$total_posts", $grn);
ImageString($im, 2, 1, 23, "Forum:", $blue);
ImageString($im, 2, 110, 23, "$total_topics", $grn);
ImageString($im, 2, 65, 23, "posts", $blue);
//ImageString($im 2, 130, 11, "$numviews[0]", $grn);
ImageString($im, 2, 134, 23, "topics", $blue);
//ImageString($im, 2, 1, 35, "Total Downloads:", $tc);
//ImageString($im, 2, 101, 35, "$numrows", $red);
//ImageString($im, 2, 119, 35, "Newest Download:", $tc);
//ImageString($im, 2, 220, 35, "$downloadtitle", $red);
//ImageString($im, 2, 141, 40, "Platinum Version:", $tc);
//ImageString($im, 2, 255, 40, "7.5", $red);
//ImageString($im, 2, 93, 40, "phpBB Version:", $tc);
//ImageString($im, 2, 340, 40, "$version ", $red);
//ImageString($im, 2, 1, 60, "Your IP:", $red);
//ImageString($im, 2, 50, 60, "$ip_address", $tc);
//ImageString($im, 4, 13, 35, "Click Here For BrainSmashR.com", $yel);
//SETI
imagestring ($im, 3, 1, 50, $header, $red);
imagestring ( $im, 3, 140, 46,$artist, $tc);
//imagestring ( $im, 2, 195, 46,"-", $red);
imagestring ( $im, 2, 140, 60,$title, $grn);
header("Content-Type: image/png");
Imagepng($im,'',100);
ImageDestroy ($im);
?>
Here is my entire signature. Feel free to use anything you wish.
_________________
USE THE FORUM. If you contact me via messenger for support I will add you to my ignore list.
McKooter
Sergeant
Joined: Nov 22, 2003
Posts: 101
Posted:
Tue May 31, 2005 3:37 am
thanks so much brian, ill pick it apart and make something new
youve been a great help,
Kiwijockey
Nuke Cadet
Joined: Sep 20, 2003
Posts: 6
Location: New Zealand
Posted:
Mon Sep 05, 2005 3:15 am
Test of my signature
_________________
Goto page Previous 1 , 2 , 3 , 4 , 5 , 6
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum