bouncer_r/php/admin login.php,1.2,1.3 index.php,1.2,1.3

David Farning (dfarning) fedora-extras-commits at redhat.com
Mon Aug 1 20:39:29 UTC 2005


Author: dfarning

Update of /cvs/fedora/bouncer_r/php/admin
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13863/php/admin

Added Files:
	login.php index.php 
Log Message:
cvs cleanup for fedora initial commit


Index: login.php
===================================================================
RCS file: login.php
diff -N login.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ login.php	1 Aug 2005 20:39:27 -0000	1.3
@@ -0,0 +1,54 @@
+<?php
+/**
+ *  Admin login. 
+ *  @package mirror
+ *  @subpackage admin
+ *  @author Mike Morgan 
+ */
+ 
+ini_set("include_path", ".:../inc");
+require_once('../cfg/init.php');
+include("site.inc");
+
+require_once(LIB.'/auth.php');
+
+
+
+#// authenticate
+if (!empty($_POST['submit'])) {
+    if ($auth = auth_mysql($_POST['username'],$_POST['password'])) {
+        auth_create_session($auth);
+        header('Location: http://'.$_SERVER['HTTP_HOST'].WEBPATH.'/admin/');
+        exit;
+    } else {
+        $msg = 'Authentication failed.  Please check username and password and try again.';
+    }
+}
+
+#$title='Login';
+$body_tags=' onload="document.getElementById(\'username\').focus();" ';
+#require_once(HEADER);
+$template = new Page;
+$template->displayHeader("Login");
+
+?>
+<h1>Bouncer Login</h1>
+<?=(!empty($msg))?'<pre>'.$msg.'</pre>':null?>
+<form name="form" id="form" method="post" action="./login.php" >
+<div>
+    <label for="username" class="label-login">Username:</label>
+
+    <input type="text" name="username" id="username" size="30" maxlength="100" />
+</div>
+<br />
+<div>
+    <label for="password" class="label-login">Password:</label>
+    <input type="password" name="password" id="password" size="30" maxlength="100" />
+</div>
+<br />
+<input type="submit" name="submit" id="submit" class="button" value="Log In" />
+</form>
+
+<?php
+$template->displayFooter('$Date$', 1);
+?>


Index: index.php
===================================================================
RCS file: index.php
diff -N index.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ index.php	1 Aug 2005 20:39:27 -0000	1.3
@@ -0,0 +1,105 @@
+<?php
+/**
+ *  Dashboard.
+ *  @package mirror
+ *  @subpackage admin
+ *  @author Mike Morgan
+ */
+
+ini_set("include_path", "../inc");
+require_once('../cfg/init.php');
+include("site.inc");
+$protect=1;  // protect this page
+
+$template = new Page;
+
+$template->displayHeader('Admin');
+
+
+
+
+#$title = 'Dashboard';
+#$nav = INC.'/admin_nav.php';
+#require_once(HEADER);
+echo '<h2>Dashboard</h2>';
+
+echo '<h3>Mirror Network</h3>';
+echo '<ul>';
+
+// total # of mirrors
+$mirror_total = db_get_one("SELECT COUNT(mirror_id) FROM mirrors",MYSQL_NUM);
+echo '<li><a href="./mirrors/index.php?sort=mirror_name"><b>'.$mirror_total[0].'</b> total mirrors.</a></li>';
+
+// # of disabled mirrors 
+$mirror_disabled = db_get_one("SELECT IF(COUNT(mirror_id)>0,COUNT(mirror_id),'No') FROM mirrors WHERE mirror_active != '1'",MYSQL_NUM);
+echo '<li><a href="./mirrors/index.php"><b>'.$mirror_disabled[0].'</b> mirrors are inactive.</a></li>';
+
+// # of active mirrors
+$mirror_active = db_get_one("SELECT IF(COUNT(mirror_id)>0,COUNT(mirror_id),'No') FROM mirrors WHERE mirror_active = '1' AND mirror_admin_disable = '0'",MYSQL_NUM);
+echo '<li><a href="./mirrors/index.php"><b>'.$mirror_active[0].'</b> mirrors are active.</a></li>';
+
+// # of admin-disabled mirrors
+$mirror_admin_disable= db_get_one("SELECT IF(COUNT(mirror_id)>0,COUNT(mirror_id),'No') FROM mirrors WHERE mirror_admin_disable = '1'",MYSQL_NUM);
+echo '<li><a href="./mirrors/index.php"><b>'.$mirror_admin_disable[0].'</b> mirrors disabled by an admin.</a></li>';
+
+// total bandwidth
+$mirror_total_bandwidth = db_get_one("SELECT SUM(mirror_rating) FROM mirrors",MYSQL_NUM);
+$mirror_avail_bandwidth = db_get_one("SELECT SUM(mirror_rating) FROM mirrors WHERE mirror_active = '1' AND mirror_admin_disable = '0'",MYSQL_NUM);
+echo '<li><a href="./mirrors/index.php?sort=mirror_rating&amp;order=DESC"><b>'.$mirror_avail_bandwidth[0].'</b> / <b>'.$mirror_total_bandwidth[0].'</b> Megabits of bandwidth is available.</a></li>';
+
+// files served
+$files_served = db_get_one("SELECT IF(COUNT(file_id),COUNT(file_id),'No') FROM downloadables",MYSQL_NUM);
+echo '<li><a href="./files.php"><b>'.$files_served[0].'</b> files</a> currently served by <a href="./mirrors/index.php?sort=mirror_name"><b>'.$mirror_active[0].'</b> mirrors.</a></li>';
+
+echo '</ul>';
+
+// product->mirror statistics
+//$product_stats = db_get("
+//    SELECT 
+//        product_versions.*,
+//        COUNT(mirrors.mirror_id) as count,
+//        COUNT(files.file_id) as filecount,
+//        SUM(mirrors.mirror_rating) as bandwidth
+//    FROM 
+//        downloadable 
+//    INNER JOIN
+//        mirrors
+//    ON
+//        downloadable.mirror_id=mirrors.mirror_id
+//    INNER JOIN 
+//        files 
+//    ON 
+//        downloadable.file_id=files.file_id
+//    INNER JOIN 
+//        product_versions 
+//    ON 
+//        files.pv_id=product_versions.pv_id 
+//    GROUP BY 
+//        files.pv_id
+//    ORDER BY
+//        pv_product_name
+//");
+//if (!empty($product_stats)) {
+//    echo '<h3>Product Availability (any lang, any os)</h3>';
+//    echo '<table class="list">';
+//    echo '<thead><tr><th>Product</th><th>Version</th><th>Files</th><th>Mirrors</th><th>Bandwidth</th></tr></thead><tbody>';
+//    foreach ($product_stats as $row) {
+//        echo '<tr class="row'.($row%2).'"><td>'.$row['pv_product_name'].'</td><td>'.$row['pv_version_name'].'</td><td>'.$row['filecount'].'</td><td>'.$row['count'].'</td><td>'.$row['bandwidth'].' Mbits</td></tr>';
+//        $row++;
+//    }
+//    echo '</tbody></table>';
+//}
+
+// recently logged in users
+$users = db_get("SELECT users.* FROM sessions INNER JOIN users ON users.username=sessions.username");
+if (!empty($users)) {
+    echo '<h3>Recent Users</h3>';
+    echo '<ul>';
+    foreach ($users as $user) {
+        echo '<li>'.$user['user_firstname'].' '.$user['user_lastname'].' ('.$user['username'].')</li>';
+    }
+    echo '</ul>';
+}
+
+$template->displayFooter('$Date$');
+?>




More information about the scm-commits mailing list