mail.add.wddb 1.71 KB
Newer Older
Nico Schottelius's avatar
init  
Nico Schottelius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
BASEDIR=/home/server/www/org/wddb/www/

function report()
{
   # sender
   UFLINE

   # return path
   RPLINE

   # we
   RECIPIENT
   
   # delivered to..
   DTLINE
   # set
}

# continent
continent=`grep "^continent" "$1" | sed 's/.*="\(.*\)"/\1/'`

case "$continent" in
   africa|asia|australia|europe|northamerica|southamerica) ;;
   *) report "Allowed continents: africa|asia|australia|europe|northamerica|southamerica" ;;
esac

# other vars
essid=`grep "^essid" "$1" | sed 's/.*="\(.*\)"/\1/'`

# remove possible dots
country=`grep "^country" "$1" | sed 's/.*="\(.*\)"/\1/' | sed 's/\.\.//g'`
area=`grep "^area" "$1" | sed 's/.*="\(.*\)"/\1/' | sed 's/\//-/g' | sed 's/ //c'`
mac=`grep "^mac" "$1" | sed 's/.*="\(.*\)"/\1/'`
rate=`grep "^rate" "$1" | sed 's/.*="\(.*\)"/\1/'`
wep=`grep "^wep" "$1" | sed 's/.*="\(.*\)"/\1/'`
hints=`grep "^hints" "$1" | sed 's/.*="\(.*\)"/\1/'`
location=`grep "^location" "$1" | sed 's/.*="\(.*\)"/\1/'`

# check for empty fields
for a in essid country area mac rate wep hints location; do
   eval tmp="\$$a"
   if [ -z "$tmp" ]; then
      report "Empty field: $a"
   fi
done

if [ ! -f $BASEDIR/$continent/$country/$area.html ]; then
   cat << EOF > "$1"
   <html>
   <head>
   <title>wddb.org - WarDriver's DataBase</title>
   </head>

   <BODY bgcolor="#000000" color="#ef0000" font-color="#ef0000">
   <FONT COLOR="#ef0000">
   
else
  lines=`cat "$BASEDIR/$continent/$country/$area.html" | wc |awk '{ print $1 }'`
  use_lines=$[$lines-7]
  head -n $use_lines "$BASEDIR/$continent/$country/$area.html" > "$1"
  
fi

cat << EOF >> "$1"
   </TABLE>
   <HR>
   <A HREF="../index.html"> << One step back</A>
   <P><A HREF="/submit-new.html">Submit new network or changes<A>
   </FONT>
   </BODY>
   </HTML>
EOF