<?php
/*
http://sid93.wordpress.com
./SiD
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Simple PHP script to insert/view Access Point
[Wardriving Database :D]
Inserted data will be saved on .txt file and on php file..
So you don't have to use MySQL ^^
Edit $db variable to change php database file.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
?>
<html>
<head>
<title>Wardriving Database ~ SiD</title>
</head>
<body>
<style type="text/css">
body {
background: #000000;
}
t {
color: #FFFFFF;
font-size: 13;
font-weight: bold;
}
x {
color: #FF6600;
font-size: 16;
font-weight: bold;
font-family: arial;
}
y {
color: #F0F8FF;
font-size: 14;
font-weight: normal;
font-family: fixed;
}
y:hover {
color: #FFFFFF;
}
a:link, a:visited, a:active {
color: #226AD0;
font-family: verdana;
font-size: 12px;
font-weight: bold;
}
a:hover {
color: #0099CC;
font-size: 12px;
}
input {
background: #C8C8C8;
font-size: 12;
font-family: verdana;
border: 1px groove #C8C8C8;
}
input:hover {
background: #3399CC;
}
textarea {
background: #C8C8C8;
color: #0B0B0B;
font-size: 11;
font-family: verdana;
border: 1px solid #000000;
}
textarea:hover {
background: #3399CC;
}
table {
border: 1px solid #666666;
border-collapse: collapse;
}
</style>
</body>
<?php
$db = "db/db.php"; //Edit this variable to change database file
if($type == "view") {
if($sid != "" && !strstr($sid, "/") && ereg("[0-9]", $sid)) {
(@include_once "db/$sid.txt") or
die("<t>Invalid file ID or deleted item.</t>");
}
else {
print "<t>Are you joking?</t>";
}
}
else {
print "
<center><y>Click on a table to view description.</y></center>
<table width='85%' border='1' align='center' bgcolor='#680000'>
<tr><th><t>Poster</t></th><th><t>SSID</t></th><th><t>Location</t></th><th><t>Key</t></th></tr>
";
(@include_once $db) or
die("<center><y>Nothing posted.</y></center><br>");
}
}
elseif($type == "insert") {
print "
<form action='?mode=insert&a=process' method='POST'>
<table width='70' border='1' style='font-size: 13px'>
<tr><td><t>Your Nick: </t></td><td align='center'><input type='text' name='nick' maxlength='20'></td></tr>
<tr><td><t>WiFi SSID: </t></td><td align='center'><input type='text' name='ssid' maxlength='20'></td></tr>
<td><t>Location: </t></td><td align='center'><input type='text' name='where' maxlength='36'></td>
<tr><td><t>Protection: </t></td>
<td align='center'><select name='key'>
<option>None</option><option>WPA</option><option>WEP</option>
</select></td></tr>
<tr><td><t>Description: </t></td><br>
<td align='center'><textarea name='descr' maxlength='35' rows=6 cols=28></textarea></td></tr>
</table>
<br><input type='Submit' name='submit' value='Insert'>
</form>
";
if(isset($_POST['submit'])) {
header("location: ?mode=insert");
}
if($process == "process") {
$id = rand(10000
,90000000
);
header("location: ?mode=insert");
}
else {
$fid = fopen("db/$id.txt", "w+");
fwrite($fid,"<x>Poster:</x><br><t>$nick</t><br><hr><x>SSID:</x><br><t>$ssid</t><br><hr><t><x>Location:</x><br><t>$location</t><br><hr><t><x>Protection:</x><br><t>$key</t><br><hr>");
if($descr != "") {
fwrite($fid,"<tr>Description</tr><br><textarea name='des' cols='28' rows='8'>$descr</textarea>");
}
}
print "
<br><t>Done. Database updated!<br>
Now you can view inserted data on the database, or view single file inserted:<br>
<a href='?mode=view&id={$id}'>Here</a>
</t>
";
}
fwrite($data, "<tr style='cursor:crosshair' onclick=\"window.location.href='?mode=view&id={$id}'\" align='center'><td width='25%'><y>$nick</y></td><td width='15%'><y>$ssid</y></td><td width='22%'><y>$location</y></td><td width='10%'><y>$key</y></td></tr>\n\n");
}
}
}
else {
print "
<center><br>
<t><a href='?mode=view'>View database</a></t>
<br><t><a href='?mode=insert'>Insert Access Point</a></t>
<hr></center>
";
}
?>