Dieses wird auch wunderbar dargestellt.
Die nötige Datenbanktabelle ist auch vorhanden und kommuniziert mit dem Skript.
Wenn ich Einträge anlege, werden diese gespeichert, jedoch kann ich diese weder ändern noch löschen.
Ich habe den Code von der Adminverwaltung für die Partnerbox hergenommen und geändert.
<?php # Copyright by: Manuel Staechele # Support: www.ilch.de defined ('main') or die ( 'no direct access' ); defined ('admin') or die ( 'only admin access' ); $design = new design ( 'Admins Area', 'Admins Area', 2 ); $design->header(); $tpl = new tpl ( 'd3_quests', 1); # loeschen if ( $menu->getA(2) == 'd' ) { $pos = db_result(db_query("SELECT pos FROM prefix_d3_quests WHERE id = ".$menu->getE(2)), 0); db_query("DELETE FROM prefix_d3_quests WHERE id = ".$menu->getE(2)); db_query("UPDATE prefix_d3_quests SET pos = pos -1 WHERE pos > ".$pos); } # aendern / eintragen if ( isset($_POST['sub']) ) { $_POST['qname'] = escape($_POST['qname'], 'string'); $_POST['go_norm'] = escape($_POST['go_norm'], 'string'); $_POST['ep_norm'] = get_homepage(escape($_POST['ep_norm'], 'string')); if ( empty ($_POST['pkey']) ) { $_POST['pos'] = db_result(db_query("SELECT COUNT(*) FROM prefix_d3_quests"),0); db_query("INSERT INTO prefix_d3_quests (qname,go_norm,ep_norm,pos) VALUES ('".$_POST['qname']."','".$_POST['go_norm']."','".$_POST['ep_norm']."','".$_POST['pos']."')"); } else { db_query("UPDATE prefix_d3_quests SET qname = '".$_POST['qname']."',go_norm = '".$_POST['go_norm']."',ep_norm = '".$_POST['ep_norm']."' WHERE id = '".$_POST['pkey']."'"); } } # verschieben if ($menu->getA(2) == 'o' OR $menu->getA(2) == 'u') { $pos = $menu->get(3); $id = $menu->getE(2); $nps = ( $menu->getA(2) == 'u' ? $pos + 1 : $pos - 1 ); $anz = db_result(db_query("SELECT COUNT(*) FROM prefix_d3_quests"),0); if ($nps < 0) { db_query("UPDATE prefix_d3_quests SET pos = ".$anz." WHERE id = ".$id); db_query("UPDATE prefix_d3_quests SET pos = pos -1"); } if ($nps >= $anz) { db_query("UPDATE prefix_d3_quests SET pos = -1 WHERE id = ".$id); db_query("UPDATE prefix_d3_quests SET pos = pos +1"); } if ( $nps < $anz AND $nps >= 0 ) { db_query("UPDATE prefix_d3_quests SET pos = ".$pos." WHERE pos = ".$nps); db_query("UPDATE prefix_d3_quests SET pos = ".$nps." WHERE id = ".$id); } } # aendern vorbereiten. if ( $menu->getA(2) == 'e' ) { $erg = db_query("SELECT id,qname,go_norm,ep_norm FROM prefix_d3_quests WHERE id = '".$menu->getE(2)."'"); $_ilch = db_fetch_assoc($erg); $_ilch['pkey'] = $menu->getE(2); } else { $_ilch = array ( 'pkey' => '', 'id' => '', 'go_norm' => '', 'qname' => '', 'ep_norm' => '' ); } $tpl->set_ar_out($_ilch,0); $page = ($menu->getA(2) == 'p' ? $menu->getE(2) : 1 ); $limit = 20; $class = 'Cnorm'; $MPL = db_make_sites ($page , '' , $limit , '?d3_quests' , 'd3_quests' ); $anfang = ($page - 1) * $limit; $abf = "SELECT id,qname,ep_norm, pos FROM prefix_d3_quests ORDER BY pos ASC LIMIT ".$anfang.",".$limit; $erg = db_query($abf); while ($row = db_fetch_assoc($erg) ) { $class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' ); $row['class'] = $class; $tpl->set_ar ( $row ); $tpl->out(1); } $tpl->set ( 'MPL', $MPL ); $tpl->out(2); $design->footer(); ?>
Template dazu:
<table cellpadding="0" cellspacing="0" border="0"><tr><td><img src="include/images/icons/admin/diablo/d3_quests.png" /></td><td width="30"></td><td valign="bottom"></td></tr></table> <script language="JavaScript" type="text/javascript"> <!-- function del ( id1 ) { var x = confirm ( "do you really want to delete?" ); if ( x ) { document.location.href="?d3_quests-d"+id1; } } //--> </script> <table width="100%"> <tr> <td valign="top" width="60%"> <form action="admin.php?d3_quests" method="POST"> <input type="hidden" name="pkey" value="{pkey}"> <table class="border" cellpadding="3" cellspacing="1" border="0"> <tr class="Chead"> <td colspan="2"><b>Quests</b></td> </tr> <tr> <td class="Cmite">Questname</td> <td class="Cnorm"><input type="text" size="50" name="qname" value="{qname}" /></td> </tr><tr> <td class="Cmite"></td> <td class="Cmite"></td> </tr><tr> <td class="Cmite">Erfahrungspunkte Normal</td> <td class="Cnorm"><input type="text" size="10" name="ep_norm" value="{ep_norm}" /></td> </tr> <tr> <td class="Cmite">Gold Normal</td> <td class="Cnorm"><input type="text" size="5" name="go_norm" value="{go_norm}" /></td> </tr><tr> <td class="Cmite"></td> <td class="Cmite"></td> </tr><tr> <td class="Cmite">Erfahrungspunkte Alptraum</td> <td class="Cnorm"><input type="text" size="10" name="ep_norm" value="{ep_norm}" /></td> </tr> <tr> <td class="Cmite">Gold Alptraum</td> <td class="Cnorm"><input type="text" size="5" name="go_norm" value="{go_norm}" /></td> </tr><tr> <td class="Cmite"></td> <td class="Cmite"></td> </tr><tr> <td class="Cmite">Erfahrungspunkte Hölle</td> <td class="Cnorm"><input type="text" size="10" name="ep_norm" value="{ep_norm}" /></td> </tr> <tr> <td class="Cmite">Gold Hölle</td> <td class="Cnorm"><input type="text" size="5" name="go_norm" value="{go_norm}" /></td> </tr><tr> <td class="Cmite"></td> <td class="Cmite"></td> </tr><tr> <td class="Cmite">Erfahrungspunkte Inferno</td> <td class="Cnorm"><input type="text" size="10" name="ep_norm" value="{ep_norm}" /></td> </tr> <tr> <td class="Cmite">Gold Inferno</td> <td class="Cnorm"><input type="text" size="5" name="go_norm" value="{go_norm}" /></td> </tr> <tr class="Cdark"> <td></td> <td><input type="submit" value="Absenden" name="sub" /></td> </tr> </table> </form> </td><td valign="top" width="40%"> <table class="border" cellpadding="3" cellspacing="1" border="0"> <tr class="Chead"> <td><b>Questname</b></td> <td></td> <td></td> <td></td> <td></td> </tr> {EXPLODE} <tr class="{class}"> <td>{qname}</td> <td><a href="?d3_quests-e{id}"><img src="include/images/icons/edit.gif" alt=""></a></td> <td><a href="javascript:del('{id}')"><img src="include/images/icons/del.gif" alt=""></a></td> <td><a href="?d3_quests-o{id}-{pos}"><img src="include/images/icons/pfeilo.gif" border="0" title="oben" alt="oben"></a></td> <td><a href="?d3_quests-u{id}-{pos}"><img src="include/images/icons/pfeilu.gif" border="0" title="unten" alt="unten"></a></td> </tr> {EXPLODE} </table> {MPL} </td></tr></table>
Ich werkel jetzt schon 3 Stunden mit dem Ding rum und steh mal voll aufn Schlauch.
verwendete ilchClan Version: 1.1 I