
Przedszkolak

Postów: 10
v7.00.05 Data rejestracji: 12.08.2012 08:41
|
Mam PHP-Fusion 7.00.05, skórka Gillette. Domy?lna lista u?ytkowników dost?pna z panelu logowania (members.php) wy?wietla nazw? u?ytkownika, grupy do jakich nale?y i poziom u?ytkownika. Chcia?bym aby wy?wietla?o równie? dat? ostatniego logowania, jak na obrazku poni?ej:

Szuka?em na forum i jest sporo w?tków jak i modyfikacji wy?wietlaj?cych np. kto by? ostatnio online czy dopisanie do uzytkownika, ?e jest online. Ale nic co mog?oby mnie naprowadzi? na w?a?ciwy trop w moim problemie. Próbowa?em zrobi? to samodzielnie i zaczerpuj?c par? linijek kodu z profile.php które ow? dat? wy?wietla edytowa?em poni?szy plik (plus dodatkowe pola w themes/locale/members.php dla wy?wietlania w tabeli nazw "Nigdy" i "Ostatnio online").
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: members.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."members.php";
add_to_title($locale['global_200'].$locale['400']);
opentable($locale['400']);
if (iMEMBER) {
if (!isset($_GET['sortby']) || !preg_match("/^[0-9A-Z]$/", $_GET['sortby'])) { $_GET['sortby'] = "all"; }
$orderby = ($_GET['sortby'] == "all" ? "" : " WHERE user_name LIKE '".stripinput($_GET['sortby'])."%'");
$result = dbquery("SELECT * FROM ".DB_USERS.$orderby."");
$rows = dbrows($result);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if ($rows) {
$i = 0;
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td align='center' width='25%' class='tbl2'><strong>".$locale['401']."</strong></td>\n";
echo "<td align='center' width='45%' class='tbl2'><strong>".$locale['405']."</strong></td>\n";
[b] echo "<td align='center' width='15%' class='tbl2'><strong>".$locale['402bu']."</strong></td>\n";[/b]
echo "<td align='center' width='15%' class='tbl2' style='white-space:nowrap'><strong>".$locale['402']."</strong></td>\n";
echo "</tr>\n";
$result = dbquery("SELECT * FROM ".DB_USERS.$orderby." ORDER BY user_level DESC, user_name LIMIT ".$_GET['rowstart'].",20");
while ($data = dbarray($result)) {
$cell_color = ($i % 2 == 0 ? "tbl1" : "tbl2"); $i++;
echo "<tr>\n<td align='left' width='25%' class='$cell_color'>\n<a href='profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a></td>\n";
$groups = "";
$user_groups = explode(".", $data['user_groups']);
$j = 0;
foreach ($user_groups as $key => $value) {
if ($value) {
$groups .= "<a href='profile.php?group_id=".$value."'>".getgroupname($value)."</a>".($j < count($user_groups)-1 ? ", " : "");
}
$j++;
}
echo "<td align='center' width='45%' class='$cell_color'>\n".($groups ? $groups : ($data['user_level']==103 ? $locale['407'] : $locale['406']))."</td>\n";
[b] echo "<td align='center' width='15%' class='$cell_color' style='white-space:nowrap'>".($user_data['user_lastvisit'] ? showdate("longdate", $user_data['user_lastvisit']): $locale['402au'])."</td>\n";[/b]
echo "<td align='center' width='15%' class='$cell_color' style='white-space:nowrap'>".getuserlevel($data['user_level'])."</td>\n</tr>";
}
echo "</table>\n";
} else {
echo "<center><br />\n".$locale['403'].$_GET['sortby']."<br /><br />\n</center>\n";
}
$search = array(
"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","0","1","2","3","4","5","6","7","8","9"
);
echo "<hr />\n<table cellpadding='0' cellspacing='1' class='tbl-border center'>\n<tr>\n";
echo "<td rowspan='2' class='tbl2'><a href='".FUSION_SELF."?sortby=all'>".$locale['404']."</a></td>";
for ($i = 0; $i < 36 != ""; $i++) {
echo "<td align='center' class='tbl1'><div class='small'><a href='".FUSION_SELF."?sortby=".$search[$i]."'>".$search[$i]."</a></div></td>";
echo ($i == 17 ? "<td rowspan='2' class='tbl2'><a href='".FUSION_SELF."?sortby=all'>".$locale['404']."</a></td>\n</tr>\n<tr>\n" : "\n");
}
echo "</tr>\n</table>\n";
} else {
redirect("index.php");
}
closetable();
if ($rows > 20) { echo "<div align='center' style='margin-top:5px;'>".makepagenav($_GET['rowstart'], 20, $rows, 3, FUSION_SELF."?sortby=".$_GET['sortby']."&")."</div>\n"; }
require_once THEMES."templates/footer.php";
?>
Problem w tym, ?e cho? tabela wy?wietla si? wed?ug konstrukcji... to wsz?dzie jest napisane "Nigdy", a przed list? kont mam ca?y spam nast?puj?cego b??du:
[b]Notice[/b]: Undefined variable: user_data in [b]/virtual/ft-guildwars.cba.pl/members.php[/b] on line [b]53[/b]
To si? odnosi do wklejonej linijki z profilu o ile rozumiem, natomiast nie rozumiem kompletnie dlaczego user_data jest nie zdefiniowane. Oba pliki wykorzystuj? przecie? jedynie maincore.php, reszta to odwo?ania do themes tak? Prosi?bym o jak?? pomoc w tej kwestii bo nie potrafi? sobie z tym poradzi? sam.
Edytowane przez north dnia 21.08.2012 22:24:38
|

