function add_student($db, $argv) { if (sizeof($argv) == 3) { $login = $argv[2]; if (preg_match("/^[a-zA-Z]{2,6}_[a-zA-Z0-9]\$/", $login) == 1) { $collection = $db->createCollection("students"); $document = array("login" => $login, "name" => get_name(), "age" => intval(get_age()), "email" => get_email(), "phone" => get_number(), "rented_movies" => array()); $collection->insert($document); echo "[32mUser registered ![0m\n"; } else { echo "[31mError: Login invalide.\n[0m"; } } else { echo "[31mInvalid arg number!\nUsage: ./etna_movies.php login.[0m\n"; } }
function get_result_student($dataSDD, $teacherResults) { $STUDENT_NAME_ROW = 13; $STUDENT_NAME_MAX = 42; $results = array(); for ($num = 0; $num <= 100; $num++) { if (isset($dataSDD->sheets[$num])) { //File SDD $sheet_num = $num; $sheet = $dataSDD->sheets[$sheet_num]['cells']; $class = $sheet[3][7]; $course = $sheet[4][7]; $room = $sheet[5][7]; for ($i = $STUDENT_NAME_ROW; $i <= $STUDENT_NAME_MAX; $i++) { if (!isset($sheet[$i][2]) || $sheet[$i][2] == "") { break; } $person = array(); $person["Code"] = $sheet[$i][2]; $person["Name"] = $sheet[$i][3]; $person["Email"] = get_email($sheet[$i][3], $sheet[$i][2]); $person["Role"] = "student"; $result = array(); $result["Person"] = $person; $result["Room"] = $room; $result["Class"] = $class; $result["Course"] = $course; $student_results = get_result($class, $course, $teacherResults); //print_r($student_results); //return; foreach ($student_results as &$student_result) { $result["Date"] = $student_result["Date"]; $result["Slot"] = $student_result["Slot"]; array_push($results, $result); } } } } //print_r($results); return $results; }
/** * 订单支付成功 * @param type $money * @param type $param */ public function success($money, $param) { if (session("pay_verify") == true) { session("pay_verify", null); //处理订单 $data = array('status' => '1', 'ispay' => '2'); //订单已经支付,状态为已提交 M('order')->where(array('tag' => $param['order_id']))->setField($data); // 发送邮件 $uid = M("pay")->where(array('out_trade_no' => $param['order_id']))->getField('uid'); $mail = get_email($uid); //获取会员邮箱 $title = "支付提醒"; $content = "您在<a href=\"" . C('DAMAIN') . "\" target='_blank'>" . C('SITENAME') . '</a>支付了订单,交易号' . $param['order_id']; if (C('MAIL_PASSWORD')) { SendMail($mail, $title, $content); } } else { E("Access Denied"); } }
function submit_profile_settings($username) { $fullname = $this->input->post('fullname'); $bio = $this->input->post('bio'); $website = $this->input->post('website'); $avatar = $this->input->post('avatar'); $message = $this->validate('profile', $username, '', '', $fullname, $bio, $website); if (!empty($message)) { $this->session->set_flashdata('message', $message); } else { if ($avatar !== '') { $avatardata = array('avatar' => $this->avatar($avatar, get_twitter($username, FALSE, FALSE), get_email($username))); manipulate_database('update', 'user', $avatardata, array('username' => $username)); } if ($website == 'http://') { $website = ''; } $data = array('fullname' => make_it_safe($fullname), 'bio' => make_it_safe($bio), 'website' => $website); manipulate_database('update', 'user', $data, array('username' => $username)); $this->session->set_flashdata('message', array('Awesome! Your profile settings had been saved.')); } }
function parent_list() { $parent_set = get_all_parents(); $output = ""; while ($parent = mysql_fetch_array($parent_set)) { $output .= "<tr id=\"{$parent['hash']}\">\n\t\t\t\t<td><input type=\"checkbox\"></td>"; $output .= "<td>" . $parent['full_name'] . "</td>"; $output .= "<td>" . get_phone($parent['id'], "contacts"); $output .= "</td>"; $output .= "<td>" . get_email($parent['id'], "contacts"); $output . -"</td>"; $output .= "<td>{$parent['addedon']}</td></tr>"; } return $output; }
} else { ?> <input type="hidden" value="<?php echo $username; ?> " id="hiddenusername"/> <input type="hidden" value="<?php echo $fullname; ?> " id="hiddenfullname"/> <?php } if ($content_type == 'settings') { ?> <input type="hidden" value="<?php echo get_email($username); ?> " id="hiddenemail"/> <input type="hidden" value="<?php echo get_twitter($username, FALSE, FALSE); ?> " id="hiddentwitter"/> <?php } if (isset($userid)) { ?> <input type="hidden" value="<?php echo $userid; ?> " id="hiddenuserid"/> <?php
function SupportEmail($TicketNo, $OldStatus = "") { global $UserName, $Name, $Company, $StreetAddress, $Town, $State, $PostCode, $CO, $OtherDetail; global $Quantity, $ProductCode, $PartNo, $Description, $Price, $Duration, $Rate, $Details, $Email, $Comment, $ByContact; global $HomePhone, $WorkPhone, $Mobile, $Status, $ShortDesc, $EngineerEmail, $Created, $EnteredBy, $SequenceNo; global $AssignedTo, $ByUser; if ($TicketNo < 1) { return false; } $Level = 0; $db = new DB_hotspot(); $stf = new SupportTicketsform(); $stf->find_values($TicketNo); $mf = new userinfoform(); $mf->find_values(UserID($UserName)); $EngineerEmail = get_email($AssignedTo); if ($OldStatus) { $Status = $OldStatus . "->" . $Status; } $subj = "Ticket: {$TicketNo}, {$Status}, {$ShortDesc}"; $Msg = "Job for: <b>{$UserName}, {$Name}</b><br>\n"; if ($StreetAddress . $Town . $State . $PostCode) { $Msg .= "at: <b>"; if ($StreetAddress) { $Msg .= "{$StreetAddress}, "; } if ($Town) { $Msg .= "{$Town}, "; } if ($State) { $Msg .= "{$State}, "; } if ($PostCode) { $Msg .= "{$PostCode}"; } $Msg .= "</b><br>\n"; } if (isset($HomePhone)) { $Msg .= "HomePhone: <b>{$HomePhone}</b><br>\n"; } if (isset($WorkPhone)) { $Msg .= "WorkPhone: <b>{$WorkPhone}</b><br>\n"; } if (isset($Mobile)) { $Msg .= "Mob: <b>{$Mobile}</b><br>\n"; } if (isset($Mail)) { $Msg .= "Email: <b>{$Mail}</b><br>\n"; } $Msg .= "------------------------------------------------------------<br>\n"; $Msg .= "Entered By: <b>{$EnteredBy}</b><br>\n"; $Msg .= "Date: <b>{$Created}</b><br>\n"; if (isset($Location)) { $Msg .= "Location: <b>{$Location}</b><br>\n"; } if (isset($RoomNo)) { $Msg .= "Room No: <b>{$RoomNo}</b><br>\n"; } if (isset($Severity)) { $Msg .= "Severity: <b>{$Severity}</b><br>\n"; } if ($Level > 0) { $Msg .= "Level: <b>{$Level}</b><br>\n"; } $Msg .= "Description: <b>{$ShortDesc}</b> {$OtherDetail}<br>\n"; $Msg .= "------------------------------------------------------------<br>\n"; /* $db->query("select id from SupportParts where TicketNo='".$TicketNo."'"); $sp = new SupportPartsform; while ($db->next_record()) { $sp->find_values($db->f(0)); $Msg .= "Part: <b>$Quantity x $ProductCode, $PartNo, $Description @ $Price</b><br>\n"; } $db->query("select id from SupportDetails where TicketNo='".$TicketNo."'"); $sd = new SupportDetailsform; while ($db->next_record()) { $sd->find_values($db->f(0)); $Msg .= "Work: <b>$Duration minutes @ $Rate /hour, $Details</b><br>\n"; } */ $db->query("select distinct FileName from SupportFiles where TicketNo='" . $TicketNo . "'"); while ($db->next_record()) { $Msg .= "Attachment: http://os.{$CO}.com.au/files/{$TicketNo}/" . $db->f(0) . "<br>\n"; } $db->query("select id from SupportComments where TicketNo='" . $TicketNo . "'"); $sc = new SupportCommentsform(); while ($db->next_record()) { $sc->find_values($db->f(0)); $mf->find_values($ByContact); $Msg .= "Comment by <b>{$ByUser}:</b> "; $Msg .= str_replace('" src="/candy/', '" src="http://os.' . $CO . '.com.au/candy/', $Comment); $Msg .= "<br>\n"; } $url = "https://os.{$CO}.com.au/SupportTickets.php?cmd=View&id=" . $TicketNo; $Msg .= "<a href='{$url}'>{$url}</a><br>\n"; $hdrs = "From: ticket+{$TicketNo}@{$CO}.net.au"; if ($EngineerEmail) { $hdrs .= "\r\nTo: {$EngineerEmail}"; } htmlMail("info@{$CO}.com.au", $subj, $Msg, $hdrs); //, $text="", $name="", $type="Application/Octet-Stream", $data="", $name2="", $display2="") echo "<pre>"; echo $hdrs; echo $subj; echo "\n"; echo $Msg; echo "</pre>"; }
$params = array($report_id, $file_path); Util::execute_command("/usr/bin/php /usr/share/ossim/scripts/vulnmeter/respdf.php ? > ?", $params); if (file_exists($file_path) && filesize($file_path) <= 5242880) { $attachments[] = array("path" => $file_path, "name" => $file_name); } } if (!valid_hex32($username)) { $body = get_timestamps($dbconn, $username, $result->fields['scan_START'], $result->fields['scan_SUBMIT'], $body); $email = get_email($dbconn, $username); Util::send_email($dbconn, $email, $subject, $body, $attachments); } else { // username is a entity $entity_data = Acl::get_entity($dbconn, $username, FALSE, FALSE); if ($entity_data["admin_user"] != "") { $body = get_timestamps($dbconn, $entity_data["admin_user"], $result->fields['scan_START'], $result->fields['scan_SUBMIT'], $body); $email = get_email($dbconn, $entity_data["admin_user"]); Util::send_email($dbconn, $email, $subject, $body, $attachments); } else { // doesn't exit pro admin $users_list = Acl::get_users_by_entity($dbconn, $username); foreach ($users_list as $k => $user_data) { if ($user_data['email'] != "") { $body = get_timestamps($dbconn, $user_data['login'], $result->fields['scan_START'], $result->fields['scan_SUBMIT'], $body); if ($user_data['email'] != '') { Util::send_email($dbconn, $user_data['email'], $subject, $body, $attachments); } } } } } if (file_exists($file_path)) {
if (!isset($HTTP_RAW_POST_DATA)) { $HTTP_RAW_POST_DATA = file_get_contents('php://input'); } $data = json_decode($HTTP_RAW_POST_DATA); $time = time(); $complaint_simulator_email = '*****@*****.**'; //Confirm SNS subscription if ($data->Type == 'SubscriptionConfirmation') { file_get_contents_curl($data->SubscribeURL); } else { //detect complaints $obj = json_decode($data->Message); $notificationType = $obj->{'notificationType'}; $problem_email = $obj->{'complaint'}->{'complainedRecipients'}; $problem_email = $problem_email[0]->{'emailAddress'}; $from_email = get_email($obj->{'mail'}->{'source'}); $messageId = $obj->{'mail'}->{'messageId'}; $from_email = $from_email[0]; //check if email is valid, if not, exit if (!filter_var($problem_email, FILTER_VALIDATE_EMAIL)) { exit; } if ($notificationType == 'Complaint') { //Update complaint status if ($problem_email == $complaint_simulator_email) { if (filter_var($from_email, FILTER_VALIDATE_EMAIL)) { mysqli_query($mysqli, 'UPDATE apps SET complaint_setup=1 WHERE from_email = "' . $from_email . '"'); mysqli_query($mysqli, 'UPDATE campaigns SET complaint_setup=1 WHERE from_email = "' . $from_email . '"'); } } //Get app ID of this complaint email
public function makeorder() { /* 菜单调用*/ $menu = R('index/menulist'); $this->assign('categoryq', $menu); /* 购物车调用*/ $cart = R("shopcart/usercart"); $this->assign('usercart', $cart); if (!session('user_auth')) { $usercart = $_SESSION['cart']; $this->assign('usercart', $usercart); } /* 热词调用*/ $hotsearch = R("Index/getHotsearch"); $this->assign('hotsearch', $hotsearch); $id = $_POST["orderid"]; $order = D("order"); //计算提交的订单的商品总额 $total = $this->getPricetotal($id); //计算提交的订单的商品运费 if ($total < C('LOWWEST')) { $trans = C('SHIPMONEY'); } else { $trans = 0; } //计算提交的积分兑换 if ($_POST["score"]) { $score = $_POST["score"]; //读取配置,1000积分兑换1元 $ratio = $score / C('RATIO'); $data['score'] = $score; $user = session('user_auth'); $uid = $user["uid"]; M("member")->where("uid='{$uid}'")->setField('score', 0); } else { $ratio = 0; } $del = M("order")->where("total='0'")->delete(); //计算提交的优惠券 if ($_POST["couponcode"]) { $code = $_POST["couponcode"]; $codeid = M("fcoupon")->where("code='{$code}' and status='1'")->getField('id'); //获取优惠券主键id $deccode = get_coupon_price($codeid); //获取优惠券等值金额 $usercouponid = M("usercoupon")->where("couponid='{$codeid}' and status='1'")->getField('id'); //获取用户可用优惠券主键id if ($usercouponid) { $data['codeid'] = $codeid; M("usercoupon")->where("couponid='{$codeid}'")->setField('status', 2); //设置优惠券已用 } else { $deccode = 0; } } else { $deccode = 0; } $senderid = $_POST["sender"]; $data['addressid'] = $senderid; $data['total'] = $total; $data['ptime'] = NOW_TIME; $data['shipprice'] = $trans; //计算提交的订单的总费用 $all = $total + $trans - $ratio - $deccode; $data['pricetotal'] = $all; //修改订单状态为用户已提交 if ($_POST["PayType"] == "1") { $data['status'] = "1"; $data['backinfo'] = "已提交等待发货"; //增加取消订单 //根据订单id保存对应的费用数据 $order->where("id='{$id}'")->save($data); //根据订单id获取购物清单 $del = M("shoplist")->where("orderid='{$id}'")->select(); //获取会员uid $member = D("member"); $uid = $member->uid(); //遍历购物清单,删除登录用户购物车中的货物id foreach ($del as $k => $val) { //获取购物清单数据表产品id,字段goodid $delbyid = $val["goodid"]; //删除购物车中用户的产品id M("shopcart")->where("goodid='{$delbyid}'and uid='{$uid}'")->delete(); } $ordercode = $order->where("id='{$id}'")->getField('orderid'); $this->assign('codeid', $ordercode); $mail = get_email($ordercode); //获取会员邮箱 $title = "交易提醒"; $content = "您在<a href=\"" . C('DAMAIN') . "\" target='_blank'>" . C('SITENAME') . '</a>提交了订单,订单号' . $param['order_id']; if (C('MAIL_PASSWORD')) { SendMail($mail, $title, $content); } $this->display('success'); } else { //设置订单状态为用户为未能完成,不删除数据 $data['backinfo'] = "等待支付"; $data['ispay'] = "1"; $data['status'] = "13"; //根据订单id保存对应的费用数据 $order->where("id='{$id}'")->save($data); $ordercode = $order->where("id='{$id}'")->getField('orderid'); $this->assign('codeid', $ordercode); $this->assign('goodprice', $all); //支付页 $this->display('Pay/index'); } }
} else { $user['userage'] = (int) $user['userage']; } if ($user['usericq'] == 0) { $user['usericq'] = ""; } if ($config['showpostslevel'] == 0) { $user['userposts'] = "- (Vom Administrator deaktiviert)"; } elseif ($config['showpostslevel'] == 1 && $g_user['userid'] != $user['userid']) { if ($g_user['userisadmin']) { $user['userposts'] = '- (Versteckt)' . $style['smallfont'] . ' [Admin: Postcount = ' . $user['userposts'] . ' ]' . $style['smallfontend']; } else { $user['userposts'] = '- (Versteckt)'; } } $user['useremail'] = get_email($user); $user['username'] = parse_code($user['username']); $user['userip'] = ''; if ($g_user['userisadmin']) { $r_online = thwb_query("SELECT onlineip FROM {$pref}" . "online WHERE userid='{$user['userid']}' AND onlinetime > " . (time() - $config['session_timeout'])); if (mysql_num_rows($r_online) > 0) { $online = mysql_fetch_array($r_online); $user['userip'] = $style['smallfont'] . ' [Admin: IP = ' . $online['onlineip'] . ', Hostname = ' . gethostbyaddr($online['onlineip']) . ' ]' . $style['smallfontend']; } } $user['useraim'] = parse_code($user['useraim']); $user['usermsn'] = parse_code($user['usermsn']); $userurlname = rawurlencode($user['username']); $navpath .= 'Profilansicht'; eval($Tprofile->GetTemplate("CONTENT")); eval($Tframe->GetTemplate());
<?php require "settings.php"; require_lib("mail.smtp"); if (isset($_POST["key"])) { if ($_POST["key"] == "group") { $OUTPUT = get_data($_POST); } elseif ($_POST["key"] == "process") { $OUTPUT = process_data($_POST); } elseif ($_POST["key"] == "modify") { if (isset($_POST["done"])) { $OUTPUT = get_email($_POST); } else { $OUTPUT = process_data($_POST); } } elseif ($_POST["key"] == "send_mail") { $OUTPUT = send_emails($_POST); } } else { $OUTPUT = select_group(); } $OUTPUT .= "<p>" . mkQuickLinks(ql("email-queue-manage.php", "Send Emails In Queue"), ql("email-queue-failures.php", "Resend Failed Emails In Queue"), ql("email-groups.php", "Send Email To Group"), ql("email-group-new.php", "Add Email Group"), ql("email-group-view.php", "View Email Groups")); require "template.php"; function select_group() { db_connect(); $groups = ""; #get list of groups $get_groups = "SELECT * from egroups ORDER BY groupname"; $run_egroups = db_exec($get_groups) or errDie("Unable to get group information."); if (pg_numrows($run_egroups) > 0) {
/** 激活邮箱 **/ public function confirm_email() { $type = I("get.type"); $type = safe_replace($type); //过滤 $regid = I("get.regid", 0, 'intval'); if ($type && $regid) { $verification = M("verification"); $mail = get_email($uid); $data['email'] = $mail; $data['create_time'] = NOW_TIME; $data['status'] = 1; $data['tag'] = 1; $data['uid'] = $regid; $verification->create(); $verification->add($data); $this->display("success"); } else { $this->redirect("index/index"); } }
<h3>Subject: </h3> <textarea rows="1" cols="60" name="subject" id="subject" type="text" style="display:block-inline;"></textarea> <br/><br/> <h3>Body: </h3> Salutation: <select name="salutation"> <option value="none">None</option> <option value="dear">Dear [first name], </option> </select> <!-- <textarea rows="1" cols="10" name="greeting" type="text" style="display:block-inline;"></textarea> --> <!-- Dear [Person's First Name],</br> --> <textarea rows="20" cols="80" name="body" id="body" type="text" style="display:block-inline;background-color:#FFF;"></textarea> <input type="submit" value="Send Email" style="vertical-align:top;"/> </form> <br /> <?php get_email(); ?> </div><!--end grid_16 --> <div class="grid_1"><p></p></div> </div><!--end grid_20 --> </div><!--end grid_24 --> </div><!--end container__24 --> </body> </html>
?> <!DOCTYPE html> <html> <head> <style> body{ background-color:#efefef; text-align:center; } </style> </head> <body> <div style = "margin:0 auto;margin-top:32px;margin-bottom:32px;width:100%;"> <?php require_once '../scripts/functions.php'; $un = $_SESSION['username']; $em = get_email($_SESSION['username']); $op = $_POST['oldpass1']; $np = $_POST['newpass1']; error_reporting(0); if (!is_valid_login($em, $op)) { echo "Your information could not be validated."; } else { change_password($em, $np); echo "Password successfully changed."; } ?> </div> <a href="javascript: self.close()">[x] close this window</a> </body> </html>
/** * 保存数据到订单 * @paragram $data */ public function save() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } $order = D("order"); //获取支付订单号 $tag = I('post.tag'); $tag = safe_replace($tag); //过滤 $data['tag'] = $tag; //支付订单号 //防止重复提交 //$info=$order->where("tag='$tag'")->find(); //isset($info)&& $this->error('重复提交订单'); //获取会员uid $uid = is_login(); $data['uid'] = $uid; //验证价格并清空购物车 $list = M("shoplist")->where("tag='{$tag}'")->select(); //遍历 foreach ($list as $k => $val) { //获取购物清单数据表产品id,字段goodid $id = $val["goodid"]; //提交的价格 $goodprice = $val["price"]; $Document = D('Document'); $info = $Document->detail($id); //系统价格 if ($info['groupprice']) { $string = $info['groupprice'] . '、' . $info['price']; $array = explode('、', $string); //验证,多个价格 if (!in_array($goodprice, $array)) { $this->error('商品价格与系统不符,商品id' . $val["goodid"] . '商品价格' . $safeprice . '系统价格' . $string); } } else { if ($goodprice !== $info['price']) { $this->error('商品价格与系统不符,商品id' . $val["goodid"] . '商品价格' . $safeprice . '系统价格' . $safe['price']); } else { #your code addUserLog('价格正确', $uid); //日志 } } //删除购物车中产品id M("shopcart")->where("goodid='{$id}'and uid='{$uid}'")->delete(); } //订单号 $data['orderid'] = date('Ym', time()) . time() . $uid; //订单号 //计算商品总额 $total = $this->getPricetotal($tag); $data['total'] = $total; //计算运费 if ($total < C('LOWWEST')) { $trans = C('SHIPMONEY'); } else { $trans = 0; } $data['ship_price'] = $trans; //运费 //计算积分 if ($_POST["score"]) { $score = I('post.score', 0, 'intval'); // 用intval过滤$_POST["score"]; //读取配置,1000积分兑换1元 $ratio = $score / C('RATIO'); M("member")->where("uid='{$uid}'")->setField('score', 0); } else { $ratio = 0; } $data['score'] = $score; $data['score_money'] = $ratio; $title = '消耗积分' . $score . '抵消金额' . $ratio; addUserLog($title, $uid); //日志 //计算优惠券 $code = I('post.couponcode'); $code = safe_replace($code); //过滤 //判断优惠券是否可用 $xfee = $total + $trans - $ratio; //计算优惠券可使用的金额,home/common/function $decfee = get_fcoupon_fee($code, $xfee); $data['coupon'] = $code; //优惠券代码 $data['coupon_money'] = $decfee; //优惠券金额 //计算使用地址id $senderid = I('post.sender'); $senderid = safe_replace($senderid); //过滤 $data['addressid'] = $senderid; //计算应付金额 $all = $total + $trans - $ratio - $decfee; $data['total_money'] = $all; //应付金额 $data['create_time'] = NOW_TIME; //创建时间 //支付类型PayType,1-货到付款 if ($_POST["PayType"] == "1") { //创建订单 $data['status'] = 1; $data['ispay'] = -1; //货到付款 $orderid = $order->add($data); M("shoplist")->where("tag='{$tag}'")->setField('orderid', $orderid); //保存货到付款支付数据 $pay = M("pay"); $pay->create(); $pay->money = $all; $pay->ratio = $ratio; $pay->total = $total; $pay->out_trade_no = $tag; $pay->yunfee = $trans; $pay->coupon = $defee; $pay->uid = $uid; $pay->addressid = $senderid; $pay->create_time = NOW_TIME; $pay->type = 2; //货到付款 $pay->status = 2; $pay->add(); //发送邮件 $mail = get_email($uid); //获取会员邮箱 $title = "交易提醒"; $content = "您在<a href=\"" . C('DAMAIN') . "\" target='_blank'>" . C('SITENAME') . '</a>提交了订单,订单号' . $tag; if (C('MAIL_PASSWORD')) { SendMail($mail, $title, $content); } //保存日志 addUserLog('货到付款订单已提交', $uid); $this->meta_title = '提交成功'; $this->display('Shopcart/success'); } //支付类型PayType,2-在线支付 if ($_POST["PayType"] == "2") { //创建订单 $data['ispay'] = "1"; $data['status'] = "-1"; //待支付 //根据订单id保存对应的费用数据 $orderid = $order->add($data); M("shoplist")->where("tag='{$tag}'")->setField('orderid', $orderid); //发起支付时thinkpay会自动创建 // $pay=M("pay"); // $pay->create(); // $pay->money=$all; // $pay->ratio=$ratio; // $pay->total=$total; // $pay->out_trade_no=$tag; // $pay->yunfee=$trans; // $pay->coupon=$deccode; // $pay->uid=$uid; // $pay->addressid=$senderid; // $pay->create_time=NOW_TIME; // $pay->type=1;//在线支付 // $pay->status=-1;//待支付 // $pay->add(); //记录日志 addUserLog('在线支付订单已提交', $uid); $this->meta_title = '订单支付'; //输出支付订单号和支付金额 $this->assign('codeid', $tag); $this->assign('goodprice', $all); //支付页 $this->display('Pay/index'); } }
$body .= "Line: {$line0}\n"; $body .= "Type: {$type}\nError: {$details}\nCode:\n\n"; $body .= get_code_block($file, $line0, $char0, $line1, $char1); $emails[$blame] = $body; echo "."; } else { echo "x"; } } } echo "\n"; } if (!$Command) { foreach ($emails as $blame => $body) { echo "sending mail to {$blame}...\n"; mail(get_email($blame), "[nemo] A bug's life ends here", "Hi, there,\n\n" . "HipHop compiler might have found some bugs with PHP code you " . "were working on. Would you take a quick look to see if they are " . "real problems? Please do not ask me to review your change. " . "Ask someone who's familiar with the code :-) If it is not your bug, " . "please try to find the right person/group to fix the problem.\n\n" . "Also, this tool is still under development. If you think this is " . "something we shouldn't be warning about, please let me know\n\n" . "Thanks!\n" . $body, "From: {$CurEmail}"); } } else { if ($Command == "--dry-run") { foreach ($emails as $blame => $body) { var_dump($blame, $body); } } } /////////////////////////////////////////////////////////////////////////////// function get_code_block($file, $line0, $char0, $line1, $char1) { global $SourceRoot; $ret = ''; $start = $line0 - 4; if ($start < 1) {
function sign_in($email, $password) { if ($GLOBALS['$connected'] == False) { connect_to_db(); } // Searching the email address in the database $result = get_email($email); $row = mysql_fetch_array($result); $hash = $row["password"]; //Unhashing the password to see if it matches what was entered. if (password_verify($password, $hash)) { $id = $row["id"]; $_SESSION['login_user'] = "******"; // Initializing Session $privilege = get_privilege(); setcookie("user_id", $id); setcookie("user_priv", $privilege); //session_id('$id'); session_start(); header('Location:index.html'); } else { echo '<script>'; echo 'alert("Password is invalid");'; echo 'location.href="index.html"'; echo '</script>'; } }
while ($user = mysql_fetch_array($r_user)) { $i % 2 == 0 ? $user['bgcolor'] = $style['CellA'] : ($user['bgcolor'] = $style['CellB']); $user['userjoin'] = form_date($user['userjoin']); $user['userlastpost'] = form_date($user['userlastpost']); $user['userlocation'] = chopstring(parse_code($user['userlocation']), 50); if ($user['userhomepage'] == "http://") { $user['userhomepage'] = ''; } $user['userhomepage'] = parse_code($user['userhomepage']); $user['username'] = parse_code($user['username']); if ($config['showpostslevel'] != 2) { if (!$g_user['userisadmin']) { $user['userposts'] = 'n/a'; } } $user['useremail'] = get_email($user, true); if ($user['userhomepage']) { $user['userhomepage'] = '<a href="' . str_replace('"', '', $user['userhomepage']) . '" target="_blank">' . chopstring($user['userhomepage'], 35) . "</a>"; } else { $user['userhomepage'] = " "; } if (!$user['usericq']) { $user['usericq'] = " "; } if (!$user['userlocation']) { $user['userlocation'] = " "; } eval($TMemberrow->GetTemplate("MEMBER_ROWS")); $i++; } }
function doit($input) { global $fp; if (!($fp = popen($input, 'r'))) { die("Cannot open pipe"); } $lines = 1; while ($line = fgets($fp, 2096)) { $parsed = new syslog_parser($line); $_timestamp = mysql_real_escape_string($parsed->timestamp); $_host = mysql_real_escape_string($parsed->host); $_dsn = ""; $_delay = ""; $_relay = ""; // Sendmail if ($parsed->process == 'sendmail' && class_exists('sendmail_parser')) { $sendmail = new sendmail_parser($parsed->entry); if (DEBUG) { print_r($sendmail); } $_msg_id = mysql_real_escape_string($sendmail->id); // Rulesets if (isset($sendmail->entries['ruleset'])) { if ($sendmail->entries['ruleset'] == 'check_relay') { // Listed in RBL(s) $_type = mysql_real_escape_string('rbl'); $_relay = mysql_real_escape_string($sendmail->entries['arg2']); $_status = mysql_real_escape_string($sendmail->entries['reject']); } if ($sendmail->entries['ruleset'] == 'check_mail') { // Domain does not resolve $_type = mysql_real_escape_string('unresolveable'); $_status = mysql_real_escape_string(get_email($sendmail->entries['reject'])); } } // Milter-ahead rejections if (preg_match('/Milter: /i', $sendmail->raw) && preg_match('/(rejected recipient|user unknown)/i', $sendmail->entries['reject'])) { $_type = mysql_real_escape_string('unknown_user'); $_status = mysql_real_escape_string(get_email($sendmail->entries['to'])); } // Unknown users if (preg_match('/user unknown/i', $sendmail->entry)) { // Unknown users $_type = mysql_real_escape_string('unknown_user'); $_status = mysql_real_escape_string($sendmail->raw); } // Relay lines if (isset($sendmail->entries['relay']) && isset($sendmail->entries['stat'])) { $_type = mysql_real_escape_string('relay'); $_delay = mysql_real_escape_string($sendmail->entries['xdelay']); $_relay = mysql_real_escape_string(get_ip($sendmail->entries['relay'])); $_dsn = mysql_real_escape_string($sendmail->entries['dsn']); $_status = mysql_real_escape_string($sendmail->entries['stat']); } } if (isset($_type)) { dbquery("REPLACE INTO mtalog VALUES (FROM_UNIXTIME('{$_timestamp}'),'{$_host}','{$_type}','{$_msg_id}','{$_relay}','{$_dsn}','{$_status}','{$_delay}')"); } $lines++; // Reset variables unset($line, $parsed, $sendmail, $_timestamp, $_host, $_type, $_msg_id, $_relay, $_dsn, $_status, $_delay); } pclose($fp); }
return null; } return $row['email_address']; } $dbconn = dbauth::connect('directory', null, $_SERVER['REMOTE_USER']) or die("Could not connect: " . pg_last_error()); pg_query($dbconn, "begin"); $personid = isset($_GET['person_id']) ? $_GET['person_id'] : null; // the order by is used to get the non-NULL ones pushed to the top , tho now // there should be only one row $query = "\n\tselect p.person_id,\n\t\tcoalesce(p.preferred_first_name, p.first_name) as first_name,\n\t\tcoalesce(p.preferred_last_name, p.last_name) as last_name,\n\t\tcoalesce(pc.nickname, p.nickname) as nickname,\n\t\tpc.position_title,\n\t\tpc.person_company_relation,\n\t\tdate_part('month', p.birth_date) as birth_date_month,\n\t\tdate_part('day', p.birth_date) as birth_date_day,\n\t\tdate_part('epoch', p.birth_date) as birth_date_epoch,\n\t\tpc.hire_date,\n\t\tc.company_name,\n\t\tc.company_id,\n\t\tpi.person_image_id,\n\t\tpc.manager_person_id,\n\t\tcoalesce(mgrp.preferred_first_name, mgrp.first_name) as mgr_first_name,\n\t\tcoalesce(mgrp.preferred_last_name, mgrp.last_name) as mgr_last_name,\n\t\tac.account_collection_id,\n\t\tac.account_collection_name,\n\t\ta.login,\n\t\tnumreports.tally as num_reports,\n\t\tofc.display_label,\n\t\tofc.building,\n\t\tofc.floor,\n\t\tofc.section,\n\t\tofc.seat_number\n\t from person p\n\t \tinner join (\n\t\t\tselect * from person_company\n\t\t\twhere hire_date is null or hire_date <= now()\n\t\t) pc using (person_id)\n\t\tinner join company c using (company_id)\n\t\tinner join v_corp_family_account a\n\t\t\ton p.person_id = a.person_id\n\t\t\tand pc.company_id = a.company_id\n\t\t\tand a.account_role = 'primary'\n\t\tleft join ( select ac.*, account_id\n\t\t\t\t\tFROM account_collection ac\n\t\t\t\t\t\tINNER JOIN account_collection_account\n\t\t\t\t\t\tUSING (account_collection_id)\n\t\t\t\t\tWHERE account_collection_type = 'department'\n\t\t) ac USING (account_id)\n\t\tleft join ( \n \tselect pi.*, piu.person_image_usage\n \t\t from\tperson_image pi\n \t\t\tinner join person_image_usage piu\n \t\t\t\ton pi.person_image_id = piu.person_image_id\n \t\t\t\tand piu.person_image_usage = 'corpdirectory'\n \t) pi on p.person_id = pi.person_id\n\t\tleft join person mgrp\n\t\t\ton pc.manager_person_id = mgrp.person_id\n\t\tleft join ( -- this probably needs to be smarter\n\t\t\t select manager_person_id as person_id, count(*) as tally\n\t\t\t from person_company\n\t\t\t where person_company_status = 'enabled'\n\t\t\t group by manager_person_id\n\t\t) numreports on p.person_id = numreports.person_id\n\t\tleft join (\n\t\t\tselect\tpl.person_id, \n\t\t\t\tpa.display_label,\n\t\t\t\tpl.building,\n\t\t\t\tpl.floor,\n\t\t\t\tpl.section,\n\t\t\t\tpl.seat_number\n\t\t\tfrom person_location pl\n\t\t\t\tinner join physical_address pa\n\t\t\t\t\tUSING (physical_address_id)\n\t\t\twhere pl.person_location_type = 'office'\n\t\t\torder by site_rank\n\t\t) ofc on ofc.person_id = p.person_id\n\twhere p.person_id = \$1\n\torder by ac.account_collection_name\n"; $result = pg_query_params($dbconn, $query, array($personid)) or die('Query failed: ' . pg_last_error()); $row = pg_fetch_array($result, null, PGSQL_ASSOC) or die("no person"); $name = $row['first_name'] . " " . $row['last_name']; header('Content-Type: text/vcard'); header("Content-disposition: inline; filename=\"vcard-{$name}.vcf\""); $email = get_email($dbconn, $row['person_id']); if (isset($email) || isset($row['login'])) { if ($email == null) { $email = $row['login'] . "@" . get_default_domain($dbconn); } } $fn = $row['first_name']; $sn = $row['last_name']; $title = $row['position_title']; echo "BEGIN:VCARD\n"; echo "VERSION:3.0\n"; echo "N:{$sn};{$fn};\n"; echo "FN:{$name}\n"; echo "TITLE:{$title}\n"; // echo "PHOTO;VALUE=URL;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif\n"; $q = "\n\tselect\tpc.person_contact_id,\n\t\t\tvcc.dial_country_code,\n\t\t\tpc.phone_number,\n\t\t\tpc.phone_extension,\n\t\t\tpc.person_contact_type,\n\t\t\tpc.person_contact_technology,\n\t\t\tpc.person_contact_location_type,\n\t\t\tpc.person_contact_privacy\n\tfrom\tperson_contact pc\n\t\t\tinner join val_country_code vcc\n\t\t\t\tusing(iso_country_code)\n\t\t\tinner join val_person_contact_loc_type vpclt\n\t\t\t\tusing (person_contact_location_type)\n\t\t\tinner join val_person_contact_technology vpct\n\t\t\t\tusing (person_contact_technology)\n\twhere\tperson_id = \$1\n\tand\tpc.person_contact_type = 'phone'\n\tand\tperson_contact_privacy != 'HIDDEN'\n\tand person_contact_technology in ('phone', 'mobile', 'fax')\n\torder by person_contact_order\n";
} } // The following actions may only be performed by an admin user if (check_admin_user()) { switch ($action) { case 'create-mail': display_mail_form(get_email()); break; case 'create-list': display_list_form(get_email()); break; case 'store-list': if (store_list($_SESSION['admin_user'], $_POST)) { echo "<p style=\"padding-bottom: 50px\">New list added.</p>"; display_items('All Lists', get_all_lists(), 'information', 'show-archive', ''); } else { echo "<p style=\"padding-bottom: 50px\">List could not be\n stored. Please try again.</p>"; } break; case 'send': send($_GET['id'], $_SESSION['admin_user']); break; case 'view-mail': display_items('Unsent Mail', get_unsent_mail(get_email()), 'preview-html', 'preview-text', 'send'); break; } } /********************************************************************** * Section 4: display footer *********************************************************************/ do_html_footer();
<?php include_once 'db_connect.php'; include_once 'functions.php'; if (!isset($_SESSION)) { session_start(); //sec_session_start(); } if (isset($_POST['username'], $_POST['p'])) { $username = $_POST['username']; $password = $_POST['p']; // The hashed password. $email = get_email($username, $mysqli); if (!$email) { echo 'Email not found in database'; header('Location: ../login.php?error=1'); exit; } if (login($email, $password, $mysqli) == true) { // Login success $login_success = true; //header('Location: ../protected_page.php'); //create remember me cookie //$week = time() + 604800; //if($_POST['remember']) { // setcookie('remember_me', $_POST['username'], $week); //sets a cookie with a negative time value //} elseif(!$_POST['remember']) { // if(isset($_COOKIE['remember_me'])) { // $past = time() - 100; // setcookie('remember_me', gone, $past);
function doit($input) { global $fp; if (!($fp = popen($input, 'r'))) { die("Cannot open pipe"); } dbconn(); $lines = 1; while ($line = fgets($fp, 2096)) { // Reset variables unset($parsed, $postfix, $_timestamp, $_host, $_type, $_msg_id, $_relay, $_dsn, $_status, $_delay); $parsed = new syslog_parser($line); $_timestamp = mysql_real_escape_string($parsed->timestamp); $_host = mysql_real_escape_string($parsed->host); // Postfix if ($parsed->process == 'postfix/smtp' && class_exists('postfix_parser')) { $postfix = new postfix_parser($parsed->entry); if (DEBUG) { print_r($postfix); } $_msg_id = mysql_real_escape_string($postfix->id); // Milter-ahead rejections if (preg_match('/Milter: /i', $postfix->raw) && preg_match('/(rejected recipient|user unknown)/i', $postfix->entries['reject'])) { $_type = mysql_real_escape_string('unknown_user'); $_status = mysql_real_escape_string(get_email($postfix->entries['to'])); } // Unknown users if (preg_match('/user unknown/i', $postfix->entry)) { // Unknown users $_type = mysql_real_escape_string('unknown_user'); $_status = mysql_real_escape_string($postfix->raw); } // you can use these matches to populate your table with all the various reject reasons etc., so one could get stats about MTA rejects as well // example if (preg_match('/NOQUEUE/i', $postfix->entry)) { if (preg_match('/Client host rejected: cannot find your hostname/i', $postfix->entry)) { $_type = mysql_real_escape_string('unknown_hostname'); } else { $_type = mysql_real_escape_string('NOQUEUE'); } $_status = mysql_real_escape_string($postfix->raw); } // Relay lines if (isset($postfix->entries['relay']) && isset($postfix->entries['status'])) { $_type = mysql_real_escape_string('relay'); $_delay = mysql_real_escape_string($postfix->entries['delay']); $_relay = mysql_real_escape_string(get_ip($postfix->entries['relay'])); $_dsn = mysql_real_escape_string($postfix->entries['dsn']); $_status = mysql_real_escape_string($postfix->entries['status']); } } if (isset($_type)) { dbquery("REPLACE INTO mtalog VALUES (FROM_UNIXTIME('{$_timestamp}'),'{$_host}','{$_type}','{$_msg_id}','{$_relay}','{$_dsn}','{$_status}','{$_delay}')"); } $lines++; } dbclose(); pclose($fp); }
function authenticateToUMLDAP($accountName, $credential, $ldapServer = 'ldap.missouri.edu', $ldapPort = 3268, &$errorMsg = "", $requireSecure = true) { $error = array(); $query_result = array(); $attributes = array("samaccountname", "proxyAddresses", "mail", "displayName"); $formatted_result = array(); $connection = ldap_connect($ldapServer, $ldapPort); if (!$connection) { $errorMsg = "Failed to connect to {$ldapServer}:{$ldapPort}"; return false; } if (!ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3)) { $errorMsg = "Failed to Set Protocol version 3"; return false; } if (!ldap_set_option($connection, LDAP_OPT_REFERRALS, 0)) { $errorMsg = "Failed to connect disable referrals from server"; return false; } if (!ldap_start_tls($connection) && $requireSecure) { $errorMsg = "Unable to get a TLS connection, are you using the correct port?"; return false; } // Try one until we connect $valid_domains = array("tig.mizzou.edu", "col.missouri.edu", "umsystem.umsystem.edu"); foreach ($valid_domains as $domain) { if ($bind_status = ldap_bind($connection, $accountName . "@" . $domain, $credential)) { break; } } // A break above leaves $bind_status = true; if ($bind_status) { $ldapresults = ldap_search($connection, 'dc=edu', "(samaccountname={$accountName})", $attributes); if (!$ldapresults) { $errorMsg = "Failed to look up after bind"; return false; } else { // THIS VALUE IS CHECK BELOW $result_count = ldap_count_entries($connection, $ldapresults); $query_result = ldap_get_entries($connection, $ldapresults); ldap_close($connection); } } else { ldap_close($connection); $errorMsg = "Failed to bind to ({$connection}) as: {$username}"; return false; } if ($result_count == 0) { $formatted_result['result'] = '0'; $formatted_result['message'] = 'Invalid Username or Password'; } else { $formatted_result['result'] = $result_count; $formatted_result['user']['fullname'] = $query_result[0]["displayname"][0]; $formatted_result['user']['username'] = $query_result[0]["samaccountname"][0]; $formatted_result['user']['emails'] = get_email($query_result); } return $formatted_result; }
<?php require_once "../includes/header.php"; $_utils = new Utils(); ?> <?php if (isset($_GET["email_id"])) { $email_id = $_GET["email_id"]; $result = get_email($email_id); $row = mysql_fetch_array($result); $email_id = $row["email_id"]; $email_name_ro = decode($row["name"], "ro"); $email_name_en = decode($row["name"], "en"); $email_body_ro = decode($row["body"], "ro"); $email_body_en = decode($row["body"], "en"); $email_name = decode($row["name"], $lang); $email_body = decode($row["body"], $lang); ?> <h1 class="emails"><?php echo $email_name; ?> </h1> <div id="list_details"> <?php echo output_message(); ?> <p><strong><?php __("Template Name");
function store_account($normal_user, $admin_user, $details) { if (!filled_out($details)) { echo 'All fields must be filled in. Try again.<br /><br />'; return false; } else { if (subscriber_exists($details['email'])) { //check logged in as the user they are trying to change if (get_email() == $details['email']) { $query = "update subscribers set realname = '{$details['realname']}',\r\n mimetype = '{$details['mimetype']}'\r\n where email = '" . $details[email] . "'"; if (db_connect() && mysql_query($query)) { return true; } else { echo 'could not store changes.<br /><br /><br /><br /><br /><br />'; return false; } } else { echo '<p>Sorry, that email address is already registered here.'; echo '<p>You will need to log in with that address to change ' . ' its settings.'; return false; } } else { $query = "insert into subscribers \r\n values ('{$details['email']}',\r\n '{$details['realname']}',\r\n '{$details['mimetype']}',\r\n password('{$details['new_password']}'),\r\n 0)"; if (db_connect() && mysql_query($query)) { return true; } else { echo 'Could not store new account.<br /><br /><br /><br /><br /><br />'; return false; } } } }
echo ' twitterinput'; } ?> " type="<?php echo $field_type; ?> " id="<?php echo handle_setting($term[$id]); ?> field" name="<?php echo handle_setting($term[$id]); ?> " <?php if ($id == 0 && $setting_type == 'account') { echo 'value="' . get_email($username) . '"'; } elseif ($id == 0 && $setting_type == 'profile') { echo 'value="' . get_fullname($username, FALSE, FALSE) . '"'; } elseif ($id == 2 && $setting_type == 'profile') { echo 'value="' . get_website($username, FALSE) . '"'; } ?> /> <?php } ?> </div> <?php } ?> <div class="clear"></div>
public function createorder() { if (!is_login()) { $this->error("您还没有登陆", U("User/login")); } /* 菜单调用*/ $menu = R('index/menulist'); $this->assign('categoryq', $menu); /* 购物车调用*/ $cart = R("shopcart/usercart"); $this->assign('usercart', $cart); if (!session('user_auth')) { $usercart = $_SESSION['cart']; $this->assign('usercart', $usercart); } /* 底部分类调用*/ $menulist = R('Service/AllMenu'); $this->assign('footermenu', $menulist); /* 热词调用*/ $hotsearch = R("Index/getHotsearch"); $this->assign('hotsearch', $hotsearch); $order = D("order"); $tag = htmlspecialchars($_POST["tag"]); $value = $order->where("tag='{$tag}'")->getField('id'); isset($value) && $this->error('重复提交订单'); //获取会员uid $uid = D("member")->uid(); //根据订单id获取购物清单 $del = M("shoplist")->where("tag='{$tag}'")->select(); //遍历购物清单,删除登录用户购物车中的货物id foreach ($del as $k => $val) { //获取购物清单数据表产品id,字段goodid $delbyid = $val["goodid"]; //删除购物车中用户的产品id M("shopcart")->where("goodid='{$delbyid}'and uid='{$uid}'")->delete(); } //计算提交的订单的商品总额 $total = $this->getPricetotal($tag); //计算提交的订单的商品运费 if ($total < C('LOWWEST')) { $trans = C('SHIPMONEY'); } else { $trans = 0; } //计算提交的积分兑换 if (htmlspecialchars($_POST["score"])) { $score = htmlspecialchars($_POST["score"]); //读取配置,1000积分兑换1元 $ratio = $score / C('RATIO'); $data['score'] = $score; $user = session('user_auth'); $uid = D("member")->uid(); M("member")->where("uid='{$uid}'")->setDec('score', $score); } else { $ratio = 0; } //计算提交的优惠券 $code = htmlspecialchars($_POST["couponcode"]); //计算提交的订单的费用(含运费) $xfee = $total + $trans - $ratio; //计算优惠券可使用的金额,home/common/function $decfee = get_fcoupon_fee($code, $xfee); $data['codeid'] = $code; $data['codemoney'] = $decfee; $senderid = htmlspecialchars($_POST["sender"]); $data['addressid'] = $senderid; $data['total'] = $total; $data['create_time'] = NOW_TIME; $data['shipprice'] = $trans; //计算提交的订单的总费用 $all = $total + $trans - $ratio - $decfee; $data['pricetotal'] = $all; $data['orderid'] = $tag; $data['tag'] = $tag; $data['uid'] = $uid; //修改订单状态为用户已提交 if (htmlspecialchars($_POST["PayType"]) == "1") { $pay = M("pay"); $pay->create(); $pay->money = $all; $pay->ratio = $ratio; $pay->total = $total; $pay->out_trade_no = $tag; $pay->yunfee = $trans; $pay->coupon = $decfee; $pay->uid = $uid; $pay->ratioscore = $score; $pay->couponcode = $code; $pay->addressid = $senderid; $pay->create_time = NOW_TIME; $pay->type = 2; //货到付款 $pay->status = 1; $pay->add(); $data['status'] = 1; $data['ispay'] = -1; //货到付款 $data['backinfo'] = "已提交等待发货"; //增加取消订单 //根据订单id保存对应的费用数据 $orderid = $order->add($data); M("shoplist")->where("tag='{$tag}'")->setField('orderid', $orderid); $this->assign('codeid', $tag); $mail = get_email($uid); //获取会员邮箱 $title = "交易提醒"; $content = "您在<a href=\"" . C('DAMAIN') . "\" target='_blank'>" . C('SITENAME') . '</a>提交了订单,订单号' . $tag; if (C('MAIL_PASSWORD')) { SendMail($mail, $title, $content); } $this->meta_title = '提交成功'; $this->display('success'); } if (htmlspecialchars($_POST["PayType"]) == "2") { //设置订单状态为用户为未能完成,不删除数据 $data['backinfo'] = "等待支付"; $data['ispay'] = "1"; $data['status'] = "-1"; //待支付 //根据订单id保存对应的费用数据 $orderid = $order->add($data); M("shoplist")->where("tag='{$tag}'")->setField('orderid', $orderid); $pay = M("pay"); $pay->create(); $pay->money = $all; $pay->ratio = $ratio; $pay->total = $total; $pay->out_trade_no = $tag; $pay->yunfee = $trans; $pay->coupon = $decfee; $pay->uid = $uid; $pay->ratioscore = $score; $pay->couponcode = $code; $pay->addressid = $senderid; $pay->create_time = NOW_TIME; $pay->type = 1; //在线支付 $pay->status = 1; //待支付 $pay->add(); $this->meta_title = '订单支付'; $this->assign('codeid', $tag); $this->assign('goodprice', $all); //支付页 $this->display('Pay/index'); } }
/** * 产生order 产生支付 pay */ public function createorder() { $uid = $this->login(); /* 热词调用*/ $hotsearch = C('HOT_SEARCH'); $this->assign('hotsearch', $hotsearch); $order = D("order"); $tag = $_POST["tag"]; $value = $order->where(array("tag" => $tag, 'uid' => $uid))->getField('id'); isset($value) && $this->error('重复提交订单'); /****计算提交的订单的商品总额 并获取商品的购物车id(sort)**/ $shoplistInfo = $this->getPricetotal($tag, $uid); $total = $shoplistInfo['total']; //计算提交的订单的商品运费 if ($total < C('LOWWEST')) { $trans = C('SHIPMONEY'); } else { $trans = 0; } //计算提交的积分兑换 并减少用户的积分 if ($_POST["score"]) { $score = $_POST["score"]; //读取配置,1000积分兑换1元 $ratio = ceil($score / C('RATIO')); $data['score'] = $score; M("ucenter_member")->where("id='{$uid}'")->setDec('score', $score); } else { $ratio = 0; //积分抵消的金额 $score = 0; //积分 } //计算提交的优惠券 $code = I('post.couponcode'); //计算提交的订单的费用(含运费) $xfee = $total + $trans - $ratio; //计算优惠券可使用的金额,home/common/function $decfee = get_fcoupon_fee($code, $xfee); $data['codeid'] = $code; $data['codemoney'] = $decfee; $senderid = I('post.sender'); $data['addressid'] = $senderid; $data['total'] = $total; $data['create_time'] = NOW_TIME; $data['shipprice'] = $trans; //运费 //计算提交的订单的总费用 $all = $total + $trans - $ratio - $decfee; $data['pricetotal'] = $all; $data['orderid'] = $tag; $data['tag'] = $tag; $data['uid'] = $uid; //设置订单状态 if ($_POST["PayType"] == "1") { //产生订单orderlist $data['status'] = 1; //待发货 $data['ispay'] = -1; //货到付款未完成 $data['backinfo'] = "已提交等待发货"; } else { if ($_POST["PayType"] == "2") { //产生订单orderlist $data['backinfo'] = "等待支付"; $data['status'] = -1; //待支付 $data['ispay'] = -2; //在线支付未完成 } } /**根据订单tag 保存对应的费用数据 并清空该物品购物车**/ $this->saveShopListOrderStatus($tag, $data, $shoplistInfo['cart_sort']); $this->assign('codeid', $tag); $this->assign('goodprice', $all); //保存对应的费用数据 $pay = M("pay"); $pay->create(); $pay->money = $all; $pay->ratio = $ratio; //积分抵消金额 $pay->ratioscore = $score; //消耗积分 $pay->total = $total; $pay->out_trade_no = $tag; $pay->yunfee = $trans; $pay->coupon = $decfee; //优惠卷抵消的金额 $pay->couponcode = $code; //优惠卷代码 $pay->uid = $uid; $pay->addressid = $senderid; $pay->create_time = NOW_TIME; if ($_POST['PayType'] == 1) { $pay->type = 1; //货到付款 $pay->status = 1; //待支付 } else { if ($_POST['PayType'] == 2) { $pay->type = 2; //在线支付 $pay->status = 1; //待支付 } } $pay->add(); //邮件通知 $mail = get_email($uid); //获取会员邮箱 $title = "交易提醒"; $content = "您在<a href=\"" . C('DAMAIN') . "\" target='_blank'>" . C('SITENAME') . '</a>提交了订单,订单号' . $tag; if (C('MAIL_PASSWORD')) { SendMail($mail, $title, $content); } if ($_POST['PayType'] == 1) { $this->meta_title = '提交成功'; $this->display('success'); } else { if ($_POST['PayType'] == 2) { $this->meta_title = '订单支付'; $this->display('Pay/index'); } } }