<?php
/*
@author waychar
@技术支持 150572314@qq.com
@copyright 2018 waychar.cn 声明：本代码可以用于学习交流使用及要商业化用途
*/
session_start();
require_once 'model/account.php';
require_once 'model/user.php';

$account = new account();
$error = get($_GET['error']);

if ($action == '' || $action == 'login') {
    //if had login
    $href = $account->href(get($_GET['href']));
    $account->is_login($href);
    $error = get($_GET['error']);
    //login
    $title="填写用户名及密码";
    $back_url="index.php";
    $other_button = "<a href=javascript:void(0) onclick='return login()'>登陆</a>";
    include 'view/top.php';
    include 'view/login.php';
} elseif ($action == 'reg') {
    //register
    $error = get($_GET['error']);
    $href = $account->href(get($_GET['href']));
    $title="填写注册资料";
    $back_url="index.php";
    $other_button = "<a href=javascript:void(0) onclick='return login()' />注册</a>";
    include 'view/top.php';
    include 'view/reg.php';
} elseif ($action == 'active_account') {
    $mobi = get($_GET['mobi']);
    include 'view/top.php';
    include 'view/active_account.php';
} elseif ($action == 'findPwd')
{
    $mobi = get($_GET['mobi']);
    $title="找回密码";
    $back_url="index.php?c=account&action=login";
    include 'view/top.php';
    include 'view/findpwd.php';
} elseif ($action == 'logout')
{
    setcookie("username", "");
    setcookie("fullname", "");
    setcookie("active", "");
    setcookie("mobi", "");
    setcookie("id", "");
    setcookie("company_id", "");
    ////
    $_SESSION["id"] = "";
    $_SESSION["e_user"] = "";
    $_SESSION["e_name"] = "";
    $_SESSION["e_date"] = "";
    $_SESSION["e_state"] = "";
    $_SESSION["e_dep_id"] = "";
    $_SESSION["e_update"] = "";
    go("index.php");
}
include 'view/bottom.php';
exit();
?>
