Nieuw lid |
|
Hallo,
ik heb een wargame script met een admin panel, nu wil ik dit script zo uitbreiden dat er wapens en armour via dit panel toegevoegd kunnen worden in plaats van direct in de mysql tabel. ik heb al verschillende dingen geprobeert maar het wil niet lukken.
dit is het panel:
<?php $title = "Admin Panel"; include("header.php"); ?>
<?php
if ($stat[rank] != Admin) {
print "You're not an admin.";
include("footer.php");
exit;
}
?>
Welcome to the admin panel. What will you do?
<ul>
<li><A href=addupdate.php>Add Update</a>
<li><a href=admin.php?view=del>Delete Member</a>
<li><a href=admin.php?view=add>Add Staff</a>
<li><a href=admin.php?view=tags>Give Tags</a>
<li><a href=admin.php?view=clearf>Clear Forum</a>
<li><a href=admin.php?view=clearc>Clear Chat</a>
<li><a href=admin.php?view=wt>Wapens toevoegen</a>
</ul>
<?php
if ($view == del) {
print "<form method=post action=admin.php?view=del&step=del>Delete ID <input type=text name=did>. <input type=submit value=Delete></form>";
if ($step == del) {
if ($did != 1) {
mysql_query("delete from players where id=$did");
print "You deleted ID $did.";
} else {
print "No deleting the owner.";
}
}
}
if ($view == add) {
print "<form method=post action=admin.php?view=add&step=add>Add ID <input type=text name=aid> as an <select name=rank><option value=Member>member</option><option value=Admin>admin</option></select>. <input type=submit value=Add></form>";
if ($step == add) {
if ($aid != 1) {
mysql_query("update players set rank='$rank' where id=$aid");
print "You added ID $aid as a $rank.";
}
}
}
if ($view == clearf) {
mysql_query("delete from topics");
mysql_query("delete from replies");
print "You cleared the forums.";
}
if ($view == clearc) {
mysql_query("delete from chat");
print "You cleared the chat.";
}
if ($view == tags) {
print "<form method=post action=admin.php?view=tags&step=tag>";
print "Make ID <input type=text name=tag_id size=5> have the <input type=text size=2 name=tag> tag. <input type=submit value=Tag>";
print "</form>";
if ($step == tag) {
mysql_query("update players set tag='$tag' where id=$tag_id");
print "You gave ID <b>$tag_id</b> the <b>$tag</b> tag.";
}
}
?>
<?php include("footer.php"); ?>
<?php $title = "Admin Panel"; include("header.php"); ?> <?php if ($stat[rank] != Admin) { print "You're not an admin."; include("footer.php"); } ?> Welcome to the admin panel. What will you do? <ul> <li><A href=addupdate.php>Add Update</a> <li><a href=admin.php?view=del>Delete Member</a> <li><a href=admin.php?view=add>Add Staff</a> <li><a href=admin.php?view=tags>Give Tags</a> <li><a href=admin.php?view=clearf>Clear Forum</a> <li><a href=admin.php?view=clearc>Clear Chat</a> <li><a href=admin.php?view=wt>Wapens toevoegen</a> </ul> <?php if ($view == del) { print "<form method=post action=admin.php?view=del&step=del>Delete ID <input type=text name=did>. <input type=submit value=Delete></form>"; if ($step == del) { if ($did != 1) { print "You deleted ID $did."; } else { print "No deleting the owner."; } } } if ($view == add) { print "<form method=post action=admin.php?view=add&step=add>Add ID <input type=text name=aid> as an <select name=rank><option value=Member>member</option><option value=Admin>admin</option></select>. <input type=submit value=Add></form>"; if ($step == add) { if ($aid != 1) { mysql_query("update players set rank='$rank' where id=$aid"); print "You added ID $aid as a $rank."; } } } if ($view == clearf) { print "You cleared the forums."; } if ($view == clearc) { print "You cleared the chat."; } if ($view == tags) { print "<form method=post action=admin.php?view=tags&step=tag>"; print "Make ID <input type=text name=tag_id size=5> have the <input type=text size=2 name=tag> tag. <input type=submit value=Tag>"; if ($step == tag) { mysql_query("update players set tag='$tag' where id=$tag_id"); print "You gave ID <b>$tag_id</b> the <b>$tag</b> tag."; } } ?> <?php include("footer.php"); ?>
en dit is de mysql tabel
#
# Table structure for table `equipment`
#
CREATE TABLE equipment (
id int(11) NOT NULL auto_increment,
owner int(11) NOT NULL default '0',
name varchar(30) NOT NULL default '',
power int(11) NOT NULL default '0',
status char(1) NOT NULL default 'U',
type char(1) NOT NULL default 'W',
cost int(11) NOT NULL default '0',
UNIQUE KEY id (id)
) TYPE=MyISAM;
# # Table structure for table `equipment` # CREATE TABLE equipment ( id int(11) NOT NULL auto_increment, owner int(11) NOT NULL default '0', name varchar(30) NOT NULL default '', power int(11) NOT NULL default '0', status char(1) NOT NULL default 'U', type char(1) NOT NULL default 'W', cost int(11) NOT NULL default '0', ) TYPE=MyISAM;
het is zo dat de'id' leeg moet blijven 'status' moet een 's' worden en bij 'type' moet er of een 'w' of een 'a' komen verder moet ik natuurlijk de naam, kracht en prijs in kunnen vullen.
weet iemand hoe ik dit kan oplossen?? of is dit onmogelijk??
iniedergeval alvast bedankt!!
vinTage vraagt : of je voortaan zelf alles tussen de code tags wil zetten..
|