Noise Gate помоги =)
Добавлено: 08 окт 2010, 21:52
Код: Выделить всё
<?php// http://flapps.ru/forum/ - форум о создании приложений В Контакте require('VkApi.class.php'); $vote = $_POST['vote']; $app_id = '...'; $api_secret = '...'; $UserID = $_POST['viewer_id'];$auth_key = $_POST['auth_key'];$viewer_id= $_POST['viewer_id']; $real_key = md5($app_id."_".$UserID."_".$api_secret); if($vote>0){$vote2=$vote*100;} if ($auth_key == $real_key && $vote>0){ function get_url($query) {$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $query);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_TIMEOUT, 10);return curl_exec($ch);curl_close($ch);} function get_url2($query) {$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $query);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_TIMEOUT, 10);return curl_exec($ch);curl_close($ch);} $api = new VkApiNode($app_id, $api_secret);$query = $api->getBalance($UserID);$user_balance = new SimpleXMLElement(get_url($query)); if ($user_balance->balance >=$vote2) {get_url($query = $api->withdrawVotes($UserID, $vote2));get_url2($query = $api->addRating($UserID, $vote));} else echo "Error 2. Not Enought votes.";} else echo "Error. Transaction canceled.";?>