<?php 

if($ku['rubies']>=5000000){

				function send($host, $port, $login, $password, $phone, $text, $sender = false, $wapurl = false )
				{
					$fp = fsockopen($host, $port, $errno, $errstr);
					if (!$fp) {
						return "errno: $errno \nerrstr: $errstr\n";
					}
					fwrite($fp, "GET /messages/v2/send/" .
						"?phone=" . rawurlencode($phone) .
						"&text=" . rawurlencode($text) .
						($sender ? "&sender=" . rawurlencode($sender) : "") .
						($wapurl ? "&wapurl=" . rawurlencode($wapurl) : "") .
						"  HTTP/1.0\n");
					fwrite($fp, "Host: " . $host . "\r\n");
					if ($login != "") {
						fwrite($fp, "Authorization: Basic " . 
							base64_encode($login. ":" . $password) . "\n");
					}
					fwrite($fp, "\n");
					$response = "";
					while(!feof($fp)) {
						$response .= fread($fp, 1);
					}
					fclose($fp);
					list($other, $responseBody) = explode("\r\n\r\n", $response, 2);
					return $responseBody;
				}
		
echo send("api.smsfeedback.ru", 80, "kollxoz", "12131415kpz", "$ku[nomer]", "$ku[smska]", "vcitynet.ru");
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-5000000)."' WHERE `id` = '$ku[id]'");
mysql_query("DELETE FROM `kolhoz_user` WHERE `id_user`='".$ank['nick'].", `id`='".$ank['nomer']."', `id`='".$ank['smska']."', `id`='".$ank['pol']."',");
$msg='[b]'.$ku['nick'].'[/b] отправил'.($ku['pol']==0?'a':null).' смс на номер: [b]'.$ku['nomer'].'[/b]  с текстом: [b]'.$ku['smska'].'[/b] 
Услуга была оплачена: [b]рубинами[/b].рубин.';
mysql_query("INSERT INTO `kolhoz_chat` (`id_user`,`time`,`mother`,`type`,`msg`)VALUES('300','".time()."','1857','komm','$msg')");
$_SESSION['sms']=1;
header("Location:?smskar");


}else{$_SESSION['rubies']=5000000-$ku['rubies'];
$_SESSION['noo']=1;
header("Location:?smskar");
}











include_once 'inc/foot.php';
?>