-
Notifications
You must be signed in to change notification settings - Fork 0
/
mycampaigns_delete.php
131 lines (96 loc) · 4.22 KB
/
mycampaigns_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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
//-----------------------//
//remove me after include//
//-----------------------//
//include the db
require_once('Connections/dbDescent.php');
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
//include functions
include 'includes/function_logout.php';
include 'includes/function_getSQLValueString.php';
mysql_select_db($database_dbDescent, $dbDescent);
include 'includes/protected_page.php';
if (isset($_GET['urlGamingID'])) {
$gameID = $_GET['urlGamingID'];
} else {
header("Location: mycampaigns.php?view=all");
die("Redirecting to mycampaigns.php");
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
$query_rsGetCampaigns = sprintf("SELECT * FROM tbgames WHERE game_id = %s", GetSQLValueString($gameID, "int"));
$rsGetCampaigns = mysql_query($query_rsGetCampaigns, $dbDescent) or die(mysql_error());
$row_rsGetCampaigns = mysql_fetch_assoc($rsGetCampaigns);
$totalRows_rsGetCampaigns = mysql_num_rows($rsGetCampaigns);
if($row_rsGetCampaigns['game_dm'] != $_SESSION['user']['id']){
header("Location: mycampaigns.php");
die("Redirecting to mycampaigns.php");
} else {
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "campaign-delete-form")) {
mysql_select_db($database_dbDescent, $dbDescent);
// Delete Travel
$insertDeleteTravel = sprintf("DELETE FROM tbtravel_aquired WHERE travel_aq_game_id = %s",
GetSQLValueString($gameID, "int"));
$ResultDeleteTravel = mysql_query($insertDeleteTravel, $dbDescent) or die(mysql_error());
// Delete Skills
$insertDeleteSkills = sprintf("DELETE FROM tbskills_aquired WHERE spendxp_game_id = %s",
GetSQLValueString($gameID, "int"));
$ResultDeleteSkills = mysql_query($insertDeleteSkills, $dbDescent) or die(mysql_error());
// Delete Items
$insertDeleteItems = sprintf("DELETE FROM tbitems_aquired WHERE aq_game_id = %s",
GetSQLValueString($gameID, "int"));
$ResultDeleteItems = mysql_query($insertDeleteItems, $dbDescent) or die(mysql_error());
// Delete Progress
$insertDeleteProgress = sprintf("DELETE FROM tbquests_progress WHERE progress_game_id = %s",
GetSQLValueString($gameID, "int"));
$ResultDeleteProgress = mysql_query($insertDeleteProgress, $dbDescent) or die(mysql_error());
// Delete Heroes
$insertDeleteHeroes = sprintf("DELETE FROM tbcharacters WHERE char_game_id = %s",
GetSQLValueString($gameID, "int"));
$ResultDeleteHeroes = mysql_query($insertDeleteHeroes, $dbDescent) or die(mysql_error());
// Delete Game
$insertDeleteGame = sprintf("DELETE FROM tbgames WHERE game_id = %s",
GetSQLValueString($gameID, "int"));
$ResultDeleteGame = mysql_query($insertDeleteGame, $dbDescent) or die(mysql_error());
header("Location: mycampaigns.php");
die("Redirecting to mycampaigns.php");
}
}
?>
<html>
<head><?php
$pagetitle = "Delete Campaign";
include 'head.php'; ?>
</head>
<body>
<?php
include 'navbar.php';
include 'banner.php';
?>
<div class="container grey campaigns-overview">
<form action="<?php echo $editFormAction; ?>" method="post" name="campaign-delete-form" id="campaign-delete-form">
<div class="row no-gutters">
<div class="col-sm-1">
</div>
<div class="col-sm-6 confirm-deco-text">
<h1>Delete Campaign</h1>
<p class="lead">Are you sure you want to delete this campaign? This cannot be undone.</p>
<p class="">Statistics generated by this website are based on all existing campaigns on this website; for that reason, it would be best if you do not delete campaigns, even if they have been abandoned or completed</p>
<input type="submit" class="btn large btn-primary" value="Delete" />
</div>
<div class="col-sm-1">
</div>
<div class="col-sm-3 confirm-deco">
<img src="img/GoblinWitcher.png" />
</div>
</div>
<input type="hidden" name="MM_insert" value="campaign-delete-form" />
</form>
</div>
</body>
</html>