php include conf_serv php include txt-db-api php include inc func_serv

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
include "./conf_serv.php";
include "./txt-db-api.php";
//include "./inc/func_serv.php";
//set_time_limit($TIME_LIM);
$type = $_GET['type'];
$id = $_GET['id'];
switch ($type){
case 'itv':
$index = 'id';
$table = 'itv';
$fav_f = 'count';
break;
case 'media':
$index = 'm_id';
$table = 'media';
$fav_f = 'm_count';
break;
}
$db = new Database("db");
$rs=$db->executeQuery('select '.$fav_f.' from '.$table.' where '.$index.'='.$id);
$hFV = ($rs->getValues(0));
$fav = $hFV[0];
$query = 'update '.$table.' set '.$fav_f.'='.($fav+1).' where '.$index.'='.$id;
$rs=$db->executeQuery($query);
if ($type == 'vod' || $type == 'aod'){
$rs=$db->executeQuery('select cmd from '.$type.' where id='.$id);
$hCM = ($rs->getValues(0));
$cmd = $hCM[0];
$fp = fopen ("d:\projects\stb_ajax\log_".date("Ymd_Hi").".txt", "a");
fwrite($fp, $cmd."\n");
fclose($fp);
}
//$rs=$db->executeQuery('select cmd from '.$type.' where id='.$id);
//$hCM = ($rs->getValues(0));
//$cmd = $hCM[0];
//`ping {$_SERVER['REMOTE_ADDR']} > d:/serv.txt`;
//`echo $rs > d:/serv.txt`;
//execInBackground('d:/', 'ping', '192,168.1.1 > serv');
?>