public function enc()
 {
     echo $str = think_encrypt('123fejf', 'fjejf339fd3j', 15);
     $str1 = think_decrypt($str, 'fjejf339fd3j');
     S('t', $str);
     dump(S('t'));
 }
 /**
  * 批量保存配置
  * @author 麦当苗儿 <*****@*****.**>
  */
 public function save($config)
 {
     $old['artid'] = M('Config')->where(array('name' => 'WXARTID'))->getField('value');
     if ($config && is_array($config)) {
         $Config = M('Config');
         foreach ($config as $name => $value) {
             $map = array('name' => $name);
             if ($name == 'WXARTID') {
                 if ($old['artid'] != $value) {
                     asyn_sendwx();
                     //$WX->sendwx();
                 }
             }
             if ($name == 'WXPASS') {
                 $value = think_encrypt($value, UC_AUTH_KEY);
             }
             $Config->where($map)->setField('value', $value);
         }
     }
     S('DB_CONFIG_DATA', null);
     $config_file = './App/Home/Conf/theme.php';
     $themename = (include $config_file);
     if ($config['WEB_THEME'] != $themename['DEFAULT_THEME']) {
         //写入配置文件
         $theme['DEFAULT_THEME'] = $config['WEB_THEME'];
         file_put_contents($config_file, "<?php \nreturn " . var_export($theme, true) . ";", LOCK_EX);
         dir_delete(RUNTIME_PATH);
     }
     $this->mtReturn(200, '网站配置保存成功!', '', 'forward', U('group'));
 }
 public function upload()
 {
     /* 返回标准数据 */
     $return = array('status' => 1, 'info' => '上传成功', 'data' => '');
     /* 获取当前分类附件配置信息 */
     $default = C('ATTACHMENT_DEFAULT');
     $category = get_category(I('get.category'));
     /* 分类正确性检测 */
     if (empty($category)) {
         $return['status'] = 0;
         $return['info'] = '没有指定分类或分类不正确;';
     } else {
         $config = $category['extend']['attachment'];
         $config = empty($config) ? $default : array_merge($default, $config);
         /* 检测并上传附件 */
         if (in_array('2', str2arr($config['allow_type']))) {
             $setting = C('ATTACHMENT_UPLOAD');
             /* 调用文件上传组件上传文件 */
             $File = M('File');
             $info = $File->upload($_FILES, $setting, $config['driver'], $config['driver_config']);
             /* 记录附件信息 */
             if ($info) {
                 $return['data'] = think_encrypt(json_encode($info['attachment']));
             } else {
                 $return['status'] = 0;
                 $return['info'] = $File->getError();
             }
         } else {
             $return['info'] = '该分类不允许上传文件附件!';
             $return['status'] = 0;
         }
     }
     /* 返回JSON数据 */
     $this->ajaxReturn($return);
 }
 public function artc()
 {
     $id = I('id');
     $info = D('Article')->get_info($id);
     if (!$info) {
         $this->error('非法ID!', U('Index/index'), false, true);
     }
     $info['description'] = stripcslashes($info['description']);
     preg_match_all("/(?<=\\[attach\\])([\\d]*)(?=\\[\\/attach\\])/", $info['description'], $arr);
     preg_match_all("/(?<=\\[qnattach\\])([\\d]*)(?=\\[\\/qnattach\\])/", $info['description'], $qnarr);
     foreach ($arr[0] as $key => $vo) {
         $replace = '<a href="' . U('File/download', array('id' => think_encrypt($vo))) . '" target="_blank" >' . getattachname($vo) . '</a><span class="attachspan">(下载次数:' . getattachdnum($vo) . '次;大小:' . format_bytes(getattachsize($vo)) . ')</span>';
         $info['description'] = str_replace('[attach]' . $vo . '[/attach]', $replace, $info['description']);
     }
     foreach ($qnarr[0] as $key1 => $vo1) {
         $replace1 = '<a href="' . U('File/download', array('qn' => 1, 'id' => think_encrypt($vo1))) . '" target="_blank" >' . getqnattachname($vo1) . '</a><span class="attachspan">(下载次数:' . getqnattachdnum($vo1) . '次;大小:' . format_bytes(getqnattachsize($vo1)) . ')</span>';
         $info['description'] = str_replace('[qnattach]' . $vo1 . '[/qnattach]', $replace1, $info['description']);
     }
     if ($info['status'] != 1 && $info['uid'] != $_SESSION['cs_home']['user_auth']['uid']) {
         $this->error('你无权查看该内容!', '', false, true);
     }
     $focus['rowid'] = $info['id'];
     $focus['type'] = 1;
     if ($sccount = M('focus')->where($focus)->count() != $info['sccount']) {
         D('Article')->where(array('id' => $id))->setField('sccount', $sccount);
     }
     D('Article')->where(array('id' => $id))->setInc('view', 1);
     if (!empty($info['tag'])) {
         $tags = explode(',', $info['tag']);
         $info['linktag'] = '';
         foreach ($tags as $key1 => $vo1) {
             $maptag['title'] = $vo1;
             $maptag['type'] = 1;
             $tagid = M('tags')->where($maptag)->getField('id');
             $url = CSU('/tagart/' . $tagid, 'Index/tagart', array('id' => $tagid));
             $info['linktag'] .= '<a style="margin-left:5px;" href="' . $url . '">[' . $vo1 . ']</a>';
             $info['tagarr'][$key1] = '<a class="tag" href="' . $url . '">' . $vo1 . '</a>';
         }
     }
     $shareurl = 'http://' . $_SERVER['HTTP_HOST'] . CSU('/artc/' . $info['id'], 'Index/artc', array('id' => $info['id']));
     $sharedes = '原文链接:' . $shareurl;
     $sharetitle = $info['title'] . '-' . C('WEB_SITE_TITLE');
     $authorinfo = query_user(array('space_url', 'signature', 'avatar64', 'nickname'), $info['uid']);
     $map['id'] = is_login();
     $map['rowid'] = $info['id'];
     $map['type'] = 1;
     if (M('Focus')->where($map)->count() > 0) {
         $hassc = true;
     }
     $this->assign('shareurl', $shareurl);
     $this->assign('hassc', $hassc);
     $this->assign('sharedes', $sharedes);
     $this->assign('sharetitle', $sharetitle);
     $this->assign('authorinfo', $authorinfo);
     $this->assign('info', $info);
     $this->assign('webdescription', $info['title']);
     $this->assign('webkeyword', $info['title']);
     $this->assign('webtitle', $info['title']);
     $this->display();
 }
 /**
  * 登陆验证
  * @param  [type] $u [用户名]
  * @param  [type] $p [密码]
  * @return [type] sid   [sid]
  * @return [type] uid   [用户ID]
  * @return [type] emp_name   [用户姓名]
  * @return [type] emp_no   [用户名]
  * @return [type] head  [头像]
  * @return [type] dept   [部门]
  * @return [type] position   [职位]
  * @return [type] rank   [职级]
  * @return [type] mobile_tel   [电话]
  * @return [type] email   [邮箱]
  * @return [type] sex   [性别]
  * @return [type] duty   [业务介绍]
  * @return [type] chek_flow [审核公文权限]
  * @return [type] submited_flow [提交公文权限]
  * @return [type] add_meeting [添加会议权限]
  * @return [type] check_meeting [<审核会议权限>]
  */
 function login($u, $p)
 {
     $result = D('User')->apiLogin($u, $p, -1, '1,2');
     // var_dump($result);
     // exit;
     if (is_array($result)) {
         //登陆成功返回accesskey
         $data['sid'] = think_encrypt($result['id'], C('UID_KEY'));
         $data['uid'] = $result['id'];
         $data['emp_name'] = $result['emp_name'];
         //姓名
         $data['emp_no'] = $result['emp_no'];
         //用户名
         $data['head'] = $result['pic'];
         //头像
         $data['dept'] = $result['dept_id'];
         //部门
         $data['position'] = $result['position_id'];
         //职位
         $data['rank'] = $result['rank_id'];
         //职级
         $data['mobile_tel'] = $result['mobile_tel'];
         //电话
         $data['email'] = $result['email'];
         //邮箱
         $data['sex'] = $result['sex'];
         //性别
         $data['duty'] = $result['duty'];
         //业务介绍
         $auth = $this->getAuth($result['id']);
         if ($auth) {
             // $data['add_flow'] = $auth['flow']?$auth['flow']:'';
             $data['add_meeting'] = $auth['meeting'] ? $auth['meeting'] : '';
             $data['check_meeting'] = $auth['meeting_check'] ? $auth['meeting_check'] : '';
             $data['chek_flow'] = $auth['chek_flow'] ? $auth['chek_flow'] : '';
             $data['submited_flow'] = $auth['submited_flow'] ? $auth['submited_flow'] : '';
         }
         // var_dump($data);
         // exit;
         $this->result('1', '登陆成功', $data);
     } else {
         switch ($result) {
             case 0:
                 $msg = '参数错误!';
                 break;
             case -1:
                 $msg = '用户不存在或被禁用!';
                 break;
             case -2:
                 $msg = '密码错误!';
                 break;
             case -3:
                 $msg = '没有登陆权限!';
                 break;
             default:
                 $msg = '未知错误!';
         }
         $this->result(0, $msg, '');
     }
 }
 public function getBackPwd()
 {
     $where['admin_email'] = $rootemail = I('post.rootemail');
     $where['name'] = $name = I('post.rootname');
     $pattern = '/^[0-9A-Za-z-\\._]+@\\w+(\\.(\\w){1,3}){1,3}$/';
     $subject = $rootemail;
     if (!preg_match($pattern, $subject)) {
         $this->redirect(U('Server/Admin'));
         die;
     } else {
         $tplObj = M('sys_email_templates');
         $tpl_status = $tplObj->field('subject,content,status')->where($where)->find();
         if ($tpl_status['status']) {
             //发邮件
             $to = $rootemail;
             //接收邮件邮箱
             $subject = $tpl_status['subject'];
             $content = $tpl_status['content'];
             //模板中包含标示
             // 自定义邮件发送内容
             $url = 'http://' . I('server.HTTP_HOST') . __APP__ . __CONTROLLER__ . '/repwd/code/' . think_encrypt($to);
             //此处加密未随机待完善
             $username = '******' . date('Y年m月d分 H时i分s秒') . '申请找回密码<strong style="color:#00acff;">' . $rootemail . '</strong>';
             $sy_webname = C('site_name');
             $url = '<a href="' . $url . '">' . $url . '</a>';
             $sy_webcopyright = C('copyright');
             // 邮件内容正则
             $pattern = array('/{sy_webname}/', '/{sy_webcopyright}/', '/{username}/', '/{url}/');
             $replacement = array($sy_webname, $sy_webcopyright, $username, $url);
             //替换模板中标签成实际内容
             $newSubject = preg_replace($pattern, $replacement, $subject);
             $newContent = preg_replace($pattern, $replacement, $content);
             //dump($newSubject);
             //dump($newContent);exit;
             $email = sendEMail($to, $newSubject, $newContent);
             //发送成功直接修改数据密码
             if ($email) {
                 //修改发送邮件时间,便用于邮件过期处理
                 $Model = M('root_admin');
                 $Model->where("name='{$name}'")->setField('this_time', time());
             } else {
                 $this->success('邮件发送失败,返回重试', U('Server/Admin'), 3);
             }
         } else {
             $this->error('管理员关闭找回密码功能', U('Server/Admin'), 3);
         }
     }
     //考虑调试邮箱登陆接口(未尝试过)
     $this->success('请查收您的邮件', U('Admin/index'), 3);
     /*
     		$to ='*****@*****.**';
     		$subject = '主题';
     		$content = '内容';
     		$email = sendEMail($to, $subject, $content);*/
     //dump($email);
 }
