LoGD Standardrelease steht hier zum Download zur Verfügung!

Zeige Source: /logd/creatures.php

Hier klicken für den Source, ODER
Weitere Dateien, von denen du den Quelltext sehen kannst:
(Das Lesen des Source, um sich spielerische Vorteile zu verschaffen, ist nicht erlaubt. Solltest du Schwachstellen oder Fehler entdecken, bist du als Spieler verpflichtet, diese zu melden.)

Source von: /logd/creatures.php

<?php    
require_once "common.php";
require_once 
"func/isnewday.php";
isnewday(2);

/*Änderungen von Rikkarda@silienta-logd.de*/
//select distinct creaturelevel,max(creaturehealth) as creaturehealth,max(creatureattack) as creatureattack,max(creaturedefense) as creaturedefense,max(creatureexp) as creatureexp,max(creaturegold) as creaturegold from creatures where creaturelevel<17 group by creaturelevel;
$creaturestattable="
+---------------+----------------+----------------+-----------------+-------------+--------------+
| creaturelevel | creaturehealth | creatureattack | creaturedefense | creatureexp | creaturegold |
+---------------+----------------+----------------+-----------------+-------------+--------------+
|             1 |             10 |              1 |               1 |          14 |           36 |
|             2 |             21 |              3 |               3 |          24 |           97 |
|             3 |             32 |              5 |               4 |          34 |          148 |
|             4 |             43 |              7 |               6 |          45 |          162 |
|             5 |             53 |              9 |               7 |          55 |          198 |
|             6 |             64 |             11 |               8 |          66 |          234 |
|             7 |             74 |             13 |              10 |          77 |          268 |
|             8 |             84 |             15 |              11 |          89 |          302 |
|             9 |             94 |             17 |              13 |         101 |          336 |
|            10 |            105 |             19 |              14 |         114 |          369 |
|            11 |            115 |             21 |              15 |         127 |          402 |
|            12 |            125 |             23 |              17 |         141 |          435 |
|            13 |            135 |             25 |              18 |         156 |          467 |
|            14 |            145 |             27 |              20 |         172 |          499 |
|            15 |            155 |             29 |              21 |         189 |          531 |
|            16 |            166 |             31 |              22 |         207 |          563 |
+---------------+----------------+----------------+-----------------+-------------+--------------+
"
;
$creaturestats=Array();
$creaturestattable=explode("\n",$creaturestattable);
// print_r($creaturestattable);
$x=0;
while (list(
$key,$val)=each($creaturestattable)){
    if (
strpos($val,"|")!==false){
        
// echo("$val`n");
        
$x++;
        
$a explode("|",$val);
        if (
$x==1){
            
$stats=array();
            while (list(
$key1,$val1)=each($a)){
                if (
trim($val1)>"") {
                    
$stats[$key1]=trim($val1);
                    
// output($val1." is col $key1`n");
                
}
            }
        }else{
            
reset($stats);
            while (list(
$key1,$val1)=each($stats)){
                
$creaturestats[(int)$a[1]][$val1]=trim($a[$key1]);
                
// output ("[".(int)$a[1]."][$val1]=".trim($a[$key1])."`n");
            
}
        }
    }
}
isnewday(2);

page_header("Creature Editor");

