// // ------------------------------------------------------------------------- // // Original Author: The Xoops Project // Author Website : http://www.xoops.org // License Type : GPL: See /manual/LICENSES/GPL.txt // ------------------------------------------------------------------------- // $xoopsOption['pagetype'] = 'user'; $xoopsOption['page_style'] = 8; include_once('./mainfile.php'); function main() { global $xoopsUser, $_COOKIE, $bcoosConfig; if (!$xoopsUser) { include_once("./header.php"); OpenTable(); echo "
"._US_USERLOGIN.":
"._US_NICKNAMECOLON."
"._US_PASSWORDCOLON."
"; CloseTable(); echo "

". _US_NOTREGISTERED ."

"; OpenTable(); echo " "._US_LOSTPASSWORD."

"._US_NOPROBLEM."
"._US_YOUREMAIL."

"._US_ACTKEYCOLON." "._US_PASSWORDCOLON." "; CloseTable(); echo "
"; include_once("./footer.php"); } elseif ($xoopsUser) { header("Location: userinfo.php?uid=".$xoopsUser->getVar("uid").""); exit(); } } //---------------------------------------------------------------------------------------// /** * Description * * @param type $var description * @return type description */ function logout() { global $xoopsUser; if ($xoopsUser) { $xoopsUser->logout(); } redirect_header("index.php", 1, _US_LOGGEDOUT."
"._US_THANKYOUFORVISIT."
"); exit(); } //---------------------------------------------------------------------------------------// /** * Description * * @param type $var description * @return type description */ function login($uname, $pass) { $uname = trim($uname); $pass = trim($pass); if ( !isset($uname) || !isset($pass) || $uname == "" || $pass == "" ) { redirect_header("user.php", 1, _US_INCORRECTLOGIN); exit(); } $user = XoopsUser::login($uname, $pass); if ( false != $user) { if ( 0 == $user->getVar('level') ) { redirect_header("index.php", 5, _US_NOACTTPADM); exit(); } include_once(XOOPS_ROOT_PATH.'/class/sessions.class.php'); $session = new XoopsUserSession(); $session->setUid($user->getVar('uid')); $session->setUname($user->getVar('uname')); $session->setPass($user->getVar('pass')); if ( !$session->store() ) { redirect_header("index.php", 1, _NOTUPDATED); exit(); } $user->updateLastLogin(); $url = (_HTTP_REFERER != "") ? _HTTP_REFERER : 'index.php'; // If caching probs persist, turn this hack on $url .= preg_match('#\&#', $url) ? '&'.time() : '?'.time(); redirect_header($url, 1, sprintf(_US_LOGGINGU, $user->getVar('uname'))); exit(); } else { redirect_header("user.php", 1, _US_INCORRECTLOGIN); exit(); } } //---------------------------------------------------------------------------------------// /** * Description * * @param type $var description * @return type description */ function activate($id, $key) { global $db; if ( empty($id) || !is_numeric($id) ) { redirect_header("index.php", 1, ""); exit(); } $thisuser = new XoopsUser($id); if ( $thisuser->actkey() != $key ) { redirect_header("index.php", 5, _US_ACTKEYNOT); exit(); } else { if ( $thisuser->isActive() ) { redirect_header("user.php", 5, _US_ACONTACT); exit(); } else { if ($thisuser->activate()) { redirect_header("user.php", 5, _US_ACTLOGIN); exit(); } else { redirect_header("index.php", 5, "Activation failed!"); exit(); } } } } //---------------------------------------------------------------------------------------// /** * Description * * @param type $var description * @return type description */ function delete($ok=0) { global $xoopsUser, $bcoosConfig, $_POST; if ( !$xoopsUser || !$bcoosConfig['self_delete'] ) { redirect_header("index.php", 5, _NOACTION); exit(); } else { if ($ok == 1) { if (!$xoopsUser->isAdmin()) { $xoopsUser->delete(); redirect_header("index.php", 3, _US_BEENDELED); exit(); } else { redirect_header("index.php", 5, _NOACTION); exit(); } } else { include_once("header.php"); echo "

"._US_SURETODEL."

"._US_REMOVEINFO."
"; echo "
"; echo myTextForm("user.php?op=delete&ok=1", _YES); echo ""; echo myTextForm("user.php", _NO); echo "
"; include_once("footer.php"); exit(); } } } //---------------------------------------------------------------------------------------// /** * Description * * @param type $var description * @return type description */ $op = !empty($_POST['op']) ? $_POST['op'] : $_GET['op']; switch($op) { case "logout": logout(); break; case "login": if (!headers_sent()) { header("Expires: Sat, 18 Aug 2002 05:30:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-store, no-cache, max-age=1, s-maxage=1, must-revalidate, post-check=0, pre-check=0"); } login($_POST['uname'], $_POST['pass']); break; case "actv": activate($_GET['id'], $_GET['key']); break; case "delete": delete($_POST['ok']); break; default: main(); } ?>