Beispiel #7
0
 public function upload()
 {
     $return = array('status' => 1, 'info' => '上传成功', 'data' => '');
     $qiniuconfig = json_decode(M('addons')->where(array('name' => 'Qiniu'))->getField('config'), true);
     if ($qiniuconfig['open'] == 1) {
         $addon = new QiniuAddon();
         $return = $addon->upload($_FILES);
         $exts = explode('.', strrev($_FILES['download']['name']));
         if (in_array(strtolower(strrev($exts[0])), array('jpg', 'gif', 'png', 'jpeg'))) {
             $return['ext'] = 3;
         } else {
             $return['ext'] = 4;
         }
         $this->ajaxReturn($return);
     } else {
         $exts = explode('.', strrev($_FILES['download']['name']));
         if (in_array(strtolower(strrev($exts[0])), array('jpg', 'gif', 'png', 'jpeg'))) {
             $return['ext'] = 1;
             /* 调用文件上传组件上传文件 */
             $Picture = D('Picture');
             $pic_driver = C('PICTURE_UPLOAD_DRIVER');
             $info = $Picture->upload($_FILES, C('PICTURE_UPLOAD'), C('PICTURE_UPLOAD_DRIVER'), C("UPLOAD_{$pic_driver}_CONFIG"));
             //TODO:上传到远程服务器
             /* 记录图片信息 */
             if ($info) {
                 $return['status'] = 1;
                 $info['download']['path'] = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/' . C('WEB_DIR') . $info['download']['path'];
                 // $info['Picture']['path']=$GLOBALS['_root'].$info['Picture']['path'];
                 $return = array_merge($info['download'], $return);
                 $return['info'] = $info[0]['path'];
                 //  $return['info'] =$_FILES['download']['name'];
             } else {
                 $return['status'] = 0;
                 $return['info'] = $Picture->getError();
             }
             $this->ajaxReturn($return);
         } else {
             $return['ext'] = 2;
             /* 调用文件上传组件上传文件 */
             $File = D('File');
             $file_driver = C('DOWNLOAD_UPLOAD_DRIVER');
             $info = $File->upload($_FILES, C('DOWNLOAD_UPLOAD'), C('DOWNLOAD_UPLOAD_DRIVER'), C("UPLOAD_{$file_driver}_CONFIG"));
             /* 记录附件信息 */
             if ($info) {
                 $return['status'] = 1;
                 $return['data'] = U('File/download', array('id' => think_encrypt($info['download']['id'])));
                 $return['info'] = $info['download']['id'];
             } else {
                 $return['status'] = 0;
                 $return['info'] = $File->getError();
             }
             /* 返回JSON数据 */
             $this->ajaxReturn($return, 'JSON');
         }
     }
 }
