コード例 #1
0
 /**
  * 新增用户
  * 
  */
 public function useradd()
 {
     if ('POST' == I('server.REQUEST_METHOD')) {
         $User = M('User');
         $data = $_POST;
         switch ($data['status']) {
             case '1':
                 $data['status'] = 1;
                 break;
             default:
                 $data['status'] = 0;
         }
         $data['password'] = md5($_POST['password']);
         $data['create_time'] = date('Ymd H:i:s');
         $data['update_time'] = date('Ymd H:i:s');
         $data['remark'] = 'dd';
         $data['last_login_ip'] = get_client_ip();
         $data['token'] = guid();
         $data['id'] = null;
         if (!$User->create($data)) {
             $this->error($User->getError());
         } else {
             if ($result = $User->add()) {
                 $this->crmSuccess('添加成功', U('index'));
             } else {
                 $this->crmError('添加失败', U('useradd'));
             }
         }
     } else {
         $this->display();
     }
 }
コード例 #2
0
 public function execute()
 {
     $request = $_REQUEST;
     $data = $request['data'];
     if (empty($data)) {
         throw new Exception('Missing Data');
     }
     if (empty($data['uid'])) {
         throw new Exception('Missing Uid');
     }
     if (empty($data['to_uid'])) {
         throw new Exception('Missing to user id');
     }
     if (empty($data['subject'])) {
         throw new Exception('Missing subject');
     }
     if (empty($data['message'])) {
         throw new Exception('Missing message');
     }
     $message_id = guid();
     $data['message_id'] = $message_id;
     $Models_Messages = new Models_Messages();
     $Models_Messages->add($data);
     $this->return = array('confirm' => 'Message sent successfully.', 'message_id' => $message_id);
 }
コード例 #3
0
 public function register($username, $password, $email, $phone, $name)
 {
     global $connAdodb;
     $sql = "select * from users where (username = "******" OR phone = " . $connAdodb->qstr($phone) . " OR email = " . $connAdodb->qstr($email) . ")";
     $rs = $connAdodb->Execute($sql);
     if ($rs->RecordCount() === 0) {
         //insert here
         $return['username'] = $username;
         $return['password'] = $password;
         $return['email'] = $email;
         $return['phone'] = $phone;
         $return['name'] = $name;
         $return['user_id'] = guid();
         $return['status'] = 1;
         $return['created'] = tstobts(time());
         $connAdodb->AutoExecute('users', $return, 'INSERT');
         unset($return['password']);
         return $return;
     }
     if ($rs->fields['username'] == $username) {
         return 0;
     }
     if ($rs->fields['email'] == $email) {
         return 1;
     }
     if ($rs->fields['phone'] == $phone) {
         return 2;
     }
     return 3;
 }
コード例 #4
0
ファイル: sites.php プロジェクト: lestatmq/cms
 public function insertCmsSite()
 {
     foreach ($this->sites as $v) {
         $arr = array();
         $a = $style = '';
         if (!empty($v['ResourcePSN'])) {
             $a = explode('}', $v['ResourcePSN']);
             $a = substr($a[0], 5);
             $arr['domain'] = $this->psn[$a]['URL'];
             $arr['dirname'] = $this->dir[$v['Name']];
         } else {
             $arr['domain'] = '';
             $arr['dirname'] = "html_{$v['NodeID']}";
         }
         $arr['siteid'] = $v['NodeID'];
         $arr['name'] = $v['Name'];
         $arr['site_title'] = $v['Name'];
         $arr['uuid'] = guid();
         $arr['setting'] = $this->setting;
         if (!empty($v['IndexTpl'])) {
             $v['IndexTpl'] = ltrim($v['IndexTpl'], "/");
             $a = explode("/", $v['IndexTpl']);
             $style = array_shift($a);
         } else {
             $style = 'default';
         }
         $arr['default_style'] = $style;
         //$arr['template'] = array($style);
         $arr['template'] = array('default');
         $res[] = $arr;
     }
     return $res;
 }
コード例 #5
0
ファイル: Util.php プロジェクト: null-1/fangtaitong
 /**
  * guid
  *
  * @return string(int)
  */
 public static function guid()
 {
     static $list = array();
     $time = explode(' ', microtime());
     // 1338438896 => 2012-05-31 12:34:56
     $guid = $time[1] - 1338438896 . sprintf('%06u', substr($time[0], 2, 6)) . substr(sprintf('%010u', mt_rand()), 0, 4);
     return isset($list[$guid]) ? guid() : ($list[$guid] = $guid);
 }
