X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=maps%2Fphp%2FMAPS.php;h=6f1a8bac713513482541e2155a6de3d1997e6281;hb=15842e23ec99588d83312f43b66e468fabe40eec;hp=0def4ba6066246853738e4cd86b145c22574d820;hpb=c0e00f11bf9b54692b2ee00e2488b7b08cb94026;p=clearscm.git diff --git a/maps/php/MAPS.php b/maps/php/MAPS.php index 0def4ba..6f1a8ba 100755 --- a/maps/php/MAPS.php +++ b/maps/php/MAPS.php @@ -50,13 +50,21 @@ 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") or DBError("OpenDB: Unable to select MAPS database", "adefaria_maps"); } // OpenDB +function CloseDB() { + global $db; + + if (isset ($db)) { + mysqli_close($db); + } // if +} // CloseDB + function SetContext($new_userid) { global $userid; @@ -66,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); @@ -102,6 +110,7 @@ function Login($userid, $password) { // Check if user exists $dbpassword = UserExists($userid); + print "dbpassword = $dbpassword
"; // Return -1 if user doesn't exist if ($dbpassword == -1) { @@ -211,9 +220,9 @@ function displayquickstats() { $current_time = date("g:i:s a"); // Start quickstats - print "
"; - print "

Today's Activity

"; - print "

as of $current_time

"; + print "
"; + print "

Today's Activity

"; + print "

as of $current_time

"; $processed = $dates[$today]["processed"]; $returned = $dates[$today]["returned"]; @@ -231,58 +240,60 @@ function displayquickstats() { $nulllist_pct = $processed == 0 ? 0 : number_format ($nulllist / $processed * 100, 1, ".", ""); - $returned_link = $returned == 0 ? 0 : - "$returned"; - $whitelist_link = $whitelist == 0 ? 0 : - "$whitelist"; - $blacklist_link = $blacklist == 0 ? 0 : - "$blacklist"; - $registered_link = $registered == 0 ? 0 : - "$registered"; - $mailloop_link = $mailloop == 0 ? 0 : - "$mailloop"; - $nulllist_link = $nulllist == 0 ? 0 : - "$nulllist"; + $returned_link = $returned == 0 ? '' : + ""; + $whitelist_link = $whitelist == 0 ? '' : + ""; + $blacklist_link = $blacklist == 0 ? '' : + ""; + $registered_link = $registered == 0 ? '' : + ""; + $mailloop_link = $mailloop == 0 ? '' : + "\""; + $nulllist_link = $nulllist == 0 ? '' : + ""; print << - + - - + + + + + + - - + - - + - - + - - + - - - -
ProcessedProcessed $processed n/a
Returned$returned_link + ${nulllist_link}Nulllist$nulllist$nulllist_pct%
${returned_link}Returned$returned $returned_pct%
Whitelist$whitelist_link + ${whitelist_link}Whitelist$whitelist $whitelist_pct%
Blacklist$blacklist_link + ${blacklist_link}Blacklist$blacklist $blacklist_pct%
Registered$registered_link + ${registered_link}Registered$registered n/a
Mailloop$mailloop_link + ${mailloop_link}Mailloop$mailloop n/a
Nulllist$nulllist_link - $nulllist_pct%
+
EOT; } // displayquickstats @@ -307,7 +318,8 @@ function NavigationBar($userid) { if (!isset ($userid) || $userid == "") { print <<Welcome to MAPS +

MAPS 2.0

+
Welcome to MAPS
+

MAPS 2.0

+
Welcome $Userid
END; + + displayquickstats(); + print <<
@@ -344,8 +360,6 @@ END; END; - displayquickstats(); - print << +

END; } // if @@ -392,9 +407,9 @@ function DisplayList($type, $next, $lines) { or DBError("DisplayList: Unable to execute query: ", $statement); for ($i = 0; $i < $lines; $i++) { - $row = mysqli_fetch_array ($result); + $row = mysqli_fetch_array($result); - if (!isset ($row ["sequence"])) { + if (!isset ($row["sequence"])) { break; } // if @@ -403,6 +418,7 @@ function DisplayList($type, $next, $lines) { $domain = $row["domain"] == "" ? " " : $row["domain"]; $hit_count = $row["hit_count"] == "" ? " " : $row["hit_count"]; $last_hit = $row["last_hit"] == "" ? " " : $row["last_hit"]; + $retention = $row["retention"] == "" ? " " : $row["retention"]; $comments = $row["comment"] == "" ? " " : $row["comment"]; // Remove time from last hit @@ -419,13 +435,13 @@ function DisplayList($type, $next, $lines) { $rightclass = ($i == $lines || $sequence == $total || $sequence == $last) ? "tablebottomright" : "tablerightdata"; - print "" . $sequence . ""; - print "\n"; + print "" . $sequence . "\n"; print "" . $username . ""; print "@"; print "$domain"; print "" . $hit_count . ""; print "" . $last_hit . ""; + print "" . $retention . ""; print "" . $comments . ""; print ""; } // for @@ -463,11 +479,11 @@ function ListDomains($top = 10) { $result = mysqli_query($db, $statement) or DBError("ListDomains: Unable to execute query: ", $statement); + print "
"; print << - Mark - Ranking +   Domain Returns @@ -475,22 +491,20 @@ END; // Get results for ($i = 0; $i < $top; $i++) { - $row = mysqli_fetch_array ($result); + $row = mysqli_fetch_array($result); $domain = $row["domain"]; $nbr = $row["nbr"]; print ""; $ranking = $i + 1; if ($i < $top - 1) { - print "\n"; - print "" . $ranking . ""; - print "$domain"; + print "" . $ranking . "\n"; + print "$domain"; print ""; print "$nbr"; } else { - print "\n"; - print "" . $ranking . ""; - print "$domain"; + print "" . $ranking . "\n"; + print "$domain"; print ""; print "$nbr"; } // if @@ -503,6 +517,7 @@ END; + END; } // ListDomains @@ -524,9 +539,11 @@ function Space() { strlen($row["subject"]) + strlen($row["timestamp"]) + strlen($row["data"]); - $space = $space + $msg_space; + $space += $msg_space; } // while + mysqli_free_result($result); + return $space; } // Space ?>