Beispiel #8
0
 /**
  * 获取模型详细信息
  * @param  integer $id 文档ID
  * @return array       当前模型详细信息
  * @author huajie <*****@*****.**>
  */
 public function detail($id)
 {
     $data = $this->field(true)->find($id);
     if (!$data) {
         $this->error = '获取详细信息出错!';
         return false;
     }
     $file = D('File')->field(true)->find($data['file_id']);
     $data['file'] = think_encrypt(json_encode($file));
     $data['file_id'] = $file;
     return $data;
 }
 public function ssoList()
 {
     //读取规则列表
     $map = array('status' => array('EGT', 0));
     $model = M('sso_app');
     $appList = $model->where($map)->order('id asc')->select();
     foreach ($appList as &$v) {
         $url = $v['url'] . '/' . $v['path'] . '?code=' . urlencode(think_encrypt('action=test&time=' . time()));
         $arr = $this->check_link($url);
         $v['link_status'] = $v['status'] == 1 ? $arr === 'success' ? '<span style="color:green">连接成功</span>' : '<span style="color:red">连接失败</span>' : '<span style="color:red">连接失败-已被禁用</span>';
     }
     unset($v);
     //显示页面
     $builder = new AdminListBuilder();
     $builder->title('单点登录应用列表')->buttonNew(U('editSsoApp'))->setStatusUrl(U('setSsoAppStatus'))->buttonEnable()->buttonDisable()->buttonDelete()->keyId()->keyTitle()->keyText('url', '网站路径')->keyText('path', 'api目录')->keyStatus()->keyText('link_status', '连接状态')->keyDoActionEdit('editSsoApp?id=###')->data($appList)->display();
 }
