Exemplo n.º 1
0
 public function sent_sms_for_register_sub_member()
 {
     check_access_right('user', $this->session);
     if (!$this->input->post('mobile')) {
         exit('{"state":"error","message":"no mobile no."}');
     }
     if ($this->session->userdata('last_sent_sub_member') != "" && time() - intval($this->session->userdata('last_sent_sub_member')) < 50) {
         exit('{"state":"error", "message":"time limited"}');
     }
     $this->load->helper('sms');
     $this->load->helper('string');
     $this->load->database();
     $code = random_string('numeric', 6);
     $query = $this->db->query("insert into " . DB_PREFIX . "sms_verification (code, mobile) value (?, ?)", [$code, $this->input->post('mobile')]);
     if ($query === true) {
         $param_arr = ['title' => 'M平台', 'code' => $code, 'time' => '60'];
         $result = sms_send(1, $this->input->post('mobile'), $param_arr);
         if ($result === true) {
             $this->session->set_userdata('last_sent_sub_member', time());
             exit('{"state":"success", "message": "success"}');
         } else {
             exit('{"state":"error", "message": "error code: ' . $result . ', code: ' . $code . '"}');
         }
     } else {
         exit('{"state":"error", "message":"db error"}');
     }
 }
Exemplo n.º 2
0
function sms_coupon($coupon, $mobile = null)
{
    global $INI;
    if ($coupon['consume'] == 'Y' || $coupon['expire_time'] < strtotime(date('Y-m-d'))) {
        return $INI['system']['couponname'] . '已失效';
    }
    $user = Table::Fetch('user', $coupon['user_id']);
    $order = Table::Fetch('order', $coupon['order_id']);
    if (!Utility::IsMobile($mobile)) {
        $mobile = $order['mobile'];
        if (!Utility::IsMobile($mobile)) {
            $mobile = $user['mobile'];
        }
    }
    if (!Utility::IsMobile($mobile)) {
        return '请设置合法的手机号码,以便接受短信';
    }
    $team = Table::Fetch('team', $coupon['team_id']);
    $partner = Table::Fetch('partner', $coupon['partner_id']);
    $coupon['end'] = date('Y-n-j', $coupon['expire_time']);
    $coupon['name'] = $team['product'];
    $content = render('manage_tpl_smscoupon', array('partner' => $partner, 'coupon' => $coupon, 'user' => $user));
    if (true === ($code = sms_send($mobile, $content))) {
        Table::UpdateCache('coupon', $coupon['id'], array('sms' => array('`sms` + 1'), 'sms_time' => time()));
        return true;
    }
    return $code;
}
Exemplo n.º 3
0
 function _exec_sms_send()
 {
     $return = '';
     $to = '';
     $message = '';
     if (sms_init($this->Config)) {
         @extract($this->ScheduleInfo['vars']);
         $return = sms_send($to, $message);
     }
     return $return;
 }
 public function deliver(array $output = array())
 {
     if (empty($this->message->smsNumber)) {
         // Try to get the SMS number from the account.
         $account = user_load($this->message->uid);
         if (!empty($account->sms_user['number'])) {
             $this->message->smsNumber = $account->sms_user['number'];
         }
     }
     if (empty($this->message->smsNumber)) {
         throw new MessageNotifyException('Message cannot be sent using SMS as the "smsNumber" property is missing from the Message entity or user entity.');
     }
     return sms_send($this->message->smsNumber, strip_tags($output['message_notify_sms_body']));
 }
/**
 * Define your hook for specific SMS keyword. 
 * Return true to mark SMS as processed and 
 * will be passed on next processing.
 * Return false will cause the SMS to be 
 * reprocessed infinitely until you return true.
 */
function my_hook_test_function($keyword, $params)
{
    global $app_name, $app_version, $nama_modem;
    // Sometime, you don't need to reply SMS from non-user number,
    // such as SMS from Service Center, message center,
    // or promotional SMS:
    if (strlen($params['sender']) <= 6) {
        return true;
    } else {
        // If the SMS requires reply, do it as follows:
        /*
         * return sms_send($params['sender'], 
         *                   'Thank your for texting us.', 
         *                   $nama_modem);
         */
        // or simply return true without replying it:
        /*
         * return true;
         */
        return sms_send($params['sender'], "Test OK. {$app_name} v.{$app_version} siap.", $nama_modem);
    }
}
/**
 * Define your hook for specific SMS keyword. 
 * Return true to mark SMS as processed and 
 * will be passed on next processing.
 * Return false will cause the SMS to be 
 * reprocessed infinitely until you return true.
 */
function my_hook_unknown_function($keyword, $params)
{
    global $app_name, $app_version, $nama_modem;
    // Sometime, you don't need to reply SMS from non-user number,
    // such as SMS from Service Center, message center,
    // or promotional SMS:
    if (strlen($params['sender']) <= 6) {
        return true;
    } else {
        // If the SMS requires reply, do it as follows:
        /*
         * return sms_send($params['sender'], 
         *                   'Thank your for texting us.', 
         *                   $nama_modem);
         */
        // or simply return true without replying it:
        /*
         * return true;
         */
        return sms_send($params['sender'], 'SMS tidak dikenali. Ketik INFO untuk mendapatkan daftar keyword.', $nama_modem);
    }
}
Exemplo n.º 7
0
function sms_coupon($coupon)
{
    global $INI;
    $coupon_user = Table::Fetch('user', $coupon['user_id']);
    if ($coupon['consume'] == 'Y' || $coupon['expire_time'] < strtotime(date('Y-m-d'))) {
        return $INI['system']['couponname'] . '已失效';
    } else {
        if (!Utility::IsMobile($coupon_user['mobile'])) {
            return '请设置合法的手机号码,以便接受短信';
        }
    }
    $team = Table::Fetch('team', $coupon['team_id']);
    $user = Table::Fetch('user', $coupon['user_id']);
    $coupon['end'] = date('Y-n-j', $coupon['expire_time']);
    $coupon['name'] = $team['product'];
    $content = render('manage_tpl_smscoupon', array('coupon' => $coupon, 'user' => $user));
    $content = trim(preg_replace("/[\\s]+/", '', $content));
    if (true === ($code = sms_send($coupon_user['mobile'], $content))) {
        Table::UpdateCache('coupon', $coupon['id'], array('sms' => array('`sms` + 1')));
        return true;
    }
    return $code;
}
/**
 * Define your hook for specific SMS keyword. 
 * Return true to mark SMS as processed and 
 * will be passed on next processing.
 * Return false will cause the SMS to be 
 * reprocessed infinitely until you return true.
 */
