本文整理汇总了PHP中generate_token函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_token函数的具体用法?PHP generate_token怎么用?PHP generate_token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_token函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create_session
function create_session($request)
{
$raw_input = $request->getBody();
$content_type = explode(';', $request->type)[0];
switch ($content_type) {
case 'application/json':
$input_data = json_decode($raw_input, true);
break;
case 'application/x-www-form-urlencoded':
$input_data = array();
parse_str($raw_input, $input_data);
break;
default:
Util::output_errors_and_die('', 415);
}
if ($input_data === null) {
Util::output_errors_and_die('', 400);
}
set_empty_if_undefined($input_data['username_or_email']);
set_empty_if_undefined($input_data['password']);
$msg = new Messages($GLOBALS['locale'], '/signin');
try {
$model = new Model();
$user_data = $model->is_valid_user($input_data['username_or_email'], $input_data['password']);
if (!$user_data) {
Util::output_errors_and_die($msg->_('invalid-username-pw'), 403);
}
switch ($user_data['status']) {
case 'pending-activation':
Util::output_errors_and_die($msg->_('pending-activation'), 403);
break;
case 'pending-approval':
Util::output_errors_and_die($msg->_('pending-approval'), 403);
break;
case 'banned':
Util::output_errors_and_die($msg->_('banned'), 403);
break;
case 'active':
$token = generate_token($user_data);
$now = new DateTime('now');
$expires_at = clone $now;
$expires_at->add(new DateInterval('P7D'));
$model->insert_auth_token($user_data['user_id'], $token, $now, $expires_at);
http_response_code(201);
$output = array('token' => $token, 'expires_at' => $expires_at->format('Y-m-d H:i:s'));
setcookie('authToken', $token, $expires_at->getTimestamp(), '/', '', $secure = true, $httponly = true);
header('Content-Type: application/json');
echo my_json_encode($output);
die;
break;
}
} catch (DatabaseException $e) {
Util::output_errors_and_die($e->getMessage(), 503);
} catch (Exception $e) {
Util::output_errors_and_die($e->getMessage(), 400);
}
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:57,代码来源:create_session.php
示例2: createToken
private function createToken($app)
{
try {
$randToken = generate_token();
return Token::create(array('app_id' => $app->id, 'token' => $randToken));
} catch (\Exception $e) {
return $this->createToken($app);
}
}
开发者ID:3x14159265,项目名称:telegramlogin,代码行数:9,代码来源:TokenController.php
示例3: cobalt_password_hash
function cobalt_password_hash($mode, $password, $username, &$salt = '', &$iteration = '', &$method = '')
{
require_once 'subclasses/system_settings.php';
$obj_settings = new system_settings();
if ($mode == 'RECREATE') {
$dbh = new data_abstraction();
$mysqli = $dbh->connect_db()->mysqli;
$clean_username = $mysqli->real_escape_string($username);
$dbh->set_table('user');
$dbh->set_fields('`salt`,`iteration`,`method`');
$dbh->set_where("`username`='{$clean_username}'");
$dbh->exec_fetch('single');
if ($dbh->num_rows == 1) {
extract($dbh->dump);
} else {
//No result found. We should produce fake data, so that the hashing process still takes place,
//mitigating probing / timing attacks
$salt = generate_token();
$method = cobalt_password_set_method();
if ($method == 'blowfish') {
$iteration = AUTH_BLOWFISH_COST_FACTOR;
} else {
$min = constant('AUTH_' . strtoupper($method) . '_MIN_ROUNDS');
$max = constant('AUTH_' . strtoupper($method) . '_MAX_ROUNDS');
if ($max < $min) {
$max = $min;
}
$iteration = mt_rand($min, $max);
echo $iteration . ' ' . $method . ' ' . $salt;
}
}
$dbh->close_db();
} elseif ($mode == 'NEW') {
$salt = generate_token();
$method = cobalt_password_set_method();
if ($method == 'blowfish') {
$iteration = AUTH_BLOWFISH_COST_FACTOR;
} else {
$min = constant('AUTH_' . strtoupper($method) . '_MIN_ROUNDS');
$max = constant('AUTH_' . strtoupper($method) . '_MAX_ROUNDS');
if ($max < $min) {
$max = $min;
}
$iteration = mt_rand($min, $max);
}
} else {
error_handler("Cobalt encountered an error during password processing.", "Cobalt Password Hash Error: Invalid mode specified.");
}
if ($method == 'blowfish') {
$digest = cobalt_password_hash_bcrypt($password, $salt, $iteration);
} elseif (in_array($method, cobalt_password_methods())) {
$digest = cobalt_password_hash_process($password, $salt, $iteration, $method);
} else {
error_handler("Cobalt encountered an error during password processing.", "Cobalt Password Hash Error: Invalid hash method specified.");
}
return $digest;
}
开发者ID:seans888,项目名称:APC-CPO,代码行数:57,代码来源:password_crypto.php
示例4: output
public function output()
{
$this->smarty->display("header.tpl");
$content = $this->smarty->fetch($this->template . ".tpl");
$content = preg_replace('/(<form\\W[^>]*\\bmethod=(\'|"|)POST(\'|"|)\\b[^>]*>)/i', '$1' . "\n" . generate_token(), $content);
if ($this->exitmsg) {
$content = $this->exitmsg;
}
echo $content;
$this->smarty->display("footer.tpl");
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:11,代码来源:class.mobile.php
示例5: start_token_session
function start_token_session($userid)
{
global $mysqli;
invalidate_users_token($userid);
$token = generate_token();
$_SESSION["ip"] = $_SERVER["REMOTE_ADDR"];
$_SESSION["client"] = $_SERVER["HTTP_USER_AGENT"];
$_SESSION["token"] = $token;
$_SESSION["userid"] = $userid;
$mysqli->query("INSERT INTO `Sessions` (`Token`, `User-ID`, `IP`) VALUES ('{$token}', {$userid}, '" . $_SERVER['REMOTE_ADDR'] . "')");
}
开发者ID:mcenderdragon,项目名称:Icon-Craft,代码行数:11,代码来源:session.php
示例6: send_token
function send_token()
{
$email = validate_email(@$_POST['email']);
if (email_overlap($email)) {
echo "email overlap";
die;
}
$mail = new PHPMailer();
//实例化
$mail->IsSMTP();
// 启用SMTP
$mail->Host = $GLOBALS['smtp_server'];
//SMTP服务器 以163邮箱为例子
$mail->Port = $GLOBALS['smtp_server_port'];
//邮件发送端口
$mail->SMTPAuth = true;
//启用SMTP认证
$mail->CharSet = "UTF-8";
//字符集
$mail->Encoding = "base64";
//编码方式
$mail->Username = $GLOBALS['smtp_user_mail'];
//你的邮箱
$mail->Password = $GLOBALS['smtp_user_pass'];
//你的密码
$mail->Subject = "NutLab SS Token";
//邮件标题
$mail->From = $GLOBALS['smtp_user_mail'];
//发件人地址(也就是你的邮箱)
$mail->FromName = "NutLab";
//发件人姓名
$address = $email;
//收件人email
$mail->AddAddress($address, "Dear");
//添加收件人(地址,昵称)
$mail->IsHTML(true);
//支持html格式内容
$token = generate_token();
$mail->Body = "感谢您在我站注册了新帐号。<br/><br/>你的验证码为" . $token;
//邮件主体内容
if (!$mail->Send()) {
echo "token sending fail:" . $mail->ErrorInfo;
echo "token sending fail";
} else {
echo "token sending success";
}
$count = count($GLOBALS['DB']->query("SELECT * FROM user WHERE email=? ", array($email)));
if ($count > 0) {
$result = $GLOBALS['DB']->query("UPDATE user SET token=? WHERE email=?", array($token, $email));
} else {
$result = $GLOBALS['DB']->query("INSERT INTO user (email,pass,passwd,u,d,transfer_enable,port,enable,activated,token) VALUES (?,'','','0','0','0',?,'0','0',?)", array($email, generate_port(), $token));
}
}
开发者ID:JNKKKK,项目名称:SS-Manager,代码行数:53,代码来源:signup.php
示例7: add
public static function add($first_name, $last_name, $phone, $email, $password, $zipcode, $referral_code = '', $device_token = '', $device_type = 'web', $membership_type = 'Member')
{
$user = new User();
$user_credit = new UserCredit();
$user->first_name = $first_name;
$user->last_name = $last_name;
$user->phone = $phone;
$user->email = $email;
$user->referred_by = 0;
$user->token = generate_token();
$user->token_expiry = generate_expiry() / 10;
$user->social_id = 0;
if ($device_type != 'web') {
$user->device_token = $device_token;
} else {
$user->device_token = '';
}
$user->device_type = $device_type;
$user->image_url = '';
$user->total_referrals = 0;
$user->remember_token = '';
$user_credit->earned = 0;
$user_credit->spent = 0;
if ($referral_code != '') {
$referrer = User::where('referral_code', $referral_code)->first();
if ($referrer) {
$user->referred_by = $referrer->id;
$user_credit->earned = 10;
// add credits to referrer
$referrer_credit = UserCredit::where('user_id', $referrer->id)->first();
$referrer_credit->earned += 5;
$referrer_credit->spent = 0;
$referrer_credit->save();
$temp_user = User::find($referrer->id);
$temp_user->total_referrals += 1;
$temp_user->save();
}
}
$user->password = Hash::make($password);
$user->membership_type = $membership_type;
$user->zipcode = $zipcode;
$user->referral_code = generate_referral_code($first_name, $last_name);
if ($membership_type == 'Member') {
$user->membership_ends_on = "2100-01-01";
} else {
$user->membership_ends_on = date('Y-m-d', strtotime('+1 years'));
}
$user->save();
$user_credit->user_id = $user->id;
$user_credit->save();
return $user;
}
开发者ID:sohelrana820,项目名称:mario-gomez,代码行数:52,代码来源:User.php
示例8: make_token
function make_token()
{
// Temporary: purge tokens more often
// Tokens are cleared on GW communication,
// but there is no gateway right now
clear_old_tokens();
$db = Flight::db();
$token = generate_token();
$stmt = $db->prepare('INSERT INTO tokens (token) VALUES (:token)');
$stmt->bindParam(':token', $token);
$stmt->execute();
return $token;
}
开发者ID:monat78,项目名称:fbwlan,代码行数:13,代码来源:tokens.php
示例9: replace_forms
function replace_forms($form_data_html)
{
$count = preg_match_all("/<form(.*?)>(.*?)<\\/form>/is", $form_data_html, $matches, PREG_SET_ORDER);
if (is_array($matches)) {
foreach ($matches as $m) {
if (strpos($m[1], "nocsrf") !== false) {
continue;
}
$name = "CSRFGuard_" . mt_rand(0, mt_getrandmax());
$token = generate_token($name);
$form_data_html = str_replace($m[0], "<form{$m[1]}>\n<input type='hidden' name='CSRFName' value='{$name}' />\n<input type='hidden' name='CSRFToken' value='{$token}' />{$m[2]}</form>", $form_data_html);
}
}
return $form_data_html;
}
开发者ID:vyppn,项目名称:stirlingframe,代码行数:15,代码来源:csrf.php
示例10: generate_token
function generate_token($username, $deep = 0)
{
global $db;
$deep++;
if ($deep > 3) {
return false;
}
$token_string = generate_string(64);
// 检测有效性
$token = $db->get('token', array('token', 'username', 'expired_time'), array('AND' => array('token' => $token_string, 'expired_time[>]' => time())));
if ($token) {
return generate_token($username, $deep);
} else {
$result = $db->insert('token', array('token' => $token_string, 'username' => $username, 'expired_time' => time() + 3600 * 2));
$active = $db->insert('active', array('content' => "登录创建 token:{$token_string} 经过 {$deep} 次", 'username' => $username, 'time' => date('Y-m-d H:i:s', time())));
return $token_string;
}
}
开发者ID:ss098,项目名称:Fire,代码行数:18,代码来源:member.php
示例11: widget_my_notes
function widget_my_notes($vars)
{
$title = "My Notes";
$mynotes = get_query_val("tbladmins", "notes", array("id" => $vars['adminid']));
$content = '
<script>
function widgetnotessave() {
$.post("index.php", { action: "savenotes", notes: $("#widgetnotesbox").val(), token: "' . generate_token('plain') . '" });
$("#widgetnotesconfirm").slideDown().delay(2000).slideUp();
}
</script>
<div align="center">
<div id="widgetnotesconfirm" style="display:none;margin:0 0 5px 0;padding:5px 20px;background-color:#DBF3BA;font-weight:bold;color:#6A942C;">Notes Saved Successfully!</div>
<textarea id="widgetnotesbox" style="width:95%;height:100px;">' . $mynotes . '</textarea>
<input type="button" value="Save Notes" onclick="widgetnotessave()" />
</div>
';
return array('title' => $title, 'content' => $content);
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:19,代码来源:my_notes.php
示例12: openform
function openform($form_name, $form_id, $method, $action, $array = false)
{
global $defender;
if (!is_array($array)) {
$class = '';
$enctype = '';
$downtime = 10;
$notice = 1;
} else {
$class = array_key_exists('class', $array) && $array['class'] ? $array['class'] : '';
$enctype = array_key_exists('enctype', $array) && $array['enctype'] == 1 ? 1 : 0;
$downtime = array_key_exists('downtime', $array) && isnum($array['downtime']) ? $array['downtime'] : 10;
$notice = array_key_exists('notice', $array) && isnum($array['notice']) ? $array['notice'] : 1;
}
$html = "<form name='" . $form_name . "' id='" . $form_id . "' method='" . $method . "' action='" . $action . "' class='" . (defined('FUSION_NULL') ? 'warning' : '') . " {$class}' " . ($enctype ? "enctype='multipart/form-data'" : '') . " >\n";
$html .= generate_token($form_name, $downtime);
if (defined('FUSION_NULL') && $notice) {
echo $defender->showNotice();
}
return $html;
}
开发者ID:WuChEn,项目名称:PHP-Fusion,代码行数:21,代码来源:form_main.php
示例13: __construct
/**
* Constructor.
*
* @param array $vars "vars" array from WHCMS.
*/
public function __construct($vars = array())
{
global $templates_compiledir, $customadminpath, $module, $_LANG, $CONFIG;
// Create smarty
$this->view = new \Smarty();
$this->view->template_dir = ROOTDIR . '/modules/addons/' . $module . '/templates/';
$this->view->compile_dir = $templates_compiledir;
// Assing WHMCS system params
$this->view->assign('_LANG', $_LANG);
$this->view->assign('_CONFIG', $CONFIG);
$this->view->assign('csrfToken', generate_token('plain'));
// Assing our module params
$this->vars = $vars;
$this->view->assign('vars', $this->vars);
$this->view->assign('customadminpath', $customadminpath);
$this->modulelink = '/' . $customadminpath . '/addonmodules.php?module=' . $module;
$this->view->assign('modulelink', $this->modulelink);
if (isset($_REQUEST['action'])) {
$this->action = $_REQUEST['action'];
}
$this->view->assign('action', $this->action);
}
开发者ID:akerbel,项目名称:whmcs-easy-addons,代码行数:27,代码来源:PageController.php
示例14: widget_my_notes
function widget_my_notes($vars)
{
global $_ADMINLANG;
$title = "My Notes";
$mynotes = get_query_val("tbladmins", "notes", array("id" => $vars['adminid']));
$content = '
<script>
function widgetnotessave() {
$.post("index.php", { action: "savenotes", notes: $("#widgetnotesbox").val(), token: "' . generate_token('plain') . '" });
$("#widgetnotesconfirm").slideDown().delay(2000).slideUp();
}
</script>
<div id="widgetnotesconfirm" style="display:none;margin:0 0 5px 0;padding:5px 20px;background-color:#DBF3BA;font-weight:bold;color:#6A942C;">Notes Saved Successfully!</div>
<form>
<textarea id="widgetnotesbox" style="height:100px;" class="form-control">' . $mynotes . '</textarea>
<div class="widget-footer">
<input type="reset" value="' . $_ADMINLANG['global']['cancel'] . '" class="btn btn-default btn-sm" /> <input type="button" value="Save Notes" onclick="widgetnotessave()" class="btn btn-info btn-sm" />
</div>
</form>
';
return array('title' => $title, 'content' => $content);
}
开发者ID:MarcelaGotta,项目名称:Webty,代码行数:22,代码来源:my_notes.php
示例15: create_session
function create_session($expire_secs = NULL, $login_id = NULL, $network_address = NULL)
{
global $dbconn;
global $auth_settings;
// Check parameters
// $network_address is mandatory, fail immediately if not set
if (is_null($network_address)) {
$network_address = $_SERVER['REMOTE_ADDR'];
}
if (strlen($network_address) < 4) {
return FALSE;
}
// Login ID is mandatory
if (is_numeric($login_id) === FALSE || $login_id < 0 || $login_id == NULL) {
return FALSE;
}
if (is_null($expire_secs) || $expire_secs < $auth_settings['session_expire_default']) {
$expire_secs = $auth_settings['session_expire_default'];
}
$session_key = generate_token();
$csrf_token = generate_token();
$create_time = time();
$expire_time = $create_time + $expire_secs;
// Add or update the session in the database
$sql = "INSERT INTO sessions (\n\t\t\tlogin_id,\n\t\t\tsession_key, csrf_token, network_address,\n\t\t\tcreate_time, expire_time\n\t\t) VALUES (\n\t\t\t:li, :sk, :csrf, :na,\n\t\t\t:ct, :et\n\t\t)\n\t\tON DUPLICATE KEY UPDATE\n\t\tlogin_id = :li,\n\t\tsession_key = :sk,\n\t\tcsrf_token = :csrf,\n\t\tnetwork_address = :na,\n\t\tcreate_time = :ct,\n\t\texpire_time = :et";
$stmt = $dbconn->prepare($sql);
$stmt->bindParam(':li', $login_id, PDO::PARAM_INT);
$stmt->bindParam(':sk', $session_key, PDO::PARAM_STR);
$stmt->bindParam(':csrf', $csrf_token, PDO::PARAM_STR);
$stmt->bindParam(':na', $network_address, PDO::PARAM_STR);
$stmt->bindParam(':ct', $create_time, PDO::PARAM_INT);
$stmt->bindParam(':et', $expire_time, PDO::PARAM_INT);
// Catch any failure to create a session
if ($stmt->execute() == FALSE) {
return FALSE;
}
set_auth_cookie($session_key, $expire_time, $domain);
return TRUE;
}
开发者ID:jbruchon,项目名称:php_secure_auth,代码行数:39,代码来源:lib_auth.php
示例16: register
function register($email, $password, $passwordRe, $connection)
{
//test if user exists
include_once 'functions.php';
$errors = check_validity($email, $password, $passwordRe, $connection);
if (count($errors) > 0) {
return $errors;
}
$k = 0;
if ($stmt = mysqli_prepare($connection, "SELECT id FROM users WHERE email=?")) {
$stmt->bind_param("s", $email);
$stmt->execute();
$stmt->bind_result($col1);
while ($stmt->fetch()) {
$k++;
}
$stmt->close();
if ($k == 0) {
include_once "functions.php";
$generatedToken = generate_token();
$sql = 'INSERT INTO users(email,password,date_registration,generated_token) VALUES(?,SHA(?),NOW(),?)';
$stmt = mysqli_prepare($connection, $sql);
$stmt->bind_param("sss", $email, $password, $generatedToken);
$stmt->execute();
if (mysqli_affected_rows($connection) == 0) {
$errors[] = 'Unfortunately registration failed!';
return $errors;
}
$stmt->close();
} else {
$errors[] = "E-mail already registered!";
return $errors;
}
}
return $errors;
}
开发者ID:robertdumitrescu,项目名称:LoopyThis-Youtube-on-repeat,代码行数:36,代码来源:database.php
示例17: getTicketAttachmentsInfo
function getTicketAttachmentsInfo($ticketid, $replyid, $attachment)
{
$attachments = array();
if ($attachment) {
$attachment = explode("|", $attachment);
foreach ($attachment as $num => $file) {
$file = substr($file, 7);
if ($replyid) {
$attachments[] = array("filename" => $file, "dllink" => "dl.php?type=ar&id=" . $replyid . "&i=" . $num, "deletelink" => "" . $PHP_SELF . "?action=viewticket&id=" . $ticketid . "&removeattachment=true&type=r&idsd=" . $replyid . "&filecount=" . $num . generate_token("link"));
continue;
}
$attachments[] = array("filename" => $file, "dllink" => "dl.php?type=a&id=" . $ticketid . "&i=" . $num, "deletelink" => "" . $PHP_SELF . "?action=viewticket&id=" . $ticketid . "&removeattachment=true&idsd=" . $ticketid . "&filecount=" . $num . generate_token("link"));
}
}
return $attachments;
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:16,代码来源:ticketfunctions.php
示例18: foreach
foreach ($fraudresults as $key => $value) {
++$i;
echo "<td class=\"fieldlabel\" width=\"30%\">" . $key . "</td><td class=\"fieldarea\"";
if ($key == "Explanation") {
echo " colspan=\"3\"";
$i = 2;
} else {
echo " width=\"20%\"";
}
echo ">" . $value . "</td>";
if ($i == "2") {
echo "</tr><tr>";
$i = 0;
continue;
}
}
echo "</tr></table></div>";
$jquerycode .= "\$(\"#rerunfraud\").click(function () {\n \$(\"#rerunfraud\").html(\"<img src=\\\"../images/spinner.gif\\\" align=\\\"absmiddle\\\" /> Performing Check...\");\n \$.post(\"orders.php\", { action: \"view\", rerunfraudcheck: \"true\", orderid: " . $id . ", token: \"" . generate_token("plain") . "\" },\n function(data){\n \$(\"#fraudresults\").html(data);\n \$(\"#rerunfraud\").html(\"Update Completed\");\n });\n return false;\n});";
}
}
echo "\n</form>\n\n";
echo $aInt->jqueryDialog("affassign", $aInt->lang("orders", "affassign"), $aInt->lang("global", "loading"), array($aInt->lang("global", "savechanges") => "\$('#affiliatefield').html(\$('#affid option:selected').text());\$(this).dialog('close');\$.post('orders.php', { action: 'affassign', orderid: " . $id . ", affid: \$('#affid').val(), token: '" . generate_token("plain") . "' });", $aInt->lang("global", "cancelchanges") => ""));
$jquerycode .= "\$(\"#showaffassign\").click(\n function() {\n \$(\"#affassign\").dialog(\"open\");\n \$(\"#affassign\").load(\"orders.php?action=affassign\");\n return false;\n }\n);\n\$(\"#togglenotesbtn\").click(function() {\n\t\$(\"#notesholder\").slideToggle(\"slow\", function() {\n\t\ttoggletext = \$(\"#togglenotesbtn\").attr(\"value\");\n\t\tif(toggletext == \"Add Notes\") { \$(\"#togglenotesbtn\").fadeOut(\"fast\",function(){ \$(\"#togglenotesbtn\").attr(\"value\",\"Hide Notes\"); \$(\"#togglenotesbtn\").fadeIn(); }); }\n\t\tif(toggletext == \"Hide Notes\") { \$(\"#togglenotesbtn\").fadeOut(\"fast\",function(){ \$(\"#togglenotesbtn\").attr(\"value\",\"Add Notes\"); \$(\"#togglenotesbtn\").fadeIn(); }); }\n\t\t\$(\"#shownotesbtnholder\").slideToggle();\n\t});\n\treturn false;\n});\n\$(\"#savenotesbtn\").click(function() {\n\t\$.post(\"" . $PHP_SELF . "?action=view&id=" . $id . "\", { updatenotes: true, notes: \$('#notes').val(), token: \"" . generate_token("plain") . "\" });\n\t\$(\"#savenotesbtn\").attr(\"value\",\"Saved\");\n\treturn false;\n});\n\$(\"#notes\").keyup(function() {\n\t\$(\"#savenotesbtn\").attr(\"value\",\"Save Notes\");\n});";
$aInt->jquerycode = $jquerycode;
$aInt->jscode = $jscode;
}
}
$content = ob_get_contents();
ob_end_clean();
$aInt->content = $content;
$aInt->display();
开发者ID:billyprice1,项目名称:whmcs,代码行数:31,代码来源:orders.php
示例19: basename
}
</script>
<title> <?php
echo GLOBAL_PROJECT_NAME;
?>
- Powered by Cobalt</title>
<link href="css/login.css" rel="stylesheet" type="text/css">
<meta http-equiv="content-type" content="text/html; charset=<?php
echo MULTI_BYTE_ENCODING;
?>
" />
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="document.getElementById('username').focus();">
<?php
echo '<form method="POST" action="' . basename($_SERVER['SCRIPT_NAME']) . '">';
$form_key = generate_token();
$form_identifier = $_SERVER['SCRIPT_NAME'];
$_SESSION['cobalt_form_keys'][$form_identifier] = $form_key;
echo '<input type="hidden" name="form_key" value="' . $form_key . '">';
?>
<div class="left_container">
<div class="title">
<?php
//echo GLOBAL_PROJECT_NAME;
echo 'Asia Pacific College </br>';
echo 'Internship Office </br>';
echo 'Communication Site';
?>
</div>
开发者ID:seans888,项目名称:APC-CPO,代码行数:30,代码来源:login.php
示例20: userSave
public function userSave()
{
$first_name = Input::get('first_name');
$last_name = Input::get('last_name');
$email = Input::get('email');
$phone = Input::get('phone');
$password = Input::get('password');
$referral_code = Input::get('referral_code');
if (Owner::where('email', $email)->count() == 0) {
$owner = new Owner();
$owner->first_name = $first_name;
$owner->last_name = $last_name;
$owner->email = $email;
$owner->phone = $phone;
if ($password != "") {
$owner->password = Hash::make($password);
}
$owner->token = generate_token();
$owner->token_expiry = generate_expiry();
if ($referral_code != "") {
if ($ledger = Ledger::where('referral_code', $referral_code)->first()) {
$referred_by = $ledger->owner_id;
$settings = Settings::where('key', 'default_referral_bonus')->first();
$referral_bonus = $settings->value;
$ledger = Ledger::find($ledger->id);
$ledger->total_referrals = $ledger->total_referrals + 1;
$ledger->amount_earned = $ledger->amount_earned + $referral_bonus;
$ledger->save();
$owner->referred_by = $ledger->owner_id;
$response_array = array('success' => true);
$response_code = 200;
}
}
$owner->save();
// send email
$settings = Settings::where('key', 'email_owner_new_registration')->first();
$pattern = $settings->value;
$pattern = str_replace('%name%', $owner->first_name, $pattern);
$subject = "Welcome On Board";
email_notification($owner->id, 'owner', $pattern, $subject);
return Redirect::to('user/signin')->with('success', 'Ypu have successfully registered. <br>Please Login');
} else {
return Redirect::to('user/signup')->with('error', 'This email ID is already registered.');
}
}
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:45,代码来源:WebUserController.php
注:本文中的generate_token函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论