Index du Forum » » Questions

Auteur

Afficher la dernière connexion d'un membre
Anonyme
19795  

  Posté : 27-10-2006 22:20

Il y a finallement plusieurs modifications à faire... Voici donc l'intégralité du code modifié à ma sauce pour faire apparaitre
une colonne "Dernière connexion" à la place de la colonne "URL"...
Le code a également été modifié afin de faire un tri par date et heure de connexion... Vous pouvez ainsi suivre les logs de vos membre plus clairement




<?PHP
/************************************************************** **********/
/* NPDS V : Net Portal Dynamic System .                           & nbsp;      */
/* ===========================        &nbs p;              ;                     */
/*            &nb sp;            &nbs p;              ;                           & nbsp;    */
/* Original Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)   */
/* http://phpnuke.org                                                   */
/*            &nb sp;            &nbs p;              ;                           & nbsp;    */
/* This version name NPDS Copyright (c) 2001-2004   */
/*            &nb sp;            &nbs p;              ;                           & nbsp;    */
/* =========================                       & nbsp;            &n bsp;        */
/* Based on MyPHPortal Modified MembersList           &n bsp;            &nb sp;    */
/*            &nb sp;            &nbs p;              ;                           & nbsp;    */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/ br />
if (!function_exists("Mysql_Connexion")) {!include! ("mainfile.php");}

// Make Member_list Private or not
if (!AutoReg()) 
{ unset($user); }
if (($member_list==1) AND ($user==
"") AND ($admin=="")) {
   Header(
"Location: index.php");
}