Beispiel #10
0
 /**
  * @param 创建订单
  * @return 加密后的站内订单编号
  * @author lussen <*****@*****.**>
  */
 public function creatPay()
 {
     $site_order = time_format(time(), 'YmdHis') . rand(100, 999);
     $data['uid'] = is_login();
     $data['pay_money'] = I('post.money');
     $data['pay_item'] = I('post.pay_item');
     $data['site_order'] = $site_order;
     $data['isdone'] = 0;
     $data['create_time'] = time();
     $result = $this->data($data)->add();
     if ($result !== false) {
         return think_encrypt($site_order);
     } else {
         return false;
     }
 }
 public function ssoList()
 {
     //读取规则列表
     $map = array('status' => array('EGT', 0));
     $model = D('sso_app');
     $appList = $model->where($map)->order('id asc')->select();
     foreach ($appList as &$v) {
         $url = $v['url'] . '/' . $v['path'] . '?code=' . urlencode(think_encrypt('action=test&time=' . time()));
         $arr = $this->check_link($url);
         $v['link_status'] = $v['status'] == 1 ? $arr === 'success' ? '<span style="color:green">' . L('_SUCCESS__LINK_') . '</span>' : '<span style="color:red">' . L('_FAIL__LINK_') . '</span>' : '<span style="color:red">' . L('_FAIL__LINK_LIMITED_') . '</span>';
     }
     unset($v);
     //显示页面
     $builder = new AdminListBuilder();
     $builder->title(L('_SINGLE_POINT_LOGIN_APPLICATION_LIST_'))->buttonNew(U('editSsoApp'))->setStatusUrl(U('setSsoAppStatus'))->buttonEnable()->buttonDisable()->buttonDelete()->keyId()->keyTitle()->keyText('url', L('_WEBSITE_PATH_'))->keyText('path', L('_CATEGORY_API_'))->keyStatus()->keyText('link_status', L('_CONNECTED_STATE_'))->keyDoActionEdit('editSsoApp?id=###')->data($appList)->display();
 }
 public function upload()
 {
     $return = array('status' => 1, 'info' => '上传成功', 'data' => '');
     /* 调用文件上传组件上传文件 */
     $File = D('File');
     $file_driver = C('DOWNLOAD_UPLOAD_DRIVER');
     $info = $File->upload($_FILES, C('DOWNLOAD_UPLOAD'), C('DOWNLOAD_UPLOAD_DRIVER'), C("UPLOAD_{$file_driver}_CONFIG"));
     /* 记录附件信息 */
     if ($info) {
         $return['data'] = think_encrypt(json_encode($info['download']));
     } else {
         $return['status'] = 0;
         $return['info'] = $File->getError();
     }
     /* 返回JSON数据 */
     $this->ajaxReturn($return);
 }
 public function upload()
 {
     //TODO: 用户登录检测
     /* 返回标准数据 */
     $return = array('status' => 1, 'info' => '上传成功', 'data' => '');
     /* 调用文件上传组件上传文件 */
     $File = D('File');
     $info = $File->upload($_FILES, C('DOWNLOAD_UPLOAD'));
     //TODO:上传到远程服务器
     /* 记录附件信息 */
     if ($info) {
         $return['data'] = think_encrypt(json_encode($info['download']));
     } else {
         $return['status'] = 0;
         $return['info'] = $File->getError();
     }
     /* 返回JSON数据 */
     $this->ajaxReturn($return);
 }
 public function addMoney($moeny, $uid)
 {
     echo $uid;
     $map['uid'] = $uid;
     $row = $this->where($map)->find();
     if (empty($row['id'])) {
         $data['uid'] = $uid;
         $data['money'] = think_encrypt($money);
         $result = $this->data($data)->add();
     } else {
         $map['uid'] = $uid;
         $data['money'] = think_encrypt(think_decrypt($row['money']) + $moeny);
         $result = $this->data($data)->where($map)->save();
         if ($result !== false) {
             return true;
         } else {
             return false;
         }
     }
 }
