Example #1
0
	public function massSendCcdx($mob, $content, $time, $isSub=false){
		$client = new SoapClient($this->wsdl);
		if(!$isSub){
			$sName = $this->msgconfig['sms']['user'];
			$sPwdDES = do_mencrypt($this->msgconfig['sms']['pass'], $this->smsdeskey);
		}else{
			$sName = $this->msgconfig['sms']['subuser'];
			$sPwdDES = do_mencrypt($this->msgconfig['sms']['subpass'], $this->smsdeskey);
		}
		$sDst = do_mencrypt($mob, $this->smsdeskey);
		$sMsg = do_mencrypt(auto_charset($content,"utf-8",'gbk'), $this->smsdeskey);
		$sTime = do_mencrypt($time, $this->smsdeskey);
		$sExNo = do_mencrypt('', $this->smsdeskey);
		$param = array('sName'=>$sName,'sPwd'=>$sPwdDES, 'sDst'=>$sDst, 'sMsg'=>$sMsg, 'sTime'=>$sTime, 'sExNo'=>$sExNo, 'smsType'=>'CCDX');
		try{
			$ret = $client->massSendCcdx($param);
			$data = dealSmsResult($ret->massSendCcdxResult);
		}catch(Exception $e){
			$data = $e->getMessage();
		}
		return $data;
	}
Example #2
0
//$input - stuff to decrypt
//$key - the secret key to use
function do_mdecrypt($input, $key)
{
    /*$input = str_replace("n", "", $input);
      $input = str_replace("t", "", $input);
      $input = str_replace("r", "", $input);*/
    $input = trim(chop(base64_decode($input)));
    $td = mcrypt_module_open('tripledes', '', 'ecb', '');
    $key = substr(md5($key), 0, 24);
    $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
    mcrypt_generic_init($td, $key, $iv);
    $decrypted_data = mdecrypt_generic($td, $input);
    mcrypt_generic_deinit($td);
    mcrypt_module_close($td);
    return trim(chop($decrypted_data));
}
/*$str = do_mencrypt("addsaccqwdwse\r\ntyuiop;lkjfhbnv cxzmx", 'sdasdsads');
  echo $str;
  echo '<br />';
  echo do_mdecrypt($str, 'sdasdsads');*/
$str = 'ÄãºÃ<>' . PHP_EOL . 'abcd!@#$%^&*';
$str = iconv('GB2312', 'UTF-8', $str);
$htmlStr = htmlspecialchars($str);
//$wStr   = str_replace('&', '_', $htmlStr);
$mencrypt = do_mencrypt($htmlStr, 'aa');
$mdecrypt = do_mdecrypt($mencrypt, 'aa');
echo '<p style="border:2px red solid;">' . $str . '</p>';
echo '<p style="border:2px red solid;">' . $htmlStr . '</p>';
echo '<p style="border:2px red solid;word-break: break-all;">' . $mencrypt . '</p>';
echo '<p style="border:2px red solid;">' . $mdecrypt . '</p>';
function setUserCredential($userId)
{
    $_temp = rand(1000, 9999) . '|rongcloud|' . $userId . '|' . time();
    setcookie(AUTH_COOKIE_KEY, do_mencrypt($_temp, AUTH_COOKIE_KEY), time() + 3600 * 24 * 30);
}