本文整理汇总了PHP中token函数的典型用法代码示例。如果您正苦于以下问题:PHP token函数的具体用法?PHP token怎么用?PHP token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了token函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: yay_parse
function yay_parse(string $source, Directives $directives = null, BlueContext $blueContext = null) : string
{
if ($gc = gc_enabled()) {
gc_disable();
}
// important optimization!
static $globalDirectives = null;
if (null === $globalDirectives) {
$globalDirectives = new ArrayObject();
}
$directives = $directives ?: new Directives();
$blueContext = $blueContext ?: new BlueContext();
$cg = (object) ['ts' => TokenStream::fromSource($source), 'directives' => $directives, 'cycle' => new Cycle($source), 'globalDirectives' => $globalDirectives, 'blueContext' => $blueContext];
foreach ($cg->globalDirectives as $d) {
$cg->directives->add($d);
}
traverse(midrule(function (TokenStream $ts) use($directives, $blueContext) {
$token = $ts->current();
tail_call:
if (null === $token) {
return;
}
// skip when something looks like a new macro to be parsed
if ('macro' === (string) $token) {
return;
}
// here we do the 'magic' to match and expand userland macros
$directives->apply($ts, $token, $blueContext);
$token = $ts->next();
goto tail_call;
}), consume(chain(token(T_STRING, 'macro')->as('declaration'), optional(repeat(rtoken('/^·\\w+$/')))->as('tags'), lookahead(token('{')), commit(chain(braces()->as('pattern'), operator('>>'), braces()->as('expansion')))->as('body'), optional(token(';'))), CONSUME_DO_TRIM)->onCommit(function (Ast $macroAst) use($cg) {
$scope = Map::fromEmpty();
$tags = Map::fromValues(array_map('strval', $macroAst->{'tags'}));
$pattern = new Pattern($macroAst->{'declaration'}->line(), $macroAst->{'body pattern'}, $tags, $scope);
$expansion = new Expansion($macroAst->{'body expansion'}, $tags, $scope);
$macro = new Macro($tags, $pattern, $expansion, $cg->cycle);
$cg->directives->add($macro);
// allocate the userland macro
// allocate the userland macro globally if it's declared as global
if ($macro->tags()->contains('·global')) {
$cg->globalDirectives[] = $macro;
}
}))->parse($cg->ts);
$expansion = (string) $cg->ts;
if ($gc) {
gc_enable();
}
return $expansion;
}
开发者ID:lastguest,项目名称:yay,代码行数:49,代码来源:yay_parse.php
示例2: editCustomer
public function editCustomer($customer_id, $data)
{
if (!isset($data['custom_field'])) {
$data['custom_field'] = array();
}
$this->db->query("UPDATE " . DB_PREFIX . "customer SET customer_group_id = '" . (int) $data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']) ? json_encode($data['custom_field']) : '') . "', newsletter = '" . (int) $data['newsletter'] . "', status = '" . (int) $data['status'] . "', approved = '" . (int) $data['approved'] . "', safe = '" . (int) $data['safe'] . "' WHERE customer_id = '" . (int) $customer_id . "'");
//+mod by yp start
if (isset($data['affiliate_id']) && mta_check_int($data['affiliate_id'])) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET affiliate_id='" . (int) $data['affiliate_id'] . "' where customer_id='" . (int) $customer_id . "'");
}
//+mod by yp end
if ($data['password']) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "' WHERE customer_id = '" . (int) $customer_id . "'");
}
$this->db->query("DELETE FROM " . DB_PREFIX . "address WHERE customer_id = '" . (int) $customer_id . "'");
if (isset($data['address'])) {
foreach ($data['address'] as $address) {
if (!isset($address['custom_field'])) {
$address['custom_field'] = array();
}
$this->db->query("INSERT INTO " . DB_PREFIX . "address SET address_id = '" . (int) $address['address_id'] . "', customer_id = '" . (int) $customer_id . "', firstname = '" . $this->db->escape($address['firstname']) . "', lastname = '" . $this->db->escape($address['lastname']) . "', company = '" . $this->db->escape($address['company']) . "', address_1 = '" . $this->db->escape($address['address_1']) . "', address_2 = '" . $this->db->escape($address['address_2']) . "', city = '" . $this->db->escape($address['city']) . "', postcode = '" . $this->db->escape($address['postcode']) . "', country_id = '" . (int) $address['country_id'] . "', zone_id = '" . (int) $address['zone_id'] . "', custom_field = '" . $this->db->escape(isset($address['custom_field']) ? json_encode($address['custom_field']) : '') . "'");
if (isset($address['default'])) {
$address_id = $this->db->getLastId();
$this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int) $address_id . "' WHERE customer_id = '" . (int) $customer_id . "'");
}
}
}
}
开发者ID:pedrocones,项目名称:store,代码行数:28,代码来源:customer.php
示例3: editAffiliate
public function editAffiliate($affiliate_id, $data)
{
$this->db->query("UPDATE " . DB_PREFIX . "affiliate SET firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', company = '" . $this->db->escape($data['company']) . "', website = '" . $this->db->escape($data['website']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "', code = '" . $this->db->escape($data['code']) . "', commission = '" . (double) $data['commission'] . "', tax = '" . $this->db->escape($data['tax']) . "', payment = '" . $this->db->escape($data['payment']) . "', cheque = '" . $this->db->escape($data['cheque']) . "', paypal = '" . $this->db->escape($data['paypal']) . "', bank_name = '" . $this->db->escape($data['bank_name']) . "', bank_branch_number = '" . $this->db->escape($data['bank_branch_number']) . "', bank_swift_code = '" . $this->db->escape($data['bank_swift_code']) . "', bank_account_name = '" . $this->db->escape($data['bank_account_name']) . "', bank_account_number = '" . $this->db->escape($data['bank_account_number']) . "', status = '" . (int) $data['status'] . "' WHERE affiliate_id = '" . (int) $affiliate_id . "'");
if ($data['password']) {
$this->db->query("UPDATE " . DB_PREFIX . "affiliate SET salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "' WHERE affiliate_id = '" . (int) $affiliate_id . "'");
}
}
开发者ID:qahar,项目名称:opencart,代码行数:7,代码来源:affiliate.php
示例4: editCustomer
public function editCustomer($customer_id, $data)
{
if (!isset($data['custom_field'])) {
$data['custom_field'] = array();
}
//RIP modifications: make the editCustomer flexible in order to use in dashboard.php
if (isset($data['firstname'])) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET customer_group_id = '" . (int) $data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', custom_field = '" . $this->db->escape(isset($data['custom_field']) ? json_encode($data['custom_field']) : '') . "', status = '" . (int) $data['status'] . "', approved = '" . (int) $data['approved'] . "', folder_name = '" . $data['folder_name'] . "' WHERE customer_id = '" . (int) $customer_id . "'");
} elseif (isset($data['status'])) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET status = '" . (int) $data['status'] . "'");
}
//RIP modifications:End.
if ($data['password']) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "' WHERE customer_id = '" . (int) $customer_id . "'");
}
$this->db->query("DELETE FROM " . DB_PREFIX . "address WHERE customer_id = '" . (int) $customer_id . "'");
if (isset($data['address'])) {
foreach ($data['address'] as $address) {
if (!isset($address['custom_field'])) {
$address['custom_field'] = array();
}
$this->db->query("INSERT INTO " . DB_PREFIX . "address SET address_id = '" . (int) $address['address_id'] . "', customer_id = '" . (int) $customer_id . "', firstname = '" . $this->db->escape($address['firstname']) . "', lastname = '" . $this->db->escape($address['lastname']) . "', company = '" . $this->db->escape($address['company']) . "', address_1 = '" . $this->db->escape($address['address_1']) . "', address_2 = '" . $this->db->escape($address['address_2']) . "', city = '" . $this->db->escape($address['city']) . "', postcode = '" . $this->db->escape($address['postcode']) . "', country_id = '" . (int) $address['country_id'] . "', zone_id = '" . (int) $address['zone_id'] . "', custom_field = '" . $this->db->escape(isset($address['custom_field']) ? json_encode($address['custom_field']) : '') . "'");
if (isset($address['default'])) {
$address_id = $this->db->getLastId();
$this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int) $address_id . "' WHERE customer_id = '" . (int) $customer_id . "'");
}
}
}
}
开发者ID:hutdast,项目名称:rip,代码行数:29,代码来源:customer.php
示例5: editPassword
public function editPassword($email, $password)
{
$affiliate_id = $this->affiliate->getId();
$this->event->trigger('pre.affiliate.edit.password', $affiliate_id);
$this->db->query("UPDATE " . DB_PREFIX . "affiliate SET salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($password)))) . "' WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "'");
$this->event->trigger('post.affiliate.edit.password', $affiliate_id);
}
开发者ID:DanyloAndreiev,项目名称:sota,代码行数:7,代码来源:affiliate.php
示例6: update_token
/**
* 生成和更新token 并保持到数据库
* @method update_token
*
* @author 云小印[[email protected]]
*
* @param mixed $info 用户id或者token值
* @param int $type 用户类型,读取配置
* @return mixed 操作成功返回token值
*/
function update_token($info, $type = null)
{
$Token = M('token');
switch ($type) {
case C('ADMIN'):
case C('STUDENT'):
case C('PRINTER'):
case C('PRINTER_WEB'):
case C('STUDENT_API'):
$data['to_id'] = $info;
$data['type'] = $type;
$Token->where($data)->delete();
//删除之前的token;再更新token
$token = token($info);
$data['token'] = md5($token);
if (!$Token->add($data)) {
return false;
}
break;
default:
if (!preg_match('/^\\d+/', $info, $result)) {
return false;
}
$id = $result[0];
$data['to_id'] = $id;
$data['token'] = md5($info);
$token = token($id);
if (!$Token->where($data)->save(array('token' => md5($token)))) {
return false;
}
break;
}
return $token;
}
开发者ID:noikiy,项目名称:print,代码行数:44,代码来源:function.php
示例7: index
/**
* index()
* 登录和注册验证处理
* @param post.number 学号
* @param post.password 密码
*/
public function index()
{
$this->_checkHttps();
$number = I('post.number', null, C('REGEX_NUMBER'));
$password = I('post.password');
if (!$number || !$password) {
$this->error(L('WRONG_FORMAT'), C('BASE_URL'));
}
$User = M('User');
$user = $User->where('student_number="%s"', $number)->field('id,password,status')->find();
if ($user) {
$login_id = $this->_login($number, $password, $user);
if (!$login_id) {
$this->error(L('LOGIN_FAIL'), C('BASE_URL'));
} else {
/*登录成功开始跳转*/
S($key, null);
$token = md5(token($login_id));
S('AUTH_' . $token, $login_id, 300);
redirect(C('BASE_URL') . '/Auth/token?type=login&key=' . $token);
}
} else {
/*未注册尝试验证*/
$data = $this->_verify($number, $password);
if (!$data) {
$this->error($this->err, C('BASE_URL'));
} else {
/*验证成功缓存验证信息并跳转*/
S($key, null);
$token = md5($number . token($number));
S('REG_' . $token, $data, 300);
redirect(C('BASE_URL') . '/Auth/token?type=register&key=' . $token);
}
}
}
开发者ID:nemohuo,项目名称:print,代码行数:41,代码来源:AuthController.class.php
示例8: converteComandosTxt
function converteComandosTxt($txt, $campanha, $dtvalidade)
{
//altera variaveis
$conn = new conn();
$codigo = token();
$conn->insert(array('dtCad' => date("Y-m-d"), 'campanha' => $campanha, 'codigo_cupom' => $codigo, 'dtvalidade' => $dtvalidade, 'usuario_acao' => $_SESSION["login"]["usuario"], 'status' => 0), "", "cupom");
$txt = str_replace("&CODE&", $codigo, $txt);
return $txt;
}
开发者ID:THAYLLER,项目名称:api_sms,代码行数:9,代码来源:recebe-sms.php
示例9: editAffiliate
public function editAffiliate($affiliate_id, $data)
{
$this->event->trigger('pre.admin.affiliate.edit', $data);
$this->db->query("UPDATE " . DB_PREFIX . "affiliate SET fullname = '" . $this->db->escape($data['fullname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', company = '" . $this->db->escape($data['company']) . "', website = '" . $this->db->escape($data['website']) . "', address = '" . $this->db->escape($data['address']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "', code = '" . $this->db->escape($data['code']) . "', commission = '" . (double) $data['commission'] . "', tax = '" . $this->db->escape($data['tax']) . "', payment = '" . $this->db->escape($data['payment']) . "', cheque = '" . $this->db->escape($data['cheque']) . "', paypal = '" . $this->db->escape($data['paypal']) . "', bank_name = '" . $this->db->escape($data['bank_name']) . "', bank_account_name = '" . $this->db->escape($data['bank_account_name']) . "', bank_account_number = '" . $this->db->escape($data['bank_account_number']) . "', alipay_account_name = '" . $this->db->escape($data['alipay_account_name']) . "', alipay = '" . $this->db->escape($data['alipay']) . "', status = '" . (int) $data['status'] . "' WHERE affiliate_id = '" . (int) $affiliate_id . "'");
if ($data['password']) {
$this->db->query("UPDATE " . DB_PREFIX . "affiliate SET salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "' WHERE affiliate_id = '" . (int) $affiliate_id . "'");
}
$this->event->trigger('post.admin.affiliate.edit', $affiliate_id);
}
开发者ID:monkeychen,项目名称:website,代码行数:9,代码来源:affiliate.php
示例10: index
public function index()
{
$this->language->load('tool/upload');
$json = array();
if (!empty($this->request->files['file']['name']) && is_file($this->request->files['file']['tmp_name'])) {
// Sanitize the filename
$filename = basename(preg_replace('/[^a-zA-Z0-9\\.\\-\\s+]/', '', html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8')));
// Validate the filename length
if (utf8_strlen($filename) < 3 || utf8_strlen($filename) > 64) {
$json['error'] = $this->language->get('error_filename');
}
// Allowed file extension types
$allowed = array();
$extension_allowed = preg_replace('~\\r?\\n~', "\n", $this->config->get('config_file_ext_allowed'));
$filetypes = explode("\n", $extension_allowed);
foreach ($filetypes as $filetype) {
$allowed[] = trim($filetype);
}
if (!in_array(strtolower(substr(strrchr($filename, '.'), 1)), $allowed)) {
$json['error'] = $this->language->get('error_filetype');
}
// Allowed file mime types
$allowed = array();
$mime_allowed = preg_replace('~\\r?\\n~', "\n", $this->config->get('config_file_mime_allowed'));
$filetypes = explode("\n", $mime_allowed);
foreach ($filetypes as $filetype) {
$allowed[] = trim($filetype);
}
if (!in_array($this->request->files['file']['type'], $allowed)) {
$json['error'] = $this->language->get('error_filetype');
}
// Check to see if any PHP files are trying to be uploaded
$content = file_get_contents($this->request->files['file']['tmp_name']);
if (preg_match('/\\<\\?php/i', $content)) {
$json['error'] = $this->language->get('error_filetype');
}
// Return any upload error
if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
$json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
}
} else {
$json['error'] = $this->language->get('error_upload');
}
if (!$json) {
$file = $filename . '.' . token(32);
move_uploaded_file($this->request->files['file']['tmp_name'], DIR_UPLOAD . $file);
// Hide the uploaded file name so people can not link to it directly.
$this->load->model('tool/upload');
$json['code'] = $this->model_tool_upload->addUpload($filename, $file);
$json['success'] = $this->language->get('text_upload');
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
开发者ID:yuriygr,项目名称:opencart,代码行数:54,代码来源:upload.php
示例11: testCreatingAndLoggingInACustomer
public function testCreatingAndLoggingInACustomer()
{
$this->db->query("INSERT INTO " . DB_PREFIX . "customer SET customer_group_id = '1', store_id = '" . (int) $this->config->get('config_store_id') . "', firstname = 'Test', lastname = 'Customer', email = '[email protected]', telephone = '123456789', fax = '123456789', custom_field = '', salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1('password')))) . "', newsletter = '0', ip = '127.0.0.1', status = '1', approved = '1', date_added = NOW()");
$customer_id = $this->db->getLastId();
$this->assertTrue($this->login('[email protected]', 'password'));
$this->assertTrue(!!$this->customer->isLogged());
$response = $this->dispatchAction('account/edit');
$this->assertRegExp('/Your Personal Details/', $response->getOutput());
$this->logout();
$this->assertFalse(!!$this->customer->isLogged());
}
开发者ID:beyondit,项目名称:opencart-test-suite,代码行数:11,代码来源:Sample2Test.php
示例12: testHelloCustomerGreeting
public function testHelloCustomerGreeting()
{
// add examplary customer
$this->db->query("INSERT INTO " . DB_PREFIX . "customer SET customer_group_id = '1', store_id = '" . (int) $this->config->get('config_store_id') . "', firstname = 'Test', lastname = 'Customer', email = '[email protected]', telephone = '123456789', fax = '123456789', custom_field = '', salt = '" . $this->db->escape($salt = token(9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1('password')))) . "', newsletter = '0', ip = '127.0.0.1', status = '1', approved = '1', date_added = NOW()");
$this->login('[email protected]', 'password');
$response = $this->dispatchAction('hello/world');
$output = json_decode($response->getOutput(), true);
$this->assertEquals('Hello Test Customer', $output['greeting']);
$this->logout();
// delete customers
$this->db->query("DELETE FROM " . DB_PREFIX . "customer");
}
开发者ID:beyondit,项目名称:opencart-project-template,代码行数:12,代码来源:HelloWorldTest.php
示例13: hygienize
function hygienize(TokenStream $ts, string $scope) : TokenStream
{
$ts->reset();
traverse(either(chain(token(T_STRING, '·unsafe'), parentheses()), either(token(T_VARIABLE)->as('target'), chain(identifier()->as('target'), token(':')), chain(token(T_GOTO), identifier()->as('target')))->onCommit(function (Ast $result) use($scope) {
(function () use($scope) {
if ((string) $this !== '$this') {
$this->value = (string) $this . '·' . $scope;
}
})->call($result->target);
}), any()))->parse($ts);
$ts->reset();
return $ts;
}
开发者ID:assertchris,项目名称:yay,代码行数:13,代码来源:expanders.php
示例14: moveFile
/**
* Move the tmp file to desired location
* @param $file
* @param string $path
* @return string|void
*/
public function moveFile($file, $path = '')
{
$name = token();
$extension = $file->guessClientExtension();
$filename = $name . '.' . $extension;
$imageTmp = Image::make($file->getRealPath());
if (!$imageTmp) {
return notify()->error('Oops', 'Something went wrong', 'warning shake animated');
}
$path = upload_path_images($path);
$image = $imageTmp->save($path . $filename);
return $filename;
}
开发者ID:bpocallaghan,项目名称:titan,代码行数:19,代码来源:UploadFile.php
示例15: token
/**
* Create new session token or validate the token passed
*
* @param string $token value to validate
* @return string|boolean
*/
public static function token($token = NULL)
{
if (!isset($_SESSION)) {
return FALSE;
}
// If a token is given, then lets match it
if ($token !== NULL) {
if (!empty($_SESSION['token']) && $token === $_SESSION['token']) {
return TRUE;
}
return FALSE;
}
return $_SESSION['token'] = token();
}
开发者ID:Robert-Xie,项目名称:php-framework-benchmark,代码行数:20,代码来源:Session.php
示例16: data
function data()
{
$params = array();
$params['max_id'] = intval(v('max_id'));
if ($content = send_request('notice_list', $params, token())) {
//echo $content;
$data = json_decode($content, 1);
if (intval($data['err_code']) != 0) {
return false;
}
return render($data, 'ajax', 'raw');
}
return null;
}
开发者ID:ramo01,项目名称:1kapp,代码行数:14,代码来源:inbox.class.php
示例17: createSubscription
public function createSubscription($subscription_for)
{
if (!$this->isUserSubscribed()) {
$user = R::dispense('subscriptions');
$user->email = $this->_email;
$user->category_id = $this->_category_id;
$user->city_id = $this->_city_id;
$user->token = token();
$user->is_confirmed = 0;
$user->created = R::isoDateTime();
$id = R::store($user);
$notif = new Notifications();
$notif->createSubscriptionMail($id, $user->token, $user->email, $subscription_for);
return $id;
}
return false;
}
开发者ID:florentsuc,项目名称:jobskee-open-source-job-board,代码行数:17,代码来源:Subscriptions.php
示例18: hygienize
function hygienize(TokenStream $ts, array $context) : TokenStream
{
$ts->reset();
$cg = (object) ['node' => null, 'context' => $context, 'ts' => $ts];
$saveNode = function (Parser $parser) use($cg) {
return midrule(function ($ts) use($cg, $parser) {
$cg->node = $ts->index();
return $parser->parse($ts);
});
};
traverse(chain(token(T_STRING, '··unsafe'), either(parentheses(), braces())), either($saveNode(token(T_VARIABLE)), chain($saveNode(identifier()), token(':')), chain(token(T_GOTO), $saveNode(identifier())))->onCommit(function (Ast $result) use($cg) {
if (($t = $cg->node->token) && ($value = (string) $t) !== '$this') {
$cg->node->token = new Token($t->type(), "{$value}·{$cg->context['scope']}", $t->line());
}
}))->parse($ts);
$ts->reset();
return $ts;
}
开发者ID:lastguest,项目名称:yay,代码行数:18,代码来源:expanders.php
示例19: signup
public function signup()
{
$data = (array) json_decode(file_get_contents("php://input"));
if ($data['password'] !== $data['repassword']) {
$this->jsonify(array('success' => false, 'message' => 'Password mismatch!'));
exit;
}
$this->load->helper('misc_helper');
$user = array('username' => $data['username'], 'email' => $data['email'], 'activated' => false, 'activation_code' => token(), 'password' => do_hash($data['password']));
$this->load->model('User');
if ($this->User->add_user($user) === true) {
$this->jsonify(array('success' => true, 'message' => 'User created successfully!', 'url' => 'login'));
exit;
} else {
$this->jsonify(array('success' => false, 'message' => 'User create failed!'));
exit;
}
}
开发者ID:bobseven,项目名称:AngularJS-Codeigniter-CRUD,代码行数:18,代码来源:registration.php
示例20: loginUser
/**
* method for user login
* @param string $username [description]
* @param string $password [description]
*/
public function loginUser($username, $password)
{
$password = hash('sha256', $password);
$username = trim($username);
$query = "select * from registrants where username = '{$username}' and password = '{$password}'";
$result = $this->db->fetchOne($query);
if ($result) {
//method for token in functions
$token = token(8);
$query = "update registrants set token = '{$token}' where username = '{$username}'";
$this->db->execute($query);
//method for pass asterisk in functions ********
$asterisk = passAsterisk();
//success Login message from functions
successLogin($username, $token, $asterisk);
} else {
returnError('Password or username doesn`t exist.');
}
}
开发者ID:bakarisanja,项目名称:slim,代码行数:24,代码来源:User.php
注:本文中的token函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论