Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
MarkyBear
Hangin' Around



Joined: Mar 27, 2005
Posts: 39

PostPosted: Sun May 15, 2005 7:39 pm Reply with quote

I installed the Site Info block from here and I love it, heck of alot better then what I had on there before, so thanx for that!

My question, how would I go about removing where it shows the Post count below the avatar? I see where the code is to display it, but if I'm not mistaken(which I prolly am). just removing the display part won't fully get rid of it...Out of no where, the queries on my site jumped from the 20's, 30's and 40's to a couple hundred and I'm trying to cut back all things I don't need on there...

Here's the code again, so you don't have to search:

Code:
if (eregi("block-User_Info.php",$_SERVER['PHP_SELF'])) {

    Header("Location: index.php");
}

function convertIP ($xip) {
   global $admin;
   if (is_admin($admin)) return $xip;
   $xipx = explode('.',$xip);
   for ($i=2;$i<count($xipx);$i++) {
      $xipx[$i] = preg_replace ('/(0|1|2|3|4|5|6|7|8|9)/', "x", $xipx[$i]);
   }
   return implode('.',$xipx);
}


$content = "";

mt_srand ((double)microtime()*1000000);
global $dbi, $nukeurl, $startdate, $user, $cookie, $prefix, $user_prefix, $db, $anonymous, $mode, $t, $f, $redirect, $random_num, $admin, $gfx_chk;
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];

// Get the last user added to the database and the total users, minus anonymous
$sql = "SELECT username,user_id FROM $user_prefix"._users." ORDER BY user_id DESC LIMIT 0,1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$lastusername = $row[username];
$lastuser = $row[user_id];
$numrows = $db->sql_fetchrow($db->sql_query("SELECT count(user_id) user_id FROM $user_prefix"._users.""));
$numrows = $numrows['user_id'];
$numrows1 = $numrows-1;

$sql = "SELECT s.host_addr, u.user_id, u.username, u.user_allow_viewonline FROM $prefix"._session." s,".$user_prefix."_users u WHERE s.guest=0 AND u.username=s.uname";
$result = $db->sql_query($sql);
$member_online_num = $db->sql_numrows($result);
$who_online_now = "";
$i = 1;
$hiddenTotal = 0;
while ($member_result = $db->sql_fetchrow($result)) {
    if ($i < 10) $zi = "0$i";
    else $zi = $i;
    if (is_admin($admin)) {
      $zi = "<a href=\"http://www.samspade.org/t/lookat?a=".$member_result[host_addr]."\" target=\"_blank\">".$zi."</a>";
   }
   $sessionNameModified = strlen($member_result[username])<13?$member_result[username]:substr($member_result[username],0,10)."...";
    if (!$member_result[user_allow_viewonline]&&!is_admin($admin)) {
      $hiddenTotal++;
   }
    elseif (!$member_result[user_allow_viewonline]&&is_admin($admin)) {
      $hiddenTotal++;
      $who_online_now .= "$zi:&nbsp;<a href=\"userinfo-.html$member_result[username]\"><img src=\"images/blocks/icon_mini_profile.gif\" border=\"0\" alt=\"Check the profile of $member_result[username]\"></a>&nbsp;<a href=\"messages-post-.html$member_result[user_id]\"><img src=\"images/blocks/nopm.gif\" border=\"0\" alt=\"Send a quick private message to $member_result[username]\"></a>&nbsp;<A HREF=\"forums.html?file=profile&mode=viewprofile&u=$member_result[user_id]\">".$sessionNameModified."</a>(H)<br />\n";
       $who_online_now .= ($i != $member_online_num ? "  " : "");
       $i++;
   }
    else {
      $who_online_now .= "$zi:&nbsp;<a href=\"userinfo-.html$member_result[username]\"><img src=\"images/blocks/icon_mini_profile.gif\" border=\"0\" alt=\"Check the profile of $member_result[username]\"></a>&nbsp;<a href=\"messages-post-.html$member_result[user_id]\"><img src=\"images/blocks/nopm.gif\" border=\"0\" alt=\"Send a quick private message to $member_result[username]\"></a>&nbsp;<A HREF=\"forums.html?file=profile&mode=viewprofile&u=$member_result[user_id]\">".$sessionNameModified."</a><br />\n";
       $who_online_now .= ($i != $member_online_num ? "  " : "");
       $i++;
   }
}