コード例 #6
0
ファイル: RemarksModel.php プロジェクト: shiyake/PHP
 function add($points, $itemId)
 {
     if ($points == null || $itemId == null) {
         return false;
     }
     $remarkId = guid();
     self::$model->getDatabase()->execute("INSERT INTO `njx_remarks` SET `remarkId`=?,`points`=?,`itemId`=?", array($remarkId, $points, $itemId));
     return $this->selectOne($remarkId);
 }
コード例 #7
0
ファイル: familias.php プロジェクト: mxcoding/sosbelladev
 public function agregarFamilia()
 {
     $datos_familia = array('id' => guid(), 'nombre' => $this->input->post('nombre'), 'descripcion' => $this->input->post('descripcion'), 'estado' => TRUE);
     if ($this->familias->agregar((object) $datos_familia)) {
         echo json_encode(TRUE);
     } else {
         echo json_encode(FALSE);
     }
 }
コード例 #8
0
ファイル: categorias.php プロジェクト: mxcoding/sosbelladev
 public function agregarCategoria()
 {
     $categoria = array('idCategoria' => guid(), 'nombre' => $this->input->post('nombre'), 'descripcion' => $this->input->post('descripcion'), 'idFamilia' => $this->input->post('familia'));
     if ($this->categorias->agregar((object) $categoria)) {
         echo json_encode(TRUE);
     } else {
         echo json_encode(FALSE);
     }
 }
コード例 #9
0
ファイル: FieldsOptionsModel.php プロジェクト: shiyake/PHP
 function add($name, $type, $tips = null, $selectorCount = null, $rangeFrom = null, $rangeTo = null, $rangeUnit = null)
 {
     if ($name == null || $type == null) {
         return false;
     }
     $foid = guid();
     self::$model->getDatabase()->execute("INSERT INTO `njx_fields_options` SET `foid`=?,`name`=?,`tips`=?,`type`=?,`selectorCount`=?,`rangeFrom`=?,`rangeTo`=?,`rangeUnit`=?", array($foid, $name, $tips, $type, $selectorCount, $rangeFrom, $rangeTo, $rangeUnit));
     return $this->selectOne($foid);
 }
コード例 #10
0
ファイル: SettingModel.php プロジェクト: shiyake/PHP
 function add($name, $value)
 {
     if ($name == null || $value == null) {
         return false;
     }
     $sid = guid();
     self::$model->getDatabase()->execute("INSERT INTO `njx_setting` SET `sid`=?,`name`=?,`value`=?", array($sid, $name, $value));
     return $this->selectOne($sid);
 }
コード例 #11
0
ファイル: FieldsModel.php プロジェクト: shiyake/PHP
 function add($foid, $value, $itemId)
 {
     if ($foid == null || $value == null || $itemId == null) {
         return false;
     }
     $oid = guid();
     self::$model->getDatabase()->execute("INSERT INTO `njx_fields` SET `oid`=?,`foid`=?,`value`=?,`itemId`=?", array($oid, $foid, $value, $itemId));
     return $this->selectOne($oid);
 }