Beispiel #15
0
/**
 * 数组加密方法
 * @param string $data 要加密的字符串
 * @param string $key  加密密钥
 * @param int $expire  过期时间 单位 秒
 * @return string
 * @author 麦当苗儿 <*****@*****.**>
 */
function array_encode($data, $key = '', $expire = 0)
{
    $data = json_encode($data);
    return think_encrypt($data, $key, $expire);
}
 /**
  * 登录绑定
  */
 public function loginBangding()
 {
     $uid = is_login();
     if ($uid > 0) {
         //无论用户原来有没有绑定,自动绑定新的微信
         redirect(U('Mobile/Public/bangding'));
         //如果会员已经登录则自动跳转到会员中心
     }
     $code = I('get.code');
     //线上
     if (empty($code)) {
         $url = SITE_URL . loginBangdingUrl();
         $this->getToken($url);
         //线上
         return;
     }
     $userOpenid = $this->getOpenid();
     //线上
     cookie(md5('userOpenid'), think_encrypt($userOpenid));
     $data = array();
     $data['title'] = "袋袋金-绑定";
     $this->assign($data);
     $this->display("loginBangding");
     //action 有大写,需要明确指定模板文件
 }
Beispiel #17
0
/**
 * url加密
 * @param $num
 * @return string
 */
