function hasUserVoted($user = null) { $query = "SELECT vote_ans from poll_responses where (" . "(poll_id = " . $this->pollID . ") and" . "(user_id = '" . $user->id . "'))"; $dbh =& XMEC::getDB(); $queryHndl = $dbh->query($query); if (DB::isError($queryHndl)) { $pollError = "Database Query failed.<BR>"; return -1; } $res = $queryHndl->fetchRow(); return $res[0]; }
function getJobPosts() { $result = NULL; $count = 0; $user = XMEC::getUser(); $dbh =& XMEC::getDB(); $query = "SELECT *, DATE_FORMAT(post_date, '%D %b,%Y') from job_posts order by post_date"; $queryHandle = $dbh->query($query); if (DB::isError($queryHandle)) { return $result; } while (is_array($title = $queryHandle->fetchRow())) { $result[$count++] = $title; } return $result; }
<?php $secure_page = 1; $this_page = "college"; include 'header.php'; if (!XMEC::authenticate_user()) { echo "<html><h1>Please login to access this page<html>"; exit; } $me =& XMEC::getUser(); if (!$me->isAdmin()) { echo "<html><h1>Not authorized !!</html>"; exit; } $dbh =& XMEC::getDB(); if (!isset($_POST['submit'])) { ?> <html> <head> </head> <body> <TABLE cellSpacing=0 cellPadding=4 width=90% align=center border=0> <TR> <TD width=6%><BR></TD> <TD width=90% height=40 class=head><B>XMEC Broadcast Mailer</B></TD> </TR> <TR><TD colspan=2> <!--Box Starts--> <TABLE cellSpacing=0 cellPadding=0 border=0 width=90% align=center> <TBODY>
function setPassword($old, $n, $admin = FALSE) { $dbh =& XMEC::getDB(); $q = "update xmec_auth set password = PASSWORD('{$n}') where user_id = "; $q .= "'{$this->id}'"; if (!$admin) { $q .= " and password = PASSWORD('{$old}')"; } if ($admin || $this->validateUser($old, true)) { $res = $dbh->query($q); if (DB::isError($res)) { $this->error = $res->getMessage(); return FALSE; } if ($res === DB_OK) { return TRUE; } } return FALSE; }