<?php
/*
*
* @copyright (c) 2010 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include_once('path.inc.php'); // get the path ;)
include_once(ROOT_PATH.'/include/config.inc.php');
include_once(ROOT_PATH.'/include/char.inc.php');
include_once(ROOT_PATH.'/include/designfunctions.inc.php');
include_once(ROOT_PATH.'/include/parse.inc.php');
include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php');
// GET-Section
// Kritisch (SQL-Injections)
$char_id = validateUnsignedInteger($_GET['char_id'], null);
// Unkritisch
$ab = $_GET['ab'];
$user = $user_ida;
$char_1 = getChar($char_id);
if(!isUserOwnerOf($user_ida['id'],$char_id)) { exit; }
if($char_1['status'] == 'Frei') {
displayErrorMessage(NULL,'Dein Charakter ist frei!', displayHistoryBackLink());
exit;
}
if($char_1['besitzer'] != $user['id']) {
displayErrorMessage(NULL,'Das ist nicht dein Charakter!', displayHistoryBackLink());
exit;
}
// Ermittle den Abholcode (Eingefuehrt um das nutzen von Bots zu erschweren!)
$code_row = mysql_fetch_assoc(mysql_query('Select * from char_abholcodes where charid = '.$char_id));
if($code_row){
$abholstring = 'char_id='.$char_id.'&code='.$code_row['code'];
} else{
$abholstring = 'char_id='.$char_id;
}
#######################Kampf
if($ab == "Kampf") {
$kampf_a = mysql_fetch_array(mysql_query("SELECT char1, char2, id, dauer FROM kampf WHERE db_satz='$char_id' order by id DESC LIMIT 1"));
$kampf_a1 = getChar($kampf_a['char1']);
$kampf_a2 = getChar($kampf_a['char2']);
$zeit_in_sek = $kampf_a['dauer'] - time();
echo "< SCRIPT language = 'JavaScript' > " ;
?>
function showfight1(){
var Info = window.open("./kampf4.php?<?php echo $abholstring ; ?> ","","status=no,hotkeys=no,Height=600,Width=820,scrollbars=yes");
}
<?php
echo "< / SCRIPT > ";
?>
< p align = center id = "content" > < b > Kampf< / b > < br > < br >
<?php
echo "< b > $kampf_a1[name] vs. $kampf_a2[name]";
?>
< div align = 'center' id = 'timer' >
<?php
if($zeit_in_sek < = 0){
echo '< a href = "javascript:showfight1()" id = "content" > anzeigen< / a > ';
} else{
?>
< script type = 'text/javascript' >
v=new Date();
var ht=document.getElementById('timer');
function t(){
n=new Date();
s=<?php echo $zeit_in_sek ; ?> -Math.round((n.getTime()-v.getTime())/1000.);
m=0;
h=0;
if(s< 0 ) {
ht.innerHTML="<?php echo "<a href='javascript:showfight1()' id='content'>anzeigen</a>" ; ?> "
} else {
if(s>59){
m=Math.floor(s/60);s=s-m*60
}
if(m>59){
h=Math.floor(m/60);m=m-h*60
}
if(s< 10 ) {
s='0'+s
}
if(m< 10 ) {
m='0'+m
}
ht.innerHTML=h+':'+m+':'+s
}
window.setTimeout('t();',950);
}
window.onload=t;
< / script >
<?php
}
?>
< / div >
<?php
}
#######################Clan Kampf
if($ab == "Clan Kampf") {
echo "< SCRIPT language = 'JavaScript' > " ;
?>
function showfight(){
var Info = window.open("./clan_kampf.php?char_id=<?php echo $char_id ; ?> ","","status=no,hotkeys=no,Height=600,Width=820,scrollbars=yes");
}
<?php
echo "< / SCRIPT > ";
$kampf_a = mysql_fetch_array(mysql_query("SELECT c1.name AS c1name, c2.name, k.id, k.dauer FROM clan_kampf k LEFT JOIN chars c1 ON(k.char1=c1.id) LEFT JOIN chars c2 ON(k.char2=c2.id) WHERE k.db_satz='$char_id' LIMIT 1"));
$zeit_in_sek = $kampf_a[dauer] - time();
?>
< p align = center > < b > Clan Kampf< / b > < br > < br >
<?php
echo "< b > $kampf_a[c1name] vs. $kampf_a[name] < / b > < br > < br > ";
?>
< div align = 'center' id = 'timer' >
<?php
if($zeit_in_sek < = 0){
echo '< a href = "javascript:showfight()" > anzeigen< / a > ';
} else{
?>
< script type = 'text/javascript' > v = new Date (); var ht = document . getElementById ( 'timer' ); function t (){ n = new Date (); s = <?php echo $zeit_in_sek ; ?> - Math . round (( n . getTime () - v . getTime ()) / 1000. ); m = 0 ; h = 0 ; if ( s < 0 ){ ht . innerHTML = " <?php echo "<a href='javascript:showfight()'>Ergebnis zeigen</a>" ; ?> " } else { if ( s > 59 ){ m = Math . floor ( s / 60 ); s = s - m * 60 } if ( m > 59 ){ h = Math . floor ( m / 60 ); m = m - h * 60 } if ( s < 10 ){ s = '0' + s } if ( m < 10 ){ m = '0' + m } ht . innerHTML = h + ':' + m + ':' + s } window . setTimeout ( 't();' , 950 );} window . onload = t ;</ script >
<?php
}
?>
< / div >
<?php
}
#######################Schatz Suche Kampf
if($ab == "Schatz Suche") {
$kampf_a = mysql_fetch_array(mysql_query('select Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$char_id));
$zeit_in_sek = $kampf_a['dauer'];
echo "< SCRIPT language = 'JavaScript' > " ;
?>
function showfight(){
var Info = window.open("./schatz3.php?<?php echo $abholstring ; ?> ","","status=no,hotkeys=no,Height=600,Width=820,scrollbars=yes");
}
<?php
echo "< / SCRIPT > ";
echo "< p align = center id = 'content' > < b > Schatz Suche < / b > < br > < br > ";
?>
< div align = 'center' id = 'timer' >
<?php
if($zeit_in_sek < = 0){
echo '< a href = "javascript:showfight()" id = "content" > anzeigen< / a > ';
} else{
?>
< script type = 'text/javascript' > v = new Date (); var ht = document . getElementById ( 'timer' ); function t (){ n = new Date (); s = <?php echo $zeit_in_sek ; ?> - Math . round (( n . getTime () - v . getTime ()) / 1000. ); m = 0 ; h = 0 ; if ( s < 0 ){ ht . innerHTML = " <?php echo "<a href='javascript:showfight()' id='content'>Abholen</a>" ; ?> " } else { if ( s > 59 ){ m = Math . floor ( s / 60 ); s = s - m * 60 } if ( m > 59 ){ h = Math . floor ( m / 60 ); m = m - h * 60 } if ( s < 10 ){ s = '0' + s } if ( m < 10 ){ m = '0' + m } ht . innerHTML = h + ':' + m + ':' + s + '<br /><a href="./schatz3.php? <?php echo $abholstring ; ?> &abort=cancel">abbrechen</a>' } window . setTimeout ( 't();' , 950 );} window . onload = t ;</ script >
<?php
}
?>
< / div > < p align = center >
<?php
}
?>