public function __construct() { if ($_POST) { $name = $_POST['firstname']; $mail = $_POST['email']; if (empty($name)) { \Helper\Js::alertForward('noMemberContact', null); } if (!\Helper\Verification::isemail($mail)) { \Helper\Js::alertForward('email1', null); } $sendMail = new \Model\Email(); $result = $sendMail->sentEmail($name, $mail); \Helper\Js::alertForward('subscribe_mail', null); } }
public function __construct() { //$client=\Helper\CheckLogin::sso(); $tpl = \Lib\common\Template::getSmarty(); $tpl->assign('time', date('Y-m-d', time())); if ($_POST || $_FILES) { $act = R::getParams('act'); $history = new \Model\History(); switch ($act) { case 'addpost': $hdate = R::getParams('hdate'); $htime = R::getParams('htime'); $trend = R::getParams('trend'); $point = R::getParams('point'); $note = R::getParams('note'); $open = R::getParams('open'); $close = R::getParams('close'); $thing = R::getParams('thing'); //$memberId=R::getParams ('memberId'); $gmt_create = time(); $data = array(); $data['hdate'] = $hdate; $data['htime'] = $htime; $data['trend'] = $trend; $data['point'] = $point; $data['note'] = $note; $data['open'] = $open; $data['close'] = $close; $data['thing'] = $thing; //$data['memberId']=$memberId; $data['gmt_create'] = $gmt_create; $res = $history->addHistory($data); if ($res) { $result = array('code' => 200, 'msg' => '操作成功'); } echo json_encode($result); exit; break; case 'multi_upload': //testglob(1); if (strrchr($_FILES['filename']['name'], '.csv') != '.csv') { \Helper\Js::alertForward('文件格式错误,只能是csv格式的文件'); } ini_set("max_execution_time", "0"); set_time_limit(0); ini_set("memory_limit", '200M'); $type_sub = R::getParams('multi_type_sub'); $handle = fopen($_FILES['filename']['tmp_name'], 'r'); $keys = fgetcsv($handle, 1000, ','); while ($data = fgetcsv($handle, 1000, ',')) { $value = array_combine($keys, $data); $value['gmt_create'] = time(); //echo '<pre/>';print_r($value);exit; $values[] = $value; } $upload_result = $history->multi_upload($values); fclose($handle); if ($upload_result['fail'] == 0) { $msg = ' 批量上传成功 ' . $upload_result['succeed'] . ' 条'; \Helper\Js::alertForward($msg); } else { $fail_serial_num = implode(',', $upload_result['fail_serial_num']); $msg = ' 批量上传失败,错误的数据为:第 ' . $upload_result['succeed'] . ' 条'; \Helper\Js::alertForward($msg); } exit; break; } } $tpl->display('operate_history_add.html'); }
public function __construct() { $tpl = \Lib\common\Template::getSmarty(); if ($_POST) { $loginmethod = R::getParams('loginmethod'); $forward = R::getParams('forward'); $Conditions = R::getParams('Conditions'); if (!$Conditions && $loginmethod != 'cart') { \helper\Js::alertForward('noConditions', '', 1); } $UserPass = R::getParams('UserPass'); $UserPass2 = R::getParams('UserPass2'); $email = R::getParams('email'); $describes = R::getParams('describes'); $CompanyName = R::getParams('CompanyName'); $KnowWeb = R::getParams('KnowWeb'); $reg_array = array(); if (!\helper\Verification::isemail($email)) { if ($loginmethod == 'cart') { $msg = array('error_status' => 4, 'msg' => \LangPack::$items['email1']); echo json_encode($msg); exit; } else { \helper\Js::alertForward('email1', '', 1); } } $reg_array['member.email'] = $email; if (!$UserPass) { if ($loginmethod == 'cart') { $msg = array('error_status' => 1, 'msg' => \LangPack::$items['pass1']); echo json_encode($msg); exit; } else { \helper\Js::alertForward('pass1', '', 1); } } if (!$UserPass || $UserPass != addslashes($UserPass)) { if ($loginmethod == 'cart') { $msg = array('error_status' => 2, 'msg' => \LangPack::$items['pass2']); echo json_encode($msg); exit; } else { \helper\Js::alertForward('pass2', '', 1); } } if ($UserPass != $UserPass2) { if ($loginmethod == 'cart') { $msg = array('error_status' => 3, 'msg' => \LangPack::$items['pass3']); echo json_encode($msg); exit; } else { \helper\Js::alertForward('pass3', '', 1); } } $UserPass = md5($UserPass . MD5_pass); $reg_array['member.userPass'] = $UserPass; $emailsDy = R::getParams('emailsDy'); if (empty($emailsDy)) { $reg_array['member.emailsDy'] = $emailsDy; } if (empty($describes)) { $reg_array['member.describes'] = $describes; } if (empty($CompanyName)) { $reg_array['member.companyName'] = $CompanyName; } if (empty($KnowWeb)) { $reg_array['member.knowWeb'] = $KnowWeb; } $reg_array['member.userState'] = 1; $reg_array['member.integral'] = 0; $reg_array['member.type'] = 'Personal'; $reg_array['member.loginTime'] = time(); $reg_array['member.loginNum'] = 1; $reg_array['member.webSiteId'] = MAIN_WEBSITEID; $clientIp = \Helper\RequestUtil::getClientIp(); $reg_array['member.loginIp'] = $clientIp; $reg_array['member.userTime'] = time(); if (isset($_COOKIE['PromotionURL'])) { $reg_array['member.promotionURL'] = addslashes($_COOKIE['PromotionURL']); } $regObj = new \Model\Register(); $data = $regObj->registerMember($reg_array); if (isset($data['addFlag']) && $data['addFlag'] == 2) { if ($loginmethod == 'cart') { $msg = array('error_status' => 5, 'msg' => \LangPack::$items['email2']); echo json_encode($msg); exit; } else { \helper\Js::alertForward('email2', '', 1); } } if (isset($data['code']) && $data['code'] == 0) { /*统计代码需要记录第一次注册的操作*/ $_SESSION[SESSION_PREFIX . "reg_record_once"] = 'reg'; /*统计代码需要记录第一次注册的操作 end*/ $_SESSION[SESSION_PREFIX . "MemberId"] = $data['id']; $_SESSION[SESSION_PREFIX . "MemberEmail"] = $email; $pos = strpos($forward, 'Step1'); $loginType = 0; if ($pos !== false) { $loginType = 1; } $cartParmas = array('cookieId' => isset($_COOKIE['CartId']) ? $_COOKIE['CartId'] : '', 'memberId' => $data['id'], 'loginType' => $loginType, 'languageCode' => SELLER_LANG); $cartObj = new \model\Cart(); $cartObj->mergeShoppingCart($cartParmas); if ($loginmethod == 'cart') { $msg = array('error_status' => 0, 'forward' => $forward); echo json_encode($msg); exit; } else { if (!$forward) { $forward = rew::rewrite(array('url' => '?module=index&action=index', 'isxs' => 'no')); } header("Location:" . $forward); exit; } } return; } else { $forward = rew::rewrite(array('url' => '?module=member&action=login', 'isxs' => 'no')); header("Location:" . $forward); exit; } }