Page not found!"; } ################# FUNCTIONS ################################## function check_file_pwd($file_password){ $query="select * from customer_downloads where file_password='$file_password'"; $result=mysql_query($query); $num_rows=mysql_num_rows($result); mysql_free_result($result); return (bool)$num_rows; } function wrong_user_info(){ $out=file_get_contents("template.tpl"); $message="

Incorrect URL!

"; $out=str_replace("[message]", $message, $out); echo $out; exit(0); } function set_login_date($file_password){ $now=time(); $query="select login_date from customer_downloads where file_password='$file_password'"; $result=mysql_query($query); if($record=mysql_fetch_object($result)) $login_date=$record->login_date; else die("
Database login_date() error, contact administration.
"); mysql_free_result($result); if(!$login_date){ mysql_query("update customer_downloads set login_date='$now' where file_password='$file_password'"); $login_date=$now; } return $login_date; } function expired_message($login_date){ $out=file_get_contents("template.tpl"); $message="

The URL is expired!

"; $out=str_replace("[message]", $message, $out); echo $out; exit(0); } function process_download($file_password){ $query="select downloads_list.file_name as file_name, downloads_list.item_name as item_name from downloads_list,customer_downloads where customer_downloads.file_password='$file_password' and downloads_list.item_name=customer_downloads.item_name"; $result=mysql_query($query); if($record=mysql_fetch_object($result)){ $file_name=$record->file_name; $item_name=$record->item_name; } else die("
Database process_download() error: no file information found, contact administration.
"); if(file_exists("safe_dir/$file_name")){//check if file link exists and if not try to create one if(is_file("files/$file_password")) @unlink("files/$file_password"); if(!is_dir("files/$file_password")){ @mkdir("files/$file_password"); chmod("files/$file_password", 0775); } if(!is_link("files/$file_password/$file_name")) if(!@symlink ( "http://downloads.hearthstoneonline.com/safe_dir/$file_name", "files/$file_password/$file_name" )) die("
Can't create link  $file_name, contact administration.
"); } else die("
File doesn't exist in the repository, contact administration.
"); $message=<<$item_name

  1. Right click this link and click 'Save Target As'.
  2. Select destination and save the file to your hard drive.
HTML; $out=file_get_contents("template.tpl"); $out=str_replace("[message]", $message, $out); echo $out; exit(0); } ?>