-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage2_hiking_delete.php
39 lines (31 loc) · 1 KB
/
page2_hiking_delete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php include("base.php")?>
<?php
include_once 'includes/dbhc.inc.php';
if(!$conn){die('Connect Error ('.mysqli_connect_errno().')'.mysqli_connect_error());}
error_reporting(E_ALL ^ E_NOTICE);
$entrance = $_GET['entrance'];
$sql = "
Delete from hiking_trail Where entrance = ?;
";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt, $sql)){
echo "SQL statement failed";
}
else {
//Bind parameters to the placeholder
mysqli_stmt_bind_param($stmt, "s",$entrance);
mysqli_stmt_execute($stmt);
}
if(isset($_SESSION)){
$str = "delete from hiking_trail Where entrance = '".$entrance."'";
$usersid = $_SESSION["userid"];
$usersuid = $_SESSION["useruid"];
$sql = "INSERT INTO log(usersId,usersUid, ontime, command) VALUES (".$_SESSION["userid"].",'".$usersuid."', now(),\"".$str."\")";
$login_res = mysqli_query($conn, $sql);
if($login_res){
}else{
printf( mysqli_error($conn));
}
}
mysqli_close($conn);
?>