summaryrefslogtreecommitdiff
path: root/htdocs/moderate/src
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/moderate/src')
-rw-r--r--htdocs/moderate/src/accounts.inc.php67
-rw-r--r--htdocs/moderate/src/footer.inc.php6
-rw-r--r--htdocs/moderate/src/header.inc.php64
3 files changed, 137 insertions, 0 deletions
diff --git a/htdocs/moderate/src/accounts.inc.php b/htdocs/moderate/src/accounts.inc.php
new file mode 100644
index 0000000..fac6c7c
--- /dev/null
+++ b/htdocs/moderate/src/accounts.inc.php
@@ -0,0 +1,67 @@
+<?php
+/* $Id: accounts.inc.php 134 2011-03-08 23:35:57Z jessemorgan $ */
+
+function getAccount($id) {
+ $query = "SELECT * FROM jpm_users WHERE"
+ . "`id`='$id' OR `email`='$id'";
+
+ $db = getDatabase();
+
+ $results = array();
+
+ try {
+ $results = $db->fetchAssocRow($query);
+
+ } catch (Cif_Database_Exception $e) {
+ $results = false;
+ }
+
+ return $results;
+}
+
+function updatePassword($id, $password) {
+ $db = getDatabase();
+
+ $row['password'] = sha1($password);
+
+ $db->update('jpm_users', $row, "WHERE `id`='$id'");
+}
+
+function getAccounts($s) {
+ $query = "SELECT * FROM jpm_users";
+
+ if (!is_null($s)) {
+ $s = addslashes($s);
+ $query .= " WHERE name LIKE '%$s%' OR email LIKE '%$s%'";
+ }
+
+ $query .= " ORDER BY name";
+
+ $db = getDatabase();
+
+ $results = array();
+
+ try {
+ $results = $db->fetchAssocRows($query);
+
+ } catch (Cif_Database_Exception $e) {
+ $results = array();
+ }
+
+ return $results;
+}
+
+function generatePassword() {
+ $alphabet = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz123456789!@#$%*()";
+ $length = strlen($alphabet);
+
+ $password = '';
+ for ($i = 0; $i < 8; $i++) {
+ $pos = rand(0, $length - 1);
+ $password .= substr($alphabet, $pos, 1);
+ }
+
+ return $password;
+}
+
+?>
diff --git a/htdocs/moderate/src/footer.inc.php b/htdocs/moderate/src/footer.inc.php
new file mode 100644
index 0000000..96d3e78
--- /dev/null
+++ b/htdocs/moderate/src/footer.inc.php
@@ -0,0 +1,6 @@
+<?php /* $Id: footer.inc.php 134 2011-03-08 23:35:57Z jessemorgan $ */ ?>
+</div>
+
+
+</body>
+</html>
diff --git a/htdocs/moderate/src/header.inc.php b/htdocs/moderate/src/header.inc.php
new file mode 100644
index 0000000..4310009
--- /dev/null
+++ b/htdocs/moderate/src/header.inc.php
@@ -0,0 +1,64 @@
+<?php
+/* $Id: header.inc.php 151 2011-04-19 23:21:06Z jessemorgan $ */
+
+if (!isset($SESSION['currentUser']['id'])) {
+ if (isset($_POST['login_email']) and isset($_POST['login_password'])) {
+ $db = getDatabase();
+
+ $email = addslashes($_POST['login_email']);
+ $password = sha1($_POST['password']);
+
+ $query = "SELECT * FROM jpm_users WHERE `email`='$email' AND `password`='$password'";
+ $result = $db->fetchAssocRow($query);
+
+ if ($result) {
+ $SESSION['currentUser'] = $result;
+ }
+
+ }
+}
+
+?><!DOCTYPE html>
+<html>
+<head>
+ <link rel="stylesheet" type="text/css" href="<?= $CONFIG['siteroot']?>/admin/admin.css" />
+
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
+ <script>
+ $(document).ready(function() {
+ $('a.delete').click(function() {
+ return confirm('Are you sure you want to delete this?');
+
+ });
+
+ $('a.delete img').hover(function() {
+ $(this).attr('src', '<?= $CONFIG['siteroot'] ?>/admin/images/delete.png');
+ },
+ function() {
+ $(this).attr('src', '<?= $CONFIG['siteroot'] ?>/admin/images/deletegray.png');
+ });
+
+ });
+ </script>
+
+</head>
+<body>
+
+<h1><a href="<?= $CONFIG['siteroot']?>/admin/index.php">Foursquare Admin Panel</a></h1>
+<div id="nav">
+ <h2>Navigation</h2>
+ <ul>
+ <li><a href="<?= $CONFIG['siteroot']?>/admin/online-campus">Online Services</a>
+ <ul>
+ <li><a href="<?= $CONFIG['siteroot']?>/admin/online-campus/attendance">Online Attendance</a></li>
+ </ul>
+ </li>
+
+ <li><a href="<?= $CONFIG['siteroot']?>/troubleshoot.php">Troubleshooting Page</a></li>
+ <li><a href="<?= $CONFIG['siteroot']?>/admin/accounts/">Accounts</a></li>
+ <li><a href="<?= $CONFIG['siteroot']?>/admin/changepassword.php">Change Password</a></li>
+ <li><a href="<?= $CONFIG['siteroot']?>/admin/login.php?logout">Logout</a></li>
+ </ul>
+</div>
+
+<div id="content">