function aesDecrypt($data, $encode = 'url') { if ($data == CPropertyValue::ensureInteger($data) . '') { //xmail('Decrypting data which is not encrypted', app()->request->requestUri, SETTINGS_DEV_EMAILS); return $data; } $key = hasParam('SETTINGS_AES_ENCRYPT_IV', 'aninditioncmskey'); Yii::import('Xpress.extensions.vendors.encryption.AES_Encryption'); $aes = new AES_Encryption(hasParam('SETTINGS_AES_ENCRYPT_KEY', '5682825638385896'), $key); switch ($encode) { case 'url': $data = base64_decode(strtr($data, array('-' => '+', '_' => '/'))); break; case 'base64': $data = base64_decode($data); break; } return $aes->decrypt($data); }
public function actionSendActivationEmail($user_id) { $model = User::model()->findByPk($user_id); if (is_null($model)) { errorHandler()->log('The user does not exsist.'); $this->result = false; return false; } $model->validation_code = md5(randomString()); $model->validation_type = User::VALIDATION_TYPE_ACTIVATE; defined('XUSER_VALIDATION_TIMESPAN') or define('XUSER_VALIDATION_TIMESPAN', 24 * 3600); $model->validation_expired = date('Y-m-d h:i:s', time() + XUSER_VALIDATION_TIMESPAN); //$model->status = User::STATUS_INACTIVE; if ($model->update(array('validation_code', 'validation_type', 'validation_expired'))) { // create activate link $pageUrl = app()->request->getHostInfo() . '/XUser/auth/validate'; $page = Page::model()->find("type='standard' AND route ILIKE '%XUser/auth/validate%'"); if (!is_null($page) && !is_null($page->defaultUrl)) { $pageUrl = app()->request->getHostInfo() . $page->defaultUrl->url; } $pageUrl .= '?code=' . $model->validation_code; // send email to user Yii::app()->mail->viewPath = 'XUser.views.emails'; $message = new YiiMailMessage(); $message->view = 'activation'; $message->setBody(array('model' => $model, 'pageUrl' => $pageUrl), 'text/html'); $message->subject = 'Please confirm your account at ' . hasParam('SETTINGS_SITE_NAME', 'Indition'); $message->addTo($model->email); $message->from = hasParam('SETTINGS_ADMIN_EMAIL', '*****@*****.**'); Yii::app()->mail->send($message); } $this->result = true; }
/** * Send email to an address * * @param string $email receiver's address * @param string $view path to view used by mailer (Yii's alias format) * @param array $data associative array passed to view */ function quickMail($email, $view, $data, $subject = 'Flexicore Member Registration Confirmation') { Yii::import('Core.extensions.vendors.mail.YiiMailMessage'); $viewName = end(explode('.', $view)); Yii::app()->mail->viewPath = str_replace('.' . $viewName, '', $view); //send mail $message = new YiiMailMessage(); $message->view = $viewName; $message->setSubject($subject); $message->setBody($data, 'text/html'); $message->addTo($email); if (hasParam('Settings::ADMIN_EMAIL')) { $message->setFrom(array(Settings::ADMIN_EMAIL => Settings::SITE_NAME)); } try { Yii::app()->mail->send($message); } catch (Exception $ex) { FErrorHandler::logError($ex->getMessage()); } }
/** * Gets the SwiftMailer transport class instance, initializing it if it has * not been created yet * @return mixed {@link Swift_MailTransport} or {@link Swift_SmtpTransport} */ public function getTransport() { if ($this->transport === NULL) { switch ($this->transportType) { case 'php': $this->transport = Swift_MailTransport::newInstance(); if ($this->transportOptions !== NULL) { $this->transport->setExtraParams($this->transportOptions); } break; case 'smtp': $this->transport = Swift_SmtpTransport::newInstance(); foreach ($this->transportOptions as $option => $value) { $this->transport->{'set' . ucfirst($option)}($value); } // sets option with the setter method break; case 'sendmail': $this->transport = Swift_SendmailTransport::newInstance(hasParam('SETTINGS_SENDMAIL_PATH', '/usr/sbin/sendmail -bs')); break; } } return $this->transport; }
return; } if (!hasParam('ip')) { echo -3; return; } $name = $_GET['name']; $mac = $_GET['mac']; $ip = $_GET['ip']; if ($lsComputers->hasComputer($name)) { echo -4; return; } $lsComputers->addComputer($name, $mac, $ip); echo 1; return; } if (hasAction('del')) { if (!hasParam('name')) { echo -1; return; } $name = $_GET['name']; if ($lsComputers->delComputer($name)) { echo 1; } else { echo 0; } return; } include "main.php";
<?php error_reporting(0); header("Content-Type: text/html;charset=gb2312"); include 'globaldata.php'; session_start(); if (hasParam("card_num")) { if (empty($_SESSION['captcha_code']) || strcasecmp($_SESSION['captcha_code'], $_POST['captcha_code']) != 0) { echo "<script>alert('验证码不匹配!');</script>"; // Captcha verification is incorrect. } else { $card_num = postV("card_num"); $username = postV("username"); $pwd = postV("pwd"); $taocan = postV("taocan"); $line_num = postV("line_num"); $start_time = date('Y-m-d H:i:s'); $jinbi = 0; $aibi = 0; if ($taocan == 3) { $jinbi = 306; $aibi = 306; } if ($taocan == 2) { $jinbi = 239; $aibi = 238; } if ($taocan == 1) { $jinbi = 128; $aibi = 127; }