-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_share.php
34 lines (30 loc) · 1.1 KB
/
delete_share.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
<?php
// Database connection
include 'sql_conn.php';
// Check if the ID is provided in the query parameter
if (isset($_GET['id'])) {
$posteddata = $_GET['id'];
$ToSharedEmailId = substr($posteddata,36);
$UniqueId = str_replace($ToSharedEmailId,"",$posteddata);
// Perform the deletion
$sql = "update shared_accounts set deleteflag = 1 where sharedaccountuniqueid = '$UniqueId' and tosharedemailid = '$ToSharedEmailId' ";
if ($conn->query($sql) === TRUE) {
// Deletion successful
echo '<script type="text/javascript">';
echo 'alert("Share has been deleted successfully.");';
echo 'window.location.href = "shared_passwords.php";';
echo '</script>';
} else {
// Error during deletion
echo '<script type="text/javascript">';
echo 'alert("An error occured while removing shared account.");';
echo 'window.location.href = "shared_passwords.php";';
echo '</script>';
}
} else {
echo include 'error/400.html';
exit;
}
// Close the database connection
$conn->close();
?>