コード例 #12
0
 public function execute()
 {
     $request = $_REQUEST;
     $data = array();
     if (empty($request['uid'])) {
         throw new Exception('Missing Uid');
     }
     if (empty($request['city_id'])) {
         throw new Exception('Missing City ID');
     }
     if (empty($request['title'])) {
         throw new Exception('Missing title');
     }
     if (empty($request['description'])) {
         throw new Exception('Missing description');
     }
     if (empty($request['categories'])) {
         throw new Exception('Missing category');
     }
     $job_id = guid();
     $data['job_id'] = $job_id;
     $data['uid'] = !empty($request['uid']) ? $request['uid'] : '';
     $data['city_id'] = !empty($request['city_id']) ? $request['city_id'] : '';
     $data['title'] = !empty($request['title']) ? $request['title'] : '';
     $data['description'] = !empty($request['description']) ? $request['description'] : '';
     $data['job_lat'] = !empty($request['lat']) ? $request['lat'] : '';
     $data['job_lng'] = !empty($request['lng']) ? $request['lng'] : '';
     $data['job_address'] = !empty($request['address']) ? $request['address'] : '';
     $data['showAddress'] = !empty($request['showAddress']) ? $request['showAddress'] : '';
     $data['totalCost'] = !empty($request['totalCost']) ? $request['totalCost'] : '';
     $data['compensation'] = !empty($request['compensation']) ? $request['compensation'] : '';
     $data['contactbyphone'] = !empty($request['contactbyphone']) ? $request['contactbyphone'] : '';
     $data['contactbytext'] = !empty($request['contactbytext']) ? $request['contactbytext'] : '';
     $data['phonenumber'] = !empty($request['phonenumber']) ? $request['phonenumber'] : '';
     $data['contactname'] = !empty($request['contactname']) ? $request['contactname'] : '';
     $data['telecommuting'] = !empty($request['telecommuting']) ? $request['telecommuting'] : '';
     $data['part_time'] = !empty($request['part_time']) ? $request['part_time'] : '';
     $data['contract'] = !empty($request['contract']) ? $request['contract'] : '';
     $data['non_profit'] = !empty($request['non_profit']) ? $request['non_profit'] : '';
     $data['internship'] = !empty($request['internship']) ? $request['internship'] : '';
     $data['direct_contact'] = !empty($request['direct_contact']) ? $request['direct_contact'] : '';
     $data['disabilities'] = !empty($request['disabilities']) ? $request['disabilities'] : '';
     $data['job_created_dt'] = date('Y-m-d H:i:s');
     $data['job_status'] = !empty($request['status']) ? $request['status'] : '1';
     $Models_Jobs = new Models_Jobs();
     $Models_Jobs->add($data);
     foreach ($request['categories'] as $k => $v) {
         $arr = array();
         $arr['job_id'] = $job_id;
         $arr['category'] = $v;
         $arr['category_id'] = guid();
         $Models_Jobs->add_category($arr);
         $cat_id[] = $arr['category_id'];
     }
     $this->return = array('confirm' => 'New job posting created successfully', 'job_id' => $job_id, 'cat_ids' => $cat_id);
 }
コード例 #13
0
ファイル: AdsModel.php プロジェクト: shiyake/PHP
 function add($content, $image, $url)
 {
     if ($content == null || $image == null || $url == null) {
         return false;
     }
     $aid = guid();
     $display = 1;
     self::$model->getDatabase()->execute("INSERT INTO `njx_ads` SET `aid`=?,`content`=?,`image`=?,`url`=?,`display`=?", array($aid, $content, $image, $url, $display));
     return $this->selectOne($aid);
 }
コード例 #14
0
ファイル: UsersModel.php プロジェクト: shiyake/PHP
 function add($discuzId, $name, $privilege)
 {
     if ($discuzId == null || $name == null || $privilege == null) {
         return false;
     }
     $uid = guid();
     $createTime = date('H-m-d H:i:s', time());
     self::$model->getDatabase()->execute("INSERT INTO `njx_users` SET `uid`=?,`discuzId`=?,`createTime`=?,`name`=?,`privilege`=?", array($uid, $discuzId, $createTime, $name, $privilege));
     return $this->selectOne($uid);
 }
コード例 #15
0
ファイル: CommentsModel.php プロジェクト: shiyake/PHP
 function add($itemId, $content)
 {
     if ($itemId == null || $content == null) {
         return false;
     }
     $rid = guid();
     $currentTime = date('Y-m-d H:i:s', time());
     echo $currentTime;
     self::$model->getDatabase()->execute("INSERT INTO `njx_comments` SET `rid`=?,`itemId`=?,`content`=?,`createTime`=?", array($rid, $itemId, $content, $currentTime));
     return $this->selectOne($rid);
 }
コード例 #16
0
 public function create()
 {
     $authinfo = $this->input['authinfo'];
     $authinfo['status'] = 0;
     $authinfo['appkey'] = guid('');
     $re = $this->customcore->create('authinfo', $authinfo);
     $custominfo = $this->input['custominfo'];
     $custominfo['appid'] = $re['id'];
     $this->customcore->create('custominfo', $custominfo);
     $this->addItem('true');
     $this->output();
 }
