Welcome to MAPS 2.0
[clearscm.git] / maps / php / MAPS.php
index 9b94c17..589e74d 100755 (executable)
@@ -50,7 +50,7 @@ function DBError($msg, $statement) {
 function OpenDB() {
   global $db;
 
-  $db = mysqli_connect("localhost", "maps", "spam")
+  $db = mysqli_connect("127.0.0.1", "maps", "spam")
     or DBError("OpenDB: Unable to connect to database server", "Connect");
 
   mysqli_select_db($db, "MAPS")
@@ -74,7 +74,7 @@ function SetContext($new_userid) {
 function Encrypt($password, $userid) {
   global $db;
 
-  $statement = "select encode(\"$password\",\"$userid\")";
+  $statement = "select hex(aes_encrypt(\"$password\",\"$userid\"))";
 
   $result = mysqli_query($db, $statement)
     or DBError("Encrypt: Unable to execute statement", $statement);
@@ -110,6 +110,7 @@ function Login($userid, $password) {
 
   // Check if user exists
   $dbpassword = UserExists($userid);
+  print "dbpassword = $dbpassword<br>";
 
   // Return -1 if user doesn't exist
   if ($dbpassword == -1) {
@@ -220,7 +221,7 @@ function displayquickstats() {
 
   // Start quickstats
   print "<div class=quickstats>";
-  print "<h4 align=center class=header>Today's Activity</h4>";
+  print "<h4 align=center class=todaysactivity>Today's Activity</h4>";
   print "<p align=center><b>as of $current_time</b></p>";
 
   $processed     = $dates[$today]["processed"];
@@ -315,7 +316,8 @@ function NavigationBar($userid) {
 
   if (!isset ($userid) || $userid == "") {
     print <<<END
-  <div class="username">Welcome to MAPS</div>
+    <h2 align='center'><font style="color: white">MAPS 2.0</font></h2>
+    <div class="username">Welcome to MAPS</div>
     <div class="menu">
     <a href="/maps/doc/">What is MAPS?</a><br>
     <a href="/maps/doc/SPAM.php">What is SPAM?</a><br>
@@ -328,7 +330,8 @@ END;
   } else {
     $Userid = ucfirst($userid);
     print <<<END
-  <div class="username">Welcome $Userid</div>
+    <h2 align='center'><font style="color: white">MAPS 2.0</font></h2>
+    <div class="username">Welcome $Userid</div>
     <div class="menu">
     <a href="/maps/">Home</a><br>
     <a href="/maps/bin/stats.cgi">Statistics</a><br>
@@ -342,6 +345,9 @@ END;
     <a href="/maps/?logout=yes">Logout</a>
     </div>
 END;
+
+    displayquickstats();
+
     print <<<END
   <div class="search">
   <form method="get" action="/maps/bin/search.cgi" name="search">
@@ -352,8 +358,6 @@ END;
   </div>
 END;
 
-    displayquickstats();
-
     print <<<END
   <div class="search">
   <form "method"=post action="javascript://" name="address"
@@ -362,6 +366,7 @@ END;
     <input type="text" class="searchfield" id="searchfield" name="email"
      size="20" maxlength="255" value="" onclick="document.address.email.value = '';">
   </form>
+  <p></p>
   </div>
 END;
   } // if
@@ -411,6 +416,7 @@ function DisplayList($type, $next, $lines) {
     $domain    = $row["domain"]    == "" ? "&nbsp;" : $row["domain"];
     $hit_count = $row["hit_count"] == "" ? "&nbsp;" : $row["hit_count"];
     $last_hit  = $row["last_hit"]  == "" ? "&nbsp;" : $row["last_hit"];
+    $retention = $row["retention"] == "" ? "&nbsp;" : $row["retention"];
     $comments  = $row["comment"]   == "" ? "&nbsp;" : $row["comment"];
 
     // Remove time from last hit
@@ -434,6 +440,7 @@ function DisplayList($type, $next, $lines) {
     print "<td class=$dataclass align=left><a href=\"http://$domain\" target=_blank>$domain</a></td>";
     print "<td class=$dataclass align=right>"   . $hit_count . "</td>";
     print "<td class=$dataclass align=center>"  . $last_hit  . "</td>";
+    print "<td class=$dataclass align=right>"   . $retention . "</td>";
     print "<td class=$rightclass align=left>"   . $comments  . "</td>";
     print "</tr>";
   } // for
@@ -492,13 +499,13 @@ END;
     if ($i < $top - 1) {
       print "<td class=tableleftdata align=center><input type=checkbox name=action" . $i . " value=on></td>\n";
       print "<td align=center class=tabledata>" . $ranking . "</td>";
-      print "<td class=tabledata>$domain</td>";
+      print "<td class=tabledata><a href=\"http://$domain\">$domain</as></td>";
       print "<input type=hidden name=email$i value=\"@$domain\">";
       print "<td align=center class=tablerightdata>$nbr</td>";
     } else {
       print "<td class=tablebottomleft align=center><input type=checkbox name=action" . $i . " value=on></td>\n";
       print "<td align=center class=tablebottomdata>" . $ranking . "</td>";
-      print "<td class=tablebottomdata>$domain</td>";
+      print "<td class=tablebottomdata><a href=\"http://$domain\">$domain</a></td>";
       print "<input type=hidden name=email$i value=\"@$domain\">";
       print "<td align=center class=tablebottomright>$nbr</td>";
     } // if