<?php if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "") { header('HTTP/1.1 301 Moved Permanently'); header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); } session_start(); require 'class/slothmusic.class.php'; $slothMusic = new slothMusic(); if (!verify($_GET['code']) && !verify($_SESSION['access_token'])) { // Получение временного кода $slothMusic->auth_code(); } else { if (verify($_GET['code']) && !verify($_SESSION['access_token'])) { // Получение access_token для авторизации $_SESSION = array('access_token' => $slothMusic->access_token()); // Редирект, чтобы убрать временный код из адреса $slothMusic->redirect(); } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>slothMusic</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="description" content="Слушай музыку из VK.com, на любом устройстве."> <meta property="og:title" content="slothMusic" />
<?php /** * Receive bit rate the audio file via url. * @author Dmitry Pavlov <*****@*****.**> * @license https://raw.github.com/ifamed/slothMusic/master/LICENSE */ session_start(); set_time_limit(5); header('Content-Type: application/json'); require 'class/slothmusic.class.php'; if (verify($_POST['id']) && verify($_POST['owner_id']) && verify($_POST['uid'])) { try { $slothMusic = new slothMusic(); $data = array('id' => (int) $_POST['id'], 'owner_id' => (int) $_POST['owner_id'], 'uid' => (int) $_POST['uid']); $DBH = new PDO('mysql:host=famed.mysql.ukraine.com.ua;dbname=famed_sloth', 'famed_sloth', '6kgwqg54', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'')); if ($DBH) { $slothMusic->connect = $DBH; echo $slothMusic->execute($data); } else { $get_data = $this->get_data($data['owner_id'], $data['id']); echo $slothMusic->send($slothMusic->kbps($get_data->url, $get_data->duration)); } } catch (PDOException $e) { echo $slothMusic->send(0); } }
<?php session_start(); /** * Download audio from url. * @author Dmitry Pavlov <*****@*****.**> * @license https://raw.github.com/ifamed/slothMusic/master/LICENSE */ set_time_limit(10); require 'class/slothmusic.class.php'; if (verify($_GET['o']) && verify($_GET['i'])) { $data = array('owner_id' => (string) $_GET['o'], 'id' => (string) $_GET['i']); $slothMusic = new slothMusic(); $slothMusic->download($data['owner_id'], $data['id']); }