예제 #1
0
 public function actionIndex()
 {
     $loginModel = new Login();
     $data['loginModel'] = $loginModel;
     $data['loginerror'] = 0;
     //前台登陆
     if (isset($_POST['Login'])) {
         $loginModel->attributes = $_POST['Login'];
         if (!$loginModel->validate()) {
             $data['loginerror'] = 1;
         } else {
             $sql = "select id from {{user}} where username = '******'Login']['loginname'] . "' and password = '******'Login']['loginpass']) . "' ";
             $LoginInfo = $loginModel->findBySql($sql);
             if ($LoginInfo == NULL) {
                 $loginModel->addError("loginname", "用户名或密码错误!");
                 $data['loginerror'] = 1;
             } else {
                 Yii::app()->session['uid'] = $LoginInfo['id'];
                 $this->redirect(array("/index/m", 'who' => $LoginInfo['id']));
             }
         }
     }
     $userModel = User::model();
     $url = "http://" . Yii::app()->params['bucket'] . "." . Yii::app()->params['domain'] . "/";
     $sql = "select id,username,headpicture from {{user}}";
     $data['users'] = $userModel->findAllBySql($sql);
     $data['url'] = $url;
     //切换布局
     $this->layout = "//layouts/register";
     $this->render("imain", $data);
 }
예제 #2
0
 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         $model = new Login();
         //echo CActiveForm::validate($model);
         $model->attributes = $_POST['Login'];
         //echo "ajax login:"******"/";
             if (Yii::app()->user->role == $this->roles['hy']) {
                 $rUrl = "/main/confirm.do";
             }
             echo '{"targetUrl":"' . $rUrl . '","success":true}';
             //Yii::app()->user->returnUrl
         } else {
             echo '{"msg":"';
             //implode(",",$model->getErrors());
             foreach ($model->getErrors() as $errors) {
                 echo '<br />' . implode(",", $errors);
             }
             echo '","success":false}';
         }
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['Login'])) {
         $model = new Login();
         $model->attributes = $_POST['Login'];
         //var_dump($_POST['Login']);
         //$model->getError();
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             $this->redirect("/");
             //Yii::app()->user->returnUrl
         }
     }
     // display the login form
     $this->render('login');
 }
예제 #3
0
 public function actionIndex()
 {
     $formModel = new Login();
     if (Yii::app()->user->isGuest) {
         if (isset($_POST['Login'])) {
             $formModel->username = $_POST['Login']['username'];
             $formModel->password = $_POST['Login']['password'];
             $formModel->rememberMe = $_POST['Login']['rememberMe'];
             if ($formModel->validate()) {
                 $user = User::model()->get(Yii::app()->user->getId());
                 $user->logSession();
                 /*if (strpos(Yii::app()->user->returnUrl, 'index.php') !== false)
                 			$this->redirect(Yii::app()->controller->module->returnUrl);
                 		else*/
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
         $formModel->password = '';
         $this->render('login', array('model' => $formModel));
     } else {
         $this->redirect(Yii::app()->controller->module->returnUrl);
     }
 }
예제 #4
0
 /**
  * This action validates user login and redirects to dashboard or return url.
  */
 public function actionIndex()
 {
     $model = new Login('login');
     // collect user input data
     if (isset($_POST['Login'])) {
         $model->attributes = $_POST['Login'];
         // validate user input and redirect to the correct user landing page
         if ($model->validate() && $model->login()) {
             $redirurl = Yii::app()->user->dashboardurl;
             $returnurl = Yii::app()->user->returnUrl;
             if (strpos($returnurl, 'sharewall.co.uk') !== false) {
                 $this->redirect($redirurl);
             } else {
                 $this->redirect($returnurl);
             }
         } else {
             // display the login form
             $this->render('index', array('model' => $model));
         }
     } else {
         // display the login form
         $this->render('index', array('model' => $model));
     }
 }
error_reporting (E_ALL ^ E_NOTICE);
require "../includes/classes/clsDataConn.php";
require "../includes/classes/clsAdminLogin.php";

/*
require_once "includes/classes/clsPartFinder.php";
require_once "includes/classes/clsMakes.php";
require_once "includes/classes/clsUnits.php";
require_once "includes/classes/clsUnitsBrief.php";
require_once "includes/generic_functions.php";

*/

//$message = $_GET["message"];
$login = new Login();
$logged_in = $login->validate();
if (! $logged_in) {
	header ("Location: index.php");
	exit(0);
}


//S-----Get input-----
	$strTableName = $_GET["t"]; //$_REQUEST["t"];
		//echo "strTableName=" . $strTableName . "<BR>";
		if ($strTableName == "") {
			$strErrorMessage = "Valid Table Name Required";
			$temp = f_OutputErrorNow($strErrorMessage); //terminates page
		}
	$strIdField = $_GET["if"];
		if ($strIdField == "") {
            $user = $Facebook->api('/me');
            //Saves ther user's inforamtion
        } catch (FacebookApiException $e) {
            echo 'There was an unexpected error. Please contact us.';
            $fb = null;
        }
    }
    require $baseDir . 'includes/redirect.php';
    //Redirect to login if the user isn't logged in
    $Profile = new Profile($Database, $user["id"], $_SESSION["login_type"]);
    //Instantiate the profile class
    $user = $Profile->getUserInfo();
    //Get information about the user
}
#########################################################################################
#																						#
# If a user is logged in through datehitter							                    #
#																						#
#########################################################################################
if ($_SESSION["login_type"] == 'konetch') {
    $Login = new Login($Database);
    if ($Login->validate($_SESSION["session_key"])) {
        $Profile = new Profile($Database, $_SESSION["session_key"], $_SESSION["login_type"]);
        //Instantiate the user class with the
        $user = $Profile->getUserInfo();
    }
}
if (!isset($publicPage)) {
    require $baseDir . 'includes/redirect.php';
}
//If this isn't a public page, redirect to login
예제 #7
0
 public function actionLogin()
 {
     $form = new Login();
     if (Yii::app()->request->isPostRequest && isset($_POST['Login'])) {
         $form->attributes = $_POST['Login'];
         if ($form->validate()) {
             $this->redirect(Yii::app()->user->returnUrl);
         }
     }
     $this->render('login', array('form' => $form));
 }