<?
error_reporting(0);
@error_reporting(E_ALL ^ E_NOTICE);
@ini_set('display_errors', false);
@ini_set('html_errors', false);
@ini_set('error_reporting', E_ALL ^ E_NOTICE);
require_once("curl_http_client.php");
$curl = new Curl_HTTP_Client();
$useragent = 'Mozilla/5.0 (Windows 8.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36';
$curl->set_user_agent($useragent);
$cookies_file = 'cookie.txt';
$curl->store_cookies($cookies_file);
$curl->set_referrer("http://www.perfectum.uz/interactive/sendsms");
if (isset($_GET['captcha'])){
$captchas = 'http://www.perfectum.uz/kcaptcha/index.php';

$captcha = $curl->fetch_url("".$captchas."");	
//	echo $captcha;	

header("Content-Type: image/jpeg");
	echo $captcha;	
	exit();



}
define('_IN_JOHNCMS', 1);
$textl = 'Bepul sms yuborish (Perfectum Mobile)';
$rootpath='../../';
include_once $rootpath.'incfiles/core.php';
require('../../incfiles/head.php');
if (isset($_POST['ok'])){
$number = trim($_POST['receiver']);
	$captcha = $_POST['codevalue'];
	$message = $_POST['smsmessage'];
	$sender = $_POST['sender'];


	
#captcha filterlash
	if ( empty($captcha) )
	{
		$error .= 'Xatolik! Rasm dagi himoya kodini kiritmadingiz!.';
	}

	# Raqamni filterlash
	if ( empty($number) )
	{
		$error .= 'Xatolik! Raqamingiz kiritilmadi.';
	}
	elseif ( !preg_match("/^[0-9]*$/", $number) )
	{
		$error .= 'Telefon raqamida faqat sonlar qatnashishi va raqamlar orasida bo\'sh joy bo\'lmasligi kerak.';
	}
	elseif ( !(strlen($number) == 7) )
{
$error .= 'Telefon raqami uzunligi 7 ta belgidan iborat bo\'lishi lozim.';
}
# Xabarni filterlash
	if ( empty($message) )
	{
		$error .= 'Xatolik! Xabar matni kiritilmadi.';
	}
	elseif( !preg_match("#^([A-zА-я0-9\'\`\,\(\)\.\:\!\?\$\%\&\*\@\~\-\_\n\r ])+$#ui", $message) )
	{
		$error .= 'Xatolik! Xabar matnida taqiqlangan belgilar mavjud yoki kril alifbosi belgilari ishlatilgan.';
	}
	elseif ( strlen($message) > 140 || strlen($message) < 2 )
	{
		$error .= 'Xabar matni uzunligi 2-140 ta belgidan iborat bo\'lishi lozim.';
	}

	if ( isset($error) )
	{
		echo $error."\n:: <a href=\"perfectum\">Qayta urinib ko'rish</a>";
	}

$message = $message."\n--\nAjoyib.Ru";
	
	$post_data = array('sender' => $sender, 'submit' => '1', 'smsmessage' => $message, 
	'receiver' => $number, 'codevalue' => $captcha);
	
	$html_data = $curl->send_post_data("http://www.perfectum.uz/send-sms.php", $post_data);
	
	include('simple_html_dom.php');
	$html = str_get_html($html_data);
	$result_1 = $html->find('div[class=error', 0) -> innertext;
	$result_2 = $html->find('div[class=error"]', 0) -> innertext;
	$result_3 = $html->find('div[class=error', 0) -> innertext;
	if ($result_1 != null)
	{
		if ($result_1 == 'Не указан номер')
			$message = 'Raqam kiritilmadi';
		else
			$message = 'Xatolik! Bir necha daqiqalardan keyin urinib ko\'ring!';
	}
	elseif ($result_2 = 'Не введен код')
		$message = '+99898<b>'.$number.'</b> raqamiga SMS muvaffaqiyatli jo\'natildi!';
		
	elseif ($result_3 != null)
	{

		$message = '+99898<b>'.$number.'</b> raqamiga SMS muvaffaqiyatli jo\'natildi!';
	}
	else
	{
		$message = 'Xatolik! Bir necha daqiqalardan keyin urinib ko\'ring!';
}
echo '<div class="tmn">'.$message.'</div>';
}
echo '
<script type="text/javascript" src="text_count.js"></script>
';
echo "<div align='center' class='phdr'>".$textl."</div>";

		
echo <<<ECH
	<div class="menu">  
	<form action="index.php" method="POST" accept-charset="utf-8" enctype="application/x-www-form-urlencoded" > 
	Raqam: <br/> 
<select><option value="">+99898</option></select>
	<input type="text" size="7" maxlength="7" name="receiver" value="" {CLASS}/><br>
	Ism:<br/>
	<input type="text" size="15" maxlength="15" name="sender" value=""/><br>
	Xabar matni:<br/>
	<textarea id="smsarea" name="smsmessage"></textarea><br/>
	<input id="symleft" type="text" size="3" maxlength="3" readonly="true"/></span> - belgi qoldi<br/>
	Ruhsat etilgan belgilar: <span class="p_t">- _ , . ) ( ' ` ! : ? $ % & * @ ~</span>
	</div>
	<div class="list1">
	Tekshiruv kodi:<br/>
	<img src="?captcha" alt="Captcha"/><br/>
	Rasmdagi kodni yozing: <br/>
	<input type="text" name="codevalue" size="10" maxlength="10" value=""/><br>
	<input type="submit" name="ok" value="Yuborish">  
	</form> 
	</div>
	<div class="sdsfd">
	</div>
	<div class="menu"> 
<span style="color: red">Eslatma!</span><br/>
	1. SMS xabar qabul qiluvchidan hech qanday maxsus sozlamalar talab qilinmaydi, SMS'lar odatdagidek tartibda yuboriladi.<br/>
	2. Jo'natilgan SMS'lar har <b>2-3soniyadayoq</b> qabul qiluvchiga yetkaziladi!<br/>
	3. Agar qabul qiluvchi aloqadan tashqarida (o'chirilgan) bo'lsa. SMS aloqaga chiqqan paytda albatta yetkaziladi.<br/>
	4. Ushbu xizmatdan foydalanish ba'zi cheklovlardan tashqari, mutlaqo bepul hisoblanadi. <br/>
	<span style="color: red">Qat'iyan taqiqlanadi:</span><br/>
	1. Xabar matnida haqoratli so'zlar ishlatish.<br/>
	2. Xabar matnida O'zb. Res. Qonunchiligiga zid so'zlar ishlatish.<br/>
	3. Katta miqdorda SMS spam'lar tarqatish.<br/>
	4. Har turdagi reklamalar tarqatishda foydalanish.<br/>
	* Xizmatdan foydalangan har-bir foydalanuvchi haqidagi ma'lumotlar bazamizda saqlanib qoladi. Ushbu shartlar amal qilinmagan taqdirda qoidabuzarni topish biz uchun muammo bo'lmaydi. Qoidabuzar topilgach esa kechirilmaydi va qattiq qarshi chora ko'riladi!   
	</div>
ECH;
require('../../incfiles/end.php');


?>





