本文整理汇总了PHP中User::find_by_sql方法的典型用法代码示例。如果您正苦于以下问题:PHP User::find_by_sql方法的具体用法?PHP User::find_by_sql怎么用?PHP User::find_by_sql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User::find_by_sql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public function getList($id = "", $pg)
{
$purl = array();
if (isset($_GET['url'])) {
$purl = $_GET['url'];
$purl = rtrim($purl);
$purl = explode('/', $_GET['url']);
} else {
$purl = null;
}
if (!isset($purl['2'])) {
$pn = 1;
} else {
$pn = $purl['2'];
}
global $database;
$resultUser = $database->db_query("SELECT * FROM users");
$pagin = new Pagination();
$pagin->nr = $database->dbNumRows($resultUser);
$pagin->itemsPerPage = 20;
$users = User::find_by_sql("SELECT * FROM users " . $pagin->pgLimit($pn));
$index_array = array("myusers" => $users, "mypagin" => $pagin->render($pg));
return $index_array;
return $index_array;
}
示例2: sync_Agenti
function sync_Agenti()
{
global $conexiune2;
//global $ftp_conn;
$ftp_conn = ftp_connect(FTP_SERVER) or die("Could not connect to ftp location");
$login_result = ftp_login($ftp_conn, FTP_USER, FTP_PASSWORD);
$sql = "SELECT * FROM Utilizator WHERE id=3";
// Doar Igor
$useri = User::find_by_sql($sql);
$sql = "DELETE FROM fes_Agent";
$result = execute_querry($sql, $conexiune2);
$sql = "ALTER TABLE fes_Agent AUTO_INCREMENT = 1";
$result = execute_querry($sql, $conexiune2);
$agent = array();
$sql_agent = "INSERT INTO fes_Agent (id,Nume,Prenume,Telefon,Email,Poza) VALUES ";
foreach ($useri as $usr) {
$agent["id"] = $usr->id;
$agent["Nume"] = $usr->Nume;
$agent["Prenume"] = $usr->Prenume;
$agent["Telefon"] = $usr->Telefon;
$agent["Email"] = $usr->Email;
$agent["Poza"] = $usr->Poza;
$sql_agent .= "('" . join("', '", array_values($agent)) . "'),";
if (!ftp_put($ftp_conn, NEW_FTP_PATH . DS . $usr->Poza, ".." . DS . "images" . DS . $usr->Poza, FTP_BINARY)) {
echo "Nu am putut transfera poza agentului " . $usr->full_name() . ".</br>";
}
}
$sql_agent = substr($sql_agent, 0, strlen($sql_agent) - 1);
$result = execute_querry($sql_agent, $conexiune2);
ftp_close($ftp_conn);
}
示例3: get_followers
function get_followers()
{
if (null !== $this->followers) {
return $this->followers;
}
if (!$this->followers_last_updated_date) {
$twitter = $this->twitter();
if ($twitter) {
$twitter->get_followers($this);
}
$this->followers_last_updated_date = new DateTime();
$this->save();
}
return $this->followers = User::find_by_sql("SELECT u.* FROM users u INNER JOIN follows f ON u.id = f.follower_id WHERE f.user_id = ?", array($this->id));
}
示例4: validate
/**
* バリデーション
*
* @access public
* @return boolean
**/
public function validate()
{
$v = new Validate();
if (!in_array('login', $this->skip)) {
$v->not_null('login', $this->login, 'ログインIDを入力してください');
$v->alphanumeric('login', $this->login, 'ログインIDは半角英数字で入力してください');
$v->range('login', $this->login, 4, 10, 'ログインIDは4文字から10文字で入力してください');
$user = User::find_by_sql('select * from users where login = ? and deleted_at is NULL', array($this->login));
if ($user->id) {
$v->add_error('login', '入力されたログインIDはすでに登録されています');
}
}
if (!in_array('password', $this->skip)) {
$v->not_null('password', $this->base_password, 'パスワードを入力してください');
$v->alphanumeric('password', $this->base_password, 'パスワードは半角英数字で入力してください');
$v->range('password', $this->base_password, 6, 255, 'パスワードは6文字以上で入力してください');
}
if (!in_array('password_confirm', $this->skip)) {
$v->not_null('password_confirm', $this->password_confirm, 'パスワード確認を入力してください');
$v->alphanumeric('password_confirm', $this->password_confirm, 'パスワード確認は半角英数字で入力してください');
$v->range('password_confirm', $this->password_confirm, 6, 255, 'パスワード確認は6文字以上で入力してください');
$v->not_equal('password_confirm', $this->password_confirm, $this->base_password, 'パスワードとパスワード確認の内容が違います');
}
if (!in_array('name', $this->skip)) {
$v->not_null('name', $this->name, '名前を入力してください');
$v->range('name', $this->name, 0, 255, '名前は255文字以内で入力してください');
}
if (!in_array('email', $this->skip)) {
$v->not_null('mail', $this->mail, 'メールアドレスを入力してください');
$v->mail_lite('mail', $this->mail, 'メールアドレスの形式が不正です');
}
if (!in_array('typecode', $this->skip)) {
$v->contain('typecode', $this->typecode, array(User::ADMIN, User::USER), '不正な区分です');
}
$this->errors = $v->errors;
return empty($this->errors) ? true : false;
}
示例5: foreach
<hr>
<!-- Beginning of Academic Distinction and Prizes Awarded -->
<table class="table table-hover">
<caption><h4>Academic Distinction and Prizes Awarded</h4></caption>
<thead>
<tr>
<th>S/N</th>
<th>Academic Prize</th>
<th>Awarding Body</th>
<th>Year</th>
</tr>
</thead>
<tbody id="academic_prizes">
<?php
$sql_awards = "SELECT academic_prizes FROM personal_details WHERE applicant_id=" . $session->applicant_id;
$result_awards = User::find_by_sql($sql_awards);
if (!empty($result_awards)) {
foreach ($result_awards as $row) {
$awards = unserialize($row->academic_prizes);
}
}
if (!empty($awards)) {
$a = 1;
foreach ($awards as $award) {
$prize = 'academic_prize_' . $a;
$award_body = 'awarding_body_' . $a;
$year = 'award_year_' . $a;
?>
<tr>
<td>
<?php
示例6: session_start
?>
<?php
//Load Session details...
if (!$session->is_logged_in()) {
session_start();
}
if (!isset($_SESSION['user_id'])) {
redirect_to('login.php?msg=Please Log-in first.');
}
$user = User::find_by_id($_SESSION['user_id']);
?>
<?php
if (isset($_GET['name'])) {
$user_array = User::find_by_sql("SELECT * FROM users WHERE first_name LIKE '%" . $_GET['name'] . "%' OR last_name LIKE '%" . $_GET['name'] . "%'");
} else {
$user_array = User::find_all();
}
?>
<?php
$path = 'assets/images/profile_pic/' . $user->profile_pic;
echo envapi_get_html_for_reg_user('176644-3EaSQ9JhWGaxqDH2EJ91XS3smNIPajiD', $user->first_name, $user->last_name, $path, false, "HI");
?>
<?php
if (isset($_POST['submit'])) {
$user = new User();
示例7: Header
?>
<?php
if (!isset($_SESSION['myid'])) {
Header("Location: index.php");
}
?>
<?php
$userid = $_SESSION['myid'];
if (isset($_POST['user']) && isset($_POST['pass']) && isset($_POST['newusername'])) {
$myusername = $_REQUEST['user'];
$mypassword = $_REQUEST['pass'];
$mynewusername = $_REQUEST['newusername'];
$sql = "SELECT * FROM clients WHERE username = '{$mynewusername}'";
$check = User::find_by_sql($sql);
if (empty($check)) {
$found_user = User::authenticate($myusername, $mypassword);
if ($found_user) {
$sql = "UPDATE clients SET username='{$mynewusername}' WHERE user_id='{$userid}'";
if ($database->query($sql) === TRUE) {
$_SESSION['myuser'] = $myusername;
$message = "Username successfully updated.";
Header("Location: my_profile.php");
} else {
$message = "Something went wrong. Username was NOT updated.";
}
} else {
$message = "Username/password combination incorrect.";
}
} else {
示例8: User
if ($user->mail_validation == 0) {
// account not activated
$user_for_mail = new User();
$user_for_mail->email = $user->email;
$user_for_mail->sendVerificationMail();
sleep(2);
echo '<h4 class="alert alert-success">Success</h4>';
echo '<hr>';
echo 'Your account has not been activated. Activate your account using the link sent to your email.';
echo '<hr>';
} else {
$form_id = $user->form_id;
/* no access code/pin in the personal details_table.
* form_id is the relationship and is unique*/
$sql_payment = "SELECT * FROM `adm_access_code` WHERE `jamb_rem_no`='" . $form_id . "' AND `reg_num`='" . $form_id . "' LIMIT 1";
$user_payments = User::find_by_sql($sql_payment);
if (empty($user_payments)) {
// redirect to buy form
$session->login($user->applicant_id);
sleep(2);
echo '<h4 class="alert alert-success">' . $display_greeting . ', ' . ucfirst($user->surname) . ' ' . ucfirst($user->first_name) . '</h4>';
echo '<hr>';
echo 'No Payment Information Found for: ';
echo '<span class="label label-success">' . $user->surname . ' ' . $user->first_name . ' ' . $user->middle_name . '</span><br>';
echo 'Please use the link below to proceed and make payment.<br><br>';
echo '<hr>';
echo '<a href="select_form.php" class="btn btn-primary">Proceed</a>';
} elseif ($user->progress == 'Completed') {
$session->login($user->applicant_id);
sleep(2);
echo '<h4 class="alert alert-success">' . $display_greeting . ', ' . ucfirst($user->surname) . ' ' . ucfirst($user->first_name) . '</h4>';
示例9: Referees
<?php
require_once '../inc/initialize.php';
$sqlemail = User::find_by_sql("SELECT email FROM personal_details WHERE applicant_id=" . $session->applicant_id);
$sqlemail = array_shift($sqlemail);
$applicant_email = $sqlemail->email;
$error = false;
$ref_ids = '';
$referee = new Referees();
$error = '';
$i = 1;
while ($i <= 3) {
if (isset($_POST['referees_id_' . $i]) && !empty($_POST['referees_id_' . $i])) {
$referee->referees_id = $_POST['referees_id_' . $i];
}
$referee->referee_title_id = $_POST['reference_title_id_' . $i];
$referee->referee_name = $_POST['referees_name_' . $i];
$referee->referee_email = $_POST['referees_email_' . $i];
if ($referee->referee_email == $applicant_email) {
echo '<h4 class="alert alert-error">Error</h4>';
echo '<hr>';
echo "The referee email must be different from the applicant's email\n";
echo '<hr>';
echo "The referee with the email " . $applicant_email . " was therefore not saved\n";
die;
}
$referee->referee_phone_number = $_POST['referees_phone_number_' . $i];
$referee->applicant_id = $session->applicant_id;
$r_id = $referee->save();
if (!$r_id) {
$error = true;
示例10: ftp_connect
//$user2="imobiliare";
//$pass2="q123456";
//$db2="imob_site";
//$ftp_location="localhost.localdomain";
//$ftp_user_name="ionut";
//$ftp_user_pass="gv101888";
$ftp_conn = ftp_connect(FTP_SERVER) or die("Could not connect to ftp location");
$login_result = ftp_login($ftp_conn, FTP_USER, FTP_PASSWORD);
$tu1 = time();
$conexiune2 = mysql_connect(SITE_SERVER, SITE_USER, SITE_PASSWORD, TRUE);
$dbselect2 = mysql_select_db(SITE_DB, $conexiune2);
//mysql_close($conexiune2);
//$database->open_connection();
// refresh agenti
$sql = "SELECT * FROM Utilizator";
$useri = User::find_by_sql($sql);
$sql = "DELETE FROM Agent";
$result = execute_querry($sql, $conexiune2);
$sql = "ALTER TABLE Agent AUTO_INCREMENT = 1";
$result = execute_querry($sql, $conexiune2);
$agent = array();
$sql_agent = "INSERT INTO Agent (id,User,Parola,Nume,Prenume,NivelAcces,Adresa1,Adresa2,Oras,Judet,Tara,CNP,SerieCI,NumarCI,Telefon,Email) VALUES ";
foreach ($useri as $usr) {
$agent["id"] = $usr->id;
$agent["User"] = $usr->User;
$agent["Parola"] = $usr->Parola;
$agent["Nume"] = $usr->Nume;
$agent["Prenume"] = $usr->Prenume;
$agent["NivelAcces"] = $usr->NivelAcces;
$agent["Adresa1"] = $usr->Adresa1;
$agent["Adresa2"] = $usr->Adresa2;
示例11: User
<?php
require_once "inc/initialize.php";
if (!$session->is_logged_in()) {
redirect_to('index.php');
}
$user = new User();
$user->applicant_id = $session->applicant_id;
$progress = $user->find_by_sql("SELECT progress FROM personal_details WHERE applicant_id='" . $user->applicant_id . "'");
$progress = array_shift($progress);
if ($progress->progress != 'Completed') {
redirect_to('application_form.php');
}
$student_status = $user->get_student_status();
$database = new MySQLDatabase();
?>
<?php
$personal_details = $database->query("SELECT * FROM personal_details p, title t, lga l, state s, religion r, nationality n, department d, faculty f, next_of_kin next, marital mar, photographs photo WHERE p.applicant_id='" . $session->applicant_id . "' AND p.title_id=t.title_id AND p.lga_id=l.lga_id AND l.state_id=s.state_id AND p.religion_id=r.religion_id AND p.country_id=n.country_id AND p.programme_applied_id=d.department_id AND d.faculty_id=f.faculty_id AND p.applicant_id=next.applicant_id AND p.applicant_id=photo.applicant_id AND p.marital_status=mar.marital_status_id");
$personal_details = $database->fetch_array($personal_details);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>University of Jos, Nigeria - <?php
echo $personal_details['faculty_name'];
?>
Complete Application Form</title>
<?php
require_once LIB_PATH . DS . 'javascript.php';
示例12: array
$user->form_id = $_SESSION['form_id'];
$user->programme_applied_id = $_SESSION['course'];
$user->student_status = $_SESSION['student_status'];
$user->type_of_programme = $_SESSION['type_of_programme'];
$user->db_fields = array('form_id', 'programme_applied_id', 'student_status', 'type_of_programme');
$user->applicant_id = $session->applicant_id;
$user->save();
$applicantFormId->form_id = $user->form_id;
unset($_SESSION['form_id']);
unset($_SESSION['type_of_programme']);
} else {
redirect_to('select_form.php');
}
} else {
$sqlpayment = "SELECT * FROM adm_access_code WHERE jamb_rem_no='" . $applicantFormId->form_id . "' AND reg_num='" . $applicantFormId->form_id . "' LIMIT 1";
$payment_details = User::find_by_sql($sqlpayment);
if (!empty($payment_details)) {
redirect_to('application_form.php');
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>University of Jos, Nigeria</title>
<?php
require_once LIB_PATH . DS . 'javascript.php';
require_once LIB_PATH . DS . 'css.php';
?>
</head>
示例13: getBestUsers
public static function getBestUsers($limit = 10)
{
return User::find_by_sql("\nSELECT * FROM users \nINNER JOIN\n(SELECT user_id, SUM(`points`) as score FROM event_eggs WHERE found = 1 GROUP BY user_id) as score\nON `users`.id = `score`.user_id ORDER BY score DESC LIMIT {$limit};");
}
示例14: User
<?php
require_once '../inc/initialize.php';
$user = new User();
$sqlstatus = $user->find_by_sql("SELECT student_status FROM personal_details WHERE applicant_id = " . $session->applicant_id);
$sqlstatus = array_shift($sqlstatus);
if ($sqlstatus->student_status == 'PGA') {
$arrayDateDetails = explode('-', $_POST['dob']);
$dateintimeformat = mktime(0, 0, 0, $arrayDateDetails[1], $arrayDateDetails[2], $arrayDateDetails[0]);
if (time() - $dateintimeformat < 568080000) {
echo '<h4 class="alert alert-error">Error</h4>';
echo '<hr>';
echo "Sorry, You must be at least 18 years to register for Post-Graduate Programme";
echo "<br>";
echo '<hr>';
exit;
}
}
$user->db_fields = array('title_id', 'gender', 'marital_status', 'dob', 'address', 'lga_id', 'religion_id', 'country_id');
$user->title_id = $_POST['title_id'];
$user->gender = $_POST['gender_id'];
$user->marital_status = $_POST['marital_status_id'];
$user->dob = $_POST['dob'];
$user->country_id = $_POST['country_id'];
$user->lga_id = $_POST['lga_id'];
$user->religion_id = $_POST['religion_id'];
$user->address = $_POST['address'];
$user->applicant_id = $session->applicant_id;
if ($user->save()) {
$next_of_kin = new NextOfKin();
$next_of_kin_details = $next_of_kin->find_by_id($user->applicant_id);
示例15: Settings
<?php
require_once "inc/initialize.php";
//print_r($session->applicant_id);
$settings = new Settings();
if (!$settings->isApplicationOpen()) {
$session->logout();
redirect_to('index.php');
}
if (!$session->is_logged_in()) {
redirect_to('index.php');
}
//gets applicant id
$applicant_form_id = User::find_by_sql("SELECT `form_id` FROM `personal_details` WHERE `applicant_id`='" . $session->applicant_id . "'");
//print_r($applicant_form_id);
foreach ($applicant_form_id as $applicantFormId) {
$applicantFormId->form_id;
}
//if there is a form id then the applicant should proceed to form
if ($applicantFormId->form_id != NULL) {
//echo "YEs";
redirect_to('payment.php');
} else {
//echo "no";
// set applicant_id into the session
$applicant_id = $session->applicant_id;
$applicant_fullname = User::applicant_fullname($applicant_id);
}
?>
<!DOCTYPE HTML>
<html>