- Readme First! - Read and follow the rules, otherwise your posts will be closed
There are currently, 53 guest(s) and 0 member(s) that are online. You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - UserInfo Block Help plz :) [ ]
Author
Message
andrewy3k
Nuke Cadet
Joined: Sep 09, 2006
Posts: 4
Posted:
Fri Sep 08, 2006 3:42 pm
Alright, I am kinda still a noob with nuke but I modified this user info block of mine off the original that came with phpnuke v7.8.
My problem with it:
1. Right above "Hey, $uname" I want to display the users Avatar picture pulled from PHPBB.. is this possible or maybe too complicated? How can I do this?
Thanks again ahead of time.. heres the code...
Code:
<?php
if (eregi("block-User_Info.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
}
$content = "";
global $user, $cookie, $prefix, $user_prefix, $db, $anonymous, $sitekey;
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 10);
cookiedecode($user);
$uname = $cookie[1];
$lasturow = $db->sql_fetchrow($db->sql_query("SELECT username FROM $user_prefix"._users." ORDER BY user_id DESC LIMIT 0,1"));
$lastuser = $lasturow['username'];
$numrows = $db->sql_numrows($db->sql_query("SELECT user_id FROM $user_prefix"._users.""));
$result = $db->sql_query("SELECT uname, guest FROM $prefix"._session." WHERE guest='0'");
$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&username=$session[uname]\">$session[uname]</a><br>\n";
} else {
$who_online_now .= "$i: <A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$session[uname]\">$session[uname]</a><br>\n";
}
$who_online_now .= ($i != $member_online_num ? " " : "");
$i++;
}
}
$Today = getdate();
//Formatting Current Date
$month = $Today['month'];
$mday = $Today['mday'];
$year = $Today['year'];
//Formatting Previous Date
$pmonth = $Today['month'];
$pmday = $Today['mday'];
$pmday = $mday-1;
$pyear = $Today['year'];
//Month conversion into numeric mode
if ($pmonth=="January") { $pmonth=1; } else
if ($pmonth=="February") { $pmonth=2; } else
if ($pmonth=="March") { $pmonth=3; } else
if ($pmonth=="April") { $pmonth=4; } else
if ($pmonth=="May") { $pmonth=5; } else
if ($pmonth=="June") { $pmonth=6; } else
if ($pmonth=="July") { $pmonth=7; } else
if ($pmonth=="August") { $pmonth=8; } else
if ($pmonth=="September") { $pmonth=9; } else
if ($pmonth=="October") { $pmonth=10; } else
if ($pmonth=="November") { $pmonth=11; } else
if ($pmonth=="December") { $pmonth=12; };
$test = mktime (0,0,0,$pmonth,$pmday,$pyear,1);
//Creating SQL parameter
$curDate2 = "%".$month[0].$month[1].$month[2]."%".$mday."%".$year."%";
$preday = strftime ("%d",$test);
$premonth = strftime ("%B",$test);
$preyear = strftime ("%Y",$test);
$curDateP = "%".$premonth[0].$premonth[1].$premonth[2]."%".$preday."%".$preyear."%";
//Executing SQL Today
$row = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDate2'"));
$userCount = $row['userCount'];
//end
//Executing SQL Today
$row2 = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDateP'"));
$userCount2 = $row2['userCount'];
//end
$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;
$content .= "<form action=\"modules.php?name=Your_Account\" method=\"post\">";
if (is_user($user)) {
$content .= "<center>Hey, <b>$uname</b>!<br></center>\n<hr>\n";
$row3 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM $user_prefix"._users." WHERE username='$uname'"));
$uid = intval($row3[user_id]);
$newpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs."
WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='5' OR privmsgs_type='1')"));
if ($newpms > 0)
{
$content .="<center><b><a href='modules.php?name=Private_Messages'><img src='images/blocks/newpm.gif' border='0'></a><br>";
$content .="<a href='modules.php?name=Private_Messages'>You have Mail!</b></a></center><hr>";
}
else {
$content .="<center><b><a href='modules.php?name=Private_Messages'>0 New Messages</b></a>";
$content .= "</a></center><hr>";
}
} else {
$content .= "<center>Hey, <b>Guest</b>!</center>\n<hr>";
$content .= ""._NICKNAME." <input type=\"text\" name=\"username\" size=\"20\" maxlength=\"25\"><br>";
$content .= ""._PASSWORD." <input type=\"password\" name=\"user_password\" size=\"20\" maxlength=\"20\"><br>";
$content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">";
$content .= "<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">";
$content .= "<input type=\"hidden\" name=\"op\" value=\"login\">";
$content .= "<input type=\"submit\" value=\""._LOGIN."\">\n (<a href=\"modules.php?name=Your_Account&op=new_user\">"._BREG."</a>)";
$content .= "<hr>";
}
$content .= " <img src=\"images/blocks/group-3.gif\" height=\"14\" width=\"17\"> <b><u>"._BMEMP."</u></b> <img src=\"images/blocks/group-3.gif\" height=\"14\" width=\"17\"><br>\n";
$content .= "<img src=\"images/blocks/blank_user_info.gif\" height=\"17\" width=\"1\"> "._BLATEST.": <A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$lastuser\"><b>$lastuser</b></a><br>\n";
$content .= "<img src=\"images/blocks/blank_user_info.gif\" height=\"14\" width=\"1\"> "._BTD.": <b>$userCount</b><br>\n";
$content .= "<img src=\"images/blocks/blank_user_info.gif\" height=\"14\" width=\"1\"> "._BYD.": <b>$userCount2</b><br>\n";
$content .= "<img src=\"images/blocks/blank_user_info.gif\" height=\"14\" width=\"1\"> "._BOVER.": <b>$numrows</b><br>\n<hr>\n";
$content .= " <img src=\"images/blocks/icon_connect.gif\" height=\"14\" width=\"17\"> <b><u>Who's Online</u></b> <img src=\"images/blocks/icon_connect.gif\" height=\"14\" width=\"17\"><br>\n";
$content .= "<img src=\"images/blocks/blank_user_info.gif\" height=\"17\" width=\"1\"> "._BVIS.": <b>$guest_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/blank_user_info.gif\" height=\"14\" width=\"1\"> "._BMEM.": <b>$member_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/blank_user_info.gif\" height=\"14\" width=\"1\"> "._BTT.": <b>$who_online_num</b><br>\n";
$content .= "<hr>\n";
$content .= "<center><a href=\"backend.php\"><img src=\"images/rss_logo.gif\" border=\"0\"></a> <a href=\"modules.php?name=Your_Account&op=logout\"><img src=\"images/logout.gif\" border=\"0\"></a></center>\n";
$content .= "</form>";
?>
andrewy3k
Nuke Cadet
Joined: Sep 09, 2006
Posts: 4
Posted:
Sat Sep 09, 2006 6:29 am
anyone?
scribby
Nuke Soldier
Joined: Apr 25, 2005
Posts: 25
Posted:
Mon Oct 16, 2006 7:25 am
I made a new userinfo block, you can view at http://www.nukedphp.com/, it has the code to display a users avatar.
I will be releasing it for download to the public shortly (within the next 24 hours).
_________________ [URL=http://www.scribbytech.com/]SCRIBBYTECH[/url]
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