-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify.php
More file actions
153 lines (130 loc) · 4.8 KB
/
Copy pathverify.php
File metadata and controls
153 lines (130 loc) · 4.8 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
function InsertData()
{
// requires DB created with: sqlite3 registration/register.db "create table reg(type,price,name,affiliation,email,vegetarian,directory)"
// query with: sqlite3 registration/register.db "select * from reg"
// format SQL string using sqlite_escape_string to guard
// against unsafe data
$queryString = "INSERT INTO reg (type, price, name, affiliation, vegetarian, email, directory) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')";
$query = sprintf($queryString,
sqlite_escape_string($_POST['type']),
sqlite_escape_string($_POST['price']),
sqlite_escape_string($_POST['name']),
sqlite_escape_string($_POST['affiliation']),
sqlite_escape_string($_POST['vegetarian']),
sqlite_escape_string($_POST['email']),
sqlite_escape_string($_POST['attendee-list']));
// echo 'Query: '.htmlspecialchars($query).'<br>';
// insert data
try {
$conn = new PDO('sqlite:/afs/cs.cmu.edu/project/ggordon-www/aistats2011/registration/register.db');
$conn->query($query);
$conn = null;
} catch (PDOException $e) {
echo "PDO exception: " . $e->getMessage() . "<br/>";
return false;
}
return true;
// // echo htmlspecialchars(system('sqlite3 -version'));
// $sqlcmd = sprintf('sqlite3 /afs/cs.cmu.edu/project/ggordon-www/aistats2011/registration/register.db ' . escapeshellarg($query));
// echo 'Cmd: '.htmlspecialchars($sqlcmd).'<br>';
// $res = exec($cmd, $output, $retval);
// if (!$retval)
// echo 'Command failed: '.$retval.'<br>';
// else {
// echo 'Result: '.htmlspecialchars($res).'<br>';
// }
// if (!sqlite_query($conn, $query, 066, $sqlite_err)) {
// echo "Insert failed";
// echo $sqlite_err;
// }
// sqlite_close($conn);
}
function Check($name, $val, $min, $max) {
if (strlen($val) < $min) {
echo "Error: field “";
echo htmlspecialchars($name);
echo "” is required.<br>";
return -1;
} else if (strlen($val) > $max) {
echo "Error: field “";
echo htmlspecialchars($name);
echo "” is too long<br>";
return -1;
} else {
return 0;
}
}
function DataIsValid()
{
if (Check('Name', $_POST['name'], 1, 250)) {
return false;
} else if (Check('Email', $_POST['email'], 1, 250)) {
return false;
} else if (Check('Affiliation', $_POST['affiliation'], 1, 250)) {
return false;
} else if (Check('Type', $_POST['type'], 1, 250)) {
return false;
} else if (Check('Food-preference', $_POST['vegetarian'], 1, 250)) {
return false;
} else if (Check('Price', $_POST['price'], 1, 250)) {
return false;
} else if (Check('Attendee-list', $_POST['attendee-list'], 0, 250)) {
return false;
} else {
return true;
}
}
?>
<script type="text/javascript">
document.getElementById('LNreg').id='leftcurrent';
</script>
<div class="contents">
<hr>
// fill in a reasonable value for non-selected checkbox
if (!strlen($_POST['attendee-list'])) {
$_POST['attendee-list'] = "please exclude from directory";
}
// insert data -- currently disabled since we are not accepting check
// registrations at this time. To re-enable, comment in the next line
// and comment out "if (1) {".
// if (DataIsValid() && InsertData()) {
if (1) {
echo "<h2>AISTATS 2011 registration</h2>Registration successful!";
echo "<blockquote>Registration type: ";
echo htmlspecialchars($_POST['type']);
echo "<br>Price: \$";
echo htmlspecialchars($_POST['price']);
echo "<br>Name: ";
echo htmlspecialchars($_POST['name']);
echo "<br>Affiliation: ";
echo htmlspecialchars($_POST['affiliation']);
echo "<br>Email: ";
echo htmlspecialchars($_POST['email']);
echo "<br>Food preference: ";
echo htmlspecialchars($_POST['vegetarian']);
echo "<br>Directory preference: ";
echo htmlspecialchars($_POST['attendee-list']);
?>
</blockquote>Thanks for registering, and see you in Ft. Lauderdale! Please remember to send your check as described below. In case of problems (e.g., if there is an error in your information above), please contact ggordonREMOVEME (at) cs.cmu.edu.
<hr>
<br>
<h2>Payment instructions</h2>
Please <b>write the registrant's email address</b> (as it appears above) on the check to ensure that it gets credited to the right account.
Make your check payable to
<blockquote>
Society for AI and Statistics
</blockquote>
Please print this confirmation page and mail it, along with your check for the registration price indicated above, to:
<blockquote>
SAIAS, Inc.<br>
c/o Daryl Pregibon<br>
706 Hudson St<br>
Hoboken, NJ 07030 USA
</blockquote>
} else {
echo "Registration failed. Please hit “Back” and try again.<p>";
}
?>
<br>
</div>
<!--- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->