Пример #1
0
 /**
  *
  * @do system login
  *
  * @access public 
  * @author Nick
  * @copyright rockhippo
  * @param -
  * @return -
  *
  */
 public function loginAction()
 {
     //当有用户请求登陆时
     if ($this->ispost) {
         $username = reqstr("username", FALSE);
         $password = reqstr("password", FALSE);
         if (!$username || !$password) {
             header("Location : /index/login");
         }
         //用户model
         $userModel = new PSys_UserModel();
         $result = $userModel->loginVerify($username, $password);
         if ($result && $result['status'] == 1) {
             XSession::Set("TA_user", $result);
             $this->jump("Welcome " . $result['user_nick'], "success", "/index/index", 1);
             exit;
         } else {
             header("Location : /index/login");
         }
     }
     $this->forward = "login";
 }
Пример #2
0
* 修 改 者:$LastChangedBy: tony_ren $                                      
* 版本地址:$HeadURL: http://192.168.1.100:12000/svn/rocktrain/trunk/RockAdmin/public/psys/v.php $                                            
* 摘    要:验证码                                                       
*/
$pubcomm = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "protected" . DIRECTORY_SEPARATOR . "publib" . DIRECTORY_SEPARATOR . "comm" . DIRECTORY_SEPARATOR;
require_once $pubcomm . 'XSession.php';
//随机生成一个4位数的数字验证码
$num = "";
for ($i = 0; $i < 4; $i++) {
    $num .= rand(0, 9);
}
//4位验证码也可以用rand(1000,9999)直接生成
//将生成的验证码写入session,备验证页面使用
//Session_start();
XSession::Init();
XSession::Set("avacode", $num);
//创建图片,定义颜色值
//Header("Content-type: image/PNG");
srand((double) microtime() * 1000000);
$im = imagecreatetruecolor(60, 20);
$black = ImageColorAllocate($im, 0, 0, 0);
$gray = ImageColorAllocate($im, 200, 200, 200);
imagefill($im, 0, 0, $gray);
//随机绘制两条虚线,起干扰作用
$style = array($black, $black, $black, $black, $black, $gray, $gray, $gray, $gray, $gray);
imagesetstyle($im, $style);
$y1 = rand(0, 20);
$y2 = rand(0, 20);
$y3 = rand(0, 20);
$y4 = rand(0, 20);
imageline($im, 0, $y1, 60, $y3, IMG_COLOR_STYLED);
Пример #3
0
 public function SetSessionInfo(array $one)
 {
     XSession::Set("Cur_X_User", $one);
 }
Пример #4
0
* 修 改 者:$LastChangedBy$                                      
* 版本地址:$HeadURL$                                            
* 摘    要:验证码                                                       
*/
$pubcomm = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . "protected" . DIRECTORY_SEPARATOR . "publib" . DIRECTORY_SEPARATOR . "comm" . DIRECTORY_SEPARATOR;
require_once $pubcomm . 'XSession.php';
//随机生成一个4位数的数字验证码
$num = "";
for ($i = 0; $i < 4; $i++) {
    $num .= rand(0, 9);
}
//4位验证码也可以用rand(1000,9999)直接生成
//将生成的验证码写入session,备验证页面使用
//Session_start();
XSession::Init();
XSession::Set("AdminLoginVcode", $num);
//创建图片,定义颜色值
//Header("Content-type: image/PNG");
srand((double) microtime() * 1000000);
$im = imagecreatetruecolor(60, 20);
$black = ImageColorAllocate($im, 0, 0, 0);
$gray = ImageColorAllocate($im, 200, 200, 200);
imagefill($im, 0, 0, $gray);
//随机绘制两条虚线,起干扰作用
$style = array($black, $black, $black, $black, $black, $gray, $gray, $gray, $gray, $gray);
imagesetstyle($im, $style);
$y1 = rand(0, 20);
$y2 = rand(0, 20);
$y3 = rand(0, 20);
$y4 = rand(0, 20);
imageline($im, 0, $y1, 60, $y3, IMG_COLOR_STYLED);