function actionModify() { $type = $this->_context->type; $name = $this->_context->get('name'); $page = (int) $this->_context->get('page', 1); if ($deleteid = $this->_context->deleteid) { if ($type == 'check') { Radcheck::meta()->deleteWhere('id = ?', $deleteid); } else { Radreply::meta()->deleteWhere('id = ?', $deleteid); } return $this->msg($tip = '删除成功', url('manage::radius/index')); } if ($this->_context->isPost()) { $post = $this->_context->post(); $orm = $type == 'check' ? Radcheck::find() : Radreply::find(); if (isset($post['id'])) { $orm->where('id = ?', (int) $post['id']); $orm = $orm->getOne(); unset($post['type'], $post['id']); $orm->changeProps($post); $orm->save(); return $this->msg($tip = '修改成功', url('manage::radius/modify', array('type' => $type, 'name' => $post['username']))); } else { $orm->where('id = ?', 0); $orm = $orm->getOne(); unset($post['type']); $orm->changeProps($post); $orm->save(); return $this->msg($tip = '添加成功', url('manage::radius/modify', array('type' => $type, 'name' => $post['username']))); } } $rs = $type == 'check' ? Radcheck::find() : Radreply::find(); $rs->where('username = ?', $name); $rs->limitPage($page, 20); $this->_view['rs'] = $rs->getAll(); $this->_view['pg'] = $rs->getPag(); $this->_view['tg'] = $type == 'check' ? 'Radius Check' : 'Radius Reply'; $this->_view['type'] = $type == 'check' ? 'check' : 'reply'; $this->_view['_UDI'] = 'manage::radius/index'; }
$error = "请输入有效的用户名"; } else { if (Radcheck::exists(array('username' => $username))) { $error = "该用户名已经存在"; } else { $password = make_random_key(); $rc = Radcheck::create(array('username' => $username, 'value' => $password, 'attribute' => 'Cleartext-Password', 'op' => ':=')); UserRadacct::create(array('uid' => $uid, 'radacctid' => $rc->id)); } } } else { if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'delete') { $id = $_REQUEST['id']; $ura = UserRadacct::find_by_pk($id, array()); if ($ura) { Radcheck::delete_all(array('conditions' => array('id' => $ura->radacctid))); $ura->delete(); } header('Location: accounts.php'); } } $radcheck = UserRadacct::find_by_uid($uid); ?> <!DOCTYPE html> <html> <head> <title>我的账号</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="../css/bootstrap.min.css" rel="stylesheet" media="screen">
<?php require '../include/init.inc'; require '../include/util.inc'; $uid = auth('uid'); $error = ""; if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else { if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'delete') { } } $radcheck = Radcheck::all(); ?> <!DOCTYPE html> <html> <head> <title>我的账号</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="../css/bootstrap.min.css" rel="stylesheet" media="screen"> <body> <?php include 'top_nav.inc'; ?> <div class="container" style="margin-top: 50px;"> <h4>欢迎您 <?php echo auth('nickname'); ?> </h4> <div class="row">
} if (!validate_nickname($nickname)) { alert(s("请输入有效的昵称", 'Please input valid nick name'), 'error'); } else { if (User::check_nickname($nickname)) { alert(s("该昵称已被占用", 'This nick name is aleady taken'), 'error'); } } if (!validate_password($password)) { alert(s("请输入有效的密码", 'Please input valid password'), 'error'); } if (count($alerts) <= 0) { $hashed_password = md5($password . $config['salt']); $verify_hash = make_random_key(); $user = User::create(array('email' => $email, 'nickname' => $nickname, 'password' => $hashed_password, 'verify_hash' => $verify_hash, 'is_locked' => 1)); Radcheck::create(array('username' => $email, 'value' => $password, 'attribute' => 'Cleartext-Password', 'op' => '')); // send active mail $r = Mailer::send_account_active($user->id); if ($r) { $_SESSION['email'] = $user->email; header('Location: /register_next.php'); } else { alert(s("注册失败,请稍后重试", 'Register failed, please try again later'), 'error'); } } } ?> <!DOCTYPE html> <html> <head> <title><?php
function actionNotify() { $root_dir = Q::ini('app_config/ROOT_DIR'); require_once $root_dir . Q::ini('appini/alipay_dir') . "lib/alipay_notify.class.php"; //计算得出通知验证结果 $alipayNotify = new AlipayNotify(Q::ini('appini/payment/alipay')); $verify_result = $alipayNotify->verifyNotify(); if ($verify_result) { //验证成功 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 $out_trade_no = $_POST['out_trade_no']; //获取订单号 $trade_no = $_POST['trade_no']; //获取支付宝交易号 $total = $_POST['price']; //获取总价格 $rs = Invoice::find('order_number = ? AND trade_status != ?', $_POST['out_trade_no'], 'TRADE_FINISHED')->getOne(); if ($rs->id()) { if (!empty($total)) { $rs->total_fee = $total; } $rs->trade_no = $trade_no; $rs->trade_time = time(); $rs->trade_status = $_POST['trade_status']; $rs->buyer_email = isset($_POST['buyer_email']) ? $_POST['buyer_email'] : '0'; $rs->due_time = $rs->per_day * 24 * 3600 + $rs->trade_time; $rs->save(); $order = Order::find('order_id = ?', $rs->order_id)->getOne(); $order->status = 'pending'; $order->save(); } $buyer_email = $order->account->user_mail; if (Q::ini('appini/email_notify')) { Mail_Api::send('[' . Q::ini('appini/meta/title') . ']' . $order->name . '的账单状态[' . strip_tags($rs->status(false)) . ']', '当前状态:' . $rs->status(false) . ' 详情请登陆系统查看:' . Q::ini('appini/meta/url') . '/service/invoice', $buyer_email, '客户'); } if ($_POST['trade_status'] == 'WAIT_BUYER_PAY') { //该判断表示买家已在支付宝交易管理中产生了交易记录,但没有付款 //判断该笔订单是否在商户网站中已经做过处理(可参考“集成教程”中“3.4返回数据处理”) //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 echo "success"; //请不要修改或删除 //调试用,写文本函数记录程序运行情况是否正常 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录"); } else { if ($_POST['trade_status'] == 'WAIT_SELLER_SEND_GOODS') { //该判断表示买家已在支付宝交易管理中产生了交易记录且付款成功,但卖家没有发货 //判断该笔订单是否在商户网站中已经做过处理(可参考“集成教程”中“3.4返回数据处理”) //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 echo "success"; //请不要修改或删除 //调试用,写文本函数记录程序运行情况是否正常 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录"); } else { if ($_POST['trade_status'] == 'WAIT_BUYER_CONFIRM_GOODS') { //该判断表示卖家已经发了货,但买家还没有做确认收货的操作 //判断该笔订单是否在商户网站中已经做过处理(可参考“集成教程”中“3.4返回数据处理”) //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 echo "success"; //请不要修改或删除 //调试用,写文本函数记录程序运行情况是否正常 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录"); } else { if ($_POST['trade_status'] == 'TRADE_FINISHED') { //该判断表示买家已经确认收货,这笔交易完成 //判断该笔订单是否在商户网站中已经做过处理(可参考“集成教程”中“3.4返回数据处理”) //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 if ($rs->id()) { $order = Order::find('order_id = ?', $rs->order_id)->getOne(); $username = $order->username; $password = $order->password; $groupname = $order->groupname; if ($order->user_id != '10') { $radUser = Radcheck::find('username =?', $username)->getOne(); $radUser->username = $username; $radUser->attribute = 'Cleartext-Password'; $radUser->op = ':='; $radUser->value = $password; $radUser->save(); /* $test = QDB::getConn()->getOne("SELECT `groupname` FROM `radusergroup` WHERE `username` = '{$username}'"); if(!$test) { $radGroup_SQL = "INSERT INTO `radusergroup` (`username`, `groupname`, `priority`) VALUES ('{$username}', '{$groupname}', '1')"; }else { $radGroup_SQL = "UPDATE `radusergroup` SET `groupname` = '{$groupname}' WHERE `username` = '{$order->username}'"; } QDB::getConn()->execute($radGroup_SQL); */ $radGroup = Radusergroup::find('username =?', $order->username)->getOne(); $radGroup->username = $order->username; $radGroup->groupname = $order->groupname; $radGroup->priority = '1'; $radGroup->save(); } $order->status = 'approve'; $order->save(); /* if(Q::ini('appini/email_order_recv')) { Mail_Api::send('[收款通知]您收到来自'.$buyer_email.'的付款',Q::ini('appini/email_order_recv'),'站长'); } */ } echo "success"; //请不要修改或删除 //调试用,写文本函数记录程序运行情况是否正常 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录"); } else { //其他状态判断 echo "success"; //调试用,写文本函数记录程序运行情况是否正常 //logResult ("这里写入想要调试的代码变量值,或其他运行的结果记录"); } } } } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } else { //验证失败 echo "fail"; //调试用,写文本函数记录程序运行情况是否正常 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录"); } }
<?php require '../include/init.inc'; $hash = $_REQUEST['hash']; $email = $_REQUEST['vemail']; $verify_ok = false; $user = User::first(array('email' => $email)); if ($user && $user->verify_hash == $hash) { $verify_ok = true; $user->is_locked = 0; $user->start_at = date('Y-m-d H:i:s'); $user->expire_at = date('Y-m-d H:i:s', strtotime('+ 1 days')); $user->save(); $rc = Radcheck::first(array('username' => $email)); if ($rc) { $rc->op = ':='; $rc->save(); } $_SESSION['user'] = $user->profile(); } ?> <!DOCTYPE html> <html> <head> <title><?php t('激活账号', 'Active account'); ?> </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="../css/bootstrap.min.css" rel="stylesheet" media="screen">