当前位置: 首页>>代码示例>>PHP>>正文


PHP ModelBase::mysqlTimestamp方法代码示例

本文整理汇总了PHP中ModelBase::mysqlTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP ModelBase::mysqlTimestamp方法的具体用法?PHP ModelBase::mysqlTimestamp怎么用?PHP ModelBase::mysqlTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelBase的用法示例。


在下文中一共展示了ModelBase::mysqlTimestamp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: t

<?php

include_once $home_dir . 'classes/emails.php';
$page_title = t('Reset Password');
$data['show_form'] = false;
if (isset($path[2]) && isset($_GET['reset_token'])) {
    $user_id = intval($path[2]);
    $reset_token = $_GET['reset_token'];
    $zUser = new User($db, $user_id);
    if ($zUser->is_loaded && $zUser->val('user_reset_password_expires') > ModelBase::mysqlTimestamp(time()) && password_verify($reset_token, $zUser->val('user_reset_password_hash'))) {
        if (isset($_POST['password']) && isset($_POST['password2'])) {
            if ($_POST['password'] == $_POST['password2']) {
                $zUser->data['user_password_hash'] = Authentication::hashPassword($_POST['password']);
                $zUser->data['user_reset_password_hash'] = null;
                $zUser->data['user_reset_password_expires'] = null;
                $zUser->save();
                $messages->add(t('Your password was reset.'), 'success');
            } else {
                $messages->error(t('Passwords don\'t match.'));
            }
        } else {
            $data['show_form'] = true;
            $data['user_id'] = $zUser->val('user_id');
            $data['reset_token'] = $reset_token;
            $messages->add(t('Enter your new password.'));
        }
    } else {
        $messages->error(t('Your link seems to be invalid.'));
    }
} else {
    $messages->error(t('This page should only be accessed from link sent to your e-mail.'));
开发者ID:lotcz,项目名称:zshop,代码行数:31,代码来源:reset.c.php

示例2: t

<?php

include_once $home_dir . 'classes/emails.php';
$page_title = t('Forgotten Password');
if (isset($_POST['email'])) {
    $zUser = new User($db);
    $zUser->loadByLoginOrEmail($_POST['email']);
    if ($zUser->is_loaded) {
        $reset_token = generateToken(50);
        $expires = time() + 60 * 60 * 24 * User::$reset_password_expires_days;
        $zUser->data['user_reset_password_hash'] = Authentication::hashPassword($reset_token);
        $zUser->data['user_reset_password_expires'] = ModelBase::mysqlTimestamp($expires);
        $zUser->save();
        $email_text = t('To reset your password, visit this link: %s/admin/reset-password/%d?reset_token=%s. This link is only valid for %d days.', $base_url, $zUser->val('user_id'), $reset_token, User::$reset_password_expires_days);
        Emails::sendPlain($globals['emails_from'], $zUser->val('user_email'), '', t('Forgotten Password'), $email_text);
        $messages->add(t('An e-mail was sent to your address with reset password instructions.'));
    } else {
        // increase ip address failed attempts here
        // *
        $messages->error(t('This e-mail address or login was not found in our database.'));
    }
}
开发者ID:lotcz,项目名称:zshop,代码行数:22,代码来源:forgot.c.php


注:本文中的ModelBase::mysqlTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。