function alpha() 
{
   global $sortby, $list;
   $alphabet = array (
"".translate("All")."""A","B","C","D","E","F","G","H","I","J","K","L","M",
              ;        
"N","O","P","Q","R","S","T","U","V","W","X","Y","Z","".translate("Other")."");

   echo 
"<table width=\"100%\" border=\"0\"><tr><td width=\"50%\" align=\"center\" valign=\"top\">";
   $num = count($alphabet) - 1;
   $counter = 0;
   while (list(, $ltr) = each($alphabet)) 
{
      echo 
"<a href=\"memberslist.php?letter=$ltr&amp;sortby=$sortby&amp;list =$list\" class=\"NOIR\">$ltr</a>";
      if ( $counter == roun d($num/2) ) 
{
         echo 
" ]<br />[ ";
      
} elseif ( $counter != $num )  ;{
         echo 
"&nbsp;|&nbsp;";
      
}
      $counter++;
   
}
   echo 
"</td><td class=\"NOIR\">";
   echo 
"<form action=\"memberslist.php\" method=\"post\">";
   echo translate(
"Search")." : <input class=\"TEXTBOX_STANDARD\" type=\"input\" name=\"letter\" size=\"30\" maxlenght=\"60\">";
   echo 
"<input type=\"hidden\" name=\"list\" value=\"".urldecode($list)."\">";
   echo 
"<input type=\"hidden\" name=\"TempoSuperCache\" value=\"OFF\">";
   echo 
"</form>";
   echo 
"</td></tr></table>";
}

function unique($ibid) 
{
   while (list(,$to_user) = each($ibid)) 
{
      if (!$Xto_user
[$to_user]{
         $Xto_user
[$to_user]=$to_user;
      
}
   
}
   return ($Xto_user);
}

function SortLinks($letter) 
{
   global $sortby, $list, $admin;
   if ($letter == 
"front"{
      $letter = translate(
"All");
   
}
   $sort=false;
   echo 
"<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td align=\"center\">\n";
   echo translate(
"Sort by:")." ";
   if ($sortby == 
"uname ASC" OR !$sortby) {
      echo translate(
"nickname")."&nbsp;|&nbsp;";
      $sort=true;
   
} else {
      echo 
"<a href=\"memberslist.php?letter=$letter&amp;sortby=uname%20ASC&a mp;list=$list\" class=\"NOIR\">".translate("nickname")."</a>&nbsp;|&nbsp;";
   
}
   if ($sortby == 
"name ASC"{
      echo translate(
"real name")."&nbsp;|&nbsp;";
      $sort=true;
   
} else {
      echo 
"<a href=\"memberslist.php?letter=$letter&amp;sortby=name%20ASC&am p;list=$list\" class=\"NOIR\">".translate("real name")."</a>&nbsp;|&nbsp;";
   
}
   if ($sortby == 
"user_avatar ASC"{
      echo translate(
"Avatar")."&nbsp;|&nbsp;";
      $sort=true;
   
} else {
      echo 
"<a href=\"memberslist.php?letter=$letter&amp;sortby=user_avatar%20ASC &amp;list=$list\" class=\"NOIR\">".translate("Avatar")."</a>&nbsp;|&nbsp;";
   
}
   if (($sortby == 
"femail ASC") or ($sortby == "email ASC")) {
      echo translate(
"Email")."&nbsp;|&nbsp;";
      $sort=true;
   
} else {
      if ($admin) 
{
         echo 
"<a href=\"memberslist.php?letter=$letter&amp;sortby=email%20ASC&a mp;list=$list\" class=\"NOIR\">".translate("Email")."</a>&nbsp;|&nbsp;";
      
} else {
         echo 
"<a href=\"memberslist.php?letter=$letter&amp;sortby=femail%20ASC& amp;list=$list\" class=\"NOIR\">".translate("Email")."</a>&nbsp;|&nbsp;";
      
}
   
}
   if ($sortby == 
"user_from ASC"{
      echo translate(
"Location")."&nbsp;|&nbsp;";
      $sort=true;
   
} else {
      echo 
"<a href=\"memberslist.php?letter=$letter&amp;sortby=user_from%20ASC&a mp;amp;list=$list\" class=\"NOIR\">".translate("Location")."</a>&nbsp;|&nbsp;";
   
}
   if ($sortby == 
"user_lastvisit DESC"{
      echo 
"Dernière connexion |";
      $sort=true;
   
} else {
      echo 
"<a href=\"memberslist.php?letter=$letter&amp;sortby=user_lastvisit%20 DESC&amp;list=$list\" class=\"NOIR\">Dernière connexion</a>&nbsp;|&nbsp;";
   
}
   if ($sortby == 
"mns DESC"{
      echo translate(
"Mini-Web site")."&nbsp;|&nbsp;";
      $sort=true;
   
} else {
      echo 
"<a href=\"memberslist.php?letter=$letter&amp;sortby=mns%20DESC&am p;list=$list\" class=\"NOIR\">".translate("Mini-Web site")."</a>&nbsp;|&nbsp;";
   
}
   if ($sortby == 
"uid DESC"{
      echo 
"I.D";
      $sort=true;
   
} else {
      echo 
"<a href=\"memberslist.php?letter=$letter&amp;sortby=uid%20DESC&am p;list=$list\" class=\"NOIR\">I.D</a>";
   
}
   if (!$sort) 
{$sortby="uname ASC";}

    echo 
"</td></tr></table>\n";
}

function avatar($user_avatar) 
{
   if (!$user_avatar) 
{
      $imgtmp=
"images/forum/avatar/blank.gif";
   
} else if (stristr($user_avatar,"users_private")) {
      $imgtmp=$user_avatar;
   
} else {
      if ($ibid=theme_image(
"forum/avatar/$user_avatar")) {$imgtmp=$ibid;} else {$imgtmp="images/forum/avatar/$user_avatar";}
      if (!file_exists($imgtmp)) {$imgtmp="images/forum/avatar/blank.gif";}
   
}
   return ($imgtmp);
}

   // OFF temporairement SC pour la&n bsp;recherche
   if ($TempoSuperCache==
"OFF"{$SuperCache=false;}

   !include!(
"header.php");
   $pagesize = $show_user;

   $letter=removeHack(stripslashes(htmlspecialchars($letter,&n bsp;ENT_QUOTES)));
   $sortby=removeHack($sortby);
   if (!isset($letter)) 
{ $letter = translate("All"); }
   if (!isset($sortby)) 
{ $sortby = "uid DESC"}
   if (!isset($page)) 
{ $page = 1; }

   if ($list!=
""{
      $tempo=unique(explode(
",",$list));
      $list=urlencode(implode(
",",$tempo));
   
}
   $result = mysql_query(
"select uname from users order by  uid DESC limit 0,1");
   list($lastuser) = mysql_fetch_row($result);
   echo 
"<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"HEADER\">\n";
   echo translate(
"Welcome to")." $sitename - ".translate("Members List");
   echo 
"</td></tr></table>\n";
   Opentable();
   echo 
"<p align=\"center\">".translate("Greetings to our latest registered use r:")." <a href=\"user.php?op=userinfo&amp;uname=$lastuser\" class=\"NOIR\">$lastuser</a></p><br />";
   if (!$admin) 
{
      if ($SuperCache) 
{
         $cache_obj =  new cacheManager();
         $cache_obj
->startCachingPage();
      
}
   
}
   if (($cache_obj
->genereting_output==1) or ($cache_obj->genereting_output==-1) or (!$SuperCache) or  ;($admin)) {
      alpha();
      SortLinks($letter);

      $min = $pagesize * ($page - 1);
      $max = $pagesize;

      $count = 
"SELECT COUNT(uid) AS total FROM users& nbsp;";
      $select = 
"select uid, name, uname, femail, url,& nbsp;user_regdate, user_from, email, is_visible, user_viewe mail, user_lastvisit, user_avatar, mns from users  ;";
      if ( ( $letter != 
"".translate("Other")."" ) AND ( $letter != "".translate("All")."" ) ) {
         $where = "where uname like '".$letter."%'";
      
} else if ( ( $letter == "".translate("Other")."" ) AND ( $letter != "".translate("All")."" ) ) {
         $where = "where uname REGEXP \"^\[1-9]\" ";
      
} else {
         $where = "";
      
}
      global $member_invisible;
      if ($member_invisible) 
< font color="#007700">{

         if ($admin)
            $and=
"";
         else 
{
            if&nb sp;($where)
              ;  $and=
"and is_visible=1 ";
            else
              ;  $and=
"where is_visible=1 ";
         
}
      
} else {
         $and=
"";
      
}

      $sort = 
"order by $sortby";
      $limit = 
" LIMIT ".$min."".$max;
      $count_result = mysql_query($co unt.$where);
      $num_rows_per_order = mysql_res ult($count_result,0,0);
      $result = mysql_query($select.$ where.$and.$sort.$limit) or die(mysql_error() );
      echo 
"<br />";
      if ( $letter != "front" ) {
         echo 
"<table width=\"100%\" cellspacing=\"0\" cellpadding=\"1\" border=\"0\"><tr class=\"HEADER\">\n";
         echo 
"<td class=\"BOX\"><span style=\"font-size: 10px;\"><b>".translate("Nickname")."</b></span></td>\n";
         echo 
"<td class=\"BOX\">&nbsp;</td>\n";
         echo 
"<td class=\"BOX\" align=\"center\">&nbsp;</td>";
         echo 
"<td class=\"BOX\" align=\"center\">&nbsp;</td>";
         echo 
"<td class=\"BOX\"><span style=\"font-size: 10px;\"><b>".translate("Real Name")."</b></span></td>\n";
         if ($sortby!="user_from ASC"{
            echo& nbsp;
"<td class=\"BOX\"><span style=\"font-size: 10px;\"><b>".translate("Email")."</b></span></td>\n";
         
} else {
            echo& nbsp;
"<td class=\"BOX\"><span style=\"font-size: 10px;\"><b>".translate("Location")."</b></span></td>\n";
         
}
         echo 
"<td class=\"BOX\"><span style=\"font-size: 10px;\">Dernière connexion</td>\n";
         $cols = 7; br />         if ($admin) < /font>{
            $cols  = 9;
            echo& nbsp;
"<td class=\"BOX\" align=\"center\" width=\"12%\"><span style=\"font-size: 10px;\"><b>".translate("Functions")."</b></span></td><td class=\"BOX\">&nbsp;</td>\n";
         
}
         echo 
"</tr>";
         $a = 0;
         $num_users =  mysql_num_rows($result);
         if ( $num_row s_per_order > 0  ) 
{
            globa l $anonymous, $user;
            while ($temp_user = mysql_fetch_array($result) ) 
{
              ;  $rowcolor = tablos();
              ;  if ($temp_user
[mns]{$mns="<a href=\"minisite.php?op=$temp_user[uname]\" alt=\"\" title=\"".translate("Mini-Web site")."\" target=\"_blank\" class=\"HEADA\"><b>(w)</b></a>";} else {$mns="";}
              ;  echo 
"<tr $rowcolor><td><a href=\"user.php?op=userinfo&amp;uname=$temp_user[uname]\" alt=\"\" title=\"".date(translate("dateinternal"),$temp_user[user_regdate])."\"  class=\"HEADA\">$temp_user[uname]</a>&nbsp;$mns</td>\n";
              ;  echo 
"<td valign=\"middle\">";
              ;  if ($ibid_avatar=avatar($temp_user
[user_avatar]))
              ;     echo 
"<img src=\"".$ibid_avatar."\" width=\"20\" height=\"20\" border=\"0\" alt=\"\" title=\"\" />";
              ;  else
              ;     echo 
"&nbsp;";
              ;  echo 
"</td>";
              ;&



Cet article provient de NPDS

http://www.npds.org/viewtopic.php?topic=21383&forum=9