function url_encode($num)
{
    return think_encrypt($num, C('URL_KEY'));
}
 /**
  * 登录绑定,未被使用
  */
 public function loginBangding()
 {
     $uid = is_login();
     if ($uid > 0) {
         //无论用户原来有没有绑定,自动绑定新的微信
         redirect(U('Home/User/showUser'));
         //如果会员已经登录则自动跳转到会员中心
     }
     if (IS_POST) {
         $postData = I("post.");
         $where = array();
         if (preg_match('/^1\\d{10}$/', $postData['username'])) {
             $where['mobile'] = $postData['username'];
         } else {
             $where['username'] = $postData['username'];
         }
         $where['password'] = encrypt_password($postData['password']);
         $userInfo = M('user')->where($where)->find();
         if (!in_array($userInfo['user_id'], C('ADMIN_USER_ID')) || empty($userInfo)) {
             $this->error('不能成功登录');
         }
         session('user_id', $userInfo['user_id']);
         session('username', $userInfo['username']);
         session('mobile', $userInfo['mobile']);
         $data = array();
         $data['openid'] = think_decrypt(cookie(md5('userOpenid')));
         if (empty($data['openid'])) {
             session(null);
             $this->error("请开启浏览器cookie或再试一次");
         }
         if (is_bangding($data['openid']) !== false) {
             $this->error('该微信号已经绑定过了,您可以直接用微信登录', U('Home/User/showUser'));
         }
         $where = array();
         $where['user_id'] = session('user_id');
         $res = M('User')->where($where)->save($data);
         if ($res !== false) {
             $this->success('登录绑定成功!', U('Home/User/showUser'));
         } else {
             session(null);
             $this->error('登录绑定失败!', U('Home/User/loginBangding'));
         }
         exit;
     }
     $code = I('get.code');
     //线上
     if (empty($code)) {
         $url = SITE_URL . U('Home/User/loginBangding');
         $this->getToken($url);
         //线上
         return;
     }
     $userOpenid = $this->getOpenid();
     //线上
     cookie(md5('userOpenid'), think_encrypt($userOpenid));
     $data = array();
     $data['title'] = "登录绑定";
     $this->assign($data);
     $this->display("loginBangding");
     //action 有大写,需要明确指定模板文件
 }
								</script><?php 
                                    break;
                                    ?>
                            <?php 
                                case "file":
                                    ?>
