/** * Returns a sorted array of objects that match given conditions * @param multidimensional array {("field", "comparator", "value"), ("field", "comparator", "value"), ...} * @param string $sortBy * @param boolean $ascending * @param int limit * @return array $groupList */ static function GetList($fcv_array, $sortBy = '', $ascending = true, $limit = '') { $sqlLimit = $limit != '' && $sortBy == '' ? "LIMIT {$limit}" : ''; if (sizeof($fcv_array) > 0) { $groupList = array(); $Database = new DatabaseConnection(); $pog_query = "select groupid from `group` where "; for ($i = 0, $c = sizeof($fcv_array) - 1; $i < $c; $i++) { $pog_query .= "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " '" . $Database->Escape($fcv_array[$i][2]) . "' AND"; } $pog_query .= "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " '" . $Database->Escape($fcv_array[$i][2]) . "' order by groupid asc {$sqlLimit}"; $Database->Query($pog_query); for ($i = 0; $i < $Database->Rows(); $i++) { $group = new Group(); $group->Get($Database->Result($i, "groupid")); $groupList[] = $group; } if ($sortBy != '') { $f = ''; $group = new Group(); if (isset($group->pog_attribute_type[strtolower($sortBy)]) && $group->pog_attribute_type[strtolower($sortBy)][0] == "NUMERIC") { $f = 'return $group1->' . $sortBy . ' > $group2->' . $sortBy . ';'; } else { if (isset($group->pog_attribute_type[strtolower($sortBy)])) { $f = 'return strcmp(strtolower($group1->' . $sortBy . '), strtolower($group2->' . $sortBy . '));'; } } usort($groupList, create_function('$group1, $group2', $f)); if (!$ascending) { $groupList = array_reverse($groupList); } if ($limit != '') { $limitParts = explode(',', $limit); if (sizeof($limitParts) > 1) { return array_slice($groupList, $limitParts[0], $limitParts[1]); } else { return array_slice($groupList, 0, $limit); } } } return $groupList; } return null; }
<?php require "common_all.php"; if (isset($_POST["reset"])) { $db = new DatabaseConnection(); $email = $db->Escape($_POST["email"]); $password = ""; for ($i = 1; $i <= 6; $i++) { $password .= chr(mt_rand(97, 122)) . chr(mt_rand(65, 90)); } $db->Query("UPDATE onlineuser SET pass_word=PASSWORD('{$password}') WHERE email='{$email}'"); $db->Query("SELECT first_name, last_name FROM onlineuser WHERE email='{$email}'"); if ($db->Rows() > 0) { $fname = $db->Result(0, "first_name"); $lname = $db->Result(0, "last_name"); $headers = "From: noreply@fastfoodjobsuk.co.uk\r\n"; $headers .= "X-Mailer: CJS_MailSystem\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $message = "<HTML><pre>"; $message .= "Dear {$fname} {$lname}\n\n"; $message .= "You password is: {$password} and if you need any further help please e-mail\n"; $message .= "support@fastfoodjobsuk.co.uk\n\n"; $message .= "Regards,\n\n"; $message .= "The Fast Food Jobs Support Team."; $message .= "</pre></html>"; mail($email, "Fastfoodjobsuk Password Reset", $message, $headers); } header("Location: forgotten_password_success.php"); exit; }
function getCVId() { $db = new DatabaseConnection(); $result = $db->Query("select cvid from `cv` where onlineuser_onlineuserid='" . $this->onlineuserId . "'"); return $db->Result(0, "cvid"); }
$errorText = ""; if (isset($_GET["code"])) { if (strlen($code) > 20) { $errorText .= "<LI>Please enter a valid code"; } if (strlen($email) > 45) { $errorText .= "<LI>Please enter a valid email address"; } if ($errorText == "") { $db = new DatabaseConnection(); $code = $db->Escape($_GET["code"]); $email = $db->Escape($_GET["email"]); $db->Query("SELECT onlineuserid FROM onlineuser WHERE email='{$email}'"); if ($db->Rows() > 0) { $user = new OnlineUser(); $user = $user->Get($db->Result(0, "onlineuserid")); if ($code == strtotime($user->dt_created)) { $user->user_status = "active"; $user->Save(); //$_SESSION["onlineuser"]=$user; header("Location: register_activated.php"); } } $errorText = "<LI>Either the email address or code you entered is incorrect"; } else { $errorText = "<ul>{$errorText}</ul>"; } } require "top.php"; ?>