File: /var/www/ilya/data/www/afish-ka.ru/modules/services/qr.inc
<?
$result = query("SELECT * FROM `shedule` WHERE `datetime`>=NOW() AND `aid`='".mysql_escape_string($global_vars['request'][2])."';"); // QR
if(mysql_num_rows($result)!=1)
die();
else {
$data = mysql_fetch_array($result);
list($actions_qr_date,$actions_qr_time)=explode(" ",$data['datetime']);
$actions_qr_date=explode("-",$actions_qr_date);
$actions_qr_time=explode(":",$actions_qr_time);
$firm = mysql_fetch_array(query("SELECT * FROM `firms` WHERE `id`='".$data['fid']."';"));
$action = query("SELECT * FROM `actions` WHERE `id`='".mysql_escape_string($global_vars['request'][2])."';");
$action = mysql_fetch_array($action);
$result = query("SELECT `type_subtitle`, `id`, `human_id`, `human_subid` FROM `firms_types` WHERE `id`='".$action['type']."' LIMIT 1;");
$actions_type = mysql_fetch_array($result);
$actions_type_id = $actions_type[1];
$actions_type_subhuman = $actions_type[3];
$actions_type_human = $actions_type[2];
$actions_type = $actions_type[0];
$actions_qr = "http://qrcode.kaywa.com/img.php?s=6&d=BEGIN%3AVCALENDAR%0D%0ABEGIN%3AVEVENT%0D%0ADTSTART%3A".$actions_qr_date[0].$actions_qr_date[1].$actions_qr_date[2]."T".$actions_qr_time[0].$actions_qr_time[1].$actions_qr_time[2]."%0D%0ADTEND%3A".$actions_qr_date[0].$actions_qr_date[1].$actions_qr_date[2]."T".$actions_qr_time[0].$actions_qr_time[1].$actions_qr_time[2]."%0D%0ASUMMARY%3A".urlencode($action['title'])."%0D%0ALOCATION%3A".urlencode($firm['title'])."%0D%0ADESCRIPTION%3A".urlencode($action['genre'].". Подробности на http://".$url.$actions_type_human."/".$actions_type_subhuman."/".$action['id']."/")."%0D%0AEND%3AVEVENT%0D%0AEND%3AVCALENDAR";
header("Location: ".$actions_qr);
}
?>