Pocz?tkuj?cy

Postów: 290 Pomógł: 45
v7.02.06 Data rejestracji: 24.10.2011 14:51
|
Skopiowa?e? "na ?ywca" wi?c b??d musia? si? pojawi?. Poni?ej poprawiony kod:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: members.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."members.php";
add_to_title($locale['global_200'].$locale['400']);
opentable($locale['400']);
if (iMEMBER) {
if (!isset($_GET['sortby']) || !preg_match("/^[0-9A-Z]$/", $_GET['sortby'])) { $_GET['sortby'] = "all"; }
$orderby = ($_GET['sortby'] == "all" ? "" : " WHERE user_name LIKE '".stripinput($_GET['sortby'])."%'");
$result = dbquery("SELECT * FROM ".DB_USERS.$orderby."");
$rows = dbrows($result);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if ($rows) {
$i = 0;
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td align='center' width='25%' class='tbl2'><strong>".$locale['401']."</strong></td>\n";
echo "<td align='center' width='45%' class='tbl2'><strong>".$locale['405']."</strong></td>\n";
echo "<td align='center' width='15%' class='tbl2'><strong>".$locale['402bu']."</strong></td>\n";
echo "<td align='center' width='15%' class='tbl2' style='white-space:nowrap'><strong>".$locale['402']."</strong></td>\n";
echo "</tr>\n";
$result = dbquery("SELECT * FROM ".DB_USERS.$orderby." ORDER BY user_level DESC, user_name LIMIT ".$_GET['rowstart'].",20");
while ($data = dbarray($result)) {
$cell_color = ($i % 2 == 0 ? "tbl1" : "tbl2"); $i++;
echo "<tr>\n<td align='left' width='25%' class='$cell_color'>\n<a href='profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a></td>\n";
$groups = "";
$user_groups = explode(".", $data['user_groups']);
$j = 0;
foreach ($user_groups as $key => $value) {
if ($value) {
$groups .= "<a href='profile.php?group_id=".$value."'>".getgroupname($value)."</a>".($j < count($user_groups)-1 ? ", " : "");
}
$j++;
}
echo "<td align='center' width='45%' class='$cell_color'>\n".($groups ? $groups : ($data['user_level']==103 ? $locale['407'] : $locale['406']))."</td>\n";
echo "<td align='center' width='15%' class='$cell_color' style='white-space:nowrap'>".($data['user_lastvisit'] ? showdate("longdate", $data['user_lastvisit']): $locale['402au'])."</td>\n";
echo "<td align='center' width='15%' class='$cell_color' style='white-space:nowrap'>".getuserlevel($data['user_level'])."</td>\n</tr>";
}
echo "</table>\n";
} else {
echo "<center><br />\n".$locale['403'].$_GET['sortby']."<br /><br />\n</center>\n";
}
$search = array(
"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","0","1","2","3","4","5","6","7","8","9"
);
echo "<hr />\n<table cellpadding='0' cellspacing='1' class='tbl-border center'>\n<tr>\n";
echo "<td rowspan='2' class='tbl2'><a href='".FUSION_SELF."?sortby=all'>".$locale['404']."</a></td>";
for ($i = 0; $i < 36 != ""; $i++) {
echo "<td align='center' class='tbl1'><div class='small'><a href='".FUSION_SELF."?sortby=".$search[$i]."'>".$search[$i]."</a></div></td>";
echo ($i == 17 ? "<td rowspan='2' class='tbl2'><a href='".FUSION_SELF."?sortby=all'>".$locale['404']."</a></td>\n</tr>\n<tr>\n" : "\n");
}
echo "</tr>\n</table>\n";
} else {
redirect("index.php");
}
closetable();
if ($rows > 20) { echo "<div align='center' style='margin-top:5px;'>".makepagenav($_GET['rowstart'], 20, $rows, 3, FUSION_SELF."?sortby=".$_GET['sortby']."&")."</div>\n"; }
require_once THEMES."templates/footer.php";
?>
|