コード例 #17
0
ファイル: franquicias.php プロジェクト: mxcoding/sosbelladev
 public function agregarFranquicia()
 {
     $data_franquicia = aObjeto(array('IdFranquicia' => guid(), 'Clave' => $this->input->post('clave'), 'Nombre' => $this->input->post('nombre'), 'IdFranquiciatario' => $this->input->post('franquiciatario')));
     if (!$this->franquicia->existe($data_franquicia->Clave)) {
         if ($this->franquicia->agregar($data_franquicia)) {
             echo json_encode(array('estatus' => TRUE, 'mensaje' => 'La franquicia se agrego correctamente'));
         } else {
             echo json_encode(array('estatus' => FALSE, 'mensaje' => 'Ocurrió un problema al agregar la franquicia'));
         }
     } else {
         echo json_encode(array('estatus' => FALSE, 'mensaje' => 'La clave de la franquicia ya existe, verifíquelo'));
     }
 }
コード例 #18
0
ファイル: sucursales.php プロジェクト: mxcoding/sosbelladev
 public function agregarSucursal()
 {
     $data_sucursal = aObjeto(array('IdSucursal' => guid(), 'Clave' => $this->input->post('Clave'), 'Nombre' => $this->input->post('Nombre'), 'Direccion' => $this->input->post('Direccion'), 'IdFranquicia' => $this->input->post('IdFranquicia')));
     if (!$this->sucursal->existe($data_sucursal->Clave)) {
         if ($this->sucursal->agregar($data_sucursal)) {
             echo json_encode(array('estatus' => TRUE, 'mensaje' => 'La sucursal se agregó correctamente'));
         } else {
             echo json_encode(array('estatus' => FALSE, 'mensaje' => 'Hubo un problema al agregar la sucursal'));
         }
     } else {
         echo json_encode(array('estatus' => FALSE, 'mensaje' => 'La clave ya existe, verifíquelo'));
     }
 }
コード例 #19
0
 public function execute()
 {
     $request = $_REQUEST;
     /*
     $data = array();
     if (empty($request['uid'])) {
       throw new Exception('Missing Uid');
     }
     if (empty($request['city_id'])) {
       throw new Exception('Missing City ID');
     }
     if (empty($request['title'])) {
       throw new Exception('Missing title');
     }
     if (empty($request['description'])) {
       throw new Exception('Missing description');
     }
     if (empty($request['categories'])) {
       throw new Exception('Missing category');
     }
     $base_id = guid();
     $data['base_id'] = $base_id;
     $data['uid'] = !empty($request['uid']) ? $request['uid'] : '';
     $data['city_id'] = !empty($request['city_id']) ? $request['city_id'] : '';
     $data['title'] = !empty($request['title']) ? $request['title'] : '';
     $data['description'] = !empty($request['description']) ? $request['description'] : '';
     $data['base_lat'] = !empty($request['lat']) ? $request['lat'] : '';
     $data['base_lng'] = !empty($request['lng']) ? $request['lng'] : '';
     $data['base_address'] = !empty($request['address']) ? $request['address'] : '';
     $data['showAddress'] = !empty($request['showAddress']) ? $request['showAddress'] : '';
     $data['contactbyphone'] = !empty($request['contactbyphone']) ? $request['contactbyphone'] : '';
     $data['contactbytext'] = !empty($request['contactbytext']) ? $request['contactbytext'] : '';
     $data['phonenumber'] = !empty($request['phonenumber']) ? $request['phonenumber'] : '';
     $data['contactname'] = !empty($request['contactname']) ? $request['contactname'] : '';
     
     $data['base_created_dt'] = date('Y-m-d H:i:s');
     $data['base_status'] = !empty($request['status']) ? $request['status'] : '1';
     $Models_Basedata = new Models_Basedata();
     $Models_Basedata->add($data);
     */
     $Models_Basedata = new Models_Basedata();
     $data = $this->baseDataCheck($request);
     $personalData = array();
     $personalData['personal_id'] = guid();
     $personalData['base_id'] = $data['base_id'];
     $personalData['age'] = !empty($request['age']) ? $request['age'] : '';
     $personalData['other_details'] = !empty($request['other_details']) ? json_encode($request['other_details']) : '';
     $Models_Basedata->personals_add($personalData);
     $this->return = array('confirm' => 'New posting created successfully', 'personal_id' => $personalData['personal_id']);
 }
