public static function getWebAdUserByUsername($username) { $result = Database::doQuery("SELECT * FROM " . Database::addPrefix('webadusers') . " WHERE username = '******' LIMIT 1"); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); return new WebAdUser($row['username']); } else { return null; } }
public static function updateUserPassword($login, $password) { if ($login instanceof Login) { $query = "UPDATE " . Database::addPrefix('logins') . "\n\t\t\t\t\t\t\tSET password = '******'\n\t\t\t\t\t\t\tWHERE LoginID = '" . $login->getID() . "'"; Database::doQuery($query); } else { $query = "UPDATE " . Database::addPrefix('logins') . "\n\t\t\t\tSET password = '******'\n\t\t\t\tWHERE LoginID = '" . Database::makeStringSafe($login) . "'"; Database::doQuery($query); } }
public static function getEquipmentByID($equipId) { $result = Database::doQuery("SELECT * FROM " . Database::addPrefix(EquipmentDao::table_name) . " WHERE equip_id = '" . Database::makeStringSafe($equipId) . "'"); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); $equipment = new Equipment($row['equip_id'], $row['name'], $row['type'], $row['serial'], $row['description'], $row['max_length'], $row['picture'], $row['min_user_level'], $row['checkoutfrom']); return $equipment; } else { return null; } }
public static function getWarningsForUserByType($userId, $type) { $userId = Database::makeStringSafe($userId); $type = Database::makeStringSafe($type); $result = Database::doQuery("SELECT * FROM " . Database::addPrefix(WarningDao::table_name) . " WHERE user_id = '" . $userId . "' and type = '" . $type . "'"); $warnings = array(); while ($row = mysql_fetch_assoc($result)) { $warnings[] = WarningDao::buildWarning($row); } return $warnings; }
public static function updateClient($client, $name, $email, $phone, $address) { if ($client instanceof Client) { $query = "UPDATE " . Database::addPrefix('clients') . "\n\t\t\t\tSET Name = '" . $name . "', Email = '" . $email . "',\n\t\t\t\tPhone = '" . $phone . "', Address = '" . $address . "'\n\t\t\t \tWHERE ClientID = '" . Database::makeStringSafe($client->getID()) . "' LIMIT 1"; Database::doQuery($query); return ClientDao::getClientByID($client->getID()); } else { $query = "UPDATE " . Database::addPrefix('clients') . "\n\t\t\t\t\t\t\tSET Name = '" . $name . "', Email = '" . $email . "',\n\t\t\t\t\t\t\tPhone = '" . $phone . "', Address = '" . $address . "'\n\t\t\t\t\t\t \tWHERE ClientID = '" . Database::makeStringSafe($client) . "' LIMIT 1"; Database::doQuery($query); return ClientDao::getClientByID($client->getID()); } }
public static function updateAdRep($adRep, $name, $email, $phone) { if ($adRep instanceof AdRep) { $query = "UPDATE " . Database::addPrefix('adreps') . "\n\t\t\t\t\tSET name = '" . $name . "', email = '" . $email . "',\n\t\t\t\t\tphone = '" . $phone . "'\n\t\t\t\t \tWHERE AdRepID = '" . Database::makeStringSafe($adRep->getID()) . "' LIMIT 1"; Database::doQuery($query); return AdRepDao::getAdRepByID($adRep->getID()); } else { $query = "UPDATE " . Database::addPrefix('clients') . "\n\t\t\t\t\t\t\t\tSET name = '" . $name . "', email = '" . $email . "',\n\t\t\t\t\t\t\t\tphone = '" . $phone . "', address = '" . $address . "'\n\t\t\t\t\t\t\t \tWHERE AdRepID = '" . Database::makeStringSafe($client) . "' LIMIT 1"; Database::doQuery($query); return AdRepDao::getAdRepByID($adRep); } }
public static function getReservationsForEquipmentByDate($equipId, $startDate, $endDate) { $equipId = Database::makeStringSafe($equipId); $query = "SELECT * FROM " . Database::addPrefix(ReservationDao::table_name) . " WHERE equip_id = '" . $equipId . "'" . " AND (('{$startDate}' BETWEEN start_date AND end_date) OR ('{$endDate}' BETWEEN start_date AND end_date))"; echo $query; $result = Database::doQuery($query); $reservations = array(); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $reservations[] = new Reservation($row['res_id'], $row['equip_id'], $row['user_id'], $row['start_date'], $row['end_date'], $row['checked_out_by'], $row['check_out_date'], $row['checked_in_by'], $row['check_in_date'], $row['length'], $row['user_comment'], $row['admin_comment'], $row['mod_status']); } } return $reservations; }
public static function setView($ip, $hostname, $site, $size, $webadID) { $ip = Database::makeStringSafe($ip); $hostname = Database::makeStringSafe($hostname); $site = Database::makeStringSafe($site); $size = Database::makeStringSafe($size); $webadID = Database::makeStringSafe($webadID); $view = WebAdViewDao::getView($ip, $site, $size); if ($view) { $query = "UPDATE " . Database::addPrefix('webadviews') . " SET webadID = '" . $webadID . "'WHERE" . " ip = '" . $ip . "' AND site = '" . $site . "' AND size = '" . $size . "'"; Database::doQuery($query); } else { WebAdViewDao::createView($ip, $hostname, $site, $size, $webadID); } }
public static function updateName($userid, $name) { $userid = Database::makeStringSafe($userid); $name = Database::makeStringSafe($name); Database::doQuery("UPDATE " . Database::addPrefix(UserDao::table_name) . " SET name = '" . $name . "' WHERE user_id = '" . $userid . "' LIMIT 1"); }
public static function createForClientWithImage($clientId, $insertDate, $design, $color, $columns, $height, $inserts, $placements, $image) { $status = InsertStatusDao::getRecieved(); $query = "INSERT INTO " . Database::addPrefix('insertionorders') . "\n\t\t\tSET ClientID = '" . Database::makeStringSafe($clientId) . "', Design = '" . Database::makeStringSafe($design) . "', \n\t\tStatusID = '" . Database::makeStringSafe($status->getID()) . "', Color = '" . Database::makeStringSafe($color) . "', \n\t\tColumns = '" . Database::makeStringSafe($columns) . "', Height = '" . Database::makeStringSafe($height) . "', \n\t\tNumInserts = '" . Database::makeStringSafe($inserts) . "', NumPlacements = '" . Database::makeStringSafe($placements) . "', \n\t\tCreatedDate = '" . Database::CurrentMySQLDate() . "', UpdatedDate = '" . Database::CurrentMySQLDate() . "', \n\t\tInsertDate = '" . Database::makeStringSafe($insertDate) . "', BillingStatus = 'Paid', \n\t\tImage = '" . $image . "'"; Database::doQuery($query); }
public static function deleteAdById($webAdId) { Database::doQuery("DELETE FROM " . Database::addPrefix('webads') . " WHERE webadID = '" . Database::makeStringSafe($webAdId) . "' LIMIT 1"); }