|
05.07.2006, 13:53
и еще- как переделать блок User Info так что бы он логинил и на сайте и на форуме, а то и стандартный,и ваш блок Login работают криво.
Вот код блока:
PHP код:
<?php
if (!defined('BLOCK_FILE')) {
Header("Location: ../index.php");
exit;
}
global $user, $cookie, $prefix, $db, $anonymous, $gfx_chk, $userinfo;
if (is_user($user)) {
getusrinfo($user);
$uname = $userinfo['username'];
$user_id = $userinfo['user_id'];
$user_avatar = $userinfo['user_avatar'];
if ($user_avatar) $content = "<br /><center><img src=\"images/avatars/$user_avatar\" /></center><br />";
$user_id = intval($user_id);
$content .= "<center><b>"._BWEL.",<br />$uname</b></center><hr>";
$newpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM ".$prefix."_bbprivmsgs WHERE privmsgs_to_userid='$user_id' AND (privmsgs_type='5' OR privmsgs_type='1')"));
$content .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr valign=\"middle\"><td><a href=\"index.php?name=Account&op=logout\" title=\""._LOGOUT."\"><img src=\"images/blocks/logout.gif\" border=\"0\" alt=\""._LOGOUT."\" /></td><td><a href=\"index.php?name=Account&op=logout\" title=\""._LOGOUT."\">"._LOGOUT."</a></td></tr></table><hr>";
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td colspan=\"2\" align=\"center\"><a href=\"index.php?name=Private_Messages\" title=\""._BPM."\"><b>"._BPM."</b></a></td></tr><tr><td>";
if ($newpms != 0) {
$content .= "<img src=\"images/red_dot.gif\" title=\""._BUNREAD."\" alt=\""._BUNREAD."\" /></td><td>"._BUNREAD.": $newpms";
} else {
$content .= "<img src=\"images/blocks/Contact.gif\" title=\""._BPM."\" alt=\""._BPM."\" /></td><td>"._BUNREAD.": $newpms";
}
$content .= "</td></tr></table><hr>";
} else {
$content .= "<form action=\"index.php?name=Account\" method=\"post\">";
$content .= "<br /><center><img src=\"images/avatars/0.gif\" /></center><br />";
$content .= "<center><b>"._WELCOMETO.",<br />$anonymous</b></center><hr>";
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">"
."<tr valign=\"middle\"><td><a href=\"index.php?name=Account&op=new_user\" title=\""._BREG."\"><img src=\"images/blocks/new_user.gif\" border=\"0\" alt=\""._BREG."\" /></td><td><a href=\"index.php?name=Account&op=new_user\" title=\""._BREG."\">"._BREG."</a></td></tr>"
."<tr valign=\"middle\"><td><a href=\"index.php?name=Account&op=pass_lost\" title=\""._PASSFOR."\"><img src=\"images/blocks/pass_lost.gif\" border=\"0\" alt=\""._PASSFOR."\" /></td><td><a href=\"index.php?name=Account&op=pass_lost\" title=\""._PASSFOR."\">"._PASSFOR."</a></td></tr></table><hr>";
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" align=\"center\">"
."<tr><td>"._NICKNAME.":</td><td><input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\"></td></tr>"
."<tr><td>"._PASSWORD.":</td><td><input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\"></td></tr>";
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 .= "<tr><td>"._SECURITYCODE.":</td><td><img src=\"?gfx=gfx&random_num=$random_num\" border=\"1\" alt=\""._SECURITYCODE."\" title=\""._SECURITYCODE."\" /></td></tr>";
$content .= "<tr><td>"._TYPESECCODE.":</td><td><input type=\"text\" name=\"gfx_check\" size=\"10\" maxlength=\"6\"></td></tr>";
$content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">";
} else {
$content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">";
$content .= "<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">";
}
$content .= "<tr><td colspan=\"2\" align=\"center\"><input type=\"hidden\" name=\"op\" value=\"login\"><input type=\"submit\" value=\""._LOGIN."\"></td></tr></form></table><hr>";
}
$m = "";
$u = "";
$i = "";
$result = $db->sql_query("SELECT uname, guest, module, UNIX_TIMESTAMP(now())-time AS time FROM ".$prefix."_session ORDER BY uname");
while (list($uname, $guest, $module, $time) = $db->sql_fetchrow($result)) {
$linkstrip = ereg_replace("_", " ", cutstr($module, 10));
if ($guest == 0) {
$title_who = "<a href=\"index.php?name=Account&op=userinfo&username=$uname\" title=\"".displayTime($time)."\">$uname</a> - $linkstrip<br />";
$m++;
} else {
$title_who = "";
$u++;
}
$who_online[$guest] .= $title_who;
$i++;
}
if ($m == "") $m = 0;
if ($u == "") $u = 0;
if ($i == "") $i = 0;
$content .= "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\"><tr valign=\"middle\"><td colspan=\"2\" align=\"center\"><b>"._BVISIT."</b></td></tr>";
$content .= "<tr><td><img src=\"images/blocks/member.gif\" title=\""._BMEM."\" alt=\""._BMEM."\" /></td><td>"._BMEM.": $m</td></tr>";
$content .= "<tr><td><img src=\"images/blocks/anony.gif\" title=\""._BVIS."\" alt=\""._BVIS."\" /></td><td>"._BVIS.": $u</td></tr>";
$content .= "<tr><td><img src=\"images/blocks/group.gif\" title=\""._BOVER."\" alt=\""._BOVER."\" /></td><td>"._BOVER.": $i</td></tr></table>";
if ($who_online[0] != "") {
$content .= "<hr><table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\"><tr><td align=\"center\"><b>"._BMEMVISIT."</b></td></tr><tr><td>$who_online[0]</td></tr></table>";
}
?>
|
|