Gazelle/sections/tools/misc/countries.php

69 lines
1.6 KiB
PHP
Raw Normal View History

2012-08-07 08:00:17 +00:00
<?php
2012-08-08 08:00:12 +00:00
if (!check_perms('users_view_invites')) { error(403);
2012-08-07 08:00:17 +00:00
}
show_header('Fishy Invites');
if (isset($_POST['newcountry'])) {
$country = mysql_escape_string(strtoupper($_POST['country']));
$DB -> query("INSERT INTO country_invites (Country) VALUES ('$country')");
}
if (isset($_POST['changecountry'])) {
$id = $_POST['id'];
$country = mysql_escape_string(strtoupper($_POST['country']));
if ($_POST['save']) {
$DB -> query("UPDATE country_invites SET Country = '$country' WHERE ID = '$id'");
}
if ($_POST['delete']) {
$DB -> query("DELETE FROM country_invites WHERE ID = '$id'");
}
}
?>
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>IRC highlight on (fishy) invites sent to countries</h2>
</div>
2012-08-07 08:00:17 +00:00
<table width="100%">
<tr class="colhead">
<td>Country</td>
<td>Submit</td>
</tr>
<tr/>
<tr>
<form method="post">
<input type="hidden" name="newcountry" value="1" />
<td>
<input type="text" name="country"/>
</td>
<td>
<input type="submit" value="Add Country"/>
</td>
</form>
</tr>
<?
$DB->query("SELECT ID, Country FROM country_invites ORDER BY Country");
while (list($ID, $Country) = $DB->next_record()) {
?>
<tr>
<form method="post">
<input type="hidden" name="changecountry" value="1" />
<input type="hidden" name="id" value="<?=$ID?>" />
<td>
<input type="text" name="country" value="<?=$Country?>"/>
</td>
<td>
<input type="submit" name="save" value="Save Country"/>
<input type="submit" name="delete" value="Delete Country"/>
</td>
</form>
</tr>
<? }?>
</table>
<?
show_footer();
?>