Added Delete Entry
This commit is contained in:
parent
f2bbb0e6dc
commit
46431b9d83
47
deleteentry.php
Normal file
47
deleteentry.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
include "scripts/setup.php";
|
||||||
|
$page_title="Edit a Mod";
|
||||||
|
require_login();
|
||||||
|
|
||||||
|
$id=$_GET['id'];
|
||||||
|
|
||||||
|
if (is_numeric($id)==false){
|
||||||
|
SQLerror("Non Integer","Non integers are not allowed in the id field. <br /> <a href=\"index.php\">Back to home</a>");
|
||||||
|
}
|
||||||
|
|
||||||
|
include "scripts/pageheader.php";
|
||||||
|
|
||||||
|
$res = mysql_query("SELECT * FROM mods WHERE mod_id=$id",$handle) or SQLerror("MySQL Query Error","Error finding entry $id");
|
||||||
|
$row = mysql_fetch_row($res) or die("row error");
|
||||||
|
|
||||||
|
if (is_member_moderator($_SESSION['user']) || $_SESSION['user']==$row[3]){
|
||||||
|
}else{
|
||||||
|
SQLerror("Deleting Denied","You do not own that entry, and you are not a moderator");
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------
|
||||||
|
// Delete Row
|
||||||
|
// --------------------------
|
||||||
|
|
||||||
|
$do=true;
|
||||||
|
$name=$_POST['mod_name'];
|
||||||
|
if ($name==""){
|
||||||
|
$do=false;
|
||||||
|
$name=$row[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($do==true){
|
||||||
|
$name=mysql_real_escape_string($name);
|
||||||
|
mysql_query("DELETE FROM mods WHERE name='$name'",$handle) or SQLerror("MySQL Query Error","Error finding entry $name");
|
||||||
|
header("location: index.php");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<form method="post" action="<?php echo curPageURL();?>">
|
||||||
|
<h1>Delete an Entry</h1>
|
||||||
|
<input type="text" name="mod_name" readonly="true" style="background-color:#EEEEEE;" value="<?php echo $name;?>"> will be permanatly deleted<br /><br />
|
||||||
|
<input type="submit" value="OK">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
include "scripts/pagefooter.php";
|
||||||
|
?>
|
@ -1 +0,0 @@
|
|||||||
This has moved to <a href="../api/python/getmodbyid.php">here</a>
|
|
@ -1 +0,0 @@
|
|||||||
This has moved to <a href="../api/python/getmodbyname.php">here</a>
|
|
@ -1 +0,0 @@
|
|||||||
This has moved to <a href="../api/python/getmods.php">here</a>
|
|
@ -15,7 +15,7 @@ include "scripts/pageheader.php";
|
|||||||
include "scripts/formatcode.php";
|
include "scripts/formatcode.php";
|
||||||
|
|
||||||
if (is_member_moderator($_SESSION['user']) || $_SESSION['user']==$row[3]){
|
if (is_member_moderator($_SESSION['user']) || $_SESSION['user']==$row[3]){
|
||||||
$links="<a href=\"editentry.php?id=$id\">Edit</a>";
|
$links="<a href=\"editentry.php?id=$id\">Edit</a> <a href=\"deleteentry.php?id=$id\">Delete</a>";
|
||||||
}else{
|
}else{
|
||||||
$links="";
|
$links="";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user