home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / unitednuke / unitednuke.exe / html / blocks / block-User_Info.php < prev    next >
PHP Script  |  2004-01-10  |  8KB  |  133 lines

  1. <?php
  2.  
  3. /************************************************************/
  4. /*                                                          */
  5. /* Updated for PHP-Nuke 5.6 -  18 Jun 2002 NukeScripts      */
  6. /* website http://www.nukescripts.com                       */
  7. /*                                                          */
  8. /* Updated for PHP-Nuke 5.5 - 24/03/2002 Rugeri             */
  9. /* website http://newsportal.homip.net                      */
  10. /*                                                          */
  11. /* (C) 2002                                                 */
  12. /* All rights beyond the GPL are reserved                   */
  13. /*                                                          */
  14. /* Please give a link back to my site somewhere in your own */
  15. /*                                                          */
  16. /************************************************************/
  17.  
  18. if (eregi("block-block-User_Info.php",$_SERVER['PHP_SELF'])) {
  19.     Header("Location: index.php");
  20. }
  21.  
  22. $content = "";
  23.  
  24. global $user, $cookie, $prefix, $user_prefix, $db, $anonymous, $sitekey;
  25. mt_srand ((double)microtime()*1000000);
  26. $maxran = 1000000;
  27. $random_num = mt_rand(0, $maxran);
  28. $datekey = date("F j");
  29. $rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
  30. $code = substr($rcode, 2, 10);
  31. cookiedecode($user);
  32. $uname = $cookie[1];
  33.  
  34. $lasturow = $db->sql_fetchrow($db->sql_query("SELECT username FROM ".$user_prefix."_users ORDER BY user_id DESC LIMIT 0,1"));
  35. $lastuser = $lasturow['username'];
  36. $numrows = $db->sql_numrows($db->sql_query("SELECT user_id FROM ".$user_prefix."_users"));
  37.  
  38. $result = $db->sql_query("SELECT uname, guest FROM ".$prefix."_session WHERE guest='0'");
  39. $member_online_num = $db->sql_numrows($result);
  40. $who_online_now = "";
  41. $i = 1;
  42. while ($session = $db->sql_fetchrow($result)) {
  43.     if (isset($session["guest"]) and $session["guest"] == 0) {
  44.         if ($i < 10) {
  45.             $who_online_now .= "0$i: <A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$session[uname]\">$session[uname]</a><br>\n";
  46.         } else {
  47.             $who_online_now .= "$i: <A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$session[uname]\">$session[uname]</a><br>\n";
  48.         }
  49.         $who_online_now .= ($i != $member_online_num ? "  " : "");
  50.         $i++;
  51.     }
  52. }
  53. $Today = getdate();
  54. //Formatting Current Date
  55. $month = $Today['month'];
  56. $mday = $Today['mday'];
  57. $year = $Today['year'];
  58. //Formatting Previous Date
  59. $pmonth = $Today['month'];
  60. $pmday = $Today['mday'];
  61. $pmday = $mday-1;
  62. $pyear = $Today['year'];
  63. //Month conversion into numeric mode
  64. if ($pmonth=="January") { $pmonth=1; } else
  65. if ($pmonth=="February") { $pmonth=2; } else
  66. if ($pmonth=="March") { $pmonth=3; } else
  67. if ($pmonth=="April") { $pmonth=4; } else
  68. if ($pmonth=="May") { $pmonth=5; } else
  69. if ($pmonth=="June") { $pmonth=6; } else
  70. if ($pmonth=="July") { $pmonth=7; } else
  71. if ($pmonth=="August") { $pmonth=8; } else
  72. if ($pmonth=="September") { $pmonth=9; } else
  73. if ($pmonth=="October") { $pmonth=10; } else
  74. if ($pmonth=="November") { $pmonth=11; } else
  75. if ($pmonth=="December") { $pmonth=12; };
  76. $test = mktime (0,0,0,$pmonth,$pmday,$pyear,1);
  77.  
  78. //Creating SQL parameter
  79. $curDate2 = "%".$month[0].$month[1].$month[2]."%".$mday."%".$year."%";
  80. $preday = strftime ("%d",$test);
  81. $premonth = strftime ("%B",$test);
  82. $preyear = strftime ("%Y",$test);
  83. $curDateP = "%".$premonth[0].$premonth[1].$premonth[2]."%".$preday."%".$preyear."%";
  84.  
  85. //Executing SQL Today
  86. $row = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM ".$user_prefix."_users WHERE user_regdate LIKE '$curDate2'"));
  87. $userCount = $row['userCount'];
  88. //end
  89.  
  90. //Executing SQL Today
  91. $row2 = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM ".$user_prefix."_users WHERE user_regdate LIKE '$curDateP'"));
  92. $userCount2 = $row2['userCount'];
  93. //end
  94.  
  95. $guest_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest='1'"));
  96. $member_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest='0'"));
  97.  
  98. $who_online_num = $guest_online_num + $member_online_num;
  99. $content .= "<form action=\"modules.php?name=Your_Account\" method=\"post\">";
  100.  
  101. if (is_user($user)) {
  102.     $content .= "<br><img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL." <b>$uname</b>.<br>\n<hr>\n";
  103.     $row3 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM ".$user_prefix."_users WHERE username='$uname'"));
  104.     $uid = intval($row3[user_id]);
  105.     $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')"));
  106.     $oldpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM ".$prefix."_bbprivmsgs WHERE privmsgs_to_userid='$uid' AND privmsgs_type='0'"));
  107.     $content .= "<img src=\"images/blocks/email-y.gif\" height=\"10\" width=\"14\"> <a href=\"modules.php?name=Private_Messages\"><b>"._BPM."</b></a><br>\n";
  108.     $content .= "<img src=\"images/blocks/email-r.gif\" height=\"10\" width=\"14\"> "._BUNREAD.": <b>$newpms</b><br>\n";
  109.     $content .= "<img src=\"images/blocks/email-g.gif\" height=\"10\" width=\"14\"> "._BREAD.": <b>$oldpms</b><br>\n<hr>\n";
  110. } else {
  111.     $content .= "<img src=\"images/blocks/group-4.gif\" height=\"14\" width=\"17\"> "._BWEL.", <b>$anonymous</b>\n<hr>";
  112.     $content .= ""._NICKNAME." <input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\"><br>";
  113.     $content .= ""._PASSWORD." <input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\"><br>";
  114.     $content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">";
  115.     $content .= "<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">";
  116.     $content .= "<input type=\"hidden\" name=\"op\" value=\"login\">";
  117.     $content .= "<input type=\"submit\" value=\""._LOGIN."\">\n (<a href=\"modules.php?name=Your_Account&op=new_user\">"._BREG."</a>)<hr>";
  118. }
  119. $content .= "<img src=\"images/blocks/group-2.gif\" height=\"14\" width=\"17\"> <b><u>"._BMEMP.":</u></b><br>\n";
  120. $content .= "<img src=\"images/blocks/ur-moderator.gif\" height=\"14\" width=\"17\"> "._BLATEST.": <A HREF=\"modules.php?name=Your_Account&op=userinfo&username=$lastuser\"><b>$lastuser</b></a><br>\n";
  121. $content .= "<img src=\"images/blocks/ur-author.gif\" height=\"14\" width=\"17\"> "._BTD.": <b>$userCount</b><br>\n";
  122. $content .= "<img src=\"images/blocks/ur-admin.gif\" height=\"14\" width=\"17\"> "._BYD.": <b>$userCount2</b><br>\n";
  123. $content .= "<img src=\"images/blocks/ur-guest.gif\" height=\"14\" width=\"17\"> "._BOVER.": <b>$numrows</b><br>\n<hr>\n";
  124. $content .= "<img src=\"images/blocks/group-3.gif\" height=\"14\" width=\"17\"> <b><u>"._BVISIT.":</u></b>\n<br>\n";
  125. $content .= "<img src=\"images/blocks/ur-anony.gif\" height=\"14\" width=\"17\"> "._BVIS.": <b>$guest_online_num</b><br>\n";
  126. $content .= "<img src=\"images/blocks/ur-member.gif\" height=\"14\" width=\"17\"> "._BMEM.": <b>$member_online_num</b><br>\n";
  127. $content .= "<img src=\"images/blocks/ur-registered.gif\" height=\"14\" width=\"17\"> "._BTT.": <b>$who_online_num</b><br>\n";
  128. if ($member_online_num > 0) {
  129.     $content .= "<hr>\n<img src=\"images/blocks/group-1.gif\" height=\"14\" width=\"17\"> <b><u>"._BON.":</u></b><br>$who_online_now";
  130. }
  131. $content .= "</form>";
  132.  
  133. ?>