public function findPasswd($username, $email) { $user_info = daocall('user', 'getUser', array($username)); if (!$user_info) { return '2'; } if ($user_info['email'] == "") { return '3'; } if (md5($user_info['email']) != md5($email)) { return '4'; } $passwd = getRandPasswd(8); $file = '../file/findpasswd.html'; if (file_exists($file)) { $body = file_get_contents($file); } else { $body = "您的新密码为:{{passwd}}<br>"; $body .= "欢迎使用本网产品,<a href='http://www.kanglesoft.com/' target=_blank>http://www.kanglesoft.com/</a>"; } $body = str_replace('{{passwd}}', $passwd, $body); $subject = $username . "密码找回"; $address[] = $user_info['email']; $mail_result = apicall('mail', 'sendMail', array($address, $subject, $body)); if ($mail_result !== false) { daocall('user', 'updatePassword', array($username, $passwd)); return '0'; } return '1'; }
public function send() { $subject = $_REQUEST['mail_subject']; $body = $_REQUEST['mail_body']; daocall('setting', 'add', array('mail_ad_subject', $subject)); daocall('setting', 'add', array('mail_ad_body', $body)); if (!$subject) { die("邮件标题未设置"); } if ($_REQUEST['address']) { $address = explode(',', $_REQUEST['address']); } else { $mails = daocall('user', 'getAllMail', array()); foreach ($mails as $a) { $address[] = trim($a['email'], ','); } } if (count($address) < 0) { die("nothing address need Send"); } if (!apicall('mail', 'sendMail', array($address, $subject, $body))) { die("发送失败"); } die("发送成功"); }
public function set() { daocall('setting', 'add', array('view_dir', $_REQUEST['view_dir'])); daocall('setting', 'add', array('reg_user_price', $_REQUEST['reg_user_price'] * 100)); daocall('setting', 'add', array('reg_off', $_REQUEST['reg_off'])); daocall('setting', 'add', array('findpasswd_off', $_REQUEST['findpasswd_off'])); daocall('setting', 'add', array('try_day', $_REQUEST['try_day'])); if ($_REQUEST['view_dir'] != $this->setting['view_dir']) { $log = array('operate_object' => 'view_dir=' . $_REQUEST['view_dir'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']); apicall('operatelog', 'operatelogAdd', array($log)); } if ($_REQUEST['reg_user_price'] * 100 != $this->setting['reg_user_price']) { $log = array('operate_object' => 'reg_user_price=' . $_REQUEST['reg_user_price'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']); apicall('operatelog', 'operatelogAdd', array($log)); } if ($_REQUEST['reg_off'] != $this->setting['reg_off']) { $log = array('operate_object' => 'reg_off=' . $_REQUEST['reg_off'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']); apicall('operatelog', 'operatelogAdd', array($log)); } if ($_REQUEST['findpasswd_off'] != $this->setting['findpasswd_off']) { $log = array('operate_object' => 'findpasswd_off=' . $_REQUEST['findpasswd_off'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']); apicall('operatelog', 'operatelogAdd', array($log)); } return header('Location: ?c=function&a=setFrom'); }
public function del() { $ret = daocall('admin_user', 'delUser', array($_REQUEST['username'])); if ($ret) { $log = array('admin' => getRole('admin'), 'operate' => $_REQUEST['a'], 'operate_object' => 'username='******'username']); apicall('operatelog', 'operatelogAdd', array($log)); } header("Location: ?c=adminuser&a=listUser"); }
public function delMproductorder() { $result = daocall('mproductorder', 'del', array(intval($_REQUEST['id']))); if (!$result) { $this->_tpl->assign('msg', '删除失败'); return $this->_tpl->fetch('msg.html'); } $log = array('operate_object' => 'id=' . $_REQUEST['id'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['a']); apicall('operatelog', 'operatelogAdd', array($log)); return $this->pageListMproductorder(); }
/** * 用户充值成功,但没有到账,管理员手动给用户确认到账 * Enter description here ... */ public function manPayReturn() { if (apicall('money', 'payReturn', array($_REQUEST['id']))) { $this->_tpl->assign('msg', '充值成功'); $log = array('operate_object' => 'id=' . $_REQUEST['id'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['a']); apicall('operatelog', 'operatelogAdd', array($log)); } else { $this->_tpl->assign('msg', '充值失败'); } return $this->display('msg.html'); }
public function add() { $body = apicall('utils', 'klencode', array($_REQUEST['body'])); $title = apicall('utils', 'klencode', array($_REQUEST['title'])); $add = daocall('question', 'add', array(getRole('user'), $title, $body)); if ($add) { $this->assign('msg', '提交成功'); } else { $this->assign('msg', '提交失败'); } return $this->fetch('msg.html'); }
public function delAgent() { if (!daocall('agent', 'del', array($_REQUEST['id']))) { $this->_tpl->assign('msg', "删除失败"); return $this->_tpl->fetch('msg.html'); } $log = array('operate_object' => 'id=' . $_REQUEST['id'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['a']); apicall('operatelog', 'operatelogAdd', array($log)); daocall('user', 'updateUserAgent_idByAent_id', array($_REQUEST['id'])); daocall('agentprice', 'delAgentpriceByAgent_id', array($_REQUEST['id'])); return $this->listAgent(); }
public function setEnv($vhost, $templete, $subtemplete, $name, $value) { $ret = $this->checkEnv($name, $value, (array) $GLOBALS['tplenv'][$templete . ':' . $subtemplete]); if ($ret == ENV_CHECK_NOT_FOUND) { $ret = $this->checkEnv($name, $value, (array) $GLOBALS['tplenv'][$templete]); } //echo "name=".$name." ret=".$ret; if ($ret != ENV_CHECK_SUCCESS) { trigger_error('参数值:' . $value . '不合法'); return false; } return apicall('vhost', 'addInfo', array($vhost, $name, 100, $value, false)); }
public function login() { $user = $this->checkPassword($_REQUEST['username'], $_REQUEST['passwd']); if (!$user) { return $this->_tpl->display('login_error.html'); //die('登录错误![<a href="javascript:history.go(-1);">返回</a>]'); } registerRole('admin', $user['username']); $_SESSION['admin_last_login'] = $user['last_login']; $_SESSION['admin_last_ip'] = $user['last_ip']; $log = array('operate_object' => 'username='******'username'], 'mem' => 'ip=' . $_SERVER["REMOTE_ADDR"], 'admin' => getRole('admin'), 'operate' => $_REQUEST['c'] . "&a=" . $_REQUEST['a']); apicall('operatelog', 'operatelogAdd', array($log)); header("Location: index.php"); }
public function step1() { if ($this->getInstallVersion() == VHMS_VERSION) { die("已经升级过了."); } load_lib("pub:db"); $db = db_connect('default'); $sqlfile = dirname(__FILE__) . '/upgrade.sql'; apicall('install', 'executeSql', array($db, $sqlfile)); apicall('product', 'flushVhostProduct'); //$db->exec("ALTER TABLE `vhost` DROP INDEX `name` , ADD UNIQUE `name` ( `name` ) "); if (!apicall('install', 'writeVersion')) { die("未能写入版本信息"); } die("成功升级,<a href='?c=session&a=loginForm'>登录</a>"); }
public function getPhyDir($vhost, $domain, $dir) { $node = apicall('vhost', 'getNode', array($vhost)); if (!$node) { return false; } $whm = apicall('nodes', 'makeWhm', array($node)); $whmCall = new WhmCall('core.whm', 'info_vh'); $whmCall->addParam('name', $vhost); $result = $whm->call($whmCall, 10); if (!$result) { return false; } //$doc_root = $result->get("doc_root"); $add_dir = $result->get("add_dir"); $hosts = $result->get("host"); $host = explode("\n", $hosts); $finded = false; foreach ($host as $h) { $hi = explode('|', $h); if (trim($hi[0]) == $domain) { $finded = true; $subdir = $hi[1]; break; } } if (!$finded) { return false; } $phy_dir = $subdir . $add_dir; if ($dir[0] != '/') { $phy_dir .= '/'; } $phy_dir .= $dir; return $phy_dir; }
*日期:2010-10-29 '说明: '以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。 '该代码仅供学习和研究支付宝接口使用,只是提供一个参考。 */ ///////////页面功能说明/////////////// //该页面可在本机电脑测试 //该页面称作“页面跳转同步通知页面”,是由支付宝服务器同步调用,可当作是支付完成后的提示信息页,如“您的某某某订单,多少金额已支付成功”。 //可放入HTML等美化页面的代码和订单交易完成后的数据库更新程序代码 //该页面可以使用PHP开发工具调试,也可以使用写文本函数log_result进行调试,该函数已被默认关闭,见alipay_notify.php中的函数return_verify //TRADE_FINISHED(表示交易已经成功结束,为普通即时到帐的交易状态成功标识); //TRADE_SUCCESS(表示交易已经成功结束,为高级即时到帐的交易状态成功标识); /////////////////////////////////// require_once "class/alipay_notify.php"; //构造通知函数信息 $alipay = new alipay_notify($GLOBALS['setting_cfg']['ALIPAY_PARTNER']['value'], $GLOBALS['setting_cfg']['ALIPAY_KEY']['value'], 'MD5', 'utf-8', strcasecmp($_SERVER['HTTPS'], "ON") == 0 ? "https:" : "http:"); //计算得出通知验证结果 $verify_result = $alipay->return_verify(); if ($verify_result) { //验证成功 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 apicall('money', 'payReturn', array($_GET['out_trade_no'], $_GET['total_fee'] * 100)); echo "成功支付" . $_GET['total_fee'] . "元"; } else { //验证失败 //如要调试,请看alipay_notify.php页面的return_verify函数,比对sign和mysign的值是否相等,或者检查$veryfy_result有没有返回true echo "fail"; }
<?php require 'header.php'; if(isset($_POST['cart'])){ $val = apicall('http://182.18.165.43/multitvfinal/api/subscription/checkout/token/'.$_SESSION['ut'].'/callback/www.google.com/', $_POST); ?> <script> window.location = '<?=json_decode($val)->result?>'; </script> <?php } $data = subList($_GET['v']); //echo '<pre>';print_r($data->result->package); ?> <div class="container row"> <div class="two-thirds column left"> <table align="center"> <tr> <td colspan="3"><img src="<?= $data->result->video->image->medium ?>" /></td> </tr> <tr> <td colspan="3"><h1 class="heading">Subscription For <?= $data->result->video->title ?></h1></td> </tr> <tr> <th>Days</th> <th>Amount</th> <td>Subscribe</td> </tr> <?php foreach ($data->result->video->subscription as $value) { //echo "<pre>"; print_r($value); ?> <form action="" method="POST"> <tr>
public function del($node, $name) { $whm = apicall('nodes', 'makeWhm', array($node)); if (!$whm) { return false; } $whmCall = new WhmCall('del_vh'); $whmCall->addParam('destroy', 1); $whmCall->addParam('name', $name); if ($whm->call($whmCall)) { // daocall('vhostinfo','delAllInfo',array($name)); return daocall('vhost', 'delVhost', array($name, null)); } return false; }
public function index() { $products = apicall('product', 'getProductList'); $this->_tpl->assign('products', $products); return $this->_tpl->fetch('host/index.html'); }
public function webSetup() { daocall('setting', 'add', array('web_name', $_REQUEST['web_name'])); daocall('setting', 'add', array('logo', $_REQUEST['logo'])); daocall('setting', 'add', array('contact', $_REQUEST['contact'])); daocall('setting', 'add', array('footer', $_REQUEST['footer'])); daocall('setting', 'add', array('stat_code', $_REQUEST['stat_code'])); daocall('setting', 'add', array('banner', $_REQUEST['banner'])); daocall('setting', 'add', array('links', $_REQUEST['links'])); daocall('setting', 'add', array('vhost_name', $_REQUEST['vhost_name'])); $list = daocall('setting', 'getAll'); apicall('utils', 'writeConfig', array($list, 'name', 'setting')); return $this->setupMain(); }
public function updateNews() { $body = apicall('utils', 'klencode', array($_REQUEST['body'], true)); $new = daocall('news', 'updateNews', array($_REQUEST['id'], $_REQUEST['title'], $body)); return $this->pageNews(); }
public function left() { $news = apicall('news', 'getNewsList', array()); $this->_tpl->assign('news', $news); return $this->fetch('public/left.html'); }
public function flush() { apicall('product', 'flushVhostProduct'); return $this->showProduct(); }
public function addReply() { $reply = apicall('utils', 'klencode', array($_REQUEST['reply'])); $log = daocall('question', 'updateReply', array($_REQUEST['id'], $reply, getRole('admin'))); return $this->pageQuestion(); }
private function getDbUsed($nodename, $name) { $whm = apicall('nodes', 'makeWhm', array($nodename)); $whmCall = new WhmCall('getDbUsed'); $whmCall->addParam('name', $name); return $whm->call($whmCall, 10); }
#!/usr/bin/php <?php @set_time_limit(0); function Usage() { die("Usage: " . $_SERVER['argv'][0] . " <sync|sync_flow|sync_expire>\n"); } $dir = dirname(__FILE__); define('SYS_ROOT', $dir); define('APPLICATON_ROOT', ''); date_default_timezone_set('Asia/Shanghai'); include SYS_ROOT . '/runtime.php'; if ($_SERVER["argv"] == null || $_REQUEST != null) { die("crontab cann't run in web model.please run in cli."); } if ($_SERVER['argc'] < 2) { Usage(); } $argv = $_SERVER['argv']; $program = array_shift($argv); $action = array_shift($argv); @apicall('shell', $action, $argv);
<?php @set_time_limit(0); function Usage() { die("Usage: " . $_SERVER['argv'][0] . " <hour|day>\n"); } $dir = dirname(__FILE__); define('SYS_ROOT', $dir); define('APPLICATON_ROOT', ''); include SYS_ROOT . '/runtime.php'; if ($_SERVER["argv"] == null || $_REQUEST != null) { die("crontab cann't run in web model.please run in cli."); } if ($_SERVER['argc'] != 2) { Usage(); } $action = $_SERVER['argv'][1]; if ($action == 'day') { return apicall('crontab', 'runDay'); } if ($action == 'hour') { return apicall('crontab', 'runHour'); } Usage();
public function randPassword() { $passwd = getRandPasswd(); if (daocall('user', 'updatePassword', array($_REQUEST['username'], $passwd))) { $msg = "新密码是: " . $passwd; } else { $msg = "重设密码出错"; } $log = array('operate_object' => 'username='******'username'], 'admin' => getRole('admin'), 'operate' => $_REQUEST['a']); apicall('operatelog', 'operatelogAdd', array($log)); $this->_tpl->assign('msg', $msg); return $this->listUser(); }
public function renewForm() { $vhost = $_REQUEST['name']; $vhost_info = daocall('vhost', 'getVhost', array($vhost, array('username', 'product_id'))); if (!$vhost_info || $vhost_info['username'] != getRole('user')) { trigger_error('没有找到该虚拟主机'); return false; } $this->_tpl->assign("name", $vhost); $product = apicall('product', 'newProduct', array('vhost')); $product_info = $product->getInfo($vhost_info['product_id']); if ($product_info) { $userinfo = daocall('user', 'getUser', array(getRole('user'))); if ($userinfo['agent_id'] > 0) { $arr['agent_id'] = $userinfo['agent_id']; $arr['product_type'] = 0; $arr['product_id'] = $vhost_info['product_id']; $agentinfo = daocall('agentprice', 'getAgentprice', array($arr)); if ($agentinfo && $agentinfo[0]['price'] > 0) { $product_info['price'] = $agentinfo[0]['price']; } } $this->_tpl->assign("product", $product_info); } return $this->_tpl->fetch('vhostproduct/renew.html'); }
public function getOs() { $whm = apicall('nodes', 'makeWhm2', array($_REQUEST['host'], $_REQUEST['port'], $_REQUEST['user'], $_REQUEST['passwd'])); $whmCall = new WhmCall('info'); $result = $whm->call($whmCall); if (!$result) { trigger_error("call whm info failed"); return false; } return $result->get("os"); }
/** * 非自动化产品业务创建函数 * 过滤用户提交的html代码 * apicall('utils','klencode',array($_REQUEST['client_msg'])); */ public function addMproductorder() { $arr = $_REQUEST; $arr['username'] = getRole('user'); if ($_REQUEST['product_id']) { $mproductorder = daocall('mproductorder', 'getMproductorder', array(intval($_REQUEST['product_id']))); if ($mproductorder['status'] != 0) { $this->_tpl->assign('msg', "订单已完成"); return $this->_tpl->fetch('msg.html'); } } //获取产品名称 $product_info = daocall('mproduct', 'getMproductById', array($_REQUEST['product_id'])); // $product = apicall('product', 'newProduct', array('m')); if (!is_object($product)) { trigger_error('没有该产品类型:m'); return false; } $user = getRole('user'); //传产品名称,用于写消费记录的购买名称识别 $arr['name'] = $product_info['name']; $arr['client_msg'] = apicall('utils', 'klencode', array($_REQUEST['client_msg'])); $arr['group_id'] = $product_info['group_id']; if (!$product->sell($user, intval($_REQUEST['product_id']), $arr)) { return false; } $this->_tpl->assign('msg', '购买成功,请注意看相订单详情里的管理员回复信息'); return $this->_tpl->fetch('public/msg.html'); }
private function reloadNode($node) { $whm = apicall('nodes', 'makeWhm2', array($node['host'], $node['port'], $node['user'], $node['passwd'])); $whmCall = new WhmCall('core.whm', 'reload_all_vh'); return $whm->call($whmCall, 10); }
/** * * 重建节点配置文件 */ public function flush() { $nodes = daocall('nodes', 'listNodes'); return apicall('utils', 'writeConfig', array($nodes, 'name', 'node')); }