-
Notifications
You must be signed in to change notification settings - Fork 5
/
deleteaccount.php
executable file
·88 lines (83 loc) · 2.85 KB
/
deleteaccount.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/*
* deleteaccount.php
*
* Copyright 2018 Krzysztof Hrybacz <krzysztof@zygtech.pl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
?>
<?php
require_once('config.php');
session_start();
if ($_GET['confirm']=='yes') {
$link = mysqli_connect($sql, $sqluser, $sqlpass, $sqldb);
mysqli_set_charset($link,'utf8');
$result = mysqli_query($link,'SELECT * FROM `' . $_SESSION['company'] . '_info`;');
if (mysqli_num_rows($result)>0) {
$query = 'DROP TABLE `' . $_SESSION['company'] . '_clients`;';
mysqli_query($link,$query);
$query = 'DROP TABLE `' . $_SESSION['company'] . '_invoices`;';
mysqli_query($link,$query);
$query = 'DROP TABLE `' . $_SESSION['company'] . '_jobs`;';
mysqli_query($link,$query);
$query = 'DROP TABLE `' . $_SESSION['company'] . '_quotes`;';
mysqli_query($link,$query);
$query = 'DROP TABLE `' . $_SESSION['company'] . '_tasks`;';
mysqli_query($link,$query);
$query = 'DROP TABLE `' . $_SESSION['company'] . '_products`;';
mysqli_query($link,$query);
$query = 'DROP TABLE `' . $_SESSION['company'] . '_users`;';
mysqli_query($link,$query);
$query = 'DROP TABLE `' . $_SESSION['company'] . '_info`;';
mysqli_query($link,$query);
unlink('./logo/' . $_SESSION['company'] . '.png');
};
mysqli_close($link);
?>
<meta http-equiv="refresh" content="0;url=<?php echo $url; ?>/index.php?logout=true">
<?php
} else {
?>
<html>
<head>
<title>Goldwater</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Titillium+Web%3A400%2C300%2C900%7CPT+Sans%3A00&subset=latin" rel="stylesheet">
</head>
<body>
<div class="container">
<img class="right" src="logo/<?php echo $_SESSION['company']; ?>.png" />
<h1> Goldwater Business </h1>
</div>
<div class="ribbonlogin"><div class="container">
<h2> DELETE </h2>
</div></div>
<div class="mainlogin"><div class="container">
<center>Are you sure you want to delete this account: <?php echo $_SESSION['company']; ?>? <a href="deleteaccount.php?confirm=yes">Yes</a></center>
</div></div>
<div class="ribbonlogin"><div class="container">
</div></div>
</body>
</body>
</html>
<?php
}
?>