本文整理汇总了PHP中urlEncode函数的典型用法代码示例。如果您正苦于以下问题:PHP urlEncode函数的具体用法?PHP urlEncode怎么用?PHP urlEncode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了urlEncode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sms_send
function sms_send($phone, $content)
{
global $INI;
if (mb_strlen($content, 'UTF-8') < 20) {
return '短信长度低于20汉字?长点吧~';
}
/* include customsms function */
$smsowner_file = dirname(__FILE__) . '/smsowner.php';
if (file_exists($smsowner_file)) {
require_once $smsowner_file;
if (function_exists('sms_send_owner')) {
return sms_send_owner($phone, $content);
}
}
/* end include */
$user = strval($INI['sms']['user']);
$pass = strtolower(md5($INI['sms']['pass']));
if (null == $user) {
return true;
}
$content = urlEncode($content);
$api = "http://notice.zuitu.com/sms?user={$user}&pass={$pass}&phones={$phone}&content={$content}";
$res = Utility::HttpRequest($api);
return trim(strval($res)) == '+OK' ? true : strval($res);
}
开发者ID:norain2050,项目名称:zuituware,代码行数:25,代码来源:sms.php
示例2: getUserInfo
public function getUserInfo($accessToken)
{
// Get the correct Profile Endpoint URL based off the country/region provided in the config['region']
$this->profileEndpointUrl();
if (empty($accessToken)) {
throw new \InvalidArgumentException('Access Token is a required parameter and is not set');
}
// To make sure double encoding doesn't occur decode first and encode again.
$accessToken = urldecode($accessToken);
$url = $this->profileEndpoint . '/auth/o2/tokeninfo?access_token=' . urlEncode($accessToken);
$httpCurlRequest = new HttpCurl($this->config);
$response = $httpCurlRequest->httpGet($url);
$data = json_decode($response);
if ($data->aud != $this->config['client_id']) {
// The access token does not belong to us
throw new \Exception('The Access token entered is incorrect');
}
// Exchange the access token for user profile
$url = $this->profileEndpoint . '/user/profile';
$httpCurlRequest = new HttpCurl($this->config);
$httpCurlRequest->setAccessToken($accessToken);
$httpCurlRequest->setHttpHeader(true);
$response = $httpCurlRequest->httpGet($url);
$userInfo = json_decode($response, true);
return $userInfo;
}
开发者ID:wikimedia,项目名称:wikimedia-fundraising-crm-vendor,代码行数:26,代码来源:PaymentsClient.php
示例3: cleanUrl
/**
* Cleans a URL so it's safe to print to the browser without issues.
* @param uri String The URL to parse
* @return String The clean URL to print
*/
public static function cleanUrl($uri)
{
$result = null;
$url = htmlEntities($uri, ENT_QUOTES, 'utf-8');
$parse = parse_url($url);
$result = "{$parse['scheme']}://";
$parse['path'] = ltrim($parse['path'], '/');
foreach (array('user', 'pass', 'path', 'query', 'fragment') as $p) {
if (isset($parse[$p])) {
$parse[$p] = urlEncode($parse[$p]);
}
}
if (!empty($parse['user'])) {
$result .= "{$parse['user']}";
if (empty($parse['pass'])) {
$result .= '@';
} else {
$result .= ":{$parse['pass']}@";
}
}
$result .= "{$parse['host']}/{$parse['path']}";
if (!empty($parse['query'])) {
$result .= "?{$parse['query']}";
}
if (!empty($parse['fragment'])) {
$result .= "#{$parse['fragment']}";
}
return $result;
}
开发者ID:aldimol,项目名称:zf-sample,代码行数:34,代码来源:Misc.php
示例4: genURL
private function genURL($url = "/", $param, $value)
{
if (false === strpos($url, '?')) {
return $url . '?' . urlEncode($param) . '=' . urlEncode($value);
} else {
return $url . '&' . urlEncode($param) . '=' . urlEncode($value);
}
}
开发者ID:cmooony,项目名称:d4d-studio,代码行数:8,代码来源:Pager.class.php
示例5: showBody
function showBody()
{
#----------------------------------------------------------------------
global $chosenPersonId;
// simple validation first...
if (!preg_match('/\\d{4}\\w{4}\\d{2}/', $chosenPersonId)) {
showErrorMessage('Invalid WCA id Format <strong>[</strong>' . o($chosenPersonId) . '<strong>]</strong>');
print '<p><a href="persons.php">Click here to search for people.</a></p>';
return;
}
#--- Get all incarnations of the person.
$persons = dbQuery("\n SELECT person.name personName, country.name countryName, day, month, year, gender\n FROM Persons person, Countries country\n WHERE person.id = '{$chosenPersonId}' AND country.id = person.countryId\n ORDER BY person.subId\n ");
#--- If there are none, show an error and do no more.
if (!count($persons)) {
showErrorMessage('Unknown person id <strong>[</strong>' . o($chosenPersonId) . '<strong>]</strong>');
$namepart = substr($chosenPersonId, 4, 4);
print '<p><a href="persons.php?pattern=' . urlEncode($namepart) . '">Click to search for people with `' . o($namepart) . '` in their name.</a></p>';
return;
}
#--- Get and show the current incarnation.
$currentPerson = array_shift($persons);
extract($currentPerson);
echo "<h1>{$personName}</h1>";
#--- Show previous incarnations if any.
if (count($persons)) {
echo "<p class='subtitle'>(previously ";
foreach ($persons as $person) {
$previous[] = "{$person['personName']}/{$person['countryName']}";
}
echo implode(', ', $previous) . ")</p>";
}
#--- Show the picture if any.
$picture = getCurrentPictureFile($chosenPersonId);
if ($picture) {
echo "<center><img class='person' src='{$picture}' /></center>";
}
#--- Show the In Memoriam if any.
$inMemoriamArray = array("2008COUR01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=2028", "2003LARS01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=1982", "2012GALA02" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=1044", "2008LIMR01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=945", "2008KIRC01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=470");
if (array_key_exists($chosenPersonId, $inMemoriamArray)) {
echo "<center><a target='_blank' href='{$inMemoriamArray[$chosenPersonId]}'>In Memoriam</a></center>";
}
#--- Show the details.
tableBegin('results', 4);
tableCaption(false, 'Details');
tableHeader(explode('|', 'Country|WCA Id|Gender|Competitions'), array(3 => 'class="f"'));
$gender_text = genderText($gender);
$numberOfCompetitions = dbValue("SELECT count(distinct competitionId) FROM Results where personId='{$chosenPersonId}'");
tableRow(array($countryName, $chosenPersonId, $gender_text, $numberOfCompetitions));
tableEnd();
#--- Try the cache for the results
# tryCache( 'person', $chosenPersonId );
#--- Now the results.
require 'includes/person_personal_records_current.php';
require 'includes/person_world_championship_podiums.php';
require 'includes/person_world_records_history.php';
require 'includes/person_continent_records_history.php';
require 'includes/person_events.php';
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:58,代码来源:person.php
示例6: getListFileTree
public function getListFileTree($path = '', $jump = '')
{
$option = "com_xsltmagic";
$files = array();
$folders = array();
$size = 0;
foreach (scandir($path) as $v) {
if (!is_dir($path . '/' . $v)) {
$files[] = $path . '/' . $v;
continue;
}
if (substr($v, 0, 1) != '.') {
// not need '.' '..'
$folders[] = $path . '/' . $v;
}
}
natcasesort($folders);
natcasesort($files);
if (isset($jump)) {
$link = explode('&', $jump);
$url = '';
for ($i = 1; $i < count($link) - 1; $i++) {
$url .= '&' . $link[$i];
}
$row[$size]->link = JRoute::_("index.php?option={$option}&controller=xslts" . $url);
$row[$size]->checked_out = false;
$row[$size]->name = '...';
$size++;
}
// Folders
for ($f = 0; $f < count($folders); $f++) {
$currentFolder = str_replace($path . '/', '', $folders[$f]);
$link = $jump . '&jump[]=' . basename($currentFolder);
$row[$size]->link = JRoute::_("index.php?option={$option}&controller=xslts" . $link);
$row[$size]->checked_out = false;
$row[$size]->name = basename($currentFolder);
$row[$size]->type = 'Folder';
$row[$size]->modified = date("d.m.Y H:i:s", filemtime($path . DS . $currentFolder));
$size++;
}
// Process files
for ($h = 0; $h < count($files); $h++) {
$currentFile = str_replace($path . '/', '', $files[$h]);
$currentEncoded = urlEncode($currentFile);
$subArr = explode('%2F', $currentEncoded);
$filename = $subArr[count($subArr) - 1];
$subArrr = explode('.', $filename);
$extension = $subArrr[count($subArrr) - 1];
$row[$size]->link = JRoute::_("index.php?option={$option}&id[]={$filename}&task=edit&controller=xslts" . $jump);
$row[$size]->checked_out = false;
$row[$size]->name = $filename;
$row[$size]->type = $extension;
$row[$size]->modified = date("d.m.Y H:i:s", filemtime($path . DS . $currentFile));
$row[$size]->fileSize = round(filesize($path . DS . $currentFile) / 1024) . ' kb';
$size++;
}
return $row;
}
开发者ID:KIZI,项目名称:sewebar-cms,代码行数:58,代码来源:xslts.php
示例7: sms_send
function sms_send($phone, $content)
{
global $INI;
if (mb_strlen($content, 'UTF-8') < 20) {
return '短信长度低于20汉字?长点吧~';
}
$user = $INI['sms']['user'];
$pass = strtolower(md5($INI['sms']['pass']));
$content = urlEncode($content);
$api = "http://notice.zuitu.com/sms?user={$user}&pass={$pass}&phones={$phone}&content={$content}";
$res = Utility::HttpRequest($api);
return trim(strval($res)) == '+OK' ? true : strval($res);
}
开发者ID:BGCX262,项目名称:zuitu-svn-to-git,代码行数:13,代码来源:sms.php
示例8: sendAvicSMSAction
public function sendAvicSMSAction($mobiles, $msg)
{
$SMS_ACT = $this->container->getParameter('SMS_ACT');
$SMS_PWD = $this->container->getParameter('SMS_PWD');
$SMS_URL = $this->container->getParameter('SMS_URL');
$SMS_EID = $this->container->getParameter('SMS_EID');
$mobiles = str_replace(";", ",", $mobiles);
$content = urlEncode(urlEncode(mb_convert_encoding($msg, 'gb2312', 'utf-8')));
$pwd = md5($SMS_PWD);
$apidata = "username={$SMS_ACT}&password={$pwd}&message={$content}&phone={$mobiles}&epid={$SMS_EID}&linkid=&subcode=";
$this->get("logger")->err($SMS_URL . "?" . $apidata);
$result = mb_convert_encoding($this->do_post_request($SMS_URL . "?" . $apidata, null), 'utf-8', 'gb2312');
$this->get("logger")->err($result);
return Utils::WrapResultOK('');
}
开发者ID:3116246,项目名称:haolinju,代码行数:15,代码来源:SendSMSController.php
示例9: exchangeRate
function exchangeRate($amount, $currency, $exchangeIn)
{
$url = @'http://www.google.com/ig/calculator?hl=en&q=' . urlEncode($amount . $currency . '=?' . $exchangeIn);
$data = @file_get_contents($url);
if (!$data) {
throw new Exception('Could not connect');
}
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
$array = $json->decode($data);
if (!$array) {
throw new Exception('Could not parse the JSON');
}
if ($array['error']) {
throw new Exception('Google reported an error: ' . $array['error']);
}
return (double) $array['rhs'];
}
开发者ID:bitoncoin,项目名称:Ozcoin,代码行数:17,代码来源:extra.php
示例10: choice
function choice($id, $caption, $options, $chosenOption)
{
#----------------------------------------------------------------------
$result = "<label for='{$id}'>";
$result .= $caption ? "{$caption}:<br />" : '';
$result .= "<select class='drop' id='{$id}' name='{$id}'>\n";
$chosen = urlEncode($chosenOption);
foreach ($options as $option) {
$nick = urlEncode($option[0]);
$text = htmlEntities($option[1], ENT_QUOTES, "UTF-8");
$selected = $chosen && $nick == $chosen ? " selected='selected'" : "";
$result .= "<option value='{$nick}'{$selected}>{$text}</option>\n";
}
$result .= "</select>";
$result .= "</label>";
return $result;
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:17,代码来源:_choices.php
示例11: accesCle
function accesCle($tuple, $format = "url")
{
$separateur = $chaine = "";
// Parcours des attributs
foreach ($this->schemaTable as $nom => $options) {
// C'est un attribut de la cl� primaire
if ($options['cle_primaire']) {
if ($format == "url") {
$chaine .= "&{$nom}=" . urlEncode($tuple[$nom]);
$separateur = "&";
} else {
$chaine .= "{$separateur}{$nom}='" . addSlashes($tuple[$nom]) . "'";
$separateur = " AND ";
}
}
}
return $chaine;
}
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:18,代码来源:IhmBD.class.php
示例12: Convert
/**
* Converts currency using google. throws an exception if something went wrong
*
* @param numeric $amount
* @param string from currency (ex USD)
* @param string to currency (ex EUR)
* @return number
* @author: http://www.it-base.ro/2007/07/09/currency-conversion-in-php
* @author: Jason M Hinkle
* @version: 1.0
*/
public static function Convert($amount, $from, $to)
{
$converted_amount = 0;
$qs = $amount . ' ' . $from . ' in ' . $to;
$url = "http://www.google.com/search?q=" . urlEncode($qs);
$g_response = strip_tags(HttpRequest::Get($url));
if (preg_match("/Rates provided for information only - see disclaimer./i", $g_response)) {
$matches = array();
preg_match('/= ([0-9\\s\\.,]+)/', $g_response, $matches);
if ($matches[1]) {
$converted_amount = $matches[1];
} else {
// this should never occur unless google changes the output formatting of the search results
throw new Exception("Unable to parse response from google");
}
} else {
throw new Exception("The google search result does not appear to contain currency information");
}
return $converted_amount;
}
开发者ID:mymizan,项目名称:phreeze,代码行数:31,代码来源:CurrencyConverter.php
示例13: send
public function send($mobile, $content, $schedule = null)
{
$providerInfo = $this->_getProviderInfo();
if ($schedule == "0000-00-00 00:00:00") {
$schedule = '';
} else {
$schedule = date('Y-m-d H:i:s', strtotime($schedule));
}
$sender = new BayouSmsSender();
$content_log = $content;
$content = urlEncode(urlEncode(mb_convert_encoding($content, 'gb2312', 'utf-8')));
$result = $sender->sendsms($providerInfo['username'], md5($providerInfo['password']), $mobile, $content, $schedule);
if ($result['status'] == 0) {
Openbiz::getService(LOG_SERVICE)->log(LOG_ERR, "SMS", "sendMessage: " . $content . " Bayou:" . $mobile . ':' . $result['msg']);
return false;
} else {
$this->HitMessageCounter();
$this->_log($mobile, $content_log, $schedule);
return true;
}
}
开发者ID:openbizx,项目名称:openbizx-cubix,代码行数:21,代码来源:SPc8686.php
示例14: encodeValue
protected static function encodeValue($value)
{
return urlEncode($value);
}
开发者ID:grlf,项目名称:eyedock,代码行数:4,代码来源:TNvpSerializer.php
示例15: _mac_addr_internal
$phone_types['polycom-spip-450'] = 'Polycom SoundPoint IP 450';
$phone_types['polycom-spip-501'] = 'Polycom SoundPoint IP 501';
$phone_types['polycom-spip-550'] = 'Polycom SoundPoint IP 550';
$phone_types['polycom-spip-560'] = 'Polycom SoundPoint IP 560';
$phone_types['polycom-spip-601'] = 'Polycom SoundPoint IP 601';
$phone_types['polycom-spip-650'] = 'Polycom SoundPoint IP 650';
$phone_types['polycom-spip-670'] = 'Polycom SoundPoint IP 670';
}
$per_page = (int) GS_GUI_NUM_RESULTS;
$mac_addr_internal = _mac_addr_internal(@$_REQUEST['mac']);
$mac_addr_display = _mac_addr_display($mac_addr_internal);
$pbx_id = array_key_exists('pbx_id', $_REQUEST) ? (int) $_REQUEST['pbx_id'] : -1;
$ip_addr = trim(@$_REQUEST['ip']);
$phone_type = @$_REQUEST['phone_type'];
$page = (int) @$_REQUEST['page'];
$search_url = 'mac=' . urlEncode($mac_addr_internal) . '&' . 'ip=' . urlEncode($ip_addr) . '&' . 'pbx_id=' . urlEncode($pbx_id) . '&' . 'phone_type=' . urlEncode($phone_type);
#####################################################################
# view {
#####################################################################
if ($action === 'view') {
//echo "<pre>"; print_r($_REQUEST); echo "</pre>";
$where = array();
if ($mac_addr_internal != '') {
$where[] = '`p`.`mac_addr` LIKE \'%' . $DB->escape($mac_addr_internal) . '%\'';
}
if ($pbx_id === 0) {
$where[] = '`h`.`is_foreign`=0';
} elseif ($pbx_id > 0) {
$where[] = '`h`.`id`=' . $pbx_id;
}
if ($ip_addr != '') {
开发者ID:rkania,项目名称:GS3,代码行数:31,代码来源:prov_phones.php
示例16: get
/**
* Get the value of a field in the current row.
* Possible keys in the options array:
* binary, unserialize, convertHTMLBreaks, urlEncode, filterHTMLSpecialCharacters, escapeForXML, stripSlashes
*
* @param string $ps_field field name
* @param array $pa_options associative array of options, keys are names of the options, values are boolean.
* @return mixed
*/
function get($ps_field, $pa_options = null)
{
$va_field = isset(DbResult::$s_field_info_cache[$ps_field]) ? DbResult::$s_field_info_cache[$ps_field] : $this->getFieldInfo($ps_field);
if (!isset($this->opa_current_row[$va_field["field"]])) {
return null;
}
$vs_val = isset($this->opa_current_row[$va_field["field"]]) ? $this->opa_current_row[$va_field["field"]] : null;
if (isset($pa_options["binary"]) && $pa_options["binary"]) {
return $vs_val;
}
if (isset($pa_options["unserialize"]) && $pa_options["unserialize"]) {
if (!isset($this->opa_unserialized_cache[$va_field["field"]]) || !($vm_data = $this->opa_unserialized_cache[$va_field["field"]])) {
$vm_data = caUnserializeForDatabase($vs_val);
$this->opa_unserialized_cache[$va_field["field"]] =& $vm_data;
}
return $vm_data;
}
if (isset($pa_options["convertHTMLBreaks"]) && $pa_options["convertHTMLBreaks"]) {
# check for tags before converting breaks
preg_match_all("/<[A-Za-z0-9]+/", $vs_val, $va_tags);
$va_ok_tags = array("<b", "<i", "<u", "<strong", "<em", "<strike", "<sub", "<sup", "<a", "<img", "<span");
$vb_convert_breaks = true;
foreach ($va_tags[0] as $vs_tag) {
if (!in_array($vs_tag, $va_ok_tags)) {
$vb_convert_breaks = false;
break;
}
}
if ($vb_convert_breaks) {
$vs_val = preg_replace("/(\n|\r\n){2}/", "<p/>", $vs_val);
$vs_val = ereg_replace("\n", "<br/>", $vs_val);
}
}
if (isset($pa_options["urlEncode"]) && $pa_options["urlEncode"]) {
$vs_val = urlEncode($vs_val);
}
if (isset($pa_options["filterHTMLSpecialCharacters"]) && $pa_options["filterHTMLSpecialCharacters"]) {
$vs_val = htmlentities(html_entity_decode($vs_val));
}
if (isset($pa_options["escapeForXML"]) && $pa_options["escapeForXML"]) {
$vs_val = caEscapeForXML($vs_val);
}
if (get_magic_quotes_gpc() || $pa_options["stripSlashes"]) {
$vs_val = stripSlashes($vs_val);
}
return $vs_val;
}
开发者ID:samrahman,项目名称:providence,代码行数:56,代码来源:DbResult.php
示例17: urlEncode
<span style="display:none" id="jum_paging"><?php
echo $paging_tampil;
?>
</span>
<span style="display:none" id="jum_hal"><?php
echo $jum_hal;
?>
</span>
<span style="display:none" id="sql"><?php
echo urlEncode($sql);
?>
</span>
<!--- untuk informasi paging jika ada pencarian -->
<span style="display:none" id="sql_cari"><?php
echo urlEncode($sql);
?>
</span>
<script type="text/javascript" >
// untuk paging
function hal(elm){
var sql = $("#sql_cari").text();
var bag_sekarang = $("#next").text() - 1;
var hal = $(elm).text();
var url = "data_tampil.php";
// untuk fungsi update_inline
var tabel = "keluarga";
var nama_id = "id_keluarga";
var url_update = "update.php";
$("#table").html("ditunggu cak .........");
开发者ID:masdidik,项目名称:simdesa,代码行数:31,代码来源:daftar_keluarga.php
示例18: getmobilevaildcodeAction
public function getmobilevaildcodeAction()
{
$re = array("returncode" => ReturnCode::$SUCCESS);
$da = $this->get("we_data_access");
$user = $this->get('security.context')->getToken()->getUser();
$accountContorller = new AccountController();
$request = $this->getRequest();
$session = $request->getSession();
$txtmobile = $request->get("txtmobile");
if (empty($txtmobile) || !preg_match("/^(1[8|3|5][0-9]|15[0|3|6|7|8|9]|18[2|5|6|8|9])\\d{8}\$/", $txtmobile)) {
$re["returncode"] = ReturnCode::$SYSERROR;
$re["msg"] = "请输入正确的手机号!";
$response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
//判断此手机已被绑定
$sql = "select 1 from we_staff where mobile_bind=?";
$params = array($txtmobile);
$ds = $da->Getdata('lo', $sql, $params);
if ($ds['lo']['recordcount'] > 0) {
$re["returncode"] = ReturnCode::$SYSERROR;
$re["msg"] = "该手机号已被绑定!";
$response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
$lastgetmobilevaildcodetime = $session->get("lastgetmobilevaildcodetime");
$getmobilevaildcodenums = $session->get("getmobilevaildcodenums");
if (empty($lastgetmobilevaildcodetime)) {
$lastgetmobilevaildcodetime = time() - 60 * 60;
}
if (empty($getmobilevaildcodenums)) {
$getmobilevaildcodenums = 0;
}
try {
if ($lastgetmobilevaildcodetime + 90 > time()) {
$re["returncode"] = ReturnCode::$SYSERROR;
$re["msg"] = "你获取验证码的次数太频繁!90秒钟只能取一次!";
$response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
if ($getmobilevaildcodenums >= 5 && $lastgetmobilevaildcodetime + 60 * 60 * 24 > time()) {
$re["returncode"] = ReturnCode::$SYSERROR;
$re["msg"] = "你获取验证码的次数太多!每天最多只能取5次!";
$response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
$mobilevaildcode = rand(100000, 999999);
$user = $this->container->getParameter("SMS_ACT");
$pass = md5($this->container->getParameter("SMS_PWD"));
//需要MD5
$phone = $txtmobile;
$content = "欢迎使用Wefafa,您的验证码是:{$mobilevaildcode} 。【发发时代】";
$content = urlEncode(urlEncode(mb_convert_encoding($content, 'gb2312', 'utf-8')));
$apidata = "func=sendsms&username={$user}&password={$pass}&mobiles={$phone}&message={$content}&smstype=0&timerflag=0&timervalue=&timertype=0&timerid=0";
$apiurl = $this->container->getParameter("SMS_URL");
$ret = $accountContorller->do_post_request($apiurl, $apidata);
if (strpos($ret, "<errorcode>0</errorcode>") > 0) {
$session->set("mobilevaildcode", $mobilevaildcode);
$session->set("lastgetmobilevaildcodetime", time());
$session->set("getmobilevaildcodenums", $getmobilevaildcodenums + 1);
$session->set("txtmobile", $txtmobile);
$re["returncode"] = ReturnCode::$SUCCESS;
} else {
$re["returncode"] = ReturnCode::$SYSERROR;
$re["msg"] = "短信发送失败!请重试";
$this->get('logger')->info($ret);
}
} catch (\Exception $e) {
$re["returncode"] = ReturnCode::$SYSERROR;
$re["msg"] = "获取并发送短信验证码失败!请重试";
$this->get('logger')->err($e);
}
$response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
开发者ID:3116246,项目名称:haolinju,代码行数:80,代码来源:BaseInfoController.php
示例19: getmobilevaildcodeAction
public function getmobilevaildcodeAction($network_domain)
{
$re = array();
$da = $this->get("we_data_access");
$user = $this->get('security.context')->getToken()->getUser();
$request = $this->getRequest();
$session = $request->getSession();
$txtmobile = $request->get("txtmobile");
if (empty($txtmobile) || !preg_match("/^(1[8|3|5][0-9]|15[0|3|6|7|8|9]|18[2|5|6|8|9])\\d{8}\$/", $txtmobile)) {
$re["success"] = "0";
$re["msg"] = "请输入正确的手机号!";
$response = new Response(json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
//判断是否已绑定手机号
/*
if(!empty($user->mobile_bind))
{
$re["success"] = "0";
$re["msg"] = "您已绑定了手机号,请先解除原有绑定!";
$response = new Response(json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
*/
//判断此手机已被绑定
$sql = "select 1 from we_staff where mobile_bind=?";
$params = array($txtmobile);
$ds = $da->Getdata('lo', $sql, $params);
if ($ds['lo']['recordcount'] > 0) {
$re["success"] = "0";
$re["msg"] = "该手机号已被绑定!";
$response = new Response(json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
$lastgetmobilevaildcodetime = $session->get("lastgetmobilevaildcodetime");
$getmobilevaildcodenums = $session->get("getmobilevaildcodenums");
if (empty($lastgetmobilevaildcodetime)) {
$lastgetmobilevaildcodetime = time() - 60 * 60;
}
if (empty($getmobilevaildcodenums)) {
$getmobilevaildcodenums = 0;
}
try {
if ($lastgetmobilevaildcodetime + 120 > time()) {
$re["success"] = "0";
$re["msg"] = "你获取验证码的次数太频繁!120秒钟只能取一次!";
$response = new Response(json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
if ($getmobilevaildcodenums >= 5 && $lastgetmobilevaildcodetime + 60 * 60 * 24 > time()) {
$re["success"] = "0";
$re["msg"] = "你获取验证码的次数太多!每天最多只能取5次!";
$response = new Response(json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
$mobilevaildcode = rand(100000, 999999);
$user = $this->container->getParameter("SMS_ACT");
$pass = md5($this->container->getParameter("SMS_PWD"));
//需要MD5
$phone = $txtmobile;
$content = "验证码:" . $mobilevaildcode . ",2分钟内有效,仅用于绑定手机操作。 【Wefafa】";
$content = urlEncode(urlEncode(mb_convert_encoding($content, 'gb2312', 'utf-8')));
$apidata = "func=sendsms&username={$user}&password={$pass}&mobiles={$phone}&message={$content}&smstype=0&timerflag=0&timervalue=&timertype=0&timerid=0";
$apiurl = $this->container->getParameter("SMS_URL");
$ret = $this->do_post_request($apiurl, $apidata);
if (strpos($ret, "<errorcode>0</errorcode>") > 0) {
$session->set("mobilevaildcode", $mobilevaildcode);
$session->set("lastgetmobilevaildcodetime", time());
$session->set("getmobilevaildcodenums", $getmobilevaildcodenums + 1);
$session->set("txtmobile", $txtmobile);
$re["success"] = "1";
//$re["code"] =$mobilevaildcode;
} else {
$re["success"] = "0";
$re["msg"] = "短信发送失败!请稍后重试";
$this->get('logger')->info($ret);
}
} catch (\Exception $e) {
$re["success"] = "0";
$re["msg"] = "获取并发送短信验证码失败!请稍后重试";
$this->get('logger')->err($e);
}
$response = new Response(json_encode($re));
$response->headers->set('Content-Type', 'text/json');
return $response;
}
开发者ID:3116246,项目名称:haolinju,代码行数:92,代码来源:AccountController.php
示例20: aastra_textscreen
if ($page < $num_pages - 1) {
$xml .= '<SoftKey index="6">' . "\n";
$xml .= ' <Label>' . ($page + 2) . '>></Label>' . "\n";
$xml .= ' <URI>' . $url_aastra_pb . '?t=imported&p=' . ($page + 1) . '&n=' . $name_search . '</URI>' . "\n";
$xml .= '</SoftKey>' . "\n";
}
$xml .= '</AastraIPPhoneTextMenu>' . "\n";
} else {
if ($name_search) {
aastra_textscreen(__('Nicht gefunden'), sprintF(__('Eintrag "%s" nicht gefunden.'), $name_search));
} else {
aastra_textscreen($page_title, __('Kein Eintrag'));
}
}
} elseif ($type === 'prv') {
$search_url = 'name=' . urlEncode($name_search);
$name_sql = str_replace(array('*', '?'), array('%', '_'), strtolower($name_search)) . '%';
$user_id = _get_userid();
$query = 'SELECT SQL_CALC_FOUND_ROWS
`id`, `lastname` `ln`, `firstname` `fn`, `number`
FROM
`pb_prv`
WHERE
`user_id`=' . $user_id . ' AND (
LOWER(`lastname`) LIKE _utf8\'' . $db->escape($name_sql) . '\' COLLATE utf8_unicode_ci OR
LOWER(`firstname`) LIKE _utf8\'' . $db->escape($name_sql) . '\' COLLATE utf8_unicode_ci
)
ORDER BY `lastname`, `firstname`
LIMIT ' . $page * $per_page . ',' . $per_page;
$rs = $db->execute($query);
$num_total = @$db->numFoundRows();
开发者ID:hehol,项目名称:GemeinschaftPBX,代码行数:31,代码来源:pb.php
注:本文中的urlEncode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论