public function checkLogin() { if (!isset($_SESSION['ticeStuId'])) { Tool::alertLocation(null, Controller::createUrl('user/login')); return false; } return true; }
public static function checkAdmin() { if (!isset($_SESSION['ticeAdmin'])) { Tool::alertLocation('请先登录', Controller::createUrl('default/login')); return false; } return true; }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { if (Yii::app()->user->isGuest) { Controller::redirect(Controller::createUrl(Yii::app()->user->loginUrl[0])); } // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { if (Yii::app()->user->isGuest) { Controller::redirect(Controller::createUrl(Yii::app()->user->loginUrl[0])); } if (!Yii::app()->user->isAdmin()) { throw new CHttpException(403, 'You are not authorized to perform this action.'); } // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } }
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>sidebar</title> <link rel="stylesheet" href="css/admin/default/admin.css"> </head> <body id="sidebar"> <dl> <a href="<?php echo Controller::createUrl('site/search'); ?> " target="main"><dd><p>查询体测数据</p></dd></a> </dl> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>首页</title> </head> <frameset rows="90px,*" border="0"> <frame src="<?php echo Controller::createUrl('site/header'); ?> " noresize="true" scrolling="no"/> <frameset cols="*,978px,*" border="1px"> <frame> <frameset cols="176px,*" scrolling="yes"> <frame src="<?php echo Controller::createUrl('site/sidebar'); ?> " name="sidebar" noresize="true" scrolling="no"/> <frame src="<?php echo Controller::createUrl('site/main'); ?> " name="main" /> </frameset> <frame> </frameset> </frameset> </html>
<head lang="en"> <meta charset="UTF-8"> <title>请登录</title> <link rel="stylesheet" href="css/admin/default/admin.css"> <script src="js/admin/default/jquery-1.11.1.min.js"></script> <script src="js/admin/default/adminLogin.js"></script> </head> <body> <form id="admin_login" name="login" method="post" action="<?php echo Controller::createUrl('site/login'); ?> "> <fieldset> <legend>学生体测查询平台登录</legend> <label><span class="width">学号:</span><input type="text" name="name" class="text"></label> <label><span class="width">密码:</span><input type="password" name="password" class="text"></label> <label><span class="width">验证码:</span><input type="test" class="text code" name="code" id="code"> <img id="codeImg" src="<?php echo Controller::createUrl('validateCode/index'); ?> " onclick="javascript:this.src='index.php?r=validateCode/index&tm='+Math.random();"> </label> <input type="submit" value="登录" onclick="return checkLogin(); " class="submit" name="send"> </fieldset> </form> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>header</title> <link rel="stylesheet" href="css/admin/default/admin.css"> </head> <body> <div id="header"> <ul> <a href="<?php echo Controller::createUrl('site/resetPasswd'); ?> " target="main"><li>修改密码</li></a> <a href="<?php echo Controller::createUrl('site/logout'); ?> " target="_parent"><li>退出</li></a> </ul> <p>欢迎您!学号:<?php echo $_SESSION['ticeStuId']; ?> </p> </div> </body> </html>
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>sidebar</title> <link rel="stylesheet" href="css/admin/default/admin.css"> </head> <body id="sidebar"> <dl> <a href="<?php echo Controller::createUrl('data/manual'); ?> " target="main"><dd><p>上传文件格式说明</p></dd></a> <a href="<?php echo Controller::createUrl('data/config'); ?> " target="main"><dd><p>设置上传文件格式</p></dd></a> <a href="<?php echo Controller::createUrl('data/upload'); ?> " target="main"><dd><p>上传体测数据</p></dd></a> </dl> </body> </html>
font-weight: bold; font-size: 20px; cursor: pointer; color: green; } p.green { font-weight: bold; font-size: 20px; color: green; } </style> </head> <body> <form method="post" action="<?php echo Controller::createUrl('data/config'); ?> "> <ul> <li> 学校类型: <select name="schoolType"> <option value="_placeHolder">请选择</option> <?php foreach ($schoolArr as $key => $name) { $selected = $key == $config->schoolType ? 'selected' : ''; echo '<option value="' . $key . '" ' . $selected . '>' . $name . '</option>'; } ?> </select> </li>
<meta charset="UTF-8"> <title>修改密码</title> <script src="js/admin/default/jquery-1.11.1.min.js"></script> <script src="js/admin/default/adminLogin.js"></script> <style> span.width { display: inline-block; width: 100px; text-align: right; } </style> </head> <body> <form id="admin_login" name="login" method="post" action="<?php echo Controller::createUrl('site/resetPasswd'); ?> "> <dl> <dd> <span class="width">原密码:</span><input type="password" name="oldPassword" class="text"> </dd> <dd> <span class="width">新密码:</span><input type="password" name="password" class="text"> </dd> <dd> <span class="width">新密码确认:</span><input type="password" name="confirm" class="text"> </dd> <dd> <input type="submit" value="修改" onclick="return checkReset(); " class="submit" name="send"> </dd>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>header</title> <link rel="stylesheet" href="css/admin/default/admin.css"> </head> <body> <div id="header"> <ul> <a href="<?php echo Controller::createUrl('default/resetPasswd'); ?> " target="main"><li>修改密码</li></a> <a href="<?php echo Controller::createUrl('default/logout'); ?> " target="_parent"><li>退出</li></a> </ul> <p>欢迎您,管理员<?php echo $_SESSION['ticeAdmin']; ?> !</p> </div> </body> </html>
<meta charset="UTF-8"> <title>修改密码</title> <script src="js/admin/default/jquery-1.11.1.min.js"></script> <script src="js/admin/default/adminLogin.js"></script> <style> span.width { display: inline-block; width: 100px; text-align: right; } </style> </head> <body> <form id="admin_login" name="login" method="post" action="<?php echo Controller::createUrl('default/resetPasswd'); ?> "> <dl> <dd> <span class="width">原密码:</span><input type="password" name="oldPassword" class="text"> </dd> <dd> <span class="width">新密码:</span><input type="password" name="password" class="text"> </dd> <dd> <span class="width">新密码确认:</span><input type="password" name="confirm" class="text"> </dd> <dd> <input type="submit" value="修改" onclick="return checkReset(); " class="submit" name="send"> </dd>
<div class="topnav_text"><a href='#'>Home</a> | <a href='#'>My Account</a> | <a href='#'>Settings</a> | <a href='#'>Logout</a> </div> </div> <div id="header"> <div id="logo"><img src="<?php echo Yii::app()->theme->baseUrl; ?> /images/logo.png"></img><?php //echo CHtml::encode(Yii::app()->name); ?> </div> </div><!-- header --> <div id="mainmenu"> <?php $this->widget('zii.widgets.CMenu', array('items' => array(array('label' => 'Home', 'url' => array('/site/index')), array('url' => Yii::app()->getModule('user')->loginUrl, 'label' => Yii::app()->getModule('user')->t("Login"), 'visible' => Yii::app()->user->isGuest), array('url' => Yii::app()->getModule('user')->registrationUrl, 'label' => Yii::app()->getModule('user')->t("Register"), 'visible' => Yii::app()->user->isGuest), array('url' => Yii::app()->getModule('user')->profileUrl, 'label' => Yii::app()->getModule('user')->t("Profile"), 'visible' => !Yii::app()->user->isGuest), array('url' => Yii::app()->getModule('user')->logoutUrl, 'label' => Yii::app()->getModule('user')->t("Logout") . ' (' . Yii::app()->user->name . ')', 'visible' => !Yii::app()->user->isGuest), array('url' => Controller::createUrl('/schemes'), 'label' => 'Schemes'), array('url' => Controller::createUrl('/Designation'), 'label' => 'Designation'), array('url' => Controller::createUrl('/Designation_types'), 'label' => 'Designation_types'), array('url' => Controller::createUrl('/Designation_types'), 'label' => 'Designation_types'), array('url' => Controller::createUrl('/Department'), 'label' => 'Department'), array('url' => Controller::createUrl('/Issues'), 'label' => 'Issues'), array('url' => Controller::createUrl('/Instructions'), 'label' => 'Instructions')))); ?> </div><!-- mainmenu --> <?php //my addition //echo "<p class=\"currentvalues\"><span> Current User:"******"(".User::model()->findByPk(Yii::app()->user->id)->profile->firstname." ".User::model()->findByPk(Yii::app()->user->id)->profile->lastname.")"."</span>"; //echo "<span> Current Scheme:"."Scheme Name"."</span></p>"; //my addition if (isset($this->breadcrumbs)) { ?> <?php $this->widget('zii.widgets.CBreadcrumbs', array('links' => $this->breadcrumbs)); ?> <!-- breadcrumbs --> <?php }