コード例 #20
0
ファイル: ItemsModel.php プロジェクト: shiyake/PHP
 function add($uid, $caid, $title)
 {
     if ($uid == null || $caid == null || $title == null) {
         return false;
     }
     $iid = guid();
     $order = $this->count() + 1;
     $createTime = date('Y-m-d H:i:s', time());
     $modifyTime = $createTime;
     $isDeleted = '0';
     $commentsCount = '0';
     $status = '0';
     self::$model->getDatabase()->execute("INSERT INTO `njx_items` SET `iid`=?,`order`=?,`createTime`=?,`modifyTime`=?,`uid`=?,`caid`=?,`isDeleted`=?,`commentsCount`=?,`status`=?,`title`=?", array($iid, $order, $createTime, $modifyTime, $uid, $caid, $isDeleted, $commentsCount, $status, $title));
     return $this->selectOne($iid);
 }
コード例 #21
0
 public function execute($request = array())
 {
     //coming soon
     if (empty($request)) {
         $request = $_REQUEST;
     }
     $data = array();
     if (empty($request['module_id'])) {
         throw new Exception('Missing module_id');
     }
     if (empty($request['user_id'])) {
         throw new Exception('Missing user_id');
     }
     if (empty($request['city_id'])) {
         throw new Exception('Missing City ID');
     }
     if (empty($request['title'])) {
         throw new Exception('Missing title');
     }
     $data['record_id'] = guid();
     $data['module_id'] = !empty($request['module_id']) ? $request['module_id'] : '';
     $data['user_id'] = !empty($request['user_id']) ? $request['user_id'] : '';
     $data['city_id'] = !empty($request['city_id']) ? $request['city_id'] : '';
     $data['title'] = !empty($request['title']) ? $request['title'] : '';
     $data['lat'] = !empty($request['lat']) ? $request['lat'] : '';
     $data['lon'] = !empty($request['lng']) ? $request['lng'] : '';
     $data['address'] = !empty($request['address']) ? $request['address'] : '';
     $data['showAddress'] = !empty($request['showAddress']) ? $request['showAddress'] : 0;
     $data['record_updated_date'] = date('Y-m-d H:i:s');
     for ($i = 1; $i <= 10; $i++) {
         $field = 'ifield' . $i;
         $data[$field] = !empty($request[$field]) ? $request[$field] : NULL;
     }
     for ($i = 1; $i <= 2; $i++) {
         $field = 'ffield' . $i;
         $data[$field] = !empty($request[$field]) ? $request[$field] : NULL;
     }
     $data['details'] = json_encode($request['details']);
     $model = new Models_Records();
     $returnData = $model->add($data);
     //add categories
     $model->add_category($data['record_id'], $request['categories']);
     $this->return = array('confirm' => 'New posting created successfully', 'record_id' => $data['record_id'], 'data' => $data, 'returnData' => $returnData);
     return $this->return;
 }
コード例 #22
0
ファイル: news.class.php プロジェクト: yixingseo/QingCmsPHP
 /**
  * 析构函数
  */
 function __construct()
 {
     $this->model["guid"] = guid();
     $this->model["id"] = 0;
     $this->model["weight"] = 99;
     $this->model["pid"] = 0;
     $this->model["title"] = '';
     $this->model["seotitle"] = '';
     $this->model["keywords"] = '';
     $this->model["description"] = '';
     $this->model["urlname"] = '';
     $this->model["info"] = '';
     $this->model["pic"] = '';
     $this->model["content"] = '';
     $this->model["insert_date"] = '';
     $this->model["insert_user"] = '';
     $this->model['att'] = '';
 }
コード例 #23
0
 function doRegist()
 {
     $openid = E_GET("openid");
     $wxuser = getWxUserByOpenid($openid);
     $mobile = E_GET("mobile");
     $vcode = E_GET("vcode");
     session_start();
     echo $_SESSION["vcode"];
     if ($vcode != $_SESSION["vcode"]) {
         echo "验证码有误";
     }
     $user = array('id' => guid(), 'username' => $mobile, 'nickname' => $wxuser['nickname'], 'openid' => $openid, 'phone' => $mobile);
     $model = new UserModel();
     $ret = $model->newUser($user);
     echo guid();
     echo $ret;
     echo "xxxooo";
 }
