Пример #1
0
<?php

require 'init.php';
header('Content-Type: application/json');
$result = array('result' => 'ok');
//set vote
$req = isset($_GET['video_id']) ? $_GET : $_POST;
if (isset($req['video_id']) && isset($req['rate'])) {
    $result['updated'] = updateRating($req['video_id'], $_POST['rate']);
}
//get next video
$result['video'] = getNextVideo(true, 1);
if ($result['video']) {
    $result['video']['title'] = 'test' . $result['video']['id'];
    $videoTagsIds = array_keys(db()->from('video_tags')->where('video_id = ?', $result['video']['id'])->fetchAll('tag_id'));
    $result['video']['tags'] = db()->from('tags')->where('id', $videoTagsIds)->fetchAll();
}
//show response
echo json_encode($result);
Пример #2
0
<?php

include_once '../models/connect_bdd.php';
include_once "../models/functions_bdd.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $id = $_POST["id"];
    $score = $_POST["score"];
    $res = updateRating($id, $score);
    return $res;
} else {
    return false;
}
Пример #3
0
<?php

//chdir(dirname(__FILE__));
require '../includes/connect.php';
require '../functions/string.php';
require "../functions/recentlyReleased.php";
require '../functions/getTodayShow.php';
require '../functions/updateRatings.php';
error_reporting(E_ALL);
ini_set('display_errors', 'On');
set_time_limit(7200);
/*
$py_script = "py\scraper.py";
$py_args = "";
//exec(pythondirectory file), must use python34 becuse of MySQLdb library
//exec('C:\Users\User\AppData\Local\Programs\Python\Python34\python.exe py\scraper.py');
*/
//update ratings
//format (just split by , and :)
//date:rating(imdb):votes,date:rating(imdb):votes, date:rating(imdb):votes, ..
updateRating(1);
echo "done updaterating";
Пример #4
0
<?php

require 'init.php';
//set vote
if (isset($_POST['video_id']) && isset($_POST['rate'])) {
    $result = updateRating($_POST['videoId'], $_POST['rate']);
    echo $result ? '1' : '0';
}
Пример #5
0
<?php

//chdir(dirname(__FILE__));
require '../includes/connect.php';
require '../functions/string.php';
require "../functions/recentlyReleased.php";
require '../functions/getTodayShow.php';
require '../functions/updateRatings.php';
error_reporting(E_ALL);
ini_set('display_errors', 'On');
set_time_limit(7200);
/*
$py_script = "py\scraper.py";
$py_args = "";
//exec(pythondirectory file), must use python34 becuse of MySQLdb library
//exec('C:\Users\User\AppData\Local\Programs\Python\Python34\python.exe py\scraper.py');
*/
echo "2";
//update ratings
//format (just split by , and :)
//date:rating(imdb):votes,date:rating(imdb):votes, date:rating(imdb):votes, ..
updateRating(2);
echo "done updaterating";