/
account.php
158 lines (128 loc) · 4.62 KB
/
account.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
session_start();
#
# Package: account.php
# Version: 1.0.0
# Author: Carl Schelin, Copyright 2013. All rights reserved.
# Function: Show the account menu
# Description: This lists the options available for logging in and out
include('settings.php');
$package = "account.php";
# if the user isn't logged in, we'll want to open the database and retrieve the information
# but not let the user act on it. Just see the events and view the details.
# perhaps 'signup' logs the user in as a link.
if (isset($_SESSION['username'])) {
include($Sitepath . '/login/check.php');
include($Sitepath . '/function.php');
check_login(4);
logaccess($_SESSION['username'], $package, "View account menu");
} else {
include($Sitepath . '/minifunc.php');
# once a database connection is made, all the other data pulls work as expected
# make sure you don't write any changes until someone logs in.
$db = mysql_connect($DBserver,$DBuser,$DBpassword);
if (!$db) {
die('Couldn\'t connect: ' . mysql_error());
} else {
$DBlogout = mysql_select_db($DBname,$db);
if (!$DBlogout) {
die('Not connected : ' . mysql_error());
}
}
}
$q_string = "select con_id,con_title,con_booklet,con_limage,con_rimage from convention where con_active > 0";
$q_convention = mysql_query($q_string) or die($q_string . ": " . mysql_error());
$a_convention = mysql_fetch_array($q_convention);
$q_string = "select img_file from images where img_id = " . $a_convention['con_booklet'];
$q_booklet = mysql_query($q_string) or die($q_string . ": " . mysql_error());
$a_booklet = mysql_fetch_array($q_booklet);
$q_string = "select img_file from images where img_id = " . $a_convention['con_limage'];
$q_limage = mysql_query($q_string) or die($q_string . ": " . mysql_error());
$a_limage = mysql_fetch_array($q_limage);
$q_string = "select img_file from images where img_id = " . $a_convention['con_rimage'];
$q_rimage = mysql_query($q_string) or die($q_string . ": " . mysql_error());
$a_rimage = mysql_fetch_array($q_rimage);
$conactive = "<h2>" . $a_convention['con_title'] . "</h2>";
if ($a_convention['con_id'] == '') {
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="REFRESH" content="5; url=index.php">
<title>No Active Convention</title>
<style type="text/css" title="currentStyle" media="screen">
<?php include($Sitepath . "/mobile.php"); ?>
</style>
</head>
<body>
<div id="main">
<h2>Error</h2>
</div>
<div id="main">
<p>There is no active convention. One Convention must be identified as active in order to proceed.</p>
<p>You will be redirected in 5 seconds or click <a href="index.php"> here to continue</a>.</p>
</div>
</body>
</html>
<?php
} else {
# there is an active convention so things can be managed now.
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php print $Sitename . " Presents " . $a_convention['con_title']; ?></title>
<script type="text/javascript" language="javascript">
</script>
<style type="text/css" title="currentStyle" media="screen">
<?php include($Sitepath . "/mobile.php"); ?>
</style>
</head>
<body>
<?php include($Sitepath . '/topmenu.start.php'); ?>
<?php include($Sitepath . '/topmenu.end.php'); ?>
<div id="main">
<div id="contentwrapper">
<div id="contentcolumn">
<div class="innertube">
<a href="/approved/<?php print $a_booklet['img_file']; ?>"><img src="/approved/<?php print $a_limage['img_file']; ?>" style="float: left;"></a>
<h1>Account</h1>
<ul>
<?php
if (isset($_SESSION['username'])) {
?>
<li><a href="<?php print $Siteroot; ?>/login/user_admin.php">Account Details</a></li>
<li><a href="<?php print $Siteroot; ?>/orders.php">My Orders</a></li>
<li><a href="<?php print $Siteroot; ?>/judge.php">My Events</a></li>
<li><a href="<?php print $Siteroot; ?>/login/logout.php">Logout (<?php print $_SESSION['username']; ?>)</a></li>
<?php
if (check_userlevel(3)) {
?>
<li><a href="<?php print $Siteroot; ?>/login/admin">User Management</a></li>
<li><a href="<?php print $Siteroot; ?>/admin/index.php">Site Management</a></li>
<?php
}
} else {
?>
<li><a href="<?php print $Siteroot; ?>/login/login.php">Login</a></li>
<?php
}
?>
</ul>
</div>
</div>
</div>
<div id="rightcolumn">
<div class="innertube">
<img src="/approved/<?php print $a_rimage['img_file']; ?>">
</div>
</div>
</div>
<?php include($Sitepath . '/confooter.php'); ?>
</body>
</html>
<?php
}
?>