$sql = "SELECT SQL_NO_CACHE uname, guest FROM $prefix"._session." WHERE guest=1";
$result = $db->sql_query($sql);
$gmember_online_num = $db->sql_numrows($result);
$gwho_online_now = "";
$gArray = Array();
while ($session = $db->sql_fetchrow($result)) {
    if (isset($session["guest"]) and $session["guest"] == 1) {
      $gArray[] = convertIP($session['uname']);
   }
}
sort($gArray,SORT_NUMERIC);
for ($j=0;$j<count($gArray);$j++) {
   if ($i < 10) $zi = "0$i";
   else $zi = $i;
   $gwho_online_now .= "$zi:&nbsp;<a href=\"http://www.samspade.org/t/lookat?a=".$gArray[$j]."\" target=\"_blank\">".$gArray[$j]."</a><br />\n";
   $gwho_online_now .= ($i != $gmember_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 Yesterday
$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

$sql = "SELECT uname FROM ".$prefix."_session WHERE guest=1";
$result = $db->sql_query($sql);
$guest_online_num = $db->sql_numrows($result);
$sql = "SELECT uname FROM ".$prefix."_session WHERE guest=0";
$result = $db->sql_query($sql);
$member_online_num = $db->sql_numrows($result)-$hiddenTotal;
$who_online_num = $guest_online_num + $member_online_num;
if (is_admin($admin)) $who_online_num = $who_online_num + $hiddenTotal;

$sql = "SELECT username FROM ".$prefix."_users_temp";
$result = $db->sql_query($sql);
$waiting = $db->sql_numrows($result);

$content .= "<form action=\"account.html\" method=\"post\">";

if (is_user($user)) {
   $sqlp = "SELECT user_posts AS posts FROM $user_prefix"._users." WHERE username = '$uname'";
   $result = $db->sql_query($sqlp);
   $row = $db->sql_fetchrow($result);
   $posts = $row[posts];
   $sql = "SELECT user_avatar FROM " . $prefix."_users WHERE username='$uname' AND user_avatar IS NOT NULL";
   $result = $db->sql_query($sql);
   if ($result) {
      $userinfo = $db->sql_fetchrow($result);
       if ( ereg( "(http)", $userinfo[user_avatar]) ) {
         $content .= "<br /><center><img src=\"$userinfo[user_avatar]\" /></center>\n";
       }
       else
       if ($userinfo[user_avatar]) {
         $content .= "<br /><center><img src=\"modules/Forums/images/avatars/$userinfo[user_avatar]\" /></center>\n";
       }
   }
   if ($posts>0) $content .= "<br /><center>$posts post(s)</center>\n";
    $content .= "<br /><img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL.", <b>$uname</b>.<br />\n\n";
    $content .= "<a href=\"modules.php?name=Your_Account&amp;op=logout\"><img src=\"images/blocks/arrow-blk.gif\" width=\"17\" border=0>&nbsp;Logout</a>\n<hr>\n";
    $sql = "SELECT user_id FROM $user_prefix"._users." WHERE username='$uname'";
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $uid = $row[user_id];
   $sql = "SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_to_userid='$uid' AND privmsgs_type='5'";
   $result = $db->sql_query($sql);
   $een = $db->sql_numrows($result);
   $sql = "SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_to_userid='$uid' AND privmsgs_type='1'";
   $result = $db->sql_query($sql);
   $twee = $db->sql_numrows($result);
   $newpms = $een + $twee;
   $sql = "SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_to_userid='$uid' AND privmsgs_type='0'";
   $result = $db->sql_query($sql);
   $oldpms = $db->sql_numrows($result);
   $content .= "<img src=\"images/blocks/email-y.gif\" height=\"10\" width=\"14\"> <a href=\"messages.html\"><b>"._BPM."</b></a><br />\n";
    $content .= "<img src=\"images/blocks/email-r.gif\" height=\"10\" width=\"14\"> "._BUNREAD.": <b>$newpms</b><br />\n";
    $content .= "<img src=\"images/blocks/email-g.gif\" height=\"10\" width=\"14\"> "._BREAD.": <b>$oldpms</b><br />\n<hr>\n";
} else {
    $content .= "<img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL.", <b>$anonymous</b>\n<hr>";
    $content .= "<table><tr><td>"._NICKNAME."</td><td><input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\"></td></tr>";
    $content .= "<tr><td>"._PASSWORD."</td><td><input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\"></td></tr></table>";
    if (extension_loaded("gd") AND ($gfx_chk == 2 OR $gfx_chk == 4 OR $gfx_chk == 5 OR $gfx_chk == 7)) {
       mt_srand ((double)microtime()*1000000);
       $maxran = 1000000;
      $random_num = mt_rand(0, $maxran);
      $content .=""._SECURITYCODE.": <img src='modules.php?name=Your_Account&op=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'>\n";
      $content .="<br />"._TYPESECCODE.": <input type=\"text\" NAME=\"gfx_check\" SIZE=\"11\" MAXLENGTH=\"10\"><br>\n";
      $content .="<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\n";
    }
   $content .="<input type=\"hidden\" name=\"redirect\" value=$redirect>\n";
   $content .="<input type=\"hidden\" name=\"mode\" value=$mode>\n";
   $content .="<input type=\"hidden\" name=\"f\" value=$f>\n";
   $content .="<input type=\"hidden\" name=\"t\" value=$t>\n";
    $content .= "<input type=\"hidden\" name=\"op\" value=\"login\">";
    $content .= "<input type=\"submit\" value=\""._LOGIN."\">\n<br /><a href=\"modules.php?name=Your_Account&amp;op=new_user\">&middot;&nbsp;"._BREG."</a><br>";
    $content .= "<a href=\"modules.php?name=Your_Account&amp;op=pass_lost\">&middot;&nbsp;"._PASSWORDLOST."</a><hr>";
}
if (is_user($user)||is_admin($admin)) {
   $content .= "<img src=\"images/blocks/group-2.gif\" height=\"14\" width=\"17\"> <b><u>"._BMEMP.":</u></b><br />\n";
   $content .= "<img src=\"images/blocks/ur-moderator.gif\" height=\"14\" width=\"17\"> "._BLATEST.": <a href=\"userinfo-.html$lastusername\"><img src=\"images/blocks/icon_mini_profile.gif\" border=\"0\" alt=\"Check the profile of $lastusername\"></a>&nbsp;<A HREF=\"forums.html?file=profile&mode=viewprofile&u=$lastuser\"><b>$lastusername</b></a><br />\n";
   if (is_admin($admin) AND @file_exists("modules/UserInfoAddons/index.php")) {
      $btdLink = "<a href=\"modules.php?name=UserInfoAddons&amp;timespan=today\">"._BTD."</a>";
      $bydLink = "<a href=\"modules.php?name=UserInfoAddons&amp;timespan=yest\">"._BYD."</a>";
   }
   else {
      $btdLink = _BTD;
      $bydLink = _BYD;
   }
   $content .= "<img src=\"images/blocks/ur-author.gif\" height=\"14\" width=\"17\"> ".$btdLink.": <b>$userCount</b><br />\n";
   $content .= "<img src=\"images/blocks/ur-admin.gif\" height=\"14\" width=\"17\"> ".$bydLink.": <b>$userCount2</b><br />\n";
   if (is_admin($admin) AND @file_exists("modules/Resend_Email/index.php")) $waitLink = "<a href=\"modules.php?name=Resend_Email\" title=\"Resend Email phpNuke Module at RavenPHPScripts\">".Waiting."</a>";
   else $waitLink = Waiting;
   $content .= "<img src=\"images/blocks/ur-member.gif\" height=\"14\" width=\"17\"> ".$waitLink.": <b>$waiting</b><br />\n";
   $content .= "<img src=\"images/blocks/ur-guest.gif\" height=\"14\" width=\"17\"> "._BOVER.": <b>$numrows1</b><br />\n<hr>\n";
}
$content .= "<img src=\"images/blocks/group-3.gif\" height=\"14\" width=\"17\"> <b><u>"._BVISIT.":</u></b>\n<br />\n";
$content .= "<img src=\"images/blocks/ur-anony.gif\" height=\"14\" width=\"17\"> "._BVIS.": <b>$guest_online_num</b><br />\n";
$content .= "<img src=\"images/blocks/ur-member.gif\" height=\"14\" width=\"17\"> "._BMEM.": <b>$member_online_num</b><br />\n";
if (is_user($user)||is_admin($admin)) {
   if (is_admin($admin)) {
      $content .= "<img src=\"images/blocks/ur-hiddenmember.gif\" height=\"14\" width=\"17\"> "."Hidden".": <b>$hiddenTotal</b><br />\n";
   }
   $content .= "<img src=\"images/blocks/ur-registered.gif\" height=\"14\" width=\"17\"> "._BTT.": <b>$who_online_num</b><br />\n<hr noshade>\n";
   if ($member_online_num > 0 || is_admin($admin)) {
      $content .= "<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\" align=\"middle\"> <b><u>"._BON.":</u></b><br />$who_online_now";
      $hr = "\n<hr noshade>\n";
   }
   if ($gmember_online_num > 0 && ($showGuests||($showGuestsAdmin&&is_admin($admin)))) {
      $content .= "<br />$gwho_online_now";
      $hr = "\n<hr noshade>\n";
   }
   $content .= $hr;

   /* Hits for Today */
   $t_time = time();
   $t_year = date("Y", $t_time);
   $t_month = date("n", $t_time);
   $t_date = date("j", $t_time);
   $result = sql_query("SELECT hits FROM $prefix"._stats_date." WHERE year='$t_year' AND month='$t_month' AND date='$t_date'", $dbi);
   list($today) = sql_fetch_row($result, $dbi);
   if (is_admin($admin)) {
      /* Hits for Yesterday */
      $y_time = $t_time - 86400;
      $y_year = date("Y", $y_time);
      $y_month = date("n", $y_time);
      $y_date = date("j", $y_time);
      $result = sql_query("SELECT hits FROM $prefix"._stats_date." WHERE year='$y_year' AND month='$y_month' AND date='$y_date'", $dbi);
      list($yesterday) = sql_fetch_row($result, $dbi);
   }
}
else {
   $hr = "\n<hr noshade>\n";
   $content .= $hr;
}
   /* Hits in Total */
   $totalhits = 0;
   $result = sql_query("SELECT sum(hits) FROM $prefix"._stats_year."", $dbi);
   list($totalhits) = sql_fetch_row($result, $dbi);
   $content .= "<center><small>"._WERECEIVED."</small><br />\n";
   $content .= "<b>$totalhits</b><br />\n";
   $content .= "<small>"._PAGESVIEWS."<br />$startdate</small></center>";
   $content .= "<hr noshade>";
if (is_user($user)||is_admin($admin)) {
   $content .= "<center>"._BHITS." "._BTD.": <b>$today</b><br />";
   if (is_admin($admin)) {
      $content .= ""._BHITS." "._BYD.": <b>$yesterday</b><br /></center>";
   }
   else $content .= "</center>";
}
if ($showServerDateTime || ($showServerDateTimeAdmin&&is_admin($admin))) {
if (is_user($user)||is_admin($admin)) {
   $content .= "<hr noshade>";
}
   $sdt = date("j F Y\nH:i:s T");
   $zone = date("Z")/3600;
   if ($zone >= 0) {
      $zone = "+".$zone;
   }
   $content .= "<center>"._SERDT."<br />$sdt (GMT $zone)</center>";
}
$content .= "</form>";

?>


Thanx for your time and any help given for this!
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sun May 15, 2005 8:20 pm Reply with quote

This is the bit of code that is doing the call:

Code:
if (is_user($user)) { 

   $sqlp = "SELECT user_posts AS posts FROM $user_prefix"._users." WHERE username = '$uname'";
   $result = $db->sql_query($sqlp);
   $row = $db->sql_fetchrow($result);
   $posts = $row[posts];
   $sql = "SELECT user_avatar FROM " . $prefix."_users WHERE username='$uname' AND user_avatar IS NOT NULL";
   $result = $db->sql_query($sql);


make it look like this instead:

Code:


if (is_user($user)) {
//   $sqlp = "SELECT user_posts AS posts FROM $user_prefix"._users." WHERE username = '$uname'";
//   $result = $db->sql_query($sqlp);
//   $row = $db->sql_fetchrow($result);
   $posts = 0;
   $sql = "SELECT user_avatar FROM " . $prefix."_users WHERE username='$uname' AND user_avatar IS NOT NULL";
   $result = $db->sql_query($sql);


Please notice that I changed the $posts variable to set it to 0. It will be checked later on and if 0, it will not show the posts.

Regards,
montego

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
MarkyBear







PostPosted: Sun May 15, 2005 8:24 pm Reply with quote

Ok I see it, I noticed that on the block here, I had no posts and nothing was showing, I like it!

Hey thanx for the quick help, I do appreciate it!

~Peace
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©