addnav("G?Zurück zur Grotte","superuser.php");
addnav("W?Zurück zum Weltlichen","village.php");
if (
$_POST[save]<>""){
    
// print_r($_POST);
    
reset($_POST);
    if (!isset(
$_POST['location'])) $_POST['location']=0;
    if (
$_POST[id]!=""){
        
$sql="UPDATE creatures SET ";
        
//unset($_POST[save]);
        
while (list($key,$val)=each($_POST)){
            if (
substr($key,0,8)=="creature"$sql.="$key = \"$val\", ";
        }
        
reset($creaturestats[(int)$_POST[creaturelevel]]);
        while (list(
$key,$val)=each($creaturestats[$_POST[creaturelevel]])){
            if ( 
$key!="creaturelevel" && substr($key,0,8)=="creature"){
                
$sql.="$key = \"".addslashes($val)."\", ";
            }
        }
        
$sql.=" location=\"".(int)($_POST['location'])."\" ";
        
//$sql = substr($sql,0,strlen($sql)-2);
        
        
$sql.= " WHERE creatureid='$_POST[id]'";
        
// output($sql);
        
db_query($sql);
        
output(db_affected_rows()." ".(db_affected_rows()==1?"Eintrag":"Einträge")." geändert.");
    }else{
        
$cols = array();
        
$vals = array();
        
        while (list(
$key,$val)=each($_POST)){
            if (
substr($key,0,8)=="creature" || $key=="location") {
                
array_push($cols,$key);
                
array_push($vals,$val);
                
//$sql.="$key = \"$val\", ";
            
}
        }
        
reset($creaturestats[(int)$_POST[creaturelevel]]);
        while (list(
$key,$val)=each($creaturestats[$_POST[creaturelevel]])){
            if (
$key!="creaturelevel"){
                
//$sql.="$key = \"".addslashes($val)."\", ";
                
array_push($cols,$key);
                
array_push($vals,$val);
            }
        }
        
$sql="INSERT INTO creatures (".join(",",$cols).",createdby) VALUES (\"".join("\",\"",$vals)."\",\"".addslashes($session['user']['login'])."\")";
        
//echo $sql;
        
db_query($sql);
    }
}
if (
$_GET['op']=="del"){
     
             
$sqlwegg2 "SELECT * FROM creatures WHERE  creatureid=$_GET[id] ";
             
$rowwegg2 mysql_query($sqlwegg2);
             
$rowwegg2 db_fetch_assoc($rowwegg2);
             
            
# echo ($row2['creaturename']);
            
           
$creaturename     $rowwegg2['creaturename'];
           
$creatureweapon     $rowwegg2['creatureweapon'];
           
$creaturelose    $rowwegg2['creaturelose'];
           
$createdby        $rowwegg2['createdby'];
           
    
debuglog("Das Monster $creaturename mit der Waffe $creatureweapon und der Todesmeldung $creaturelose
                       vom Autor 
$createdby wurde gelöscht.");
                       
    
$sql "DELETE FROM creatures WHERE creatureid = \"$_GET[id]\"";
    
db_query($sql);
    if (
db_affected_rows()>0){
        
output("Kreatur gelöscht`n`n");
    }else{
        
output("Kreatur nicht gelöscht: ".db_error(LINK));
    }
    
$_GET['op']="";
}
if (
$_GET['op']==""){
    
addnav("K?Eine Kreatur hinzufügen","creatures.php?op=add");

    
// Seitenweise Navigation, hinzu gefügt von Linus für alvion-logd.de
    
addnav("A?Alle Level","creatures.php?alle=alle");
    if(isset(
$_GET['alle']) && $_GET['alle']="alle"){
            
$sql "SELECT * FROM creatures ORDER BY creaturelevel, creaturename";
    } else {
        if(isset(
$_GET['level'])) $level=$_GET['level'];
        else 
$level=1;
        
$sql "SELECT * FROM creatures WHERE creaturelevel=$level ORDER BY creaturename";
    }
    
$result db_query($sql) or die(db_error(LINK));

    
$resmax=db_fetch_assoc(db_query("SELECT MAX(creaturelevel) AS m FROM creatures"));     
    
$maxlevel=$resmax['m'];    
    if(
$level>&& $level<$maxleveladdnav("E?Ein Level weiter","creatures.php?level=".($level+1)."");
    if(
$level>1addnav("z?Ein Level zurück","creatures.php?level=".($level-1)."");
    
addnav("Seiten");
    for(
$i=1;$i<=$maxlevel;$i++){
        
addnav("Level $i","creatures.php?level=$i");
    }
    
// Ende Seiten-Navi
    
    
output("<table><tr><td>Ops</td><td>Kreaturname</td><td>Level</td><td>Waffe</td><td>Nachricht beim Tod</td><td>Autor</td>",true);
    if(
$session[user][superuser]>=3output("<td><b>Input von</b></td>",true);

    
output("</tr>",true);
    
addnav("","creatures.php");
    for (
$i=0;$i<db_num_rows($result);$i++){
        
$row db_fetch_assoc($result);
                     
output("<tr class='".($i%2?"trlight":"trdark")."'>",true);
        if (
$row[creaturelevel]==17 || $row[creaturelevel]==18){
            
output("<td> [Edit|Del] </td><td>",true);
        }else{
            
output("<td> [<a href='creatures.php?op=edit&id=$row[creatureid]'>Edit</a>|".
            
"<a href='creatures.php?op=del&id=$row[creatureid]' onClick='return confirm(\"Bist du dir sicher, dass du diese Kreatur löschen willst?\");'>Del</a>] </td><td>",true);
            
addnav("","creatures.php?op=edit&id=$row[creatureid]");
            
addnav("","creatures.php?op=del&id=$row[creatureid]");
        }
        
output($row[creaturename]);
        
output("</td><td>",true);
        
output($row[creaturelevel]);
        
output("</td><td>",true);
        
output($row[creatureweapon]);
        
output("</td><td>",true);
        
output($row[creaturelose]);
        
output("</td><td>",true);
                     
output($row[createdby]);
                     if(
$session['user']['superuser']>=4){
                     
output("</td><td>",true);
                     
output($row[Inputby]);
                     }
        
output("</td>",true);
    }
    
output("</tr></table>",true);
}else{
    if (
$_GET['op']=="edit" || $_GET['op']=="add"){
        if (
$_GET['op']=="edit"){
            
$sql "SELECT * FROM creatures WHERE creatureid=$_GET[id]";
            
$result db_query($sql) or die(db_error(LINK));
            if (
db_num_rows($result)<>1){
                
output("`4Fehler`0, diese Kreatur wurde nicht gefunden!");
            }else{
                
$row db_fetch_assoc($result);
            }
        }
        
output("<form action='creatures.php' method='POST'>",true);
        
output("<input name='id' value=\"".HTMLEntities($_GET[id])."\" type='hidden'>",true);
        
output("<table border='0' cellpadding='2' cellspacing='0'>",true);
        
rawoutput("<tr><td>Kreaturname:</td><td><input name='creaturename' maxlength='50' value=\"".stripslashes($row[creaturename])."\"></td></tr>",true);
        
rawoutput("<tr><td>Waffe: </td><td><input name='creatureweapon' maxlength='50' value=\"".stripslashes($row[creatureweapon])."\"></td></tr>",true);
        
rawoutput("<tr><td colspan='2'>Nachricht beim Tod: <br><input name='creaturelose' size='65' maxlength='120' value=\"".stripslashes($row[creaturelose])."\"></td></tr>",true);
        
output("<tr><td>Level: </td><td><select name='creaturelevel'>",true);
        for (
$i=1;$i<=16;$i++){
            
output("<option value='$i'".($row[creaturelevel]==$i?" selected":"").">$i</option>\n",true);
        }
        
output("</select></td></tr>",true);
        
output("<tr><td>Kreatur ist auch auf dem Friedhof</td><td><input type='radio' name='location' value='1'".($row['location']==1?" checked":"").">Ja <input type='radio' name='location' value='0'".($row['location']==0?" checked":"").">Nein </td></tr>",true);
        
output("<tr><td colspan='2'><input type='hidden' name='save' value='Save'><input type='submit' class='button' name='submit' value='Speichern'></td></tr>",true);
        
output("</table>",true);
        
output("</form>",true);
        
addnav("","creatures.php");
    }else{
    
    }
    
addnav("Zurück zum Monster-Editor","creatures.php");
}

page_footer();