-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhill_admin.php
More file actions
245 lines (217 loc) · 7.12 KB
/
hill_admin.php
File metadata and controls
245 lines (217 loc) · 7.12 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?PHP
require_once("./include/membersite_config.php");
//create a variable if the user is already logged in.
$alreadyloggedin=1;
if(!$hill_func->CheckLogin())
{
$alreadyloggedin=0;
$username_for_comment_box=null;
header('Location:hill_login.php');
//exit;
}
else
{
$username_for_comment_box=$hill_func->UserFullName();
if(strtoupper($hill_func->UserType())!="ADMIN")
{header('Location:hill_login.php');}
}
?>
<div id="wrap">
<!-- Site header is called from site-header file -->
<?php include('site_header.php');?>
<div id="body_sty">
<h2>Hill Administrator Page</h2>
<?php echo '<p>'.date("Y-m-d h:m",time()).' ('.date_default_timezone_get().')</p>';?>
<h3><hr/>Part A: User Databases</h3>
<p></p>
<?php
require_once("./include/membersite_config.php");
mysql_connect($xhost, $xusername, $xpassword) or die("Line 37 Cannot Connect to DB");
mysql_select_db($xdb_name) or die("Line 38 Cannot select DB");
$user_query = "SELECT * FROM $xtbl_name";
if (!$result_user_query = mysql_query($user_query) )
{
echo mysql_error();
echo '<p>Query submitted: '.$user_query.'</p>';
}
else
{
echo '<p>User database: '.$xdb_name.'--->'.$xtbl_name.'</p>';
?>
<table width="100%" border="1" cellspacing="1" div id='smallfont'>
<tr>
<th>ID_User</th>
<th>Name</th>
<th>Email</th>
<th>Phone Number</th>
<th>User Name</th>
<th>Confirm Code</th>
<th>User Type</th>
<th>Registration Date</th>
<th>Last Update</th>
</tr>
<?php
while ($user_row=mysql_fetch_assoc($result_user_query))
{
?>
<tr>
<td> <?php echo $user_row['id_user']?></td>
<td> <?php echo $user_row['name']?></td>
<td> <?php echo $user_row['email']?></td>
<td> <?php echo $user_row['phone_number']?></td>
<td> <?php echo $user_row['username']?></td>
<td> <?php echo $user_row['confirmcode']?></td>
<td> <?php echo $user_row['usertype']?></td>
<td><?php echo $user_row['regisdate']?></td>
<td><?php echo $user_row['lastupdate']?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
<!-- Code to ask if ADMIN wants to change any info -->
<!-- Edit Users-->
<br/><br/><br/>
<h3>Edit Users</h3><br/>
<form name="input" action="hill_admin_users_edit.php" method="post">
USER ID to Edit: <input type="text" name="user_id_to_edit" size=5/>
<input type="submit" value="Edit" /><br/><br/>
<input type="submit" formaction="" value="Delete User - DISABLED" />
<input type="submit" formaction="register.php" value="Add New User- Do via REGISTER" />
</form>
<p>............ In Development .............</p>
<p></p>
<h3><hr/>Part B: Knowledge Databases</h3>
<?php
include "./include/hillarticleconfig.php";
$getallarticles="SELECT * FROM article ORDER by date_posted ASC";
$getallcategories="SELECT * FROM categories";
$resultallcategories=mysql_query($getallcategories);
if(!$resultallarticles = mysql_query($getallarticles))
{
echo mysql_error();
}
else
{
echo '<p>Knowledge database: '.$blogdb.'</p>';
$numallarticles=mysql_num_rows($resultallarticles);
//show all the articles info
//start the table - close off the php loop first.
?>
<p>Existing Articles and Comments</p>
<!-- first show the categories -->
<p>Categories</p>
<table width="100%" border="1" cellspacing="1" div id='smallfont'>
<tr>
<th>ID</th>
<th>Category</th>
<th>Category Order</th>
</tr>
<?php
while($row_cat=mysql_fetch_assoc($resultallcategories))
{
?>
<tr>
<td><?php echo $row_cat['catid'];?></td>
<td><?php echo $row_cat['category'];?></td>
<td><?php echo $row_cat['cat_order'];?></td>
</tr>
<?php
}
?></table>
<!-- now the main articles and their comments -->
<p>Articles and Comments</p>
<table width="750px" border="1" cellspacing="1" div id='smallfont'>
<tr>
<th>ID</th>
<th>Author</th>
<th>Title</th>
<th>Comment (100 chars only)</th>
<th>Post Date</th>
<th>Cat</th>
<th>Art_Child</th>
</tr>
<?php
while($row_art=mysql_fetch_assoc($resultallarticles))
{
?>
<tr>
<td><?php echo $row_art['artid'];?></td>
<td><?php echo $row_art['name'];?></td>
<td><?php echo $row_art['title'];?></td>
<td><?php echo substr($row_art['comments'],0,100);?></td>
<td><?php echo $row_art['date_posted'];?></td>
<td><?php echo $row_art['categoryID']?></td>
<td><?php echo $row_art['artchild']?></td>
</tr>
<?php
}
?></table>
<?php
}
?>
<!-- Code to ask if ADMIN wants to change any info -->
<!-- Edit Categories -->
<br/><br/><br/>
<h3>Edit Categories and Articles</h3><br/>
<form name="input" action="hill_admin_categories_edit.php" method="post">
Category ID to Edit: <input type="text" name="cat_id_to_edit" size=5/>
<input type="submit" value="Edit" />
</form>
<form name="input" action="hill_admin_categories_delete.php" method="post">
Category ID to Delete: <input type="text" name="cat_id_to_edit" size=5/>
<input type="submit" value="Delete" />
</form>
<form name="input" action="hill_admin_categories_addnew.php" method="post">
Category ID to ADD new: <input type="hidden" name="cat_id_to_edit" size=5/>
<input type="submit" value="Add New" />
</form>
<form name="input" action="hill_admin_articles_edit.php" method="post">
Article ID to Edit: <input type="text" name="art_num_to_edit" size=5/>
<input type="submit" value="Edit" />
</form>
<form name="input" action="hill_admin_articles_delete.php" method="post">
Article ID to Delete: <input type="text" name="art_num_to_edit" size=5/>
<input type="submit" value="Delete" />
</form>
<form name="input" action="hill_admin_articles_addnew.php" method="post">
Article ID to ADD new: <input type="hidden" name="art_num_to_edit" size=5/>
<input type="submit" value="Add New" />
</form>
<h3><hr/>Part C: Congressional Databases</h3>
<p></p>
<p>............ In Development .............</p>
<p></p>
<h3><hr/>Misc</h3>
<h4>Site Mechanics </h4>
<ul style="margin-left:20px; line-height:150%;">
<li>Aesthetics </li>
<ul>
<li>Site layout is strightforward.
<ul>
<li>Header at the top, footer at the bottom.</li>
<li>Main body split as two boxes - text goes on the left and the right box reserved for pictures and ads.</li>
</ul>
<li>Color scheme is white with some shading on the header rows.</li>
<li>Fonts are Arial/Sans-Serif as default for most pages.</li>
<li>Font color is gray for most text.</li>
</ul>
<br/>
<li>Programming</li>
<ul>
<li>Principal script: PHP. </li>
<li>Database: MySQL. </li>
<li>Intent is to have pages generated dynamically as much as possible.</li>
</ul>
<br/>
</ul>
<!-- InstanceEnd -->
<!-- code for the right box and footer -->
</div>
<!-- Right box with ads disabled for the admin pages -->
<!-- Site footer is called from site-footer file -->
<?php include('site_footer.php');?>
</div>