-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample_ops_reg_form.php
164 lines (129 loc) · 4.74 KB
/
sample_ops_reg_form.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
159
160
161
162
163
164
<?php
// Note that the sample code includes PHP 'require' and 'require_once'
// statements that reference files in the EventTools directory. If you
// move the sample file to another directory, you'll have to update the file
// paths in these statements.
require_once('access.php');
require('utilities.php');
$message = "";
// Just show form the first time around, when no arguments provided
if (! isset( $_REQUEST[ "fname" ] )) {
showform( "" );
return;
}
//' check for not enough completed
if ( !formcomplete() ) {
$message = "<span style=\"color:red;font-weight:bold\">";
$message .= "Please complete all values and submit again; your registration is not complete.";
$message .= "</span>";
showform( $message );
return;
}
$now = time();
// add to local log file.
$datastring = get_request_args(date("m/d/y g:i a T",$now),";")."\r\n";
if (!$fp = fopen("datafile.dtf", "a")) {
print "Cannot open \"datafile.dtf\"\n";
} else {
fwrite( $fp, $datastring );
fclose( $fp );
}
// send email with info
// If needed, change the email address on the next line
$to = $event_tools_registrar_email_address;
$subject = $event_tools_event_name." Registration FYI ".$_REQUEST["fname"]." ".$_REQUEST["lname"];
$headers = sprintf("From: ".$event_tools_event_name." Registration Form <".$to.">\r\n");
$message = sprintf("%s %s has registered\r\n\r\n", $_REQUEST["fname"], $_REQUEST["lname"]);
$message .= "A tabular version can be found at http://".$_SERVER['SERVER_NAME']."/eventtools/ops_req_single.php?email=".$_REQUEST["email"]."\r\n\r\n";
// add fill dump
$message .= get_request_args(date("m/d/y g:i a T",$now)."\r\n","\r\n");
// uncomment next line to send email
//mail($to, $subject, $message, $headers);
// process into database
require( 'ops_incremental_request.php');
// show confirmation on page
print "<h1>Thank you for Registering for ".$event_tools_event_name."</h1>\n";
print "Your info has been emailed to ".$to.", stored and will be processed shortly.<br><br>\n";
print "You can expect to hear from us within the next few days, and if you think you've been forgotten or\n";
print "are being ignored, please feel free to send a direct email plea to ".$to." .<br><br>\n";
// end of code here
// check that required values are present
function formcomplete() {
$musthave = array();
$musthave[] = "fname";
$musthave[] = "lname";
$musthave[] = "email";
$musthave[] = "phone";
$musthave[] = "street";
$musthave[] = "city";
$musthave[] = "state";
$musthave[] = "zip";
foreach ( $musthave as $i ) {
if ( !isset( $_REQUEST[ $i ] ) || ($_REQUEST[ $i ] == "") )
return(0);
}
return(1);
}
// show the HTML form
function showform( $message ) {
global $event_tools_event_name;
$page = <<<END
<html>
<body>
END;
print $page.$message;
$page = <<<END
<h2>Register for
END;
print $page.$event_tools_event_name;
$page = <<<END
</h2>
<form action="" method="get">
<table border=1 class="VisTable">
<tr valign="top"><td width="40%">
<table border=0>
<tr><td colspan=2>Who are you?</td></tr>
<tr><td>First Name</td><td><input type=text size=25 name=fname></td></tr>
<tr><td>Last Name</td><td><input type=text size=25 name=lname></td></tr>
<tr><td>Email Address</td><td><input type=text size=25 name=email></td></tr>
<tr><td>Telephone</td><td><input type=text size=15 name=phone></td></tr>
<tr><td>Cell Phone</td><td><input type=text size=15 name=cell></td></tr>
<tr><td>Street Address</td><td><input type=text size=25 name=street></td></tr>
<tr><td>City</td><td><input type=text size=25 name=city></td></tr>
<tr><td>State</td><td><input type=text size=15 name=state></td></tr>
<tr><td>ZIP code</td><td><input type=text size=15 name=zip></td></tr>
END;
print $page;
global $event_tools_emergency_contact_info;
if ($event_tools_emergency_contact_info) {
$page = <<<END
<tr><td>Emergency contact</td><td><input type=text size=25 name=econtact></td></tr>
<tr><td>Emergency phone</td><td><input type=text size=15 name=ephone></td></tr>
END;
print $page;
}
require('ops_req_tools.php');
create_option_entries();
$page = <<<END
</table>
</td><td width="40%">
<table border=0>
<tr><td colspan=2><a href="#notes">**</a> Please rank your preferred venues:</td></tr>
END;
print $page;
create_request_entries(10,' status_code >= 60');
$page = <<<END
</table>
</td>
</tr>
<tr><td colspan=3><br>Comments<div style="text-align:center"><textarea name="comments" rows=10 cols=60></textarea></div><br></td></tr>
</table>
<input type=submit value="Submit registration">
<input type=reset value="Clear this form">
</form>
</body>
</html>
END;
print $page;
}
?>