function my_hook_stok_function($keyword, $params)
{
    global $app_name, $app_version, $nama_modem;
    // Sometime, you don't need to reply SMS from non-user number,
    // such as SMS from Service Center, message center,
    // or promotional SMS:
    if (strlen($params['sender']) <= 6) {
        return true;
    } else {
        // If the SMS requires reply, do it as follows:
        /*
         * return sms_send($params['sender'], 
         *                   'Thank your for texting us.', 
         *                   $nama_modem);
         */
        // or simply return true without replying it:
        /*
         * return true;
         */
        $tersedia = fetch_one_value("select sum(stok_inkubator) from vw_inkubator_tersedia");
        return sms_send($params['sender'], 'Inkubator tersedia: ' . $tersedia . ' buah.', $nama_modem);
    }
}
/**
 * Define your hook for specific SMS keyword. 
 * Return true to mark SMS as processed and 
 * will be passed on next processing.
 * Return false will cause the SMS to be 
 * reprocessed infinitely until you return true.
 * 
 * AVOID HEAVY LONG PROCESS HERE. Database initializations are better be done on activation callback.
 */
function my_hook_monitor_function($keyword, $params)
{
    global $app_name, $app_version, $nama_modem;
    global $my_kembali_sms_format, $my_kembali_sms_sample;
    // Sometime, you don't need to reply SMS from non-user number,
    // such as SMS from Service Center, message center,
    // or promotional SMS:
    $valid_param_count = 5;
    // pre( $params);
    // return true;
    if (strlen($params['sender']) <= 6) {
        return true;
    } else {
        if (count($params['params']) != $valid_param_count) {
            sms_send($params['sender'], '1/2. SMS tidak valid. Jumlah parameter data harus ' . $valid_param_count . '.', $nama_modem);
            sms_send($params['sender'], '2/2. Format SMS: ' . $my_monitor_sms_format, $nama_modem);
            sms_send($params['sender'], '3/2. Contoh SMS: ' . $my_monitor_sms_sample, $nama_modem);
        } else {
            $kode_pinjam = strtoupper($params['params'][1]);
            // cek kode pinjam, jika ID = 0, berarti kode pinjam tidak valid:
            $id_pinjam = fetch_one_value("select coalesce( (\n                    select UUID_SHORT() id from inkubator_pinjam p where upper(p.kode_pinjam) = '{$kode_pinjam}'\n                    and p.status_pinjam  = 'Disetujui' \n                ),0) as id");
            if ($id_pinjam == 0) {
                sms_send($params['sender'], 'Kode Pinjam tidak ditemukan: ' . $kode_pinjam . '.', $nama_modem);
            } else {
                // proses SMS dan insert ke table `inkubator_kembali`:
                // Sample: KEMBALI*323431-353131-35*30*3.60*SEHAT;
                $p_pjg = trim($params['params'][2]);
                $p_berat = trim($params['params'][3]);
                $p_kondisi = strtoupper(trim($params['params'][4]));
                // cek tangal, panjang dan berat apakah formatnya sesuai atau tidak.
                // $p_validate_tgl     = '/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/'; // dd/mm/yyyy
                $p_validate_pjg = '/^[0-9]{1,2}+([\\,\\.][0-9]{1,2})?$/';
                // max2digits[.,]max2digits
                if (!preg_match($p_validate_pjg, $p_pjg)) {
                    sms_send($params['sender'], 'Maaf. Panjang bayi saat kembali salah. Contoh panjang bayi: 31.5', $nama_modem);
                } else {
                    if (!preg_match($p_validate_pjg, $p_berat)) {
                        sms_send($params['sender'], 'Maaf. Berat bayi saat kembali salah. Contoh berat bayi: 3,12', $nama_modem);
                    } else {
                        if ($p_kondisi != 'SEHAT' && $p_kondisi != 'SAKIT') {
                            sms_send($params['sender'], 'Maaf. Kondisi bayi salah. Harus SEHAT atau SAKIT.', $nama_modem);
                        } else {
                            // process tgl, berat & panjang:
                            // xx/yy/xxxx
                            $p_skor = $p_kondisi == 'SEHAT' ? 1 : 0;
                            $p_berat = str_replace(',', '.', $p_berat);
                            $p_pjg = str_replace(',', '.', $p_pjg);
                            // all set! save it to database.
                            $sub_mon_sql = "insert into inkubator_monitoring \n                \t\t(id, kode_pinjam, tgl_input, panjang_bayi, berat_bayi, kondisi, skor, keterangan)\n                \t   values\n                \t\t(UUID_SHORT(), '{$kode_pinjam}', CURRENT_TIMESTAMP(), {$p_pjg}, {$p_berat}, '{$p_kondisi}', {$p_skor},\n                \t\tconcat('Data monitoring ', (select p.nama_bayi from inkubator_pinjam p where p.kode_pinjam = '{$kode_pinjam}'))\n                \t   );";
                            /*
                            $f = fopen('d:/test-.txt','w');
                            fputs($f, $save_sql);
                            fputs($f, $sub_mon_sql);
                            fclose($f);
                            */
                            if (exec_query($sub_mon_sql)) {
                                sms_send($params['sender'], 'Data monitoring telah diterima.', $nama_modem);
                            } else {
                                sms_send($params['sender'], 'Maaf, server sedang sibuk. Cobalah beberapa saat lagi.', $nama_modem);
                            }
                        }
                    }
                }
            }
        }
        return true;
    }
}
Exemplo n.º 10
0
	function ticketCreate( $userid, $productid, $orderid )
	{
		Load::logic('product');
		$ProductLogic = new ProductLogic();
		$product = $ProductLogic->productGet($productid, 0, true);
		if ( $product['type'] == 'stuff' )
		{
						return true;
		}
				$rndLength = 12;
		$rndLoop = ceil($rndLength / 3);
		$rndString = '';
		for ( $i = 0; $i < $rndLoop; $i ++ )
		{
			$rndString .= ( string )rand(100, 999);
		}
		$rndString = substr($rndString, 0, $rndLength);
				$ticketNumber = $rndString;
		$ticketPassword = rand('100000', '999999');
		$ary = array(
			'uid' => $userid, 'productid' => $productid, 'orderid' => $orderid, 'number' => $ticketNumber, 'password' => authcode($ticketPassword, 'ENCODE', $this->Config['auth_key']), 'status' => 1
		);
		$this->DatabaseHandler->SetTable(TABLE_PREFIX . 'tttuangou_ticket');
		$result = $this->DatabaseHandler->Insert($ary);
		$sms = ConfigHandler::get('sms');
		if ( $sms['power'] == 'on' )
		{
									$sql = 'SELECT * FROM ' . TABLE_PREFIX . 'system_members WHERE uid=' . $userid;
			$userInfo = $this->DatabaseHandler->Query($sql)->GetRow();
			if ( is_numeric($userInfo['phone']) )
			{
								$sql = '
					SELECT
						p.name, p.perioddate, s.sellerphone, s.selleraddress
					FROM
						' . TABLE_PREFIX . 'tttuangou_product p LEFT join ' . TABLE_PREFIX . 'tttuangou_seller s on p.sellerid=s.id
					WHERE p.id=' . $productid;
				$ticketInfo = $this->DatabaseHandler->Query($sql)->GetRow();
				$smsContent = str_replace(array(
					'{user_name}', '{product_name}', '{ticket_number}', '{ticket_password}', '{perioddate}', '{seller_phone}', '{seller_address}', '{site_name}'
				), array(
					$userInfo['username'], $ticketInfo['name'], $ticketNumber, $ticketPassword, date('Y-m-d', $ticketInfo['perioddate']), $ticketInfo['sellerphone'], $ticketInfo['selleraddress'], $this->Config['site_name']
				), $sms['template']);
				Load::functions('sms');
				$result = sms_send($userInfo['phone'], $smsContent);
				$sql = 'INSERT INTO ' . TABLE_PREFIX . 'tttuangou_sms (id, name, phone, content, mid, state)VALUES(NULL, "' . $userInfo['username'] . '", "' . $userInfo['phone'] . '", "' . $smsContent . '", "' . $result['msgid'] . '", "' . $result['msgstate'] . '")';
								$this->DatabaseHandler->Query($sql);
			}
		}
				Load::logic('order');
		$OrderLogic = new OrderLogic();
		$OrderLogic->orderType($orderid, 9);
		return true;
	}
