|
17.03.2006, 22:54
Спасибо огромное за хак, установил, все отлично работает, только у меня возник один вопрос... Я пользуюсь другим блоком авторизации(стандартный меня не устраивает), так вот вопрос заключается в том как мне его переделать, чтобы он нормально регистрировал в форуме... Вот код...
PHP код:
<?php
if (!defined('BLOCK_FILE')) {
Header("Location: ../index.php");
exit;
}
$content = "";
global $user, $cookie, $prefix, $user_prefix, $db, $anonymous, $sitekey, $userinfo, $mode, $t, $f, $admin, $stop, $module_name, $redirect, $gfx_chk, $language;
include("language/lang-$language.php");
getusrinfo($user);
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];
list($lastuser) = $db->sql_fetchrow($db->sql_query("SELECT username FROM $user_prefix"._users." ORDER BY user_id DESC LIMIT 0,1", $db));
list($newid) = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM $user_prefix"._users." WHERE username='$lastuser'", $db));
$numrows = $db->sql_numrows($db->sql_query("SELECT user_id FROM $user_prefix"._users."", $db));
//$numrows = ($numrows - 1); //removes admin as user
$result = $db->sql_query("SELECT uname, guest FROM $prefix"._session." WHERE guest=0", $db);
$member_online_num = $db->sql_numrows($result , $db);
$who_online_now = "";
$i = 1;
while ($session = $db->sql_fetchrow($result, $db)) {
list($uid) = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM $user_prefix"._users." WHERE username='$session[uname]'", $db));
if (isset($session["guest"]) and $session["guest"] == 0) {
if ($i < 10) {
$who_online_now .= "0$i: <a href=\"index.php?name=Private_Messages&mode=post&u=$uid\"><img src=\"images/blocks/useronline/icon_minipost.gif\" border=0 alt=\""._UMSENDPM." $session[uname]\" align=absmiddle></a><A HREF=\"index.php?name=Forums&file=profile&mode=viewprofil e&u=$uid\">$session[uname]</a><br>\n";
} else {
$who_online_now .= "$i: <a href=\"index.php?name=Private_Messages&mode=post&u=$uid\"><img src=\"images/blocks/useronline/icon_minipost.gif\" border=0 alt=\""._UMSENDPM." $session[uname]\" align=absmiddle></a><A HREF=\"index.php?name=Forums&file=profile&mode=viewprofil e&u=$uid\">$session[uname]</a><br>\n";
}
$who_online_now .= ($i != $member_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
list($userCount) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDate2'", $db));
//end
//Executing SQL Today
list($userCount2) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDateP'", $db));
//end
$guest_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest=1", $db));
$member_online_num = $db->sql_numrows($db->sql_query("SELECT uname FROM ".$prefix."_session WHERE guest=0", $db));
$who_online_num = $guest_online_num + $member_online_num;
$content .= "<form action=\"index.php?name=Your_Account\" method=\"post\">";
if (is_user($user)) {
if ($userinfo[user_avatar]) {
$content .= "<center>"._UMWELB."<br><a href=\"index.php?name=Your_Account&op=avatarlist\"><img src=\"modules/Forums/images/avatars/$userinfo[user_avatar]\" border=\"0\"></a><br>$uname\n</center><hr>";
} else {
$content .= "<center>"._UMWELB."<br><img src=\"images/blocks/useronline/No_Avatar.gif\"><br>$uname\n</center><hr>";
}
$row3 = $db->sql_fetchrow($db->sql_query("SELECT user_id FROM $user_prefix"._users." WHERE username='$uname'"));
$uid = intval($row3[user_id]);
$newpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_to_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='1' OR privmsgs_type='5')", $db));
$oldpms = $db->sql_numrows($db->sql_query("SELECT privmsgs_from_userid FROM $prefix"._bbprivmsgs." WHERE privmsgs_from_userid='$uid' AND (privmsgs_type='1' OR privmsgs_type='5')", $db));
$content .= "<img src=\"images/blocks/useronline/email-y.gif\" height=\"10\" width=\"14\"> <a href=\"index.php?name=Private_Messages\"><b>"._BPM."</b></a><br>\n";
$content .= "<img src=\"images/blocks/useronline/icon2.gif\" height=\"10\" width=\"10\" align=\"absmiddle\"> "._UMNMSG.": <b>$newpms</b><br>\n";
$content .= "<img src=\"images/blocks/useronline/icon2.gif\" height=\"10\" width=\"10\" align=\"absmiddle\"> "._UMOMSG.": <b>$oldpms</b><br>\n<hr>\n";
} else {
$content .= "<center>"._UMWEL."<br><img src=\"images/blocks/useronline/No_Avatar.gif\"><br>$anonymous\n</center><hr>";
$content .= "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">";
$content .= "<tr><td>"._UMNICK."</td><td align=\"right\"><input type=\"text\" name=\"username\" size=\"18\" maxlength=\"25\">";
$content .= "</tr></td><tr><td>"._UMPSW."</td><td align=\"right\"> <input type=\"password\" name=\"user_password\" size=\"18\" maxlength=\"20\">";
if (extension_loaded("gd") AND ($gfx_chk == 2 OR $gfx_chk == 4 OR $gfx_chk == 5 OR $gfx_chk == 7)) {
$content .= "<tr><td>"._SECURITYCODE.":</td><td align=right><img src='?gfx=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."' width=120 height=20></td></tr>\n"
."<tr><td>"._TYPESECCODE.":</td><td alin=right> <input type=\"text\" name=\"gfx_check\" size=\"18\" maxlength=\"6\"></td></tr>\n"
."<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">\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 .= "</td></tr><td><a href=\"index.php?name=Your_Account&op=new_user\">"._UMREG."</a></td><td align=\"right\"><input type=\"submit\" value=\""._UMLOGIN."\">\n</tr></td></table><hr>";
}
$content .= "<img src=\"images/blocks/useronline/icon_profile.gif\" height=\"15\" width=\"19\"> <b>"._BMEMP.":</b><br>\n";
$content .= "<img src=\"images/blocks/useronline/ur-moderator.gif\" height=\"15\" width=\"15\"> "._BLATEST.": <A HREF=\"index.php?name=Forums&file=profile&mode=viewprofil e&u=$newid\"><b>$lastuser</b></a><br>\n";
$content .= "<img src=\"images/blocks/useronline/ur-author.gif\" height=\"15\" width=\"15\"> "._BTD.": <b>$userCount</b><br>\n";
$content .= "<img src=\"images/blocks/useronline/ur-admin.gif\" height=\"15\" width=\"15\"> "._BYD.": <b>$userCount2</b><br>\n";
$content .= "<img src=\"images/blocks/useronline/ur-guest.gif\" height=\"15\" width=\"15\"> "._BOVER.": <b>$numrows</b><br>\n<hr>\n";
$content .= "<img src=\"images/blocks/useronline/group-1.gif\" height=\"15\" width=\"15\"> <b>"._UMONLINE."$who_online_num]:</b>\n<br>\n";
$content .= "<img src=\"images/blocks/useronline/ur-anony.gif\" height=\"15\" width=\"15\"> "._BVIS.": <b>$guest_online_num</b><br>\n";
$content .= "<img src=\"images/blocks/useronline/ur-member.gif\" height=\"15\" width=\"15\"> "._BMEM.": <b>$member_online_num</b>\n";
$content .= "<hr>\n<img src=\"images/blocks/useronline/group-3.gif\" height=\"15\" width=\"15\"> <b>"._UMON."</b><br>$who_online $who_online_now";
$content .= "</form>";
if (is_user($user)) {$content .= "<hr><img src=\"images/blocks/useronline/icon_logout.gif\" align=\"absmiddle\"><a href=\"index.php?name=Your_Account&op=logout\"> <b>"._UMBEXIT."</b></a>";}
?>
Заранее огромное спасибо...
|
|