/
rules.php
112 lines (91 loc) · 3.09 KB
/
rules.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
<?php
session_start();
#
# Package: rules.php
# Version: 1.0.0
# Author: Carl Schelin, Copyright 2013. All rights reserved.
# Function: Manage the events used by the convention
# Description: This lists and lets you edit the various convention events.
include('settings.php');
$package = "rules.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, "Convention Rules");
} 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 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);
$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>Convention Rules</title>
<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 class="rules" id="main">
<?php
$q_string = "select rul_text from rules where rul_status > 0 and rul_conid = " . $a_convention['con_id'];
$q_rules = mysql_query($q_string) or die($q_string . ": " . mysql_error());
while ($a_rules = mysql_fetch_array($q_rules)) {
$a_rules['rul_text'] = str_replace("<p>", "<p class=\"rules\">", $a_rules['rul_text']);
$a_rules['rul_text'] = str_replace("<li>", "<li class=\"rules\">", $a_rules['rul_text']);
print $a_rules['rul_text'];
}
?>
</div>
<?php include($Sitepath . '/confooter.php'); ?>
</body>
</html>
<?php
}
?>