-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserchangesubdivision.php
51 lines (44 loc) · 1.43 KB
/
userchangesubdivision.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
<?php
require_once 'require/util.php'; //utility functions
require_once 'require/htmllib.php'; //HTML functions
require_once 'require/dblib.php'; //database functions
require_once 'require/config.php'; //server info
error_reporting(E_ALL); ///YES! YES! YES!
begin_session();
//begin page generation
print_htmlhead("Change User Subdivision",0);
//the main event.
if ($_SESSION['authorized']) //check for login
{
//Connect to Server
$server = bank_server_connect();
if (isset($_POST['submitted'])) //was a form submitted
{
//make the change and confirm it
set_subdivision($_SESSION['username'], $_POST['subdivision'], $server);
$_SESSION['subdivision'] = get_subdivision($_SESSION['username'], $server); //update session
print ("Subdivision for ".$_SESSION['username']." set to ".$_POST['subdivision']." successfully.<br />");
}
else //no form was submitted.
{
print_form($server);
}
}
else
{
print ('You must <a href="login.php">login</a>, in order to use this page');
}
print_htmlfoot();
function print_form($server)
//prints the second part of the form
{
print ('<form action="userchangesubdivision.php" method="post">');
print ('<br />');
print ('Select New Subdivision<br />');
subdivision_select(get_country($_SESSION['username'],$server),$server);
print ('<br /><br />');
print ('<input type="hidden" name="submitted" value="true" />');
print ('<input type="submit" value="Change Subdivision" />');
print ('</form>');
}
?>