<div class="controls">
									<input type="file" id="upload_file_<?php 
                                    echo $field["name"];
                                    ?>
">
									<input type="hidden" name="<?php 
                                    echo $field["name"];
                                    ?>
" value="<?php 
                                    echo think_encrypt(json_encode(get_table_field($data[$field['name']], 'id', '', 'File')));
                                    ?>
"/>
									<div class="upload-img-box">
										<?php 
                                    if (isset($data[$field['name']])) {
                                        ?>
<div class="upload-pre-file"><span class="upload_icon_all"></span><?php 
                                        echo get_table_field($data[$field['name']], 'id', 'name', 'File');
                                        ?>
</div><?php 
                                    }
                                    ?>
									</div>
								</div>
								<script type="text/javascript">
    function jiamiFile()
    {
        // 取当前用户的网站信息
        $map['uid'] = $this->mid;
        $info = M('web_info')->where($map)->find();
        // 第一步:取文件内容
        $file = SITE_PATH . '/test.php';
        $get = trim(wp_file_get_contents($file));
        if ('<?php' == strtolower(substr($get, 0, 5))) {
            $get = substr($get, 5);
        } else {
            $get = substr($get, 2);
        }
        if ('?>' == substr($get, -2)) {
            $get = substr($get, 0, -2);
        }
        // 第二步:取加密的KEY
        $key = substr($info['web_key'], 0, 5);
        $license = substr($info['web_key'], 5);
        // 代码里插入判断授权的代码段
        $pre_code = <<<str
\t\t\$ip = gethostbyname ( SITE_DOMAIN );
\t\t\$fip = strtok ( \$ip, '.' );
\t\t\$is_free = \$fip == '10' || \$fip == '127' || \$fip == '168' || \$fip == '192';
\t\tif (! \$is_free) {
\t\t\t\$license = C ( 'WEIPHP_STORE_LICENSE' );
\t\t\t\$key = substr ( \$license, 0, 5 );
\t\t\t\$license = substr ( \$license, 5 );\t\t\t
\t\t\t
\t\t\t\$domain_str = md5 ( think_encrypt ( SITE_DOMAIN, \$key ) );
\t\t\t\$ip_str = md5 ( think_encrypt ( \$ip, \$key ) );
\t\t\tif (\$license != \$domain_str && \$license != \$ip_str) {
\t\t\t\theader("Content-Type: text/html;charset=utf-8"); 
\t\t\t\techo '禁止访问未授权的应用';
\t\t\t\texit ();
\t\t\t}
\t\t}
str;
        $content = strip_whitespace($pre_code . $get);
        $content = think_encrypt($content, $key);
        $content = "<?php eval(code_decode('{$content}'));";
        dump($content);
        file_put_contents(SITE_PATH . '/test2.php', $content);
    }
