PHP User::find_by_pk Examples

PHP User::find_by_pk - 3 examples found. These are the top rated real world PHP examples of User::find_by_pk extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
    public static function send_account_active($uid)
    {
        $user = User::find_by_pk($uid, array());
        $email = $user->email;
        $hash = $user->verify_hash;
        $mail = new PHPMailer();
        $mail->IsSMTP();
        // Set mailer to use SMTP
        $mail->Host = 'smtp.exmail.qq.com';
        // Specify main and backup server
        $mail->SMTPAuth = true;
        // Enable SMTP authentication
        $mail->Username = 'service@cnode.cc';
        // SMTP username
        $mail->Password = 'ww445178';
        // SMTP password
        //$mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted
        $mail->From = 'service@cnode.cc';
        $mail->FromName = 'CNODE';
        $mail->AddAddress($user->email, $user->nickname);
        // Add a recipient
        $mail->CharSet = "UTF-8";
        $mail->WordWrap = 50;
        // Set word wrap to 50 characters
        $mail->IsHTML(true);
        // Set email format to HTML
        $mail->Subject = '用户注册验证邮件';
        $mail->Body = <<<EOT
<div id="mailContentContainer" style="height:auto;min-height:100px;_height:100px;font-size:14px;padding:0;font-family: 'lucida Grande',Verdana;">
\t<div style="background:#0061ba;width:820px;margin:0 auto;padding:8px;border:1px solid #0061ba;">
\t</div>
\t<div style="border:1px solid #0061ba;width:820px;margin:0 auto;padding:8px;">
\t    <div style="padding:5px 20px;font-size:14px;">
\t        <p style="padding-bottom:20px;">亲爱的 <strong><a href="mailto:http://{$email}" target="_blank">{$email}</a></strong>:</p>
\t        <p style="background:#f7f7f7; padding:10px 20px;line-height:36px;">欢迎加入 <strong>CNODE</strong>,
\t        请点击下面的链接来验证你的Email帐号<span style="font-size:12px; color:#999;">(链接24小时内访问有效)</span><br>
\t        <a href="http://www.cnode.cc/account/active.php?vemail={$email}&amp;hash={$hash}" target="_blank" style="line-height:18px;">http://www.cnode.cc/account/active.php?vemail={$email}&amp;hash={$hash}</a><br>
\t        <span style="font-size:12px; color:#999;">如果以上链接无法点击,请将它复制到你的浏览器(如IE)地址栏中进入访问。<br>
\t        如果此次激活请求非你本人所发,请忽略本邮件。</span></p> 
\t        <p style="padding-top:30px;">CNODE(<a href="http://www.cnode.cc/" target="_blank">http://www.cnode.cc/</a>) - VPN专业服务商</p>
\t        <p style="border-top:1px solid #ddd;color:#999;font-size:12px;padding-top:10px;">这是一封系统自动发出的邮件,请勿回复。</p>
\t    </div>
\t</div> 
</div>'
EOT;
        //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
        if (!$mail->Send()) {
            file_put_contents('/tmp/mailer.log', "ERROR: send_account_active({$uid}) " . $mail->ErrorInfo);
            return false;
        }
        return true;
    }
Example #2
0
            //判断该笔订单是否在商户网站中已经做过处理
            //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
            //如果有做过处理,不执行商户的业务程序
        } else {
            echo "trade_status=" . $_GET['trade_status'];
        }
    }
    echo "支付成功<br />";
    //echo "trade_no=".$trade_no;
    $invoice = Invoice::find_by_pk($out_trade_no, array());
    if ($invoice) {
        $invoice->callback_at = date('Y-m-d H:i:s');
        $invoice->trade_status = $trade_status;
        $invoice->trade_no = $trade_no;
        if ($invoice->pay_status != Invoice::PAY_STATUS_DONE) {
            $user = User::find_by_pk($invoice->uid, array());
            $user->balance += $_GET['total_fee'];
            $user->save();
            $invoice->pay_status = Invoice::PAY_STATUS_DONE;
            $invoice->total_fee = $_GET['total_fee'];
        }
        $invoice->save();
    }
    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
    echo <<<EOT
\t<script type="text/javascript">
\twindow.setTimeout(function() {
\t\tlocation.href="/account/index.php";
\t}, 2000);
\t</script>\t
EOT;
Example #3
0
<?php

require '../include/init.inc';
$uid = auth('uid');
$plans = array(0, array('days' => 30, 'price' => 15), array('days' => 90, 'price' => 40), array('days' => 180, 'price' => 75), array('days' => 365, 'price' => 120));
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $planid = $_POST['planid'];
    if ($planid < 1 || $planid > 4) {
        $planid = 1;
    }
    $plan = $plans[$planid];
    $user = User::find_by_pk($uid, array());
    if ($plan['price'] > $user->balance) {
        $recharge = $plan['price'] - $user->balance;
        $msg = s("你的账号余额不足,请充值后再购买。当前余额: {$user->balance} 元, 还需充值 {$recharge} 元 <a href='recharge.php?v={$recharge}'>立即充值</a>", "Insufficient balance,please recharge your account, then buy。Balance: {$user->balance} RMB, need rechage {$recharge} RMB <a href='recharge.php?v={$recharge}'>Recharge Now</a>");
        alert($msg, 'error');
    } else {
        $user->start_at = date('Y-m-d H:i:s');
        if ($user->expire_in < 0) {
            $user->expire_at = date('Y-m-d H:i:s', strtotime('+ ' . $plan['days'] . ' days'));
        } else {
            $user->expire_at = $user->expire_at->add(new DateInterval('P' . $plan['days'] . 'D'));
        }
        $user->balance -= $plan['price'];
        $user->save();
        // 购买成功
        $msg = s("购买成功。<a href='index.php'>查看我的账号</a>", "Buy success. <a href='index.php'>Check my account</a>");
        alert($msg, 'success');
    }
}
?>