コード例 #24
0
 protected function baseDataCheck($request)
 {
     $data = array();
     if (empty($request['uid'])) {
         throw new Exception('Missing Uid');
     }
     if (empty($request['city_id'])) {
         throw new Exception('Missing City ID');
     }
     if (empty($request['title'])) {
         throw new Exception('Missing title');
     }
     if (empty($request['description'])) {
         throw new Exception('Missing description');
     }
     if (empty($request['categories'])) {
         throw new Exception('Missing category');
     }
     $data['base_id'] = guid();
     $data['uid'] = !empty($request['uid']) ? $request['uid'] : '';
     $data['city_id'] = !empty($request['city_id']) ? $request['city_id'] : '';
     $data['title'] = !empty($request['title']) ? $request['title'] : '';
     $data['description'] = !empty($request['description']) ? $request['description'] : '';
     $data['base_lat'] = !empty($request['lat']) ? $request['lat'] : '';
     $data['base_lng'] = !empty($request['lng']) ? $request['lng'] : '';
     $data['base_address'] = !empty($request['address']) ? $request['address'] : '';
     $data['showAddress'] = !empty($request['showAddress']) ? $request['showAddress'] : '';
     $data['contactbyphone'] = !empty($request['contactbyphone']) ? $request['contactbyphone'] : '';
     $data['contactbytext'] = !empty($request['contactbytext']) ? $request['contactbytext'] : '';
     $data['phonenumber'] = !empty($request['phonenumber']) ? $request['phonenumber'] : '';
     $data['contactname'] = !empty($request['contactname']) ? $request['contactname'] : '';
     $data['images'] = !empty($request['images']) ? json_encode($request['images']) : '';
     $data['base_created_dt'] = date('Y-m-d H:i:s');
     $data['base_status'] = !empty($request['status']) ? $request['status'] : '1';
     $Models_Basedata = new Models_Basedata();
     $Models_Basedata->add($data);
     $arr = array();
     $arr['base_id'] = $data['base_id'];
     $arr['category'] = $request['categories'];
     $arr['category_id'] = guid();
     $Models_Basedata->add_category($arr);
     $data['cat_id'] = $arr['category_id'];
     return $data;
 }
コード例 #25
0
 public function execute()
 {
     $request = $_REQUEST;
     /*$data = array();
       if (empty($request['uid'])) {
         throw new Exception('Missing Uid');
       }
       if (empty($request['city_id'])) {
         throw new Exception('Missing City ID');
       }
       if (empty($request['title'])) {
         throw new Exception('Missing title');
       }
       if (empty($request['description'])) {
         throw new Exception('Missing description');
       }
       if (empty($request['categories'])) {
         throw new Exception('Missing category');
       }
       $base_id = guid();
       $data['base_id'] = $base_id;
       $data['uid'] = !empty($request['uid']) ? $request['uid'] : '';
       $data['city_id'] = !empty($request['city_id']) ? $request['city_id'] : '';
       $data['title'] = !empty($request['title']) ? $request['title'] : '';
       $data['description'] = !empty($request['description']) ? $request['description'] : '';
       $data['base_lat'] = !empty($request['lat']) ? $request['lat'] : '';
       $data['base_lng'] = !empty($request['lng']) ? $request['lng'] : '';
       $data['base_address'] = !empty($request['address']) ? $request['address'] : '';
       $data['showAddress'] = !empty($request['showAddress']) ? $request['showAddress'] : '';
       $data['contactbyphone'] = !empty($request['contactbyphone']) ? $request['contactbyphone'] : '';
       $data['contactbytext'] = !empty($request['contactbytext']) ? $request['contactbytext'] : '';
       $data['phonenumber'] = !empty($request['phonenumber']) ? $request['phonenumber'] : '';
       $data['contactname'] = !empty($request['contactname']) ? $request['contactname'] : '';*/
     $Models_Basedata = new Models_Basedata();
     $data = $this->baseDataCheck($request);
     $communityData = array();
     $communityData['community_id'] = guid();
     $communityData['base_id'] = $data['base_id'];
     $Models_Basedata->community_add($communityData);
     $this->return = array('confirm' => 'New posting created successfully', 'community_id' => $communityData['community_id']);
 }