Beispiel #21
0
 public function send_mail($to, $type)
 {
     $uid = is_login();
     if ($type == 1) {
         //验证邮件
         $map['id'] = array('neq', $uid);
         $map['email'] = $to;
         $r = M('ucenter_member')->where($map)->find();
         if ($r != '') {
             $this->error('该邮件地址已经被别人注册了!');
         }
         $name = get_username($uid);
         $subject = C('WEB_SITE') . '邮箱验证邮件';
         $body = '请点击以下链接完成邮箱验证,有效时间为5分钟:<br />' . "http://{$_SERVER['HTTP_HOST']}" . U('Userbase/yzmail', array('uid' => think_encrypt($uid, '', 3000), 'mail' => think_encrypt($to, '', 3000)));
     }
     if ($type == 2) {
         $subject = C('WEB_SITE') . ':恭喜您,注册成功!';
         $body = C('MAIL_USER_REG');
         $name = get_username($uid);
     }
     $res = send_mail($to, $subject, $body, $name, $attachment);
     if ($res == 1) {
         $this->success('邮件已发送,请到邮箱进行查收');
     } else {
         $this->error('邮件发送失败,请检查邮箱设置');
     }
 }
Beispiel #22
0
 public function mi()
 {
     $username = I('username');
     $email = I('email');
     if (IS_POST) {
         //登录验证
         //检测验证码
         //根据用户名获取用户UID
         $user = D('User/UcenterMember')->where(array('username' => $username, 'email' => $email, 'status' => 1))->find();
         $uid = $user['id'];
         if (!$uid) {
             $this->error("用户名或邮箱错误");
         }
         $verify = think_encrypt($uid, '', 3000);
         $url = "http://{$_SERVER['HTTP_HOST']}" . U('Home/User/reset', array('uid' => $uid, 'verify' => $verify));
         $body = C('USER_RESPASS') . "<br/>" . $url . "<br/>" . C('WEB_SITE') . "系统自动发送--请勿直接回复<br/>" . date('Y-m-d H:i:s', TIME()) . "</p>";
         $subject = C('WEB_SITE') . "密码找回";
         send_mail($email, $subject, $body);
         $this->success('密码找回邮件发送成功', U('Home/User/login'));
     } else {
         if (is_login()) {
             redirect(U('Index/index'));
         }
         $this->display();
     }
 }
Beispiel #23
0
 /**
  * 下载ftp文件
  * @param  array    $file     文件信息数组
  * @param  callable $callback 下载回调函数,一般用于增加下载次数
  * @param  string   $args     回调函数参数
  * @return boolean            下载失败返回false
  */
 private function downFtpFile($file, $callback = null, $args = null)
 {
     /* 调用回调函数新增下载数 */
     is_callable($callback) && call_user_func($callback, $args);
     $host = C('DOWNLOAD_HOST.host');
     $root = explode('/', $file['rootpath']);
     $file['savepath'] = $root[3] . '/' . $file['savepath'];
     $data = array($file['savepath'], $file['savename'], $file['name'], $file['mime']);
     $data = json_encode($data);
     $key = think_encrypt($data, C('DATA_AUTH_KEY'), 600);
     header("Location:http://{$host}/onethink.php?key={$key}");
 }
 protected function _upload()
 {
     $return = array('status' => 1, 'info' => '上传成功', 'data' => '');
     /* 调用文件上传组件上传文件 */
     $File = D('File');
     $file_driver = C('DOWNLOAD_UPLOAD_DRIVER');
     $info = $File->upload($_FILES, C('DOWNLOAD_UPLOAD'), C('DOWNLOAD_UPLOAD_DRIVER'), C("UPLOAD_{$file_driver}_CONFIG"));
     /* 记录附件信息 */
     if ($info) {
         if (!empty($info['file'])) {
             $return = $info['file'];
         }
         if (!empty($info['imgFile'])) {
             $return = $info['imgFile'];
             $return['url'] = $return['path'];
         }
         $return['sid'] = think_encrypt($info['file']['id']);
         $return['status'] = 1;
         $return['error'] = 0;
     } else {
         $return['status'] = 0;
         $return['info'] = $File->getError();
     }
     /* 返回JSON数据 */
     $this->ajaxReturn($return);
 }