64
64
$name = trim($_POST['name']);
65
65
$notes = trim($_POST['notes']);
67
$http_proxy_port_number = trim($_POST['http_proxy_port_number']);
68
$ssh_server_port_number = trim($_POST['ssh_server_port_number']);
69
$ssh_server_fingerprint = trim($_POST['ssh_server_fingerprint']);
70
$ssh_user_name = trim($_POST['ssh_user_name']);
71
$ssh_user_password = trim($_POST['ssh_user_password']);
67
73
// NOTE: Because we don't have transactions, there is a race condition between
68
74
// the address conflict check and the insert/update attempt. If a conflict is
69
75
// introduced between the check and the insert/update, a DB error will occur.
80
$query = "INSERT INTO proxy (hostname, login_url, name, notes) VALUES (:hostname, :login_url, :name, :notes)";
81
db_query_execute($config, $query, convert_null_array(array(":hostname" => $hostname, ":login_url" => $proxy_login_url, ":name" => $name, ":notes" => $notes)));
86
$query = "INSERT INTO proxy ".
87
"(hostname, login_url, name, notes, http_proxy_port_number, ssh_server_port_number, ".
88
" ssh_server_fingerprint, ssh_user_name, ssh_user_password) ".
90
"(:hostname, :login_url, :name, :notes, :http_proxy_port_number, :ssh_server_port_number, ".
91
" :ssh_server_fingerprint, :ssh_user_name, :ssh_user_password)";
92
db_query_execute($config, $query, convert_null_array(array(
93
":hostname" => $hostname,
94
":login_url" => $proxy_login_url,
97
":http_proxy_port_number" => $http_proxy_port_number,
98
":ssh_server_port_number" => $ssh_server_port_number,
99
":ssh_server_fingerprint" => $ssh_server_fingerprint,
100
":ssh_user_name" => $ssh_user_name,
101
":ssh_user_password" => $ssh_user_password)));
83
103
$last = db_get_last_insert_id($config);
117
137
$notes = trim($_POST['notes']);
118
138
$update_stats = isset($_POST['update_stats']);
140
$http_proxy_port_number = trim($_POST['http_proxy_port_number']);
141
$ssh_server_port_number = trim($_POST['ssh_server_port_number']);
142
$ssh_server_fingerprint = trim($_POST['ssh_server_fingerprint']);
143
$ssh_user_name = trim($_POST['ssh_user_name']);
144
$ssh_user_password = trim($_POST['ssh_user_password']);
120
146
// NOTE: Because we don't have transactions, there is a race condition between
121
147
// the conflict check and the insert/update attempt. If a conflict is
122
148
// introduced between the check and the insert/update, a DB error will occur.
139
$query = "UPDATE proxy SET hostname = :hostname, login_url = :login_url, name = :name, notes = :notes WHERE id = :id";
140
db_query_execute($config, $query, convert_null_array(array(":hostname" => $hostname, ":login_url" => $proxy_login_url, ":name" => $name, ":notes" => $notes, ":id" => $_POST['id'])));
165
$query = "UPDATE proxy SET hostname = :hostname, login_url = :login_url, name = :name, notes = :notes, ".
166
"http_proxy_port_number = :http_proxy_port_number, ssh_server_port_number = :ssh_server_port_number, ".
167
"ssh_server_fingerprint = :ssh_server_fingerprint, ssh_user_name = :ssh_user_name, ".
168
"ssh_user_password = :ssh_user_password WHERE id = :id";
169
db_query_execute($config, $query, convert_null_array(array(
170
":hostname" => $hostname,
171
":login_url" => $proxy_login_url,
174
":http_proxy_port_number" => $http_proxy_port_number,
175
":ssh_server_port_number" => $ssh_server_port_number,
176
":ssh_server_fingerprint" => $ssh_server_fingerprint,
177
":ssh_user_name" => $ssh_user_name,
178
":ssh_user_password" => $ssh_user_password,
179
":id" => $_POST['id'])));
142
181
// Proxy notes were added after stats had already been gathered, so we'll give
143
182
// the user the option of copying the notes from the current edit to the stats
194
233
<!--<th><?=msg("last_user_request")?></th>
195
234
<th><?=msg("average_daily_requests")?></th>-->
235
<th><?=msg("http_proxy_port_number")?></th>
236
<th><?=msg("ssh_server_port_number")?></th>
237
<th><?=msg("ssh_server_fingerprint")?></th>
238
<th><?=msg("ssh_user_name")?></th>
239
<th><?=msg("ssh_user_password")?></th>
196
240
<th><a href="<?=getenv("SCRIPT_NAME")?>?add=1"><?=msg("add")?></a></th>
212
256
<td><textarea name="notes" rows="10" cols="60" wrap="off" style="width:100%"><?=escape_html($_POST['notes'])?></textarea></td>
260
<td><input type="text" name="http_proxy_port_number" maxlength="10" size="10" value="<?=escape_html($_POST['http_proxy_port_number'])?>"></td>
261
<td><input type="text" name="ssh_server_port_number" maxlength="10" size="10" value="<?=escape_html($_POST['ssh_server_port_number'])?>"></td>
262
<td><input type="text" name="ssh_server_fingerprint" maxlength="100" size="40" value="<?=escape_html($_POST['ssh_server_fingerprint'])?>"></td>
263
<td><input type="text" name="ssh_user_name" maxlength="100" size="15" value="<?=escape_html($_POST['ssh_user_name'])?>"></td>
264
<td><input type="text" name="ssh_user_password" maxlength="100" size="15" value="<?=escape_html($_POST['ssh_user_password'])?>"></td>
215
265
<td><input type="submit" value="<?=msg("add")?>"> <a href="<?=getenv("SCRIPT_NAME")?>"><?=msg("cancel")?></a></td>
309
359
// echo "<td>{$_p}{$last_user_request}{$_s}</td>\n";
310
360
// echo "<td>{$_p}{$average_daily_requests}{$_s}</td>\n";
361
echo "<td>{$_p}".escape_html($record['http_proxy_port_number'])."{$_s}</td>\n";
362
echo "<td>{$_p}".escape_html($record['ssh_server_port_number'])."{$_s}</td>\n";
363
echo "<td>{$_p}".escape_html($record['ssh_server_fingerprint'])."{$_s}</td>\n";
364
echo "<td>{$_p}".escape_html($record['ssh_user_name'])."{$_s}</td>\n";
365
echo "<td>{$_p}".escape_html($record['ssh_user_password'])."{$_s}</td>\n";
311
366
echo "<td><a href=\"".getenv("SCRIPT_NAME")."?edit={$record[id]}\">{$_p}".msg("edit")."{$_s}</a> ";
330
385
// echo "<td>{$last_user_request}</td>";
331
386
// echo "<td>{$average_daily_requests}</td>";
388
echo "<input type=\"text\" name=\"http_proxy_port_number\" maxlength=\"10\" size=\"10\" value=\"".escape_html($record['http_proxy_port_number'])."\">";
391
echo "<input type=\"text\" name=\"ssh_server_port_number\" maxlength=\"10\" size=\"10\" value=\"".escape_html($record['ssh_server_port_number'])."\">";
394
echo "<input type=\"text\" name=\"ssh_server_fingerprint\" maxlength=\"100\" size=\"40\" value=\"".escape_html($record['ssh_server_fingerprint'])."\">";
397
echo "<input type=\"text\" name=\"ssh_user_name\" maxlength=\"100\" size=\"15\" value=\"".escape_html($record['ssh_user_name'])."\">";
400
echo "<input type=\"text\" name=\"ssh_user_password\" maxlength=\"100\" size=\"15\" value=\"".escape_html($record['ssh_user_password'])."\">";
333
403
echo "<input type=\"submit\" value=\"".msg("update")."\"> <a href=\"".getenv("SCRIPT_NAME")."\">".msg("cancel")."</a>";
334
404
echo "<br><br><input type='checkbox' name='update_stats' ".($_POST['update_stats'] ? 'checked=1' : '')." /><font size='small'>".msg("proxies_update_stats")."</font>";