コード例 #26
0
 /**
  * 管理员登陆
  * @param unknown $name
  * @param unknown $password
  * @return string|multitype:string
  */
 public function signIn($name, $password)
 {
     // 获取正确的密码
     $md5Passwd = $this->where('name = "%s"', $name)->getField('password');
     // 校验
     if ($md5Passwd === false) {
         return $this->getDbError();
     }
     if ($md5Passwd === null) {
         return '用户名不存在';
     }
     if (md5(sha1($password)) != $md5Passwd) {
         return '密码错误';
     }
     // 登陆成功,创建Session,并返回sessionId
     $sessId = guid();
     $value['admin']['name'] = $name;
     S('SESS_' . $sessId, $value, 3600);
     // 成功
     return [$sessId];
 }
コード例 #27
0
ファイル: gen_hash_string.php プロジェクト: huberyhe/scripts
include "vendor/autoload.php";
function guid()
{
    if (function_exists('com_create_guid')) {
        return com_create_guid();
    } else {
        mt_srand((double) microtime() * 10000);
        //optional for php 4.2.0 and up.
        $charid = strtoupper(md5(uniqid(rand(), true)));
        $hyphen = chr(45);
        // "-"
        $uuid = chr(123) . substr($charid, 0, 8) . $hyphen . substr($charid, 8, 4) . $hyphen . substr($charid, 12, 4) . $hyphen . substr($charid, 16, 4) . $hyphen . substr($charid, 20, 12) . chr(125);
        // "}"
        return $uuid;
    }
}
echo " . generating hash strings...\n";
echo str_repeat("=", $strLen + 3) . "\n";
for ($i = 0; $i < $strsNum; $i++) {
    $salt = guid();
    $ALPHABET = "abcdefghijklmnpqrstuvwxyz123456789";
    $hashids = new Hashids\Hashids($salt, $strLen, $ALPHABET);
    $id = $hashids->encode($i);
    printf("%02d %s\n", $i + 1, $id);
    // echo $i . " " . $id . "\n";
    // $numbers = $hashids->decode($id);
    // echo $this->guid();
    // var_dump($id, $numbers);
}
echo str_repeat("=", $strLen + 3) . "\n";
echo " . generate hash strings completed.\n\n";
コード例 #28
0
/**
 * Updates and inserts all the specified items passed to your address book
 * @return UpdateAddressBookItemsResponse
 */
function updateAddressBookItemsSample()
{
    global $api;
    global $AccountID;
    // Create an address book item with email, user name, account name, and
    // account ID
    $contact = new AddressBookItem();
    $contact->Email = "*****@*****.**";
    $contact->UserName = "******";
    $contact->AccountName = "test account";
    $contact->Shared = true;
    $contact->AddressBookID = guid();
    $contacts = array($contact);
    // Send
    $updateAddressBookItemsparams = new UpdateAddressBookItems();
    $updateAddressBookItemsparams->AddressBookItems = $contacts;
    $updateAddressBookItemsparams->ReturnAddressBook = false;
    $response = $api->UpdateAddressBookItems($updateAddressBookItemsparams);
    return $response;
}
コード例 #29
0
ファイル: index.php プロジェクト: virsoni/DocuSign-SOAP-SDK
        $charid = strtoupper(md5(uniqid(rand(), true)));
        $hyphen = chr(45);
        // "-"
        $uuid = substr($charid, 0, 8) . $hyphen . substr($charid, 8, 4) . $hyphen . substr($charid, 12, 4) . $hyphen . substr($charid, 16, 4) . $hyphen . substr($charid, 20, 12);
    }
    return $uuid;
}
// figure out the URL of this server
// NOTE: DocuSign only pushes status to HTTPS!
$postBackPath = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
$postBackPath .= $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
$postedXml = @file_get_contents('php://input');
if (!empty($_POST['post'])) {
    // if this is a sample load
    $xml = simplexml_load_file("post.sample") or die("Unable to load sample XML file!");
    $xml->EnvelopeStatus->EnvelopeID = guid();
    // here we replace the GUID so we have unique files
    //
    // using the curl library to get the post
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $postBackPath);
    curl_setopt($curl, CURLOPT_HEADER, array("Content-Type: application/xml"));
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $xml->asXML());
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_exec($curl);
    curl_close($curl);
} else {
    if (!empty($postedXml)) {
        // see if this is a post to this page
        // if it is then we have to save it.
コード例 #30
0
 /**
  * Create a new CustomKeyedItem and initialize the id with a GUID
  */
 public function __construct()
 {
     $this->key = guid();
 }