public static function updateInfo($uid, $fname, $roll, $email) { $uid = pg_escape_string($uid); $fname = pg_escape_string($fname); $roll = strtolower(pg_escape_string($roll)); $email = pg_escape_string($email); $sql = "update users set us_fullname='{$fname}', us_rollno='{$roll}', us_email='{$email}' where us_id='{$uid}' returning us_id"; $row = resource2array(dbquery($sql)); return $row[0]; }
public static function listAllEventIds(){ $qry = "select ev_id from event"; $res = dbquery($qry); return(resource2array($res)); }
public static function searchRegisteredTeam($arg) { $arg = '%' . $arg . '%'; $qry = "select * from registration where \n\t\t\t\t\t\t(teamname like '" . $arg . "') OR \n\t\t\t\t\t\t(teamid like '" . $arg . "') OR \n\t\t\t\t\t\t(teamleader like '" . $arg . "')"; return resource2array(dbquery($qry)); }
/** * Returns all videos uplaoded by a user. * @param integer $uid User ID to get uplaoded videos. * @return string JSON containing all uploaded video details. */ function getUserUploadedVideosJson($uid) { $sql = "Select cn_id from content_video where cn_userid={$uid}"; $contentarray = resource2array(dbquery($sql)); $json = array(); $vcount = count($contentarray); for ($i = 0; $i < $vcount; $i++) { $obj = new video($contentarray[$i]); array_push($json, array('cid' => $obj->getContentId(), 'title' => $obj->getTitle(), 'viewcount' => $obj->getViewCount(), 'poster' => $obj->getPoster(), 'timestamp' => $obj->getTimestamp(), 'uid' => $obj->getUserId(), 'fullname' => user::getFullNameS($obj->getUserId()), 'userpic' => user::getUserPictureS($obj->getUserId()))); } return json_encode($json); }
public static function search($arg){ $arg='%'.$arg.'%'; $sql="SELECT * FROM participant WHERE (pc_tatid ILIKE '".$arg."') OR (pc_name ILIKE '".$arg."') OR (pc_email ILIKE '".$arg."')"; $arr=resource2array(dbquery($sql)); return $arr; }
/** * Login function * @param string $uname Username * @param string $upass User Password * @return */ public static function login($uname,$upass) { global $global_salt; $uname=pg_escape_string($uname); $upass=sha1($upass.$global_salt); $sql="Select us_id, us_name, us_fullname, us_status, us_pic from users where us_name='$uname' and us_pass='******'"; $res=dbquery($sql); $user=resource2array($res); if($user) { session_start(); $_SESSION['uid']=$user[0]; $_SESSION['username']=$user[1]; $_SESSION['fullname']=$user[2]; $_SESSION['status']=$user[3]; $_SESSION['userpic']=user::getUserPictureS($user[0],$user[4]); return 1; } return 0; }
/** * Static function that returns the Content ID most recent 'n' videos in the database. * @param integer $n Number of recent videos to fetch. * @return array Array of Content ID's of 'n' latest videos. */ public static function getRecent($n) { $sql = "Select cn_id from content_video order by cn_timestamp DESC limit " . $n; return resource2array(dbquery($sql)); }
public static function searchSuggestion($arg) { $arg = '%' . $arg . '%'; $qry = "select * from suggestion where \n\t\t\t\t\t\t(name like '" . $arg . "') OR \n\t\t\t\t\t\t(emailid like '" . $arg . "') OR \n\t\t\t\t\t\t(msg like '" . $arg . "')"; return resource2array(dbquery($qry)); }
/** Function that returns a list of the teams taking part in event $eid */ public static function getTeamIds($eventid){ $sql="SELECT rg_teamid FROM registration WHERE rg_eventid='".$eventid."'"; return resource2array(dbquery($sql)); }
/** * Static function that retrieves all accommodated Teams' information. */ public static function getAllData(){ $sql="SELECT * FROM accomodation"; $data=resource2array(dbquery($sql)); return $data; }
/** * Searches for a keyword in the content description. * @param string $query Search Tag * @return array Array of all Content ID's with the tag. */ public static function descriptionSearch($query,$offset,$limit) { $sql="select distinct cn_id from content where cn_desc ilike '%$query%' order by cn_id Limit $limit Offset $offset"; return resource2array(dbquery($sql)); }