load("GLOBAL,SAFE"); $guthabenistda=checktable("bb".$n."_guthaben"); $result = $db->query_first("SELECT username FROM bb".$n."_users WHERE userid='$wbbuserdata[userid]'" ); $username1 = $result[0]; // get userid/username from session data $username = $username1; $userid = $wbbuserdata[userid]; $config = $db->query_first("SELECT * FROM bb".$n."_safeknacker_config"); if($guthabenistda==1){ $dummy3=$db->query_first("select waehrung from bb".$n."_guthaben where gutid='1'"); $geld=$dummy3['waehrung']; } else { $geld=$config['geld']; } $pott=$config['pott']; $einsatz=$config['einsatz']; $einsatz_min=$config['einsatz_min']; $safe_bis=$einsatz_min." und ".$einsatz; eval ("\$faq_safe = \"".$lang->get4eval("LANG_SAFE_FAQ_INHALT")."\";"); if($config['onoff'] == "0") { eval("\$tpl->output(\"".$tpl->get("safe_error")."\");"); exit(); }else if($action == "rang"){ if($wbbuserdata['can_safe_play']){ $result = $db->query("SELECT * FROM bb".$n."_safeknacker_user ORDER by jackpotwin DESC"); while($row = $db->fetch_array($result)) { $juser = $row[jackpotuser]; $jwin = $row[jackpotwin]; $jcode = $row[jackpotcode]; eval ("\$jackpot_main2 .= (\"".$tpl->get("safe_main2")."\");"); } eval("\$tpl->output(\"".$tpl->get("safe_rang")."\");"); exit(); }else{ eval("\$tpl->output(\"".$tpl->get("safe_nicht_berechtigt")."\");"); exit(); } } if($config['onoff'] == "0") { eval("\$tpl->output(\"".$tpl->get("safe_error")."\");"); exit(); }else $j=$db->query_first("SELECT * FROM bb".$n."_safeknacker"); if($wbbuserdata['can_safe_play']){ $result = $db->query_first("SELECT username FROM bb".$n."_users WHERE userid='$wbbuserdata[userid]'" ); $username1 = $result[0]; // get userid/username from session data $username = $username1; $userid = $wbbuserdata[userid]; if($guthabenistda==1){ $dummy2=$db->query_first("Select guthaben from bb".$n."_users where username='$username'"); $haben = $dummy2['guthaben']; if($haben<$einsatz){ eval("\$tpl->output(\"".$tpl->get("safe_no_guthaben")."\");"); exit(); } } if($action == "check"){ $j=$db->query_first("SELECT * FROM bb".$n."_safeknacker"); if($j['kombination'] == $_POST['kombination']){ $newkombination=rand(999,1); $oldkomb="".$_POST[kombination].""; $oldjack="".$j[jackpot].""; $db->query("TRUNCATE TABLE bb".$n."_safeknacker_kombi"); $db->query("TRUNCATE TABLE bb".$n."_safeknacker_kombi_user"); $db->query("UPDATE bb".$n."_safeknacker SET jackpot='".$pott."', kombination='".$newkombination."', versuche='0'"); $onpm= new onpm(); $msg_new="Der Inhalt in Höhe von". $oldjack ."Euros wurde mit der Kombination". $oldkomb ." von ".$username1." geknackt.\nDer Safecode wurde zurückgesetzt, die neue Kombination lautet jetzt: ".$newkombination; $onpm->insertpm("Safe wurde geknackt.",$msg_new,1,1,1); $db->query("INSERT INTO bb".$n."_safeknacker_user (jackpotuser,jackpotwin,jackpotcode) VALUES ('$username1','$oldjack','$oldkomb')"); if($guthabenistda==1){ $dummy=$db->query("update bb".$n."_users set guthaben=guthaben+'$oldjack' where username='$username'"); $db->query("INSERT INTO bb".$n."_kontoauszug (kid,userid,datum,info,betrag,art) VALUES ('','$userid','".time()."','Geknackter Jackpott in Safeknacker !','$oldjack','plus')"); } eval("\$tpl->output(\"".$tpl->get("safe_gewonnen")."\");"); exit; }else{ $lost_betrag=rand($einsatz_min,$einsatz); $newjackpot=$j[jackpot]+$lost_betrag; $versuche=$j[versuche]+1; $db->query("INSERT INTO bb".$n."_safeknacker_kombi SET id='".$versuche."', combination='".$_POST[kombination]."'"); if(!$db->query_first("select * from bb".$n."_safeknacker_kombi_user where userid='".$wbbuserdata[userid]."'")){ $db->query("INSERT INTO bb".$n."_safeknacker_kombi_user SET userid='".$wbbuserdata[userid]."',username='".addslashes($wbbuserdata[username])."',kombis=1"); }else { $db->query("update bb".$n."_safeknacker_kombi_user SET kombis=kombis+1 where userid='".$wbbuserdata[userid]."'"); } $db->query("UPDATE bb".$n."_safeknacker SET jackpot='".$newjackpot."', versuche='".$versuche."'"); if($guthabenistda==1){ $dummy=$db->query("update bb".$n."_users set guthaben=guthaben-'$lost_betrag' where username='$username'"); $db->query("INSERT INTO bb".$n."_kontoauszug (kid,userid,datum,info,betrag,art) VALUES ('','$userid','".time()."','Einsatz in Safeknacker !','$lost_betrag','minus')"); } eval("\$tpl->output(\"".$tpl->get("safe_verloren")."\");"); exit; } } $check = $db->query("SELECT * FROM bb".$n."_safeknacker"); while($row3 = $db->fetch_array($check)) { if($row3[versuche] > 0){ $schnitt2 = ($j[jackpot] - $config[pott]) / $j[versuche]; $schnitt = round($schnitt2,2); } if($row3[versuche] <= 0){ $schnitt ="0"; } } eval ("\$mitmachen .= (\"".$tpl->get("safe_mitmachen")."\");"); $jackpot_main2 = ""; $result = $db->query("SELECT * FROM bb".$n."_safeknacker_user ORDER by jackpotwin DESC LIMIT 3"); while($row = $db->fetch_array($result)) { $juser = $row[jackpotuser]; $jwin = $row[jackpotwin]; $jcode = $row[jackpotcode]; eval ("\$jackpot_main2 .= (\"".$tpl->get("safe_main2")."\");"); } $kombinationen = $db->query("SELECT * FROM bb".$n."_safeknacker_kombi ORDER BY combination ASC"); $kombi = $kombit = ""; while($row = $db->fetch_array($kombinationen)) $kombi .= "$row[combination], "; $suser = $db->query("SELECT * FROM bb".$n."_safeknacker_kombi_user ORDER BY kombis DESC limit 30"); $count=0; while($row = $db->fetch_array($suser)){ $count++; $rowclass=getone($count,"tablea","tableb"); $safe_tab=' '.$count.' '.$row[username].' '.$row[kombis].' '; if($count>15) $safetab_1 .= $safe_tab; else $safetab_2 .= $safe_tab; } if(empty($safetab_1)){ $safetab_1=' '.$lang->get("LANG_SAFE_INFOS_NOUSER").' '; } if(empty($safetab_2)){ $safetab_2=' '.$lang->get("LANG_SAFE_INFOS_NOUSER").' '; } eval("\$tpl->output(\"".$tpl->get("safe_main")."\");"); exit(); }else{ eval("\$tpl->output(\"".$tpl->get("safe_nicht_berechtigt")."\");"); exit(); } function checktable($tbl_name){ global $db,$n,$sqldb; $i=0; $res = $db->query("SHOW TABLES;"); while($row = $db->fetch_array($res)){ $tt="Tables_in_".$sqldb; if ($row[$tt]==$tbl_name){ $i=1; } } return $i; } ?>