<?php
require 'config.php';
// connect database
$conn = @mysql_connect($global_database_host, $global_database_username, $global_database_password);
mysql_query('set names "utf8"');
mysql_select_db($global_database, $conn);
$sql = "SELECT release_version, version_type, release_date, description, meta_keywords, meta_description FROM svr_release_note WHERE version_type = '1' AND is_active='1'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$release_version = $row["release_version"];
$array_release_version = explode("." , $release_version);
$release_version_s = $array_release_version[0] . '.'. $array_release_version[1] . '.'. $array_release_version[2];
	

// close database
mysql_close( $conn );
$link = 'http://down.qixing123.com/down/'.$release_version_s.'/7xing_'.$release_version_s.'.exe';
header("location:".$link);

// // e.g. http://www.qixing123.com/download.php?=.exe
// // e.g. http://www.qixing123.com/download.php?type=s&nd=123&id=456
// $type = $_GET['type']; // o/i
// $nd = $_GET['nd'];
// $id = $_GET['id'];

// $ext_name = '.exe';
// $version = '1.42.3.338';

// $file_full_path = 'down/online_installer_o1.exe';
// $file_name = '7xing_installer_' . $nd . '_' . $id . '.exe';

// // online installer
// $file_full_path = 'down/online_installer_o1.exe';
// $file_name = '7xing_installer_' . $nd . '_' . $id . '.exe';

// if ($type == 'i') {
    // // offline installer-default browser
    // $file_full_path = 'down/' . $version . '/install_' . $version . '_id1.exe';
    // $file_name = '7xing_' . $version . '_' . $nd . '_' . $id . '.exe';
// }
// if ($type == 's') {
    // // slient offline installer-default browser
    // $file_full_path = 'down/' . $version . '/install_' . $version . '_sd1.exe';
    // $file_name = '7xing_' . $version . '_' . $nd . '_' . $id . '.exe';
// }
// if ($type == 'si') {
    // // offline installer
    // $file_full_path = 'down/' . $version . '/install_' . $version . '_i1.exe';
    // $file_name = '7xing_' . $version . '_' . $nd . '_' . $id . '.exe';
// }
// if (file_exists($file_full_path)){
    // $file_size = filesize($file_full_path);
    // Header('Accept-Ranges: bytes');
    // Header('Content-Disposition: attachment; filename=' . $file_name);
    // Header('Content-Encoding: none');
    // Header('Content-Length: ' . $file_size);
    // Header('Content-Type: application/octet-stream');
    
    // ob_clean();
    // flush();
    // readfile($file_full_path);
	
    // //exit;
// }
// else {
    // echo 'File not exist.';
// }
?>