Share Pastebin
Guest
Public paste!

SiD

By: a guest | Jan 15th, 2009 | Syntax: PHP | Size: 4.61 KB | Hits: 77 | Expires: Never
Copy text to clipboard
  1. <?php
  2. /*
  3.  
  4. http://sid93.wordpress.com
  5. ./SiD
  6.  
  7. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  8. Simple PHP script to insert/view Access Point
  9. [Wardriving Database :D]
  10.  
  11. Inserted data will be saved on .txt file and on php file..
  12. So you don't have to use MySQL ^^
  13. Edit $db variable to change php database file.
  14. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15.  
  16. */
  17. ?>
  18.  
  19. <html>
  20.  
  21. <head>
  22. <title>Wardriving Database ~ SiD</title>
  23. </head>
  24.  
  25. <body>
  26. <style type="text/css">
  27.  
  28. body {
  29.  background: #000000;
  30. }
  31. t {
  32.  color: #FFFFFF;
  33.  font-size: 13;
  34.  font-weight: bold;
  35. }
  36. x {
  37.  color: #FF6600;
  38.  font-size: 16;
  39.  font-weight: bold;
  40.  font-family: arial;
  41. }
  42. y {
  43.  color: #F0F8FF;
  44.  font-size: 14;
  45.  font-weight: normal;
  46.  font-family: fixed;
  47. }
  48. y:hover {
  49.  color: #FFFFFF;
  50. }
  51.  
  52. a:link, a:visited, a:active {
  53.  color: #226AD0;
  54.  font-family: verdana;
  55.  font-size: 12px;
  56.  font-weight: bold;
  57. }
  58. a:hover {
  59.  color: #0099CC;
  60.  font-size: 12px;
  61. }
  62.  
  63. input {
  64.  background: #C8C8C8;
  65.  font-size: 12;
  66.  font-family: verdana;
  67.  border: 1px groove #C8C8C8;
  68. }
  69. input:hover {
  70.  background: #3399CC;
  71. }
  72.  
  73. textarea {
  74.  background: #C8C8C8;
  75.  color: #0B0B0B;
  76.  font-size: 11;
  77.  font-family: verdana;
  78.  border: 1px solid #000000;
  79. }
  80. textarea:hover {
  81.  background: #3399CC;
  82. }
  83.  
  84. table {
  85.  border: 1px solid #666666;
  86.  border-collapse: collapse;
  87. }
  88.  
  89. </style>
  90. </body>
  91.  
  92.  
  93. <?php
  94.  
  95. $db = "db/db.php"; //Edit this variable to change database file
  96.  
  97. $type = htmlentities($_GET["mode"]);
  98.  
  99. if($type == "view") {
  100.         if(isset($_GET['id'])) {
  101.                 $sid = htmlentities($_GET['id']);
  102.                 if($sid != "" && !strstr($sid, "/") && ereg("[0-9]", $sid)) {
  103.                         (@include_once "db/$sid.txt") or die("<t>Invalid file ID or deleted item.</t>");
  104.                 }
  105.                 else {
  106.                         print "<t>Are you joking?</t>";
  107.                 }
  108.         }
  109.         else {
  110.                 print "
  111.                 <center><y>Click on a table to view description.</y></center>
  112.                 <table width='85%' border='1' align='center' bgcolor='#680000'>
  113.                 <tr><th><t>Poster</t></th><th><t>SSID</t></th><th><t>Location</t></th><th><t>Key</t></th></tr>
  114.                 ";
  115.                 (@include_once $db) or die("<center><y>Nothing posted.</y></center><br>");
  116.         }
  117. }
  118. elseif($type == "insert") {
  119.         print "
  120.         <form action='?mode=insert&a=process' method='POST'>
  121.  
  122.         <table width='70' border='1' style='font-size: 13px'>
  123.         <tr><td><t>Your Nick: </t></td><td align='center'><input type='text' name='nick' maxlength='20'></td></tr>
  124.         <tr><td><t>WiFi SSID: </t></td><td align='center'><input type='text' name='ssid' maxlength='20'></td></tr>
  125.         <td><t>Location: </t></td><td align='center'><input type='text' name='where' maxlength='36'></td>
  126.         <tr><td><t>Protection: </t></td>
  127.         <td align='center'><select name='key'>
  128.         <option>None</option><option>WPA</option><option>WEP</option>
  129.         </select></td></tr>
  130.         <tr><td><t>Description: </t></td><br>
  131.         <td align='center'><textarea name='descr' maxlength='35' rows=6 cols=28></textarea></td></tr>
  132.         </table>
  133.         <br><input type='Submit' name='submit' value='Insert'>
  134.  
  135.         </form>
  136.         ";
  137.  
  138.         $nick     = htmlentities($_POST['nick']);
  139.         $ssid     = htmlentities($_POST['ssid']);
  140.         $location = htmlentities($_POST['where']);
  141.         $key      = htmlentities($_POST['key']);
  142.         $descr    = htmlentities($_POST['descr']);
  143.  
  144.         if(isset($_POST['submit'])) {
  145.  
  146.                 if(empty($nick) || empty($ssid) || empty($location)) {
  147.                         header("location: ?mode=insert");
  148.                         die;
  149.                 }
  150.  
  151.                 $process = htmlentities($_GET['a']);
  152.                 if($process == "process") {
  153.                         $id = rand(10000,90000000);
  154.                         if(file_exists("db/$id.txt")) {
  155.                                 header("location: ?mode=insert");
  156.                                 die;
  157.                         }
  158.                         else {
  159.                                 $fid = fopen("db/$id.txt", "w+");
  160.                                 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>");
  161.                                 if($descr != "") {
  162.                                         fwrite($fid,"<tr>Description</tr><br><textarea name='des' cols='28' rows='8'>$descr</textarea>");
  163.                                 }
  164.                         }
  165.                         if(file_exists("db/$id.txt")) {
  166.                                 print "
  167.                                 <br><t>Done. Database updated!<br>
  168.                                 Now you can view inserted data on the database, or view single file inserted:<br>
  169.                                 <a href='?mode=view&id={$id}'>Here</a>
  170.                                 </t>
  171.                                 ";
  172.                                 fclose($fid);
  173.                         }
  174.  
  175.                         $data = fopen($db, "a");
  176.                         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");
  177.                         fclose($data);
  178.  
  179.                 }
  180.         }
  181.  
  182. }
  183. else {
  184.         print "
  185.         <center><br>
  186.         <t><a href='?mode=view'>View database</a></t>
  187.         <br><t><a href='?mode=insert'>Insert Access Point</a></t>
  188.         <hr></center>
  189.         ";
  190. }
  191.  
  192. ?>