Updated some code for associating and mac address displays

This commit is contained in:
Will Bradley 2012-08-13 18:52:50 -07:00
parent 1166c879f5
commit 8e9686414d
3 changed files with 12 additions and 6 deletions

View File

@ -23,7 +23,7 @@ $message = "";
function csv_filter($value) { function csv_filter($value) {
return preg_replace('/[^a-z0-9:]/i','',$value); return preg_replace('/[^a-z0-9: ]/i','',$value);
} }
function is_mac($mac) { function is_mac($mac) {
@ -63,7 +63,7 @@ include('header-inc.php');
<table> <table>
<tr><td><label for="name">Your Name:</label></td><td><input type="text" id="name" name="name" /></td></tr> <tr><td><label for="name">Your Name:</label></td><td><input type="text" id="name" name="name" /></td></tr>
<tr><td><label for="macaddress">MAC Address:</label></td><td><input type="text" id="macaddress" name="macaddress" value="<?php echo arp_lookup($_SERVER['REMOTE_ADDR']); ?>" /> <tr><td><label for="macaddress">MAC Address:</label></td><td><input type="text" id="macaddress" name="macaddress" value="<?php echo arp_lookup($_SERVER['REMOTE_ADDR']); ?>" />
<span id="autodetect"><?php if($arp_found) { echo "(Autodetected MAC from IP address ".$_SERVER['REMOTE_ADDR'].")"; } ?></span> <span id="autodetect"><?php if($arp_found) { echo "(Autodetected your MAC from IP address ".$_SERVER['REMOTE_ADDR'].")"; } ?></span>
</td></tr> </td></tr>
</table> </table>
<input type="submit" id="submit" name="submit" value="Register" /> <input type="submit" id="submit" name="submit" value="Register" />

View File

@ -4,7 +4,7 @@ include('header-inc.php');
$result = http_parse_message(http_get("http://localhost/pamela/data.php")); $result = http_parse_message(http_get("http://localhost/pamela/data.php"));
$result = preg_replace("/\s/","",$result->body); // get rid of linebreaks $result = preg_replace("/[\r|\n]/","",$result->body); // get rid of linebreaks
$decode = json_decode($result); $decode = json_decode($result);
$decode = preg_replace("/^([0-9a-f]{2}([:]|$)){6}$/i",'{$0}',$decode); $decode = preg_replace("/^([0-9a-f]{2}([:]|$)){6}$/i",'{$0}',$decode);
@ -16,12 +16,20 @@ echo "<h2>Who's here right now?</h2>";
echo "<ul>"; echo "<ul>";
foreach($array as $entry) { foreach($array as $entry) {
if(substr($entry,0,1) == "{") { if(substr($entry,0,1) == "{") {
echo "<li class='macaddr'>".$entry."</li>"; if($_GET['showmacs'] == "1") {
echo "<li class='macaddr'>".$entry."</li>";
}
} }
else{ else{
echo "<li>".$entry."</li>"; echo "<li>".$entry."</li>";
} }
} }
if($_GET['showmacs'] == "1") {
echo "<li>&nbsp;<br/><a href=\"?showmacs=0\">Hide people who haven't registered yet</a>";
}
else {
echo "<li>&nbsp;<br/><a href=\"?showmacs=1\">Show people who haven't registered yet</a>";
}
echo "</ul>"; echo "</ul>";
?> ?>

View File

@ -201,5 +201,3 @@ scan
translate translate
upload upload
git commit mac_log.csv -m "Save updates user database"