2603.0 - First effort...
This commit is contained in:
58
delete.php
Normal file
58
delete.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
session_start();
|
||||
$_SESSION['rezult_msg']="";
|
||||
$_SESSION['ret_link']="";
|
||||
include('conn.php');
|
||||
$now=date('YmdHis');
|
||||
|
||||
//DATA
|
||||
//ip
|
||||
if(!empty($_GET['ip'])&&isset($_GET['ip'])){
|
||||
$ip=$_GET['ip'];
|
||||
}
|
||||
else{
|
||||
$ip="";
|
||||
}
|
||||
|
||||
if(!empty($_GET['tbl'])&&isset($_GET['tbl'])){
|
||||
$tbl=$_GET['tbl'];
|
||||
if($tbl=='b'){
|
||||
$table_name='blacklist';
|
||||
$list=0;
|
||||
}
|
||||
elseif ($tbl=='w'){
|
||||
$table_name='whitelist';
|
||||
$list=1;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$tbl="";
|
||||
}
|
||||
|
||||
|
||||
if($tbl<>"" && $ip<>""){
|
||||
$sql_del="DELETE FROM $table_name WHERE ip='$ip'";
|
||||
$sql_last_upd="UPDATE info SET last=$now WHERE list='$list'";
|
||||
|
||||
if(mysqli_query($con,$sql_del)){
|
||||
$_SESSION['rezult_msg']="IP successfully deleted in the database.";
|
||||
$rez_last_upd=mysqli_query($con,$sql_last_upd);
|
||||
echo $_SESSION['rezult_msg'];
|
||||
$link="index.php?var=1";
|
||||
header("location:$link");
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
$_SESSION['rezult_msg']="The value was not deleted from the database. Please try again.<br>".mysqli_error($con);
|
||||
$_SESSION['ret_link']="index.php";
|
||||
header("location:error.php?var=2");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$_SESSION['rezult_msg']="There are not enough parameters to erase the value from the database.";
|
||||
$_SESSION['ret_link']="index.php";
|
||||
header("location:error.php?var=2");
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user