Exemplo n.º 11
0
     if (!$Title) {
         showmsg("短信内容不能为空");
     }
     $Num = 1;
     $detail = explode("\r\n", $mobDB);
 } else {
     $detail = explode(",", $mobDB);
 }
 //$Title=urlencode($Title);
 $rows = $Num;
 $min = ($page - 1) * $rows;
 for ($i = $min; $i < $min + $rows; $i++) {
     if (!$detail[$i]) {
         continue;
     }
     if (sms_send($detail[$i], $Title) === 1) {
         $succeeNUM++;
     } else {
         $failNUM++;
     }
     $ck++;
 }
 $page++;
 if ($ck++) {
     $mobstr = implode(",", $detail);
     echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=?lfj={$lfj}&action={$action}&page={$page}&succeeNUM={$succeeNUM}&failNUM={$failNUM}&mobDB={$mobstr}&Title={$Title}'>";
     exit;
 } else {
     $succeeNUM = intval($succeeNUM);
     $failNUM = intval($failNUM);
     jump("短信发送完毕,发送成功的短信有 <font color=red>{$succeeNUM}</font> 条,发送失败的短信有 <font color=red>{$failNUM}</font> 条", "index.php?lfj={$lfj}&job={$action}", 30);
/**
 * Define your hook for specific SMS keyword. 
 * Return true to mark SMS as processed and 
 * will be passed on next processing.
 * Return false will cause the SMS to be 
 * reprocessed infinitely until you return true.
 */
function my_hook_pinjam_function($keyword, $params)
{
    global $app_name, $app_version, $nama_modem;
    global $my_pinjam_sms_format, $my_pinjam_sms_sample;
    // Sometime, you don't need to reply SMS from non-user number,
    // such as SMS from Service Center, message center,
    // or promotional SMS:
    $valid_param_count = 16;
    // pre( $params);
    // return true;
    if (strlen($params['sender']) <= 6) {
        return true;
    } else {
        if (count($params['params']) != $valid_param_count) {
            sms_send($params['sender'], '1/2. SMS tidak valid. Jumlah parameter data harus ' . $valid_param_count . '.', $nama_modem);
            sms_send($params['sender'], '2/2. Format SMS: ' . $my_pinjam_sms_format, $nama_modem);
            sms_send($params['sender'], '3/2. Contoh SMS: ' . $my_pinjam_sms_sample, $nama_modem);
        } else {
            // dapatkan ID dan KODE peminjaman:
            $sql_pinjam = "select (@idx:=UUID_SHORT()) id, /*hex(@idx) kode, */ concat(left(hex(@idx),6),'-',substr(hex(@idx),7,6),'-',right(hex(@idx),2)) kode limit 0,1";
            // pre( $params);
            fetch_query($sql_pinjam);
            $meta_pinjam = fetch_query($sql_pinjam);
            $id_pinjam = $meta_pinjam[0]['id'];
            $kode_pinjam = $meta_pinjam[0]['kode'];
            // proses SMS dan insert ke table `inkubator_pinjam`:
            // Format: PINJAM*NAMA_BAYI*TGL_LAHIR*TGL_PULANG_RS*CM_PJGLAHIR*KG_BERATLAHIR*<SEHAT/SAKIT>*NAMA_RS*NM_DOKTER/BIDAN*NO_KK*ALAMAT*NAMA_IBU*NAMA_AYAH
            // Sample: PINJAM*DIAN KHAMSAWARNI*21/09/2015*23/09/2015*28*3,2*SEHAT*RSU Wahidin*Dr. Marhamah, Sp.OG*9288299288*BTN Hamzy E8/A*RINA MAWARNI*ARIFIN ADINEGORO
            $p_nama_bayi = trim($params['params'][1]);
            $p_kelamin = strtolower(trim($params['params'][2]));
            $p_tgl_lahir = trim($params['params'][3]);
            $p_tgl_pulang = trim($params['params'][4]);
            $p_pjg_lahir = trim($params['params'][5]);
            $p_berat_lahir = trim($params['params'][6]);
            $p_kondisi = strtoupper(trim($params['params'][7]));
            $p_rumah_sakit = trim($params['params'][8]);
            $p_dokter = trim($params['params'][9]);
            $p_no_kk = trim($params['params'][10]);
            $p_alamat = trim($params['params'][11]);
            $p_nama_ibu = trim($params['params'][12]);
            $p_ktp_ibu = trim($params['params'][13]);
            $p_nama_ayah = trim($params['params'][14]);
            $p_ktp_ayah = trim($params['params'][15]);
            // cek tangal, panjang dan berat apakah formatnya sesuai atau tidak.
            $p_validate_tgl = '/^[0-9]{2}\\/[0-9]{2}\\/[0-9]{4}$/';
            // dd/mm/yyyy
            $p_validate_pjg = '/^[0-9]{1,2}+([\\,\\.][0-9]{1,2})?$/';
            // max2digits[.,]max2digits
            if ($p_kelamin != 'laki-laki' && $p_kelamin != 'perempuan') {
                sms_send($params['sender'], 'Maaf. Jenis Kelamin harus LAKI-LAKI atau PEREMPUAN.', $nama_modem);
            } else {
                if (!preg_match($p_validate_tgl, $p_tgl_lahir)) {
                    sms_send($params['sender'], 'Maaf. Tgl lahir salah format. Harus berformat dd/mm/yyyy.', $nama_modem);
                } else {
                    if (!preg_match($p_validate_tgl, $p_tgl_pulang)) {
                        sms_send($params['sender'], 'Maaf. Tgl pulang dari RS salah format. Harus berformat dd/mm/yyyy.', $nama_modem);
                    } else {
                        if (!preg_match($p_validate_pjg, $p_pjg_lahir)) {
                            sms_send($params['sender'], 'Maaf. Panjang bayi saat lahir salah. Contoh panjang bayi: 29', $nama_modem);
                        } else {
                            if (!preg_match($p_validate_pjg, $p_berat_lahir)) {
                                sms_send($params['sender'], 'Maaf. Berat bayi saat lahir salah. Contoh berat bayi: 2,69', $nama_modem);
                            } else {
                                if ($p_kondisi != 'SEHAT' && $p_kondisi != 'SAKIT') {
                                    sms_send($params['sender'], 'Maaf. Kondisi bayi salah. Harus SEHAT atau SAKIT.', $nama_modem);
                                } else {
                                    if (strlen($p_ktp_ibu) != 16) {
                                        sms_send($params['sender'], 'Maaf. Nomor KTP ibu harus 16 angka.', $nama_modem);
                                    } else {
                                        if (strlen($p_ktp_ayah) != 16) {
                                            sms_send($params['sender'], 'Maaf. Nomor KTP ayah harus 16 angka.', $nama_modem);
                                        } else {
                                            // process tgl, berat & panjang:
                                            // xx/yy/xxxx
                                            // $x = fopen('d:/testjk.txt','w'); fwrite($x, $p_kelamin); fclose($x);
                                            if ($p_kelamin == 'laki-laki') {
                                                $p_kelamin = 'Laki-Laki';
                                            } else {
                                                $p_kelamin = 'Perempuan';
                                            }
                                            $p_skor = $p_kondisi == 'SEHAT' ? 1 : 0;
                                            $p_tgl_lahir = substr($p_tgl_lahir, 6, 4) . '-' . substr($p_tgl_lahir, 3, 2) . '-' . substr($p_tgl_lahir, 0, 2);
                                            $p_tgl_pulang = substr($p_tgl_pulang, 6, 4) . '-' . substr($p_tgl_pulang, 3, 2) . '-' . substr($p_tgl_pulang, 0, 2);
                                            $p_berat_lahir = str_replace(',', '.', $p_berat_lahir);
                                            $p_pjg_lahir = str_replace(',', '.', $p_pjg_lahir);
                                            // all set! save it to database.
                                            $save_sql = "insert into inkubator_pinjam (\n                    id, kode_pinjam, id_inkubator, tgl_pinjam, nama_bayi, kembar, tgl_lahir, berat_lahir, panjang_lahir, \n                    kondisi, rumah_sakit, nama_dokter, tgl_pulang, no_kk, alamat, \n                    nama_ibu, hp_ibu, email_ibu,\n                    nama_ayah, hp_ayah, email_ayah,\n                    jumlah_pinjam, keterangan_status_pinjam, konfirmasi, ktp_ibu, ktp_ayah, jenis_kelamin    \n                ) values (\n                    {$id_pinjam}, '{$kode_pinjam}', 0, CURRENT_TIMESTAMP(), '{$p_nama_bayi}', 'N', '{$p_tgl_lahir}', {$p_berat_lahir}, {$p_pjg_lahir}, \n                    '{$p_kondisi}', '{$p_rumah_sakit}','{$p_dokter}', '{$p_tgl_pulang}', '{$p_no_kk}', '{$p_alamat}', \n                    '{$p_nama_ibu}', '" . $params['sender'] . "', '',\n                    '{$p_nama_ayah}', '" . $params['sender'] . "', '',\n                    1, 'Ditunda untuk review.', 'Y', '" . $p_ktp_ibu . "', '" . $p_ktp_ayah . "','{$p_kelamin}'\n                )";
                                            $sub_mon_sql = "insert into inkubator_monitoring \n                    (id, kode_pinjam, tgl_input, panjang_bayi, berat_bayi, kondisi, skor, keterangan)\n          \t       values\n                    ( UUID_SHORT(), '{$kode_pinjam}', CURRENT_TIMESTAMP(), {$p_pjg_lahir}, {$p_berat_lahir}, '{$p_kondisi}', {$p_skor}, 'Status awal {$p_nama_bayi}')";
                                            // $f = fopen('d:/test-.txt','w');
                                            /* Debug:
                                               fputs($f, $save_sql);
                                               fputs($f, $sub_mon_sql);
                                               fclose($f);
                                               */
                                            if (exec_query($save_sql)) {
                                                // reply SMS:
                                                if (exec_query($sub_mon_sql)) {
                                                    sms_send($params['sender'], 'Peminjaman sedang diproses. Kode Pinjam: ' . $kode_pinjam, $nama_modem);
                                                } else {
                                                    exec_query("delete from inkubator_pinjam where id = {$id_pinjam}");
                                                    sms_send($params['sender'], 'Maaf, server sedang sibuk. Cobalah beberapa saat lagi.', $nama_modem);
                                                }
                                            } else {
                                                sms_send($params['sender'], 'Maaf, server sedang sibuk. Cobalah beberapa saat lagi.', $nama_modem);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return true;
    }
}
Exemplo n.º 13
0
 /**
  * 获取短信验证码
  *
  * /user/Verifycode
  * @return Response
  */
 public function postVerifycode()
 {
     $rule = array('mobile_phone' => 'required');
     if ($error = $this->validateInput($rule)) {
         return $error;
     }
     // 检查手机号
     $mobile = trim(Input::get('mobile_phone'));
     if (User::where('mobile', $mobile)->first()) {
         return self::error(self::ERROR_MOBILE_REPREAT, '手机号码已经存在');
     }
     // 获取短信码
     $verify_code = get_randStr(6, 'NUMBER');
     $sms_text = sprintf('欢迎加入O2OMobile,您的申请验证码为%s,我们将竭诚为您服务,5分钟有效。', $verify_code);
     $send_ok = sms_send($mobile, $sms_text);
     if (!$send_ok) {
         return self::error(self::STATUS_BAD_REQUEST, '短信发送失败!');
     }
     //把验证码存入cache
     Cache::put('verifycode_' . $mobile, array('verify_code' => $verify_code, 'time' => time()), 10);
     $resp = array('verify_code' => $verify_code);
     return $this->json($resp);
 }
Exemplo n.º 14
0
                } else {
                    va_mail($mail_to, $t->get_var("admin_subject"), $admin_message, $email_headers);
                }
            }
            if ($admin_sms) {
                $admin_sms_recipient = get_setting_value($cc_info, "admin_sms_recipient", "");
                $admin_sms_originator = get_setting_value($cc_info, "admin_sms_originator", "");
                $t->set_block("admin_sms_recipient", $admin_sms_recipient);
                $t->set_block("admin_sms_originator", $admin_sms_originator);
                $t->set_block("admin_sms_message", $admin_sms_message);
                $t->set_var("basket", $items_text);
                $t->set_var("items", $items_text);
                $t->parse("admin_sms_recipient", false);
                $t->parse("admin_sms_originator", false);
                $t->parse("admin_sms_message", false);
                sms_send($t->get_var("admin_sms_recipient"), $t->get_var("admin_sms_message"), $t->get_var("admin_sms_originator"));
            }
        }
        header("Location: " . $return_page);
        exit;
    }
} else {
    // Prepopulate Name of Cardholder
    $db->query("SELECT name, first_name, last_name FROM " . $table_prefix . "orders WHERE order_id=" . $db->tosql($order_id, INTEGER));
    if ($db->next_record()) {
        $name = $db->f("name");
        $first_name = $db->f("first_name");
        $last_name = $db->f("last_name");
        @(list($l_first_name, $l_last_name) = explode(" ", $name, 2));
        if (!strlen($first_name)) {
            $first_name = $l_first_name;
Exemplo n.º 15
0
    $db->query("CREATE TABLE `{$pre}regnum` (\n\t`sid` varchar( 8 ) NOT NULL default '',\n\t`num` varchar( 6 ) NOT NULL default '',\n\t`posttime` int( 10 ) NOT NULL default '0',\n\tUNIQUE KEY `sid` ( `sid` ) ,\n\tKEY `posttime` ( `num` , `posttime` ) \n\t) TYPE = HEAP");
}
if (!$webdb[yzNumReg]) {
    showerr('系统没开放这个功能!');
}
$time = $timestamp - 60;
if ($db->get_one("SELECT * FROM {$pre}regnum WHERE sid='{$usr_sid}' AND posttime>{$time}")) {
    showerr("如果你的注册码还没有收到的话?请一分钟后再重发!");
}
$sms = rands(4);
$content = $webdb['webname'] . "提供给您的注册码是:(" . $sms . ")这四位数";
if ($webdb[yzNumReg] == 2) {
    if (!ereg("^1([0-9]{10})\$", $num)) {
        showerr('手机号码有误!' . $num);
    }
    if (sms_send($num, $sms)) {
        $db->query("REPLACE INTO `{$pre}regnum` ( `sid` , `num` , `posttime` ) VALUES ('{$usr_sid}', '{$sms}', '{$timestamp}')");
        showerr("信息已经成功发送到您指定的手机号码中,请注意查收,有可能会延迟几分钟,请耐心等待!", 1);
    } else {
        showerr("信息发送失败,可能是手机短信接口有问题!");
    }
} elseif ($webdb[yzNumReg] == 1) {
    $email = $num;
    $title = $webdb['webname'] . "提供给你的注册码信息";
    if (send_mail($email, $title, $content, $ifcheck = 1)) {
        $db->query("REPLACE INTO `{$pre}regnum` ( `sid` , `num` , `posttime` ) VALUES ('{$usr_sid}', '{$sms}', '{$timestamp}')");
        showerr("注册码信息已经成功发送到您的邮箱中,请注意查收", 1);
    } else {
        showerr("信息发送失败,可能是邮件发送功能配置有误!");
    }
}
Exemplo n.º 16
0
 public function _sendSms($sendinfo)
 {
     global $_W;
     load()->func('communication');
     $weid = $_W['uniacid'];
     //$username = $sendinfo['username'];
     //$pwd = $sendinfo['pwd'];
     $mobile = $sendinfo['mobile'];
     $content = $sendinfo['content'];
     //$target = "http://www.dxton.com/webservice/sms.asmx/Submit";
     //替换成自己的测试账号,参数顺序和wenservice对应
     //$post_data = "account=" . $username . "&password="******"&mobile=" . $mobile . "&content=" . rawurlencode($content);
     //请自己解析$gets字符串并实现自己的逻辑
     //<result>100</result>表示成功,其它的参考文档
     //$result = ihttp_request($target, $post_data);
     //$xml = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA);
     //$result = (string)$xml->result;
     //$message = (string)$xml->message;
     load()->func('sms');
     $result = sms_send($mobile, $content);
     return $result;
 }
Exemplo n.º 17
0
 function SmsReset()
 {
     if (!sms_init()) {
         $this->Messager('还没有开启手机短信功能', null);
     }
     $sms = jpost('sms', 'txt');
     $key = jpost('key', 'txt');
     $rets = sms_check_verify($sms, $key);
     if ($rets['error']) {
         $this->Messager($rets['result'] . " 请返回重试,或者<a href='index.php?mod=get_password'>点此重新发起验证</a>", "index.php?mod=get_password&code=sms_send&sms={$sms}&key={$key}");
     } else {
         if (jpost('reset_pwd_submit')) {
             $pwd = jpost('password');
             if (empty($pwd) || $pwd != jpost('confirm') || strlen($pwd) < 6) {
                 $this->Messager('两次输入的密码不一致!请设置5位以上的密码!', 'index.php?mod=get_password');
             }
             $info = sms_bind_info($sms);
             $uid = $info['uid'];
             if (empty($info) || $uid < 1) {
                 $this->Messager('此手机号未绑定任何帐号', null);
             }
             $member = jsg_member_info($uid);
             if (!$member) {
                 $this->Messager("用户ID【{$uid}】已经不存在了", null);
             }
             sms_enter_verify($sms);
             jsg_member_edit($member['nickname'], '', '', $pwd, '', '', 1);
             $msg = "【{$member['uid']}】{$member['nickname']},您的新密码已重新设置为 {$pwd} ,请注意保管!";
             sms_send($sms, $msg, 0);
             $this->Messager("新密码设置成功,现在为您转入登录界面.", $this->Config['site_url'] . "/index.php?mod=login");
         } else {
             $act_name = '重设您的新密码';
             include template('get_password_sms_reset');
         }
     }
 }
Exemplo n.º 18
0
        if (!eregi("^{$lfjuid}_", basename($idcardpic)) && $idcardpic != "idcard/{$lfjuid}.jpg") {
            showerr("请上传身份证复印件,不能引用其它图片!");
        }
        if ($idcardpic != "idcard/{$lfjuid}.jpg") {
            unlink(ROOT_PATH . "{$webdb['updir']}/idcard/{$lfjuid}.jpg");
            rename(ROOT_PATH . "{$webdb['updir']}/{$idcardpic}", ROOT_PATH . "{$webdb['updir']}/idcard/{$lfjuid}.jpg");
        }
    }
    $db->query("UPDATE {$pre}memberdata SET idcard='{$idcard}',truename='{$truename}',idcard_yz='-1' WHERE uid='{$lfjuid}'");
    refreshto("{$FROMURL}", "请等待管理员审核", 10);
} elseif ($action == 'mobphone') {
    $code = rand(1000, 9999);
    if (!eregi("^1(3|5|8)([0-9]{9})\$", $mobphone)) {
        showerr("手机号码有误!");
    }
    $msg = sms_send($mobphone, "你的验证码是:{$code}");
    if ($msg !== 1) {
        showerr("系统发送短信失败,有可能是你的手机号码有误,也有可能是系统的短信接口平台出现故障,请联系管理员在后台检查短信平台接口!");
    }
    $md5code = str_replace('+', '%2B', mymd5("{$code}\t{$mobphone}\t{$lfjuid}", "EN"));
    require dirname(__FILE__) . "/" . "head.php";
    require dirname(__FILE__) . "/" . "template/yz.htm";
    require dirname(__FILE__) . "/" . "foot.php";
} elseif ($action == 'mobphone2') {
    if ($lfjdb[mob_yz]) {
        showerr("请不要重复验证手机号码!");
    }
    if (!$yznum) {
        showerr("请输入验证码");
    } elseif (!$md5code) {
        showerr("资料有误");
Exemplo n.º 19
0
            if ($action == 'act_sendcoupon') {
                $order = Table::Fetch('order', $order_id);
                $team = Table::Fetch('team', $order['team_id']);
                $partner = Table::Fetch('partner', $team['partner_id']);
                $coupons = $_POST['coupon'];
                $mobile = $order['mobile'];
                $couponend = date('Y-n-j', $team['expire_time']);
                $sms_cnt = '';
                $sms_cnt .= $team['product'] . ',优券编号:';
                foreach ($coupons as $index => $coupon) {
                    $coupon_arr = Table::Fetch('coupon', $coupon);
                    $couponid = formatStrInsertWord($coupon, ' ', 3);
                    if ($index + 1 == count($coupons)) {
                        $coupon_str = $couponid;
                    } else {
                        $coupon_str = $couponid . ';';
                    }
                    $sms_cnt .= $coupon_str;
                    //	update the number of sms
                    DB::Update('coupon', $coupon, array('sms' => $coupon_arr['sms'] + 1));
                }
                $sms_cnt .= '。有效期至' . $couponend . '';
                // $sms_cnt .= '。商电:'.$partner['phone'].'';
                //	发送短信
                sms_send($mobile, $sms_cnt);
                Session::Set('notice', "本次优券重发短信成功!如有安装杀毒软件请检查是否被阻截,您也可以下载<a target=_blank href=http://m.milituan.net/m/iphone/index.html>青年优品APP</a>\n\n在线查看或打印抄写优券编号至商家消费");
                redirect(null);
            }
        }
    }
}
Exemplo n.º 20
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
$action = strval($_GET['action']);
$user_id = abs(intval($_GET['user_id']));
$user = Table::Fetch('user', $user_id);
$toolsbind = DB::GetTableRow('toolsbind', array('user_id' => $user_id));
if (empty($toolsbind) && $user['mobile']) {
    $toolsbind = $user;
    $toolsbind['tools'] = $user['mobile'];
}
if ($action == 'getrepaypwcode' && !empty($user) && !empty($toolsbind)) {
    if (empty($user['remcode'])) {
        $rand = substr(time(), -3) . rand(100, 999);
        Table::UpdateCache('user', $user_id, array('remcode' => $rand));
    } else {
        $rand = $user['remcode'];
    }
    sms_send($toolsbind['tools'], "{$rand}(米粒团找回密码验证码,请完成验证),如非本人操作,请忽略本短信。");
    echo 1;
    //成功
}
Exemplo n.º 21
0
 if (!Utility::IsMobile($_POST['mobile'])) {
     Session::Set('error', '手机号码不正确');
     redirect(WEB_ROOT . '/account/repass.php');
 } else {
     $sended = DB::GetQueryResult("SELECT mobile FROM verifycode WHERE mobile='" . $_POST['mobile'] . "' AND status=3 AND getip='" . Utility::GetRemoteIp() . "' AND dateline>'" . (time() - 3600) . "'");
     if ($sended) {
         Session::Set('error', '每IP每手机号每小时只能找回一次密码');
         redirect(WEB_ROOT . '/account/repass.php');
     } else {
         $user = Table::Fetch('user', strval($_POST['mobile']), 'mobile');
         if ($user) {
             //设置6位随机数字密码
             $new_password = Utility::VerifyCode();
             $content = $INI['system']['sitename'] . " 您的用户名:" . $user['username'] . " 新密码:" . $new_password . " 请及时修改密码。";
             //长度不能超过70个字符
             $ret = sms_send($_POST['mobile'], $content);
             if ($ret === true) {
                 //插入获取验证码数据记录
                 $verifycode_data = array('mobile' => $_POST['mobile'], 'getip' => Utility::GetRemoteIp(), 'verifycode' => $new_password, 'dateline' => time(), 'reguid' => $user['id'], 'regdateline' => time(), 'status' => 3);
                 $table = new Table('verifycode', $verifycode_data);
                 $table->insert(array('mobile', 'getip', 'verifycode', 'dateline', 'reguid', 'regdateline', 'status'));
                 $password = ZUser::GenPassword($new_password);
                 Table::UpdateCache('user', $user['id'], array('password' => $password, 'recode' => ''));
                 Session::Set('notice', '成功发送找回密码短信到手机号:' . $_POST['mobile'] . ' 请稍候查看短信及时修改密码');
                 redirect(WEB_ROOT . '/account/repass.php');
             } else {
                 Session::Set('error', '找回密码短信发送失败,错误码:' . $ret . '');
                 redirect(WEB_ROOT . '/account/repass.php');
             }
         }
         Session::Set('error', '你的手机号没有在本站注册');
Exemplo n.º 22
0
Arquivo: sms.php Projeto: noikiy/mdwp
         json('手机号码不正确', 'alert');
     }
     $exists = Table::Count('user', array('mobile' => $mobile));
     if ($exists >= 1) {
         json('此手机号已有会员绑定', 'alert');
     }
     $sended = DB::GetQueryResult("SELECT mobile FROM verifycode WHERE (status=4 or status=5) AND getip='" . Utility::GetRemoteIp() . "' AND dateline>'" . (time() - 3600) . "'");
     if ($sended) {
         json('每IP每手机号每小时只能获取一次验证码', 'alert');
     } else {
         //设置6位随机数字验证码
         $verifycode = Utility::VerifyCode();
         //发送验证码短信到手机
         $content = $INI['system']['sitename'] . " 您的手机号:" . $mobile . " 绑定验证码:" . $verifycode . " 一天内提交绑定有效。";
         //长度不能超过70个字符
         $ret = sms_send($mobile, $content);
         if ($ret === true) {
             //插入获取验证码数据记录
             $verifycode_data = array('mobile' => $mobile, 'getip' => Utility::GetRemoteIp(), 'verifycode' => $verifycode, 'dateline' => time(), 'status' => 4);
             $table = new Table('verifycode', $verifycode_data);
             $table->insert(array('mobile', 'getip', 'verifycode', 'dateline', 'status'));
             json('绑定验证码短信成功发送到手机号:' . $mobile . '', 'alert');
         } else {
             json('绑定验证码短信发送失败,错误码:' . $ret . '', 'alert');
         }
     }
 } elseif ('bindmobile_submit' == $action) {
     $mobile = strval($_GET['mobile']);
     $verifycode = strval($_GET['verifycode']);
     if (empty($mobile)) {
         json('手机号不能为空', 'alert');
/**
 * Define your hook for specific SMS keyword. 
 * Return true to mark SMS as processed and 
 * will be passed on next processing.
 * Return false will cause the SMS to be 
 * reprocessed infinitely until you return true.
 */
function my_hook_info_function($keyword, $params)
{
    global $app_name, $app_version, $nama_modem;
    global $my_info_kategori, $my_info_keyword;
    // Sometime, you don't need to reply SMS from non-user number,
    // such as SMS from Service Center, message center,
    // or promotional SMS:
    $param = $params['params'];
    if (strlen($params['sender']) <= 6) {
        return true;
    } else {
        // If the SMS requires reply, do it as follows:
        /*
         * return sms_send($params['sender'], 
         *                   'Thank your for texting us.', 
         *                   $nama_modem);
         */
        // or simply return true without replying it:
        /*
         * return true;
         */
        $c = count($param);
        $sql_kunci = "select k.keyword from sms_keywords k where (not (upper(k.keyword) in ('UNKNOWN',upper('{$my_info_keyword}')) ))\n                     and (k.kategori in (select s.kategori from sms_keywords s where s.keyword = '{$my_info_keyword}')) order by k.keyword asc";
        if ($c != 2) {
            $pesan1 = 'Terimakasih. Ketik ' . strtoupper($my_info_keyword) . DELIMITER . 'KATAKUNCI untuk bantuan.';
            $kunci = fetch_query($sql_kunci);
            $pesan2 = '';
            foreach ($kunci as $i => $item) {
                $pesan2 .= ',' . $item['keyword'];
            }
            $pesan2 = 'Format Kata Kunci yang Tersedia: ' . substr($pesan2, 1);
            unset($kunci);
        } else {
            $info_kw = strtoupper($param[1]);
            $kirim = keyword_fetch_by_keyword($info_kw);
            // $kirim = fetch_query("select format_sms, contoh_sms from sms_keywords where upper(keyword) = upper('$info_kw')" );
            if (count($kirim) == 0) {
                $pesan1 = 'Kata kunci ' . strtoupper($info_kw) . ' tidak ditemukan. Ketik ' . strtoupper($my_info_keyword) . ' untuk bantuan.';
                $kunci = fetch_query($sql_kunci);
                $pesan2 = '';
                foreach ($kunci as $i => $item) {
                    $pesan2 .= ',' . $item['keyword'];
                }
                $pesan2 = 'Format Kata Kunci yang Tersedia: ' . substr($pesan2, 1);
                unset($kunci);
            } else {
                $pesan1 = 'Format SMS: ' . $kirim['sms_format'];
                $pesan2 = 'Contoh SMS: ' . $kirim['sms_sample'];
            }
            unset($kirim);
        }
        $ok1 = sms_send($params['sender'], $pesan1, $nama_modem);
        $ok2 = true;
        if (!empty($pesan2)) {
            $ok2 = sms_send($params['sender'], $pesan2, $nama_modem);
        }
        return $ok1 && $ok2;
    }
}
Exemplo n.º 24
0
 } else {
     if ('noticesmssubscribe' == $action) {
         need_auth('team');
         $nid = abs(intval($_GET['nid']));
         $team = Table::Fetch('team', $id);
         $condition = array('enable' => 'Y');
         if (abs(intval($team['city_id']))) {
             $condition['city_id'] = abs(intval($team['city_id']));
         }
         $subs = DB::LimitQuery('smssubscribe', array('condition' => $condition, 'order' => 'ORDER BY id ASC', 'offset' => $nid, 'size' => 10));
         $content = render('manage_tpl_smssubscribe');
         if ($subs) {
             $mobiles = Utility::GetColumn($subs, 'mobile');
             $nid += count($mobiles);
             $mobiles = implode(',', $mobiles);
             $smsr = sms_send($mobiles, $content);
             if (true === $smsr) {
                 usleep(500000);
                 json("X.misc.noticenextsms({$id},{$nid});", 'eval');
             } else {
                 json("发送失败,错误码:{$smsr}", 'alert');
             }
         } else {
             json('订阅短信发送完毕', 'alert');
         }
     } else {
         if ('noticesubscribe' == $action) {
             need_auth('team');
             $nid = abs(intval($_GET['nid']));
             $now = time();
             $interval = abs(intval($INI['mail']['interval']));
Exemplo n.º 25
0
    }
    $code = $row['verifycode'];
    $record['total'] = $row['total'] + 1;
} else {
    $code = random(6, true);
    $record['uniacid'] = $_W['uniacid'];
    $record['receiver'] = $receiver;
    $record['verifycode'] = $code;
    $record['total'] = 1;
    $record['createtime'] = TIMESTAMP;
}
if (!empty($row)) {
    pdo_update('uni_verifycode', $record, array('id' => $row['id']));
} else {
    pdo_insert('uni_verifycode', $record);
}
if ($receiver_type == 'email') {
    load()->func('communication');
    $content = "您的邮箱验证码为: {$code} 您正在使用{$uniacid_arr['name']}相关功能, 需要你进行身份确认.";
    $result = ihttp_email($receiver, "{$uniacid_arr['name']}身份确认验证码", $content);
} else {
    $setting = uni_setting($_W['uniacid'], 'notify');
    $content = "您的短信验证码为: {$code} 您正在使用{$uniacid_arr['name']}相关功能, 需要你进行身份确认. " . random(3);
    load()->func('sms');
    $result = sms_send($receiver, $content);
}
if (is_error($result)) {
    header('error: ' . urlencode($result['message']));
    exit($result['message']);
}
exit('success');
Exemplo n.º 26
0
Arquivo: pay.php Projeto: noikiy/mdwp
	if ($leftnum <= 0) {
		Session::Set('error', '您购买本单产品的数量已经达到上限,快去关注一下其他产品吧!');
		redirect( WEB_ROOT . "/team.php?id={$id}"); 
	}
}

//payed order
if ( $order['state'] == 'pay' ) {  
	if ( is_get() ) {
		$user = Table::Fetch('user', $login_user['id'], 'id');
		if ($INI['sms']['buy']=='1' && Utility::IsMobile($user['mobile'])) {
			@session_start();
			$last_order_id = intval($_SESSION['last_order_id']);
			if($last_order_id != $order_id){
			$content = $INI['system']['sitename']." 团购项目:".$team['product']." 支付成功,感谢您的购买。";
			$ret = sms_send($user['mobile'], $content);
			$_SESSION['last_order_id'] = $order_id;
	
			}
		}
		die(include template('order_pay_success'));		
	} else {
		redirect(WEB_ROOT  . "/order/pay.php?id={$order_id}");
	}
}

$total_money = moneyit($order['origin'] -$order['ubi']- $login_user['money']);
if ($total_money<0) { 
	$total_money = 0; $order['service'] = 'credit'; 
} else if($_POST){
	$credit = moneyit($order['origin'] - $total_money);
Exemplo n.º 27
0
    $update = array();
    $update['notify'] = iserializer($notify);
    pdo_update('uni_settings', $update, array('uniacid' => $_W['uniacid']));
    if (!empty($_GPC['testsend']) && !empty($_GPC['receiver'])) {
        $result = ihttp_email($_GPC['receiver'], $_W['setting']['copyright']['sitename'] . '验证邮件' . date('Y-m-d H:i:s'), '如果您收到这封邮件则表示您系统的发送邮件配置成功!');
        if (is_error($result)) {
            message($result['message']);
        }
    }
    message('更新设置成功!', url('system/common'));
}
if (checksubmit('authmodesubmit')) {
    $authmode = intval($_GPC['authmode']);
    setting_save($authmode, 'authmode');
    message('更新设置成功!', url('system/common'));
}
if (checksubmit('sms_submit')) {
    $sms = $_GPC['sms'];
    setting_save($sms, 'sms');
    if (!empty($_GPC['sms_testsend']) && !empty($_GPC['sms_receiver'])) {
        load()->func('sms');
        $content = "您的验证码是:【{$_W['setting']['copyright']['sitename']}短信测试】。如需帮助请联系客服。";
        $result = sms_send($_GPC['sms_receiver'], $content, $_W['setting']['copyright']['sitename'], false);
        if (is_error($result)) {
            message($result['message']);
        }
    }
    message('更新设置成功!', url('system/common'));
}
setting_load(array('authmode', 'mail', 'sms'));
template('system/common');
Exemplo n.º 28
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
need_manager();
$action = strval($_GET['action']);
$id = abs(intval($_GET['id']));
$v = strval($_GET['v']);
if ('sms' == $action) {
    $mobile = $v;
    $html = render('manage_ajax_dialog_miscsms');
    json($html, 'dialog');
} else {
    if ('smssend' == $action) {
        $mobile = $v;
        $content = strval($_GET['content']);
        if (true === ($ret = sms_send($mobile, $content))) {
            json('call_succ();', 'eval');
        }
        json('call_fail("' . $ret . '");', 'eval');
    } else {
        if ('imageremove' == $action) {
            $team = Table::Fetch('team', $id);
            $field = "image{$v}";
            $relpath = $team[$field];
            $abspath = WWW_ROOT . '/static/' . $relpath;
            if (file_exists($abspath) && @unlink($abspath)) {
                Table::UpdateCache('team', $id, array($field => null));
                json(array(array('data' => '删除图片成功', 'type' => 'alert'), array('data' => "X.team.imageremovecall({$v});", 'type' => 'eval')), 'mix');
            }
            json('删除图片失败', 'alert');
        } else {
     }
     break;
 case 'tolak':
     $p_kode = post_var('pid', 0);
     $p_ket = post_var('pket', 'Peminjaman ditolak karena tidak memenuhi persyaratan');
     $p_hp_ibu = post_var('phpi', '');
     $p_hp_ayah = post_var('phpa', '');
     if ($p_kode == 0) {
         echo 'ERParameter tidak valid.';
     } else {
         $i_sql = "update inkubator_pinjam set status_pinjam = 'Ditolak', \n                                tgl_update_status_pinjam = CURRENT_TIMESTAMP(),\n                                keterangan_status_pinjam = '{$p_ket}' where kode_pinjam = '{$p_kode}'";
         // pre($i_sql);
         // $i_sql = "";
         if (exec_query($i_sql)) {
             if (!empty($p_hp_ibu)) {
                 sms_send($p_hp_ibu, $p_ket);
             }
             echo 'OKData peminjaman dengan kode <strong>' . $p_kode . '</strong> telah ditolak.';
         } else {
             echo 'ERPenolakan peminjaman gagal.';
         }
     }
     break;
 case 'delete':
     $p_kode = post_var('pid', 0);
     if ($p_kode == 0) {
         echo 'ERParameter tidak valid.';
     } else {
         $_mysqli->autocommit(false);
         if (exec_query("delete from inkubator_monitoring where kode_pinjam = '{$p_kode}'") && exec_query("delete from inkubator_pinjam where kode_pinjam = '{$p_kode}'") && exec_query("delete from inkubator_kembali where kode_pinjam = '{$p_kode}'")) {
             $_mysqli->commit();
Exemplo n.º 30
0
    $db->query("UPDATE `{$_pre}content` SET yz='{$yz}' WHERE id='{$id}'");
    jump("修改成功", "{$FROMURL}", '0');
} elseif ($job == "reply") {
    $rsdb = $db->get_one("SELECT * FROM `{$pre}form_reply` WHERE id='{$id}'");
    $rsdb[content] = En_TruePath($rsdb[content], 0);
    $rsdb[content] = editor_replace($rsdb[content]);
    get_admin_html('reply');
} elseif ($action == "reply") {
    $rsdb = $db->get_one("SELECT A.*,U.mobphone FROM `{$_pre}content` A LEFT JOIN `{$pre}memberdata` U ON A.uid=U.uid WHERE A.id='{$id}'");
    $db->query("DELETE FROM `{$pre}form_reply` WHERE id='{$id}'");
    $postdb[content] = En_TruePath($postdb[content]);
    $db->query("UPDATE `{$_pre}content` SET yz=1 WHERE id='{$id}'");
    $db->query("INSERT INTO `{$pre}form_reply` ( `id` , `mid` , `posttime` , `uid` , `username` , `content` , `ip` ) VALUES ('{$id}', '{$mid}', '{$timestamp}', '{$userdb['uid']}', '{$userdb['username']}', '{$postdb['content']}', '{$onlineip}')");
    //手机短信通知客户
    if ($send_sms) {
        if (!$rsdb[mobphone]) {
            $MSG = '客户没有设置手机号码,短信发送失败.';
        } else {
            $mdb = $db->get_one("SELECT * FROM {$_pre}module WHERE id='{$mid}' ");
            $Title = "你好,你在<{$webdb['webname']}-{$mdb['name']}>提的问题,管理员已作解答,请尽快上网查阅!";
            if (sms_send($rsdb[mobphone], $Title) === 1) {
                $MSG = '短信发送成功';
            } else {
                $MSG = '短信发送失败,请检查短信接口,是否帐号有误,或者是余额不足!';
            }
        }
    } else {
        $MSG = '回复成功';
    }
    jump($MSG, "{$admin_path}&job=view&mid={$mid}&id={$id}", '3');
}