本文整理汇总了PHP中fetch_ip函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_ip函数的具体用法?PHP fetch_ip怎么用?PHP fetch_ip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_ip函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: new_active_code
public function new_active_code($uid, $expire_time, $active_code, $active_type_code = null)
{
if ($active_id = $this->insert('active_data', array('uid' => intval($uid), 'expire_time' => intval($expire_time), 'active_code' => $active_code, 'active_type_code' => $active_type_code, 'add_time' => time(), 'add_ip' => ip2long(fetch_ip())))) {
$this->delete('active_data', "uid = " . intval($uid) . " AND active_type_code = '" . $this->quote($active_type) . "' AND active_id <> " . intval($active_id));
}
return $active_id;
}
示例2: online_active
public function online_active($uid, $last_active)
{
if (!$uid or $last_active + 60 > time()) {
return false;
}
$online_data = array('uid' => $uid, 'last_active' => time(), 'ip' => ip2long(fetch_ip()), 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'active_url' => $_SERVER['HTTP_REFERER']);
if ($user_online = $this->fetch_row('users_online', 'uid = ' . intval($uid))) {
$this->shutdown_update('users_online', $online_data, 'uid = ' . $user_online['uid']);
} else {
$this->insert('users_online', $online_data);
}
$online_time = time() - $last_active;
if ($online_time > 300) {
$online_time = 1;
}
$this->shutdown_query("UPDATE " . get_table('users') . ' SET online_time = online_time + ' . intval($online_time) . ', last_active = ' . time() . ' WHERE uid = ' . intval($uid));
return true;
}
示例3: unsubscription_action
public function unsubscription_action()
{
if ($_GET['id']) {
$arg = explode(',', $_GET['id']);
$email = base64_decode($arg[0]);
$human_verify = $arg[2];
}
if (md5($email . G_SECUKEY) == $arg[1]) {
if ($human_verify == ip2long(fetch_ip())) {
$this->model('edm')->unsubscription($email);
H::redirect_msg(AWS_APP::lang()->_t('%s 退订邮件成功', $email));
} else {
$unsubscription_link = get_js_url('/account/edm/unsubscription/' . $arg[0] . ',' . $arg[1] . ',' . ip2long(fetch_ip()));
H::redirect_msg(AWS_APP::lang()->_t('是否确认退订邮件订阅? ( <a href="%s">继续</a> )', $unsubscription_link));
}
} else {
H::redirect_msg(AWS_APP::lang()->_t('退订链接无效'));
}
}
示例4: save_question
/**
*
* 增加问题内容
* @param string $question_content //问题内容
* @param string $question_detail //问题说明
*
* @return boolean true|false
*/
public function save_question($question_content, $question_detail, $published_uid, $question_difficulty, $quiz_id, $anonymous = 0, $ip_address = null, $from = null)
{
if (!$ip_address) {
$ip_address = fetch_ip();
}
$now = time();
$to_save_question = array('question_content' => htmlspecialchars($question_content), 'question_detail' => htmlspecialchars($question_detail), 'add_time' => $now, 'update_time' => $now, 'published_uid' => intval($published_uid), 'difficulty' => intval($question_difficulty), 'quiz_id' => intval($quiz_id), 'anonymous' => intval($anonymous), 'ip' => ip2long($ip_address));
if ($from and is_array($from)) {
foreach ($from as $type => $from_id) {
if (!is_digits($from_id)) {
continue;
}
$to_save_question[$type . '_id'] = $from_id;
}
}
$question_id = $this->insert('question', $to_save_question);
if ($question_id) {
$this->shutdown_update('users', array('question_count' => $this->count('question', 'published_uid = ' . intval($published_uid))), 'uid = ' . intval($published_uid));
$this->model('search_fulltext')->push_index('question', $question_content, $question_id);
}
return $question_id;
}
示例5: register_process_action
public function register_process_action()
{
if (get_setting('register_type') == 'close') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站目前关闭注册')));
} else {
if (get_setting('register_type') == 'invite' and !$_POST['icode']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过邀请注册')));
} else {
if (get_setting('register_type') == 'weixin') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过微信注册')));
}
}
}
if ($_POST['icode']) {
if (!($invitation = $this->model('invitation')->check_code_available($_POST['icode'])) and $_POST['email'] == $invitation['invitation_email']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('邀请码无效或与邀请邮箱不一致')));
}
}
if (trim($_POST['user_name']) == '') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入用户名')));
} else {
if ($this->model('account')->check_username($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名已经存在')));
} else {
if ($check_rs = $this->model('account')->check_username_char($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名包含无效字符')));
} else {
if ($this->model('account')->check_username_sensitive_words($_POST['user_name']) or trim($_POST['user_name']) != $_POST['user_name']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名中包含敏感词或系统保留字')));
}
}
}
}
if ($this->model('account')->check_email($_POST['email'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('E-Mail 已经被使用, 或格式不正确')));
}
if (strlen($_POST['password']) < 6 or strlen($_POST['password']) > 16) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('密码长度不符合规则')));
}
// if (! $_POST['agreement_chk'])
// {
// H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你必需同意用户协议才能继续')));
// }
// 检查验证码
// if (!AWS_APP::captcha()->is_validate($_POST['seccode_verify']) AND get_setting('register_seccode') == 'Y')
// {
// H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请填写正确的验证码')));
// }
if (get_setting('ucenter_enabled') == 'Y') {
$result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email']);
if (is_array($result)) {
$uid = $result['user_info']['uid'];
} else {
H::ajax_json_output(AWS_APP::RSM(null, -1, $result));
}
} else {
$uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']);
}
if ($_POST['email'] == $invitation['invitation_email']) {
$this->model('active')->set_user_email_valid_by_uid($uid);
$this->model('active')->active_user_by_uid($uid);
}
$this->model('account')->setcookie_logout();
$this->model('account')->setsession_logout();
if ($_POST['icode']) {
$follow_users = $this->model('invitation')->get_invitation_by_code($_POST['icode']);
} else {
if (HTTP::get_cookie('fromuid')) {
$follow_users = $this->model('account')->get_user_info_by_uid(HTTP::get_cookie('fromuid'));
}
}
if ($follow_users['uid']) {
$this->model('follow')->user_follow_add($uid, $follow_users['uid']);
$this->model('follow')->user_follow_add($follow_users['uid'], $uid);
$this->model('integral')->process($follow_users['uid'], 'INVITE', get_setting('integral_system_config_invite'), '邀请注册: ' . $_POST['user_name'], $follow_users['uid']);
}
if ($_POST['icode']) {
$this->model('invitation')->invitation_code_active($_POST['icode'], time(), fetch_ip(), $uid);
}
if (get_setting('register_valid_type') == 'N' or get_setting('register_valid_type') == 'email' and get_setting('register_type') == 'invite') {
$this->model('active')->active_user_by_uid($uid);
}
$user_info = $this->model('account')->get_user_info_by_uid($uid);
if (get_setting('register_valid_type') == 'N' or $user_info['group_id'] != 3 or $_POST['email'] == $invitation['invitation_email']) {
$valid_email = 1;
} else {
AWS_APP::session()->valid_email = $user_info['email'];
$this->model('active')->new_valid_email($uid);
$valid_email = 0;
}
$this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt']);
H::ajax_json_output(AWS_APP::RSM(array('uid' => $user_info['uid'], 'user_name' => $user_info['user_name'], 'valid_email' => $valid_email), 1, null));
}
示例6: update_user_last_login
/**
* 更新用户最后登录时间
*
* @param int
*/
public function update_user_last_login($uid)
{
if (!$uid) {
return false;
}
return $this->shutdown_update('users', array('last_login' => time(), 'last_ip' => ip2long(fetch_ip())), 'uid = ' . intval($uid));
}
示例7: request
public static function request($url, $method, $post_fields = null, $time_out = 15, $header = null, $cookie = null)
{
if (!function_exists('curl_init')) {
throw new Zend_Exception('CURL not support');
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl, CURLOPT_TIMEOUT, $time_out);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
if (defined('WECENTER_CURL_USERAGENT')) {
curl_setopt($curl, CURLOPT_USERAGENT, WECENTER_CURL_USERAGENT);
} else {
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12');
}
switch ($method) {
case 'POST':
curl_setopt($curl, CURLOPT_POST, TRUE);
if ($post_fields) {
if (is_array($post_fields)) {
$post_fields = http_build_query($post_fields);
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_fields);
}
break;
case 'DELETE':
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
if ($post_fields) {
$url = "{$url}?{$post_fields}";
}
break;
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLINFO_HEADER_OUT, TRUE);
if (isset($header) and !is_array($header)) {
unset($header);
}
$header[] = 'API-RemoteIP: ' . fetch_ip();
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
if (substr($url, 0, 8) == 'https://') {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
}
if ($cookie and is_array($cookie)) {
curl_setopt($curl, CURLOPT_COOKIE, urldecode(http_build_query($cookie, '', '; ')));
}
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
示例8: register_process_action
//.........这里部分代码省略.........
{
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名包含无效字符')));
}
else if ($this->model('account')->check_username_sensitive_words($_POST['user_name']) OR trim($_POST['user_name']) != $_POST['user_name'])
{
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('用户名中包含敏感词或系统保留字')));
}
if ($this->model('account')->check_email($_POST['email']))
{
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('E-Mail 已经被使用, 或格式不正确')));
}
if (strlen($_POST['password']) < 6 OR strlen($_POST['password']) > 16)
{
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('密码长度不符合规则')));
}
*/
if (!$_POST['agreement_chk']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你必需同意用户协议才能继续')));
}
// 检查验证码
if (!AWS_APP::captcha()->is_validate($_POST['seccode_verify']) and get_setting('register_seccode') == 'Y') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请填写正确的验证码')));
}
if (get_setting('ucenter_enabled') == 'Y') {
$result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email']);
if (is_array($result)) {
$uid = $result['user_info']['uid'];
} else {
H::ajax_json_output(AWS_APP::RSM(null, -1, $result));
}
} else {
$uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']);
}
if ($_POST['email'] == $invitation['invitation_email']) {
$this->model('active')->set_user_email_valid_by_uid($uid);
$this->model('active')->active_user_by_uid($uid);
}
if (isset($_POST['sex'])) {
$update_data['sex'] = intval($_POST['sex']);
if ($_POST['province']) {
$update_data['province'] = $_POST['province'];
$update_data['city'] = $_POST['city'];
}
if ($_POST['job_id']) {
$update_data['job_id'] = intval($_POST['job_id']);
}
$update_attrib_data['signature'] = $_POST['signature'];
// 更新主表
$this->model('account')->update_users_fields($update_data, $uid);
// 更新从表
$this->model('account')->update_users_attrib_fields($update_attrib_data, $uid);
}
$this->model('account')->setcookie_logout();
$this->model('account')->setsession_logout();
if ($_POST['icode']) {
$follow_users = $this->model('invitation')->get_invitation_by_code($_POST['icode']);
} else {
if (HTTP::get_cookie('fromuid')) {
$follow_users = $this->model('account')->get_user_info_by_uid(HTTP::get_cookie('fromuid'));
}
}
if ($follow_users['uid']) {
$this->model('follow')->user_follow_add($uid, $follow_users['uid']);
$this->model('follow')->user_follow_add($follow_users['uid'], $uid);
$this->model('integral')->process($follow_users['uid'], 'INVITE', get_setting('integral_system_config_invite'), '邀请注册: ' . $_POST['user_name'], $follow_users['uid']);
}
if ($_POST['icode']) {
$this->model('invitation')->invitation_code_active($_POST['icode'], time(), fetch_ip(), $uid);
}
if (get_setting('register_valid_type') == 'N' or get_setting('register_valid_type') == 'email' and get_setting('register_type') == 'invite') {
$this->model('active')->active_user_by_uid($uid);
}
$user_info = $this->model('account')->get_user_info_by_uid($uid);
if (get_setting('register_valid_type') == 'N' or $user_info['group_id'] != 3 or $_POST['email'] == $invitation['invitation_email']) {
$this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt'], null, true, $user_info['group_id']);
if (!$_POST['_is_mobile']) {
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/home/first_login-TRUE')), 1, null));
}
} else {
AWS_APP::session()->valid_email = $user_info['email'];
$this->model('active')->new_valid_email($uid);
if (!$_POST['_is_mobile']) {
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/account/valid_email/')), 1, null));
}
}
if ($_POST['_is_mobile']) {
if ($_POST['return_url']) {
$user_info = $this->model('account')->get_user_info_by_uid($uid);
$this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt'], null, true, $user_info['group_id']);
$return_url = strip_tags($_POST['return_url']);
} else {
$return_url = get_js_url('/m/');
}
H::ajax_json_output(AWS_APP::RSM(array('url' => $return_url), 1, null));
}
}
示例9: set_admin_login
public function set_admin_login($uid)
{
AWS_APP::session()->admin_login = H::encode_hash(array('uid' => $uid, 'UA' => $_SERVER['HTTP_USER_AGENT'], 'ip' => fetch_ip()));
}
示例10: request
public static function request($url, $method, $post_fields = NULL, $time_out = 15)
{
if (!function_exists('curl_init')) {
throw new Zend_Exception('CURL not support');
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl, CURLOPT_TIMEOUT, $time_out);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
switch ($method) {
case 'POST':
curl_setopt($curl, CURLOPT_POST, TRUE);
if ($post_fields) {
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_fields);
}
break;
case 'DELETE':
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
if ($post_fields) {
$url = "{$url}?{$post_fields}";
}
break;
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLINFO_HEADER_OUT, TRUE);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('API-RemoteIP: ' . fetch_ip()));
if (substr($url, 0, 8) == 'https://') {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
}
curl_setopt($curl, CURLOPT_USERAGENT, 'WeCenter/' . G_VERSION);
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
示例11: save_answer
/**
*
* 保存问题回复内容
*/
public function save_answer($question_id, $answer_content, $uid, $anonymous = 0)
{
if (!($question_info = $this->model('question')->get_question_info_by_id($question_id))) {
return false;
}
if (!($answer_id = $this->insert('answer', array('question_id' => $question_info['question_id'], 'answer_content' => $answer_content, 'add_time' => time(), 'uid' => intval($uid), 'category_id' => $question_info['category_id'], 'anonymous' => intval($anonymous), 'ip' => ip2long(fetch_ip()))))) {
return false;
}
$this->update('question', array('update_time' => time()), 'question_id = ' . intval($question_id));
$this->model('question')->update_answer_count($question_id);
$this->model('question')->update_answer_users_count($question_id);
$this->shutdown_update('users', array('answer_count' => $this->count('answer', 'uid = ' . intval($uid))), 'uid = ' . intval($uid));
return $answer_id;
}
示例12: explode
}
// 创建数据表
$db_table_querys = explode(";\r", str_replace(array('[#DB_PREFIX#]', '[#DB_ENGINE#]', "\n"), array($_POST['db_prefix'], $_POST['db_engine'], "\r"), file_get_contents(ROOT_PATH . 'install/db/mysql.sql')));
foreach ($db_table_querys as $_sql) {
if ($query_string = trim(str_replace(array("\r", "\n", "\t"), '', $_sql))) {
$db->query($query_string);
}
}
$db->insert($_POST['db_prefix'] . 'system_setting', array('varname' => 'db_engine', 'value' => 's:' . strlen($_POST['db_engine']) . ':"' . $_POST['db_engine'] . '";'));
TPL::output('install/final');
break;
case 4:
$db = load_class('core_db')->setObject('master');
$db_prefix = load_class('core_config')->get('database')->prefix;
$salt = fetch_salt(4);
$data = array('user_name' => $_POST['user_name'], 'password' => compile_password($_POST['password'], $salt), 'email' => $_POST['email'], 'salt' => $salt, 'group_id' => 1, 'reputation_group' => 5, 'valid_email' => 1, 'is_first_login' => 1, 'reg_time' => time(), 'reg_ip' => ip2long(fetch_ip()), 'last_login' => time(), 'last_ip' => ip2long(fetch_ip()), 'last_active' => time(), 'invitation_available' => 10, 'integral' => 2000);
$db->insert($db_prefix . 'users', $data);
$db->insert($db_prefix . 'users_attrib', array('uid' => 1, 'signature' => ''));
$db->insert($db_prefix . 'integral_log', array('uid' => 1, 'action' => 'REGISTER', 'integral' => 2000, 'note' => load_class('core_lang')->_t('初始资本'), 'balance' => 2000, 'time' => time()));
//加载网站配置
$base_dir = dirname(dirname($_SERVER['PHP_SELF']));
$base_dir = $base_dir == DIRECTORY_SEPARATOR ? '' : $base_dir;
$insert_query = file_get_contents(ROOT_PATH . 'install/db/system_setting.sql');
$insert_query = str_replace('[#DB_PREFIX#]', $db_prefix, $insert_query);
if (defined('IN_SAE')) {
$insert_query = str_replace('[#UPLOAD_URL#]', serialize($_POST['upload_url']), $insert_query);
$insert_query = str_replace('[#UPLOAD_DIR#]', serialize('saestor://uploads'), $insert_query);
} else {
$base_url = strtolower(base_url());
if (substr($base_url, -8) == '/install') {
$base_url = substr_replace($base_url, '', -8);
示例13: reply_ticket
public function reply_ticket($ticket_id, $message, $uid, $attach_access_key = null)
{
$ticket_info = $this->get_ticket_info_by_id($ticket_id);
if (!$ticket_info or $ticket_info['status'] == 'closed') {
return false;
}
$now = time();
$reply_id = $this->insert('ticket_reply', array('ticket_id' => $ticket_info['id'], 'message' => htmlspecialchars($message), 'uid' => intval($uid), 'time' => $now, 'uid' => intval($uid), 'ip' => ip2long(fetch_ip())));
if (!$reply_id) {
return false;
}
set_human_valid('answer_valid_hour');
if ($attach_access_key) {
$this->model('publish')->update_attach('ticket_reply', $reply_id, $attach_access_key);
}
if (!$ticket_info['reply_time']) {
$this->shutdown_update('ticket', array('reply_time' => $now), 'id = ' . $ticket_info['id']);
}
if ($ticket_info['weibo_msg_id']) {
$this->model('openid_weibo_weibo')->reply_answer_to_sina($question_info['question_id'], cjk_substr($answer_content, 0, 110, 'UTF-8', '...'));
}
if ($ticket_info['received_email_id']) {
$this->model('edm')->reply_answer_by_email($question_info['question_id'], nl2br(FORMAT::parse_bbcode($answer_content)));
}
return $reply_id;
}
示例14: request
public static function request($url, $method, $post_fields = null, $time_out = 15, $header = null, $cookie = null)
{
if (!function_exists('curl_init')) {
throw new Zend_Exception('CURL not support');
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl, CURLOPT_TIMEOUT, $time_out);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
switch ($method) {
case 'POST':
curl_setopt($curl, CURLOPT_POST, TRUE);
if ($post_fields) {
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_fields);
}
break;
case 'DELETE':
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
if ($post_fields) {
$url = "{$url}?{$post_fields}";
}
break;
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLINFO_HEADER_OUT, TRUE);
if (isset($header) and !is_array($header)) {
unset($header);
}
$header[] = 'API-RemoteIP: ' . fetch_ip();
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
if (substr($url, 0, 8) == 'https://') {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
}
curl_setopt($curl, CURLOPT_USERAGENT, 'HeavenSpree/' . G_VERSION);
if ($cookie and is_array($cookie)) {
curl_setopt($curl, CURLOPT_COOKIE, urldecode(http_build_query($cookie, '', '; ')));
}
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
示例15: register_process_action
public function register_process_action()
{
if (get_setting('register_type') == 'close') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('��վĿǰ�ر�ע��')));
} else {
if (get_setting('register_type') == 'invite' and !$_POST['icode']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('��վֻ��ͨ������ע��')));
} else {
if (get_setting('register_type') == 'weixin') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('��վֻ��ͨ����ע��')));
}
}
}
if ($_POST['icode']) {
if (!($invitation = $this->model('invitation')->check_code_available($_POST['icode'])) and $_POST['email'] == $invitation['invitation_email']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('��������Ч�����������䲻һ��')));
}
}
if (trim($_POST['user_name']) == '') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�������û���')));
} else {
if ($this->model('account')->check_username($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�û����Ѿ�����')));
} else {
if ($check_rs = $this->model('account')->check_username_char($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�û������Ч�ַ�')));
} else {
if ($this->model('account')->check_username_sensitive_words($_POST['user_name']) or trim($_POST['user_name']) != $_POST['user_name']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�û����а���дʻ�ϵͳ������')));
}
}
}
}
if ($this->model('account')->check_email($_POST['email'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('E-Mail �Ѿ���ʹ��, ���ʽ����ȷ')));
}
if (strlen($_POST['password']) < 6 or strlen($_POST['password']) > 16) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('���볤�Ȳ���Ϲ���')));
}
if (!$_POST['agreement_chk']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('�����ͬ���û�Э����ܼ���')));
}
// �����֤��
if (!AWS_APP::captcha()->is_validate($_POST['seccode_verify']) and get_setting('register_seccode') == 'Y') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('����д��ȷ����֤��')));
}
if (get_setting('ucenter_enabled') == 'Y') {
$result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email']);
if (is_array($result)) {
$uid = $result['user_info']['uid'];
} else {
H::ajax_json_output(AWS_APP::RSM(null, -1, $result));
}
} else {
$uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']);
}
if ($_POST['email'] == $invitation['invitation_email']) {
$this->model('active')->set_user_email_valid_by_uid($uid);
$this->model('active')->active_user_by_uid($uid);
}
if (isset($_POST['sex'])) {
$update_data['sex'] = intval($_POST['sex']);
if ($_POST['province']) {
$update_data['province'] = htmlspecialchars($_POST['province']);
$update_data['city'] = htmlspecialchars($_POST['city']);
}
if ($_POST['job_id']) {
$update_data['job_id'] = intval($_POST['job_id']);
}
$update_attrib_data['signature'] = htmlspecialchars($_POST['signature']);
// �������
$this->model('account')->update_users_fields($update_data, $uid);
// ���´ӱ�
$this->model('account')->update_users_attrib_fields($update_attrib_data, $uid);
}
$this->model('account')->setcookie_logout();
$this->model('account')->setsession_logout();
if ($_POST['icode']) {
$follow_users = $this->model('invitation')->get_invitation_by_code($_POST['icode']);
} else {
if (HTTP::get_cookie('fromuid')) {
$follow_users = $this->model('account')->get_user_info_by_uid(HTTP::get_cookie('fromuid'));
}
}
if ($follow_users['uid']) {
$this->model('follow')->user_follow_add($uid, $follow_users['uid']);
$this->model('follow')->user_follow_add($follow_users['uid'], $uid);
$this->model('integral')->process($follow_users['uid'], 'INVITE', get_setting('integral_system_config_invite'), '����ע��: ' . $_POST['user_name'], $follow_users['uid']);
}
if ($_POST['icode']) {
$this->model('invitation')->invitation_code_active($_POST['icode'], time(), fetch_ip(), $uid);
}
if (get_setting('register_valid_type') == 'N' or get_setting('register_valid_type') == 'email' and get_setting('register_type') == 'invite') {
$this->model('active')->active_user_by_uid($uid);
}
$user_info = $this->model('account')->get_user_info_by_uid($uid);
if (get_setting('register_valid_type') == 'N' or $user_info['group_id'] != 3 or $_POST['email'] == $invitation['invitation_email']) {
$this->model('account')->setcookie_login($user_info['uid'], $user_info['user_name'], $_POST['password'], $user_info['salt']);
if (!$_POST['_is_mobile']) {
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/home/first_login-TRUE')), 1, null));
//.........这里部分代码省略.........