/* Decoded by unphp.net */
error_reporting (E_ALL &~E_NOTICE);
@ini_set('display_errors','Off');
$portal_anaus="spielhoelle";
require_once("./global.php");
require_once("./swf_game_global.php");
if ($wbbuserdata['can_use_spielhoelle'] != '1') {
eval ("\$msg = \"".$tpl->get("swf_game_info_useraccount_keine_rechte_zum_betreten")."\";");
$waittime = 7;
$url = "index.php?sid=$session[hash]";
eval("\$tpl->output(\"".$tpl->get("redirect")."\");");
exit;
}
$darfer=$db->query_first("SELECT game_download, game_download_anzahl, game_download_lastresetzeit, game_download_anzahlgesamt FROM bb".$n."_swf_game_users WHERE userid='".$wbbuserdata['userid']."'");
if ($darfer['game_download'] == 0) access_error();
$game_download = $darfer['game_download'];
$game_download_anzahl = $darfer['game_download_anzahl'];
$game_download_anzahlgesamt = $darfer['game_download_anzahlgesamt'];
$game_download_maxanzahl = $wbbuserdata['can_game_download_maxanzahl'];
$game_download_lastresetzeit = $darfer['game_download_lastresetzeit'];
$game_download_resetzeit_tage = $wbbuserdata['can_game_download_resetzeit_tage'];
$aktuelleZeit=time();
$resetnachXTagenSTAMP_DIFF = intval($darfer['game_download_lastresetzeit']+($wbbuserdata['can_game_download_resetzeit_tage']*86400));
$resetnachXTagen_formatiert = formatdate($dateformat,$resetnachXTagenSTAMP_DIFF);
$resetnachXTagen_uhrzeitformatiert = formatdate($timeformat,$resetnachXTagenSTAMP_DIFF);
$letzterreset_formatiert = formatdate($dateformat,$darfer['game_download_lastresetzeit']);
$letzterreset_uhrzeitformatiert = formatdate($timeformat,$darfer['game_download_lastresetzeit']);
if ($wbbuserdata['can_game_download_maxanzahl'] >0) {
if ($darfer['game_download_anzahl'] >= $wbbuserdata['can_game_download_maxanzahl']) {
if ($aktuelleZeit >= $resetnachXTagenSTAMP_DIFF) {
$db->query("UPDATE bb".$n."_swf_game_users SET game_download_anzahl='0',game_download_lastresetzeit='".$aktuelleZeit."' WHERE userid='".$wbbuserdata['userid']."'");
$darfer=$db->query_first("SELECT game_download, game_download_anzahl, game_download_lastresetzeit, game_download_anzahlgesamt FROM bb".$n."_swf_game_users WHERE userid='".$wbbuserdata['userid']."'");
}else{
$url = "swf_game.php?action=start&action2=start&sid=$session[hash]#anf";
$waittime = "2";
$msg = "Downloadlimit erreicht!
";
eval ("\$swf_game_zentral = \"".$tpl->get("swf_game_redirect_zentral")."\";");
require("swf_game.php");
exit();
}
}
}
if(isset($_REQUEST['action'])) $action=strip_tags($_REQUEST['action']);
else $action="";
if($swfconfig['guthaben']==1){
$hopfen=$db->query_first("SELECT * FROM bb".$n."_guthaben WHERE gutid='1'");
$waehrung=strip_tags($hopfen['waehrung']);
}
$gameid=intval($_REQUEST['gameid']);
$daten_aus_der_DB=$db->query_first("SELECT * FROM bb".$n."_swf_games WHERE gameid='".$gameid."'");
if ($daten_aus_der_DB['dl'] == 0) {
$url = "swf_game.php?action=start&action2=start&sid=$session[hash]#anf";
$waittime = "2";
$msg = "Wichtige Mitteilung!
Dieses Spiel steht aus Copyright Gründen nicht zum download bereit!";
eval ("\$swf_game_zentral = \"".$tpl->get("swf_game_redirect_zentral")."\";");
require("swf_game.php");
exit();
}
$db->query("INSERT INTO bb".$n."_swf_game_download (id,userid, username,gameid, gamename,downloadzeit) VALUES ('', '".$wbbuserdata['userid']."','".$wbbuserdata['username']."', '".$gameid."','".$daten_aus_der_DB['title']."','".time()."')");
if ($swfconfig['acp_artdesdownloades'] == 0) {
require_once("./acp/swf_lib/zip_erstellen.php");
if ($daten_aus_der_DB['hgames'] == 1) {
$url = "swf_game.php?action=start&action2=start&sid=$session[hash]#anf";
$waittime = "5";
$msg = "HTML5 Spiel download mit ZIP Packer nicht möglich!";
eval ("\$swf_game_zentral = \"".$tpl->get("swf_game_redirect_zentral")."\";");
require("swf_game.php");
exit();
}elseif ($daten_aus_der_DB['ibpro_game'] == 1) {
$url = "swf_game.php?action=start&action2=start&sid=$session[hash]#anf";
$waittime = "5";
$msg = "IbProArcade Spiel download mit ZIP Packer nicht möglich!";
eval ("\$swf_game_zentral = \"".$tpl->get("swf_game_redirect_zentral")."\";");
require("swf_game.php");
exit();
}else{
$zip_name=explode(".",$daten_aus_der_DB['filename']);
$datei_da="./arcade/gamedata/$zip_name[0]";
$zipfile = new zipfile();
$filename="./".$gameordner."/".$daten_aus_der_DB['filename']."";
$clearfilename=$daten_aus_der_DB['filename'];
$handle = fopen ($filename,"r");
$content = fread ($handle,filesize ($filename));
fclose ($handle);
$zipfile->add_file($content,$clearfilename,filemtime($filename));
$filename="./".$gifordner."/".$daten_aus_der_DB['thumbnailname']."";
$clearfilename=$daten_aus_der_DB['thumbnailname'];
$handle = fopen ($filename,"r");
$content = fread ($handle,filesize ($filename));
fclose ($handle);
$zipfile->add_file($content,$clearfilename,filemtime($filename));
if (file_exists($datei_da)) {
$zipfile ->add_dir("gamedata/".$zip_name[0]."/");
$path_datei="gamedata/".$zip_name[0]."/";
echodir($datei_da,$path_datei);
}
$dbfilename = $daten_aus_der_DB['name'].".sql";
$inhalt = "INSERT INTO bb1_swf_games (name, title, description, filename, thumbnailname, thumbnaildata, active, championactive, championid, championtext, championcolor, scorevar, width, height, codebase, querystring, objectparam, embedparam) VALUES ('".$daten_aus_der_DB['name']."','".$daten_aus_der_DB['title']."','".$daten_aus_der_DB['description']."','".$daten_aus_der_DB['filename']."','".$daten_aus_der_DB['thumbnailname']."','".$daten_aus_der_DB['thumbnaildata']."','".$daten_aus_der_DB['active']."','".$daten_aus_der_DB['championactive']."',".$daten_aus_der_DB['championid'].",'".$daten_aus_der_DB['championtext']." Champion','".$daten_aus_der_DB['championcolor']."','".$daten_aus_der_DB['scorevar']."',".$daten_aus_der_DB['width'].",".$daten_aus_der_DB['height'].",'".$daten_aus_der_DB['codebase']."','".$daten_aus_der_DB['querystring']."','".$daten_aus_der_DB['objectparam']."','".$daten_aus_der_DB['embedparam']."');";
$zipfile->add_File($inhalt,$dbfilename);
$dbfilename = $daten_aus_der_DB['name'].".php";
$daten_aus_der_DB[scorevar] = str_replace("$","",$daten_aus_der_DB[scorevar]);
$daten_aus_der_DB[title] = filter_hochkomma($daten_aus_der_DB[title]);
$daten_aus_der_DB[championtext] = filter_hochkomma($daten_aus_der_DB[championtext]);
$daten_aus_der_DB['description'] = html_entity_decode($daten_aus_der_DB['description']);
$daten_aus_der_DB_VG = explode('
',$daten_aus_der_DB['description']);
$inhalt=" '$daten_aus_der_DB[name]',
'gtitle' => '$daten_aus_der_DB[title]',
'bgcolor' => '000000',
'gwidth' => '$daten_aus_der_DB[width]',
'gheight' => '$daten_aus_der_DB[height]',
'active' => '1',
'gcat' => '1',
'gwords' => '$daten_aus_der_DB_VG[0]',
'object' => '$daten_aus_der_DB_VG[0]',
'gkeys' => '$daten_aus_der_DB_VG[1]',
'highscore_type' => 'high',
);?>";
$zipfile->add_File($inhalt,$dbfilename);
$dbfilename = "WICHTIG_BITTE_LESEN!.txt";
eval ("\$inhalt = \"".$tpl->get("swf_game_download_inhalt_anleitung_zip")."\";");
$zipfile->add_File($inhalt,$dbfilename);
header("HTTP/1.1 200 OK");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"$zip_name[0].zip\"");
header("Content-Transfer-Encoding: binary");
$db->query("UPDATE bb".$n."_swf_game_users SET game_download_anzahl=game_download_anzahl+1, game_download_anzahlgesamt=game_download_anzahlgesamt+1 WHERE userid='".$wbbuserdata['userid']."'");
echo $zipfile->file();
exit();
}
}else{
require_once("./acp/swf_lib/tar.php");
if ($daten_aus_der_DB['hgames'] == 1) {
$zip_name=explode(".",$daten_aus_der_DB['filename']);
$datei_da="./arcade/$zip_name[0]";
$tar = new Archive_Tar("arcade/$zip_name[0].tar");
$angelegtesfile = "arcade/$zip_name[0].tar";
$filename="./".$gifordner."/".$daten_aus_der_DB['thumbnailname']."";
$clearfilename=$daten_aus_der_DB['thumbnailname'];
$handle = fopen ($filename,"r");
$content = fread ($handle,filesize ($filename));
fclose ($handle);
$tar->addString($clearfilename,$content);
if (is_dir ('./arcade/'.$zip_name[0])){$tar->addModify ('./arcade/'.str_replace ('','',$zip_name[0]),'','./arcade');}
if (is_dir ('./arcade/gamedata/'.$zip_name[0])){$tar->addModify ('./arcade/gamedata/'.str_replace ('','',$zip_name[0]),'','./arcade');}
if (file_exists ('./arcade/arcadelib/'.str_replace ('','.txt',$zip_name[0]))){$tar->addModify ('./arcade/arcadelib/'.str_replace ($zip_name[0]),'','./arcade/');}
$dbfilename = $daten_aus_der_DB['name'].".php";
$daten_aus_der_DB['scorevar'] = str_replace("$","",$daten_aus_der_DB['scorevar']);
$daten_aus_der_DB['title'] = filter_hochkomma($daten_aus_der_DB['title']);
$daten_aus_der_DB['championtext'] = filter_hochkomma($daten_aus_der_DB['championtext']);
$daten_aus_der_DB['description'] = html_entity_decode($daten_aus_der_DB['description']);
$daten_aus_der_DB_VG = explode('
',$daten_aus_der_DB['description']);
$inhalt=" '$daten_aus_der_DB[name]',
'gtitle' => '$daten_aus_der_DB[title]',
'bgcolor' => '000000',
'gwidth' => '$daten_aus_der_DB[width]',
'gheight' => '$daten_aus_der_DB[height]',
'active' => '1',
'gcat' => '1',
'gwords' => '$daten_aus_der_DB_VG[0]',
'object' => '$daten_aus_der_DB_VG[0]',
'gkeys' => '$daten_aus_der_DB_VG[1]',
'highscore_type' => 'high',
);?>";
$tar->addString($dbfilename,$inhalt);
$db->query("UPDATE bb".$n."_swf_game_users SET game_download_anzahl=game_download_anzahl+1, game_download_anzahlgesamt=game_download_anzahlgesamt+1 WHERE userid='".$wbbuserdata['userid']."'");
$db->query("UPDATE bb".$n."_swf_games SET download_anzahl=download_anzahl+1 WHERE gameid='".$gameid."'");
$file1 = "".$zip_name[0].".tar";$file2 = "game_".$zip_name[0].".tar";
$filedownload1 = "arcade/$file1";$filedownload2 = "arcade/$file2";
$src = $filedownload1;$des = $filedownload2;
@rename ($src,$des);
$filedownload = "arcade/$file2";
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$file2\"");
readfile($filedownload2);
if (file_exists ($filedownload2)){
chmod ($filedownload2 ,0777);
unlink ($filedownload2);
}
exit();
}else{
$zip_name=explode(".",$daten_aus_der_DB['filename']);
$datei_da="./arcade/gamedata/$zip_name[0]";
$tar = new Archive_Tar("arcade/$zip_name[0].tar");
$angelegtesfile = "arcade/$zip_name[0].tar";
$filename="./".$gameordner."/".$daten_aus_der_DB['filename']."";
$clearfilename=$daten_aus_der_DB['filename'];
$handle = fopen ($filename,"r");
$content = fread ($handle,filesize ($filename));
fclose ($handle);
$tar->addString($clearfilename,$content);
chmod ($angelegtesfile,0777);
$filename="./".$gifordner."/".$daten_aus_der_DB['thumbnailname']."";
$clearfilename=$daten_aus_der_DB['thumbnailname'];
$handle = fopen ($filename,"r");
$content = fread ($handle,filesize ($filename));
fclose ($handle);
$tar->addString($clearfilename,$content);
$datei_einpacken_arcadelib = "$zip_name[0].txt";
if (is_dir ('./arcade/gamedata/'.$zip_name[0])){$tar->addModify ('./arcade/gamedata/'.str_replace ('','',$zip_name[0]),'','./arcade');}
if (file_exists ('./arcade/arcadelib/'.$datei_einpacken_arcadelib)){
$tar->addModify ('./arcade/arcadelib/'.$datei_einpacken_arcadelib);
$daten_aus_der_DB[ibpro_game] = '1';
}
$dbfilename = $daten_aus_der_DB['name'].".php";
$daten_aus_der_DB['scorevar'] = str_replace("$","",$daten_aus_der_DB['scorevar']);
$daten_aus_der_DB['title'] = filter_hochkomma($daten_aus_der_DB['title']);
$daten_aus_der_DB['championtext'] = filter_hochkomma($daten_aus_der_DB['championtext']);
$daten_aus_der_DB['description'] = html_entity_decode($daten_aus_der_DB['description']);
$daten_aus_der_DB_VG = explode('
',$daten_aus_der_DB['description']);
$inhalt=" '$daten_aus_der_DB[name]',
'gtitle' => '$daten_aus_der_DB[title]',
'bgcolor' => '000000',
'gwidth' => '$daten_aus_der_DB[width]',
'gheight' => '$daten_aus_der_DB[height]',
'active' => '1',
'gcat' => '1',
'gwords' => '$daten_aus_der_DB_VG[0]',
'object' => '$daten_aus_der_DB_VG[0]',
'gkeys' => '$daten_aus_der_DB_VG[1]',
'highscore_type' => 'high',
);?>";
$tar->addString($dbfilename,$inhalt);
$db->query("UPDATE bb".$n."_swf_game_users SET game_download_anzahl=game_download_anzahl+1, game_download_anzahlgesamt=game_download_anzahlgesamt+1 WHERE userid='".$wbbuserdata['userid']."'");
$db->query("UPDATE bb".$n."_swf_games SET download_anzahl=download_anzahl+1 WHERE gameid='".$gameid."'");
$file1 = "".$zip_name[0].".tar";$file2 = "game_".$zip_name[0].".tar";
$filedownload1 = "arcade/$file1";$filedownload2 = "arcade/$file2";
$src = $filedownload1;$des = $filedownload2;
@rename ($src,$des);
$filedownload = "arcade/$file2";
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$file2\"");
readfile($filedownload2);
if (file_exists ($filedownload2)){
chmod ($filedownload2 ,0777);
unlink ($filedownload2);
}
exit();
}
}
function echodir($path = ".",$path_datei1){
global $zipfile,$zip_name;
$dir = dir($path);
while(false !== ($file = $dir->read())){
if(("."== $file) OR (".."== $file)) continue;
if(is_dir($path."/".$file)){
$zipfile ->add_dir("gamedata/".$zip_name[0]."/".$file."/");
$path1="gamedata/".$zip_name[0]."/".$file."/";
echodir1($path."/".$file,$path1);
}else{
$filename=$path."/".$file."";
$clearfilename=$path_datei1."".$file;
$handle = fopen ($filename,"r");
$content = @fread ($handle,filesize ($filename));
fclose ($handle);
$zipfile->add_file($content,$clearfilename,filemtime($filename));
}
}
$dir->close();
}
function echodir2($path = ".",$path_datei1){
global $zipfile,$zip_name;
$dir = dir($path);
while(false !== ($file = $dir->read())){
if(("."== $file) OR (".."== $file)) continue;
if(is_dir($path."/".$file)){
$zipfile ->add_dir("".$zip_name[0]."/".$file."/");
$path1="".$zip_name[0]."/".$file."/";
echodir1($path."/".$file,$path1);
}else{
$filename=$path."/".$file."";
$clearfilename=$path_datei1."".$file;
$handle = fopen ($filename,"r");
$content = @fread ($handle,filesize ($filename));
fclose ($handle);
$zipfile->add_file($content,$clearfilename,filemtime($filename));
}
}
$dir->close();
}
function echodir1($path,$path1){
global $zipfile,$zip_name;
$dir = dir($path);
while(false !== ($file = $dir->read())){
if(("."== $file) OR (".."== $file)) continue;
$filename=$path."/".$file."";
$clearfilename=$path1."".$file;
$handle = fopen ($filename,"r");
$content = @fread ($handle,filesize ($filename));
fclose ($handle);
$zipfile->add_file($content,$clearfilename,filemtime($filename));
}
$dir->close();
};