{source}
<?php
$dbcon = mysql_connect(“localhost”, “standup_ipuser”, “T942mwxFna%G”) or die(mysql_error());
mysql_select_db(“standup_ip2location”, $dbcon);
print “<p><a href=’add-prc’></a></p>“;
//Filtering
print “<div><table cellspacing=’6′><tr><td>Filter by: “;
$locquery = mysql_query(“SELECT DISTINCT state FROM prc_info ORDER BY state”)or die(mysql_error());
print “<select name=’filter’ onChange=’FilterState(this.value)’>
<option value=”>State</option>“;
while ($row = mysql_fetch_array($locquery, MYSQL_ASSOC)) {
$state = $row[‘state’];
print “<option value=’$state’>$state</option>“;
}
print “</select></td>“;
$locquery2 = mysql_query(“SELECT DISTINCT country FROM prc_info ORDER BY country”)or die(mysql_error());
print “<td><select name=’filter’ onChange=’FilterCountry(this.value)’>
<option value=”>Country</option>“;
while ($row = mysql_fetch_array($locquery2, MYSQL_ASSOC)) {
$country = $row[‘country’];
print “<option value=’$country’>$country</option>“;
}
print “</select></td><td><a href=’prc-management’>Show All</a></td>
</tr></table></div>“;
if (isset($_GET[‘state’])) {
$loc = $_GET[‘state’];
$result = mysql_query(“SELECT * FROM prc_info WHERE state = ‘$loc’ ORDER BY id DESC”)or die(mysql_error());
}else if (isset($_GET[‘country’])) {
$loc = $_GET[‘country’];
$result = mysql_query(“SELECT * FROM prc_info WHERE country = ‘$loc’ ORDER BY id DESC”)or die(mysql_error());
}else {
$result = mysql_query(“SELECT * FROM prc_info ORDER BY id DESC”)or die(mysql_error());
}
//List PRCs
print “<table cellspacing=’10’ width=’100%’ border=’0′>
<tr><td></td><td><b>PRC</b></td><td><b>Contact</b></td><td align=’center’><b>Test</b></td><td align=’center’><b>Email</b></td></tr>“;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$id = $row[‘id’];
$prc = $row[‘name’];
$address = $row[‘address’];
$city = $row[‘city’];
$state = $row[‘state’];
$zip = $row[‘zip’];
$contact = $row[‘contact’];
$phone = $row[‘phone’];
$email = $row[’email’];
$date = $row[‘date’];
$ip = $row[‘ip’];
$ipLoc = $row[‘ipLoc’];
$tested = $row[‘tested’];
$emailed = $row[’emailed’];
print “<tr><td width=’250′ valign=’top’><a class=’prcinfopop’><img src=’http://www.standupgirl.com/images/info.png’><b>Address</b><br />$address<br />$city, $state $zip<br /><b>Phone</b> – $phone</td><td width=’300′ valign=’top’>$prc</td></td><td valign=’top’>$contact</td>“;
if ($tested == 1) {
print “<td valign=’top’ align=’center’><img src=’http://www.standupgirl.com/images/green_check.png’></td>“;
}else if ($tested == 2) {
print “<td valign=’top’ align=’center’><img src=’http://www.standupgirl.com/images/red_x.png’></td>“;
}else {
if ($ipLoc == ‘Outside Area’ || $ip == ”) {
print “<td valign=’top’ align=’center’><a href=’prc-test?ip=$ip&prcid=$id&sbmt=3′>
<img src=’http://www.standupgirl.com/images/warning.png’></a></td>“;
}else if ($ipLoc == ‘Within 30 miles’) {
print “<td valign=’top’ align=’center’><a href=’prc-test?ip=$ip&prcid=$id&sbmt=2′><img src=’http://www.standupgirl.com/images/test.png’></a></td>“;
}else if ($ipLoc == ‘PRC’) {
print “<td valign=’top’ align=’center’><a href=’prc-test?ip=$ip&prcid=$id&sbmt=1′><img src=’http://www.standupgirl.com/images/test.png’></a></td>“;
}
}
if ($tested != 0) {
if ($emailed == 1) {
print “<td valign=’top’ align=’center’><img src=’http://www.standupgirl.com/images/mail-sent.png’></td>“;
}else {
print “<td valign=’top’ align=’center’><a href=’prc-management?prcid=$id’><img src=’http://www.standupgirl.com/images/send-mail.png’></a></td>“;
}
}
print “</tr>“;
}
print “</table>“;
?>
{/source}