-
Notifications
You must be signed in to change notification settings - Fork 0
/
unsubscribeaccount.php
36 lines (30 loc) · 1.02 KB
/
unsubscribeaccount.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
<?php
session_start();
require __DIR__ . '/Connections.php';
if (isset($_GET['token'])) {
$del_token = $_GET['token'];
$uselect = $con->prepare('SELECT * from details WHERE Token=?');
$uselect->bind_param('s', $del_token);
$uselect->execute();
$result = $uselect->get_result();
$no_of_rows = $result->num_rows;
$uselect->close();
if ($no_of_rows > 0) {
$dquery = $con->prepare("DELETE from details WHERE Token=?");
$dquery->bind_param('s', $del_token);
$dquery->execute();
$dquery->close();
$_SESSION['heading'] = 'Unsubscribe Account';
$_SESSION['subject'] = 'You have successfully unsubscribed.';
$_SESSION['data'] = 'To subscribe again';
header('Location: output.php');
exit(0);
}
else {
$_SESSION['heading'] = 'Unsubscribe Account';
$_SESSION['subject'] = 'Account Already unsubscribed.';
$_SESSION['data'] = 'To subscribe again';
header('Location: output.php');
exit(0);
}
}