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;
 }
Example #2
0
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);
}
Example #3
0
 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));
 }
Example #4
0
 /**
  * バリデーション
  * 
  * @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;
 }
	<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 
Example #6
0
?>

<?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();
Example #7
0
?>

<?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 {
Example #8
0
 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>';
<?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;
Example #10
0
//$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;
Example #11
0
<?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';
Example #12
0
        $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>
Example #13
0
 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};");
 }
<?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);
Example #15
0
<?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>
Example #16
0
		<textarea name="database_emails" id="database_emails"></textarea>
		<input type="hidden" name="submitting_page" value="<?php 
echo $page;
?>
" />
		<input type="submit" id="submit" class="submit" name="addEmailsToDatabase" value="Add Emails" />
	</form>
<div class="clearer"></div>	
<h3>Send Out Beta Invites</h3>
	<form id="sendBetaInvites" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" method="post">
		<div id="emailDbBox">
			<?php 
$emailsFromDb = User::find_by_sql('SELECT id,email FROM users WHERE register_date = "0000-00-00"');
foreach ($emailsFromDb as $email) {
    ?>
			<input type="checkbox" name="user_id[]" value="<?php 
    echo $email->id;
    ?>
" checked="checked" /><?php 
    echo $email->email;
    ?>
<br />
			<?php 
}
?>
		</div>
		<h4>Email Body</h4>
		<textarea name="emailBody"></textarea>
<?php

require_once '../inc/initialize.php';
$password = htmlspecialchars(md5($_POST['epassword']), ENT_QUOTES);
$email = htmlspecialchars($_POST['email'], ENT_QUOTES);
$sql = "SELECT * FROM `personal_details` WHERE `email`='" . $email . "'";
$user_details = User::find_by_sql($sql);
if (empty($user_details)) {
    sleep(2);
    echo '<h4 class="alert alert-error">Error</h4>';
    echo '<hr>';
    echo "Invalid email\n";
    echo "Ensure that it was the link in your mail that you clicked";
} else {
    foreach ($user_details as $users) {
        $users->applicant_id;
    }
    $user = new User();
    $user->applicant_id = $users->applicant_id;
    $user->password = $password;
    $user->db_fields = array('password');
    $user->save();
    if ($database->affected_rows() == 1) {
        sleep(2);
        echo '<h4 class="alert alert-success">Success</h4>';
        echo '<hr>';
        echo 'You have successfully reset your password<br>';
        echo '<a href="index.php">Continue</a>';
    } else {
        sleep(2);
        echo '<h4 class="alert alert-error">Error</h4>';
     }
 }
 if ($empty_tab_flag) {
     echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
     echo '<hr>';
     echo $message;
     echo '<br><hr>';
     echo '<a href="application_form.php" class="btn">Close</a>';
 } else {
     $user->progress = 'Completed';
     $user->db_fields = array('progress');
     $user->applicant_id = $session->applicant_id;
     $referees = new Referees();
     $referees_details = $referees->find_by_sql("SELECT * FROM referees WHERE applicant_id='" . $session->applicant_id . "'");
     $mail_error = '';
     $applicant_name = User::find_by_sql("SELECT * FROM personal_details WHERE applicant_id=" . $session->applicant_id);
     $applicant_name = array_shift($applicant_name);
     $applicant_name = $applicant_name->surname . ' ' . $applicant_name->first_name . ' ' . $applicant_name->middle_name;
     foreach ($referees_details as $referee_info) {
         $referees->referee_email = $referee_info->referee_email;
         $referees->referee_name = $referee_info->referee_name;
         $referees->referees_id = $referee_info->referees_id;
         if (!$referees->sendRefereeMail($applicant_name)) {
             $mail_error .= "Mail not sent to " . $referees->referee_email . "<br>";
         }
     }
     if ($user->save()) {
         $admissions = new Admission();
         $sql_adm = "select admission_id from admission_status where applicant_id='" . $session->applicant_id . "'";
         $res_adm = Admission::find_by_sql($sql_adm);
         if (empty($res_adm)) {
<?php

$success = false;
$errors = array();
$data = array();
$objects = array();
require 'includes/initialize.php';
if (!$session->is_logged_in()) {
    array_push($errors, "Not logged in.");
} else {
    $users = User::find_by_sql("SELECT * FROM users WHERE user_id!=" . $session->user_id . " ORDER BY Rand() LIMIT 10");
    foreach ($users as $user) {
        $user_arr = array();
        $user_arr['user_id'] = $user->user_id;
        $user_arr['name'] = $user->name;
        $user_arr['dob'] = $user->dob;
        $user_arr['interests'] = $user->interests;
        $user_arr['bio'] = $user->bio;
        $user_arr['img'] = $user->img;
        $user_arr['email'] = $user->email;
        array_push($objects, $user_arr);
    }
    $success = true;
}
display_success($success, $errors, $data, $objects);
Example #20
0
<?php

//require the framework
require_once "../requires/initialize.php";
// create the page
$page = new Page();
$page->name = "Delete User";
$page->is_user_only = true;
// check if user wants to delete their account
if (isset($_POST["confirm"])) {
    if (in_array($user->role_wk, array("2", "3"))) {
        // if user is the last admin or staff, cannot delete account
        $user_array = User::find_by_sql("SELECT * FROM `user` WHERE `role_wk` = " . $user->role_wk . " AND `is_deleted` = 0;");
        // find all of the ADMINs
        if (count($user_array) <= 1) {
            $session->message("You are the last " . $user->role_wk->name . "! Another " . $user->role_wk->name . " account must be created before this one can be deleted.");
            redirect_head(ROOT_URL);
        }
    }
    // delete the user
    $user->delete();
    $session->message("Your account has been deleted!");
    $session->logout(true);
    redirect_head(ROOT_URL . "index.php");
    die;
} elseif (isset($_POST["deny"])) {
    $session->message("Your account was not deleted.");
    redirect_head(ROOT_URL);
}
//header template
require_once "../requires/template/header.php";
<?php

require_once "../initialize.php";
$amount = $_POST['Amount'];
$ResponseCode = $_POST['ResponseCode'];
$CardNumber = $_POST['CardNumber'];
$RefNumb = $_POST['RefNumb'];
$RetRefNumb = $_POST['RetRefNumb'];
$TranxDate = $_POST['TranxDate'];
$ResponseDescription = $_POST['ResponseDescription'];
$PaymentReference = $_POST['PaymentReference'];
$form_no = substr($RefNumb, 2, sizeof($RefNumb) - 3);
$sql_fullname = "SELECT applicant_id, surname, first_name, middle_name, student_status FROM `personal_details` WHERE `form_id` = '" . $form_no . "'";
$Applicant_details = User::find_by_sql($sql_fullname);
$Applicant_detail = array_shift($Applicant_details);
if (isset($_POST['action']) && $_POST['action'] == 'updateit') {
    $acceptance = new AcceptanceLog();
    $acceptance->db_fields = array('student_id', 'ResponseCode', 'ResponseDescription', 'Amount', 'returned_amount', 'MerchantReference', 'PaymentReference', 'Initiating_date', 'Interswitch_date', 'status');
    $sql_acc_id = "SELECT id FROM `acceptance_log` WHERE student_id='" . $form_no . "'";
    $acc_id = $acceptance->find_by_sql($sql_acc_id);
    $acc_id_final = array_shift($acc_id);
    $acceptance->student_id = $form_no;
    $acceptance->ResponseCode = $ResponseCode;
    $acceptance->ResponseDescription = $ResponseDescription;
    $acceptance->Amount = $amount / 100;
    $acceptance->returned_amount = $amount . '.00';
    $acceptance->MerchantReference = $PaymentReference;
    $acceptance->PaymentReference = $RefNumb;
    $acceptance->Interswitch_date = $TranxDate;
    $acceptance->status = $Applicant_detail->student_status;
    if (!empty($acc_id_final)) {
Example #22
0
echo "<ul>";
while ($user_data = mysqli_fetch_assoc($result)) {
    $username = $user_data['username'];
    echo "<li>{$username}</li>";
}
echo "</ul>";
$sql2 = "SELECT * FROM users";
$result = $db->query($sql2);
echo "Teambook Users in Database:<br />";
echo "<ul>";
while ($user_data2 = $db->fetch_assoc($result)) {
    $username = $user_data2['username'];
    echo "<li>{$username}</li>";
}
echo "</ul>";
echo "<br />";
echo "<h1>Using the User Class</h1>";
echo "<h2>Using an instance method and object instance:</h2>";
$user = new User();
$found_user = $user->find_by_id(1);
echo $found_user['username'];
echo "<hr />";
echo "<h2>Using a static/class method - less code</h2>";
$found_user = User::find_by_id_static(1);
echo $found_user['username'];
echo "<hr />";
echo "<h2>Using a static/class method - find_by_sql method</h2>";
$sql3 = "SELECT * FROM users WHERE userId=2";
$result_set = User::find_by_sql($sql3);
$found_user = $db->fetch_assoc($result_set);
echo $found_user['username'];
Example #23
0
<?php

require_once "inc/initialize.php";
if (!$session->is_logged_in()) {
    redirect_to('index.php');
}
$user = new User();
$user->applicant_id = $session->applicant_id;
$form_id = $user->get_form_id();
$sql = "SELECT * FROM `adm_access_code` WHERE `jamb_rem_no`='" . $form_id . "' AND `reg_num`='" . $form_id . "'";
$payment_record = $user->find_by_sql($sql);
if (empty($payment_record)) {
    redirect_to('select_form.php');
}
$student_status = $user->get_student_status();
$database = new MYSQLDatabase();
$sqlprogrammedetails = "SELECT * FROM personal_details p, department d, faculty f WHERE p.applicant_id=" . $session->applicant_id . " AND p.programme_applied_id=d.department_id AND d.faculty_id=f.faculty_id";
$programmedetails = $database->fetch_array($database->query($sqlprogrammedetails));
$sessiondetails = $database->fetch_array($database->query("SELECT session FROM application_status WHERE id=1"));
$paymentdetails = $database->fetch_array($database->query("SELECT * FROM adm_access_code WHERE jamb_rem_no='" . $programmedetails['form_id'] . "'"));
$invoice = new Invoice();
$invoice->db_fields = array('applicant_id', 'date', 'amount');
$invoice->applicant_id = $session->applicant_id;
$invoice->date = date('Y-m-d H:i:s', time());
$invoice->amount = $paymentdetails['amount'];
$invoice->save();
$invoicedetails = $database->fetch_array($database->query("SELECT * FROM invoice WHERE applicant_id='" . $session->applicant_id . "'"));
//set it to writable location, a place for temp generated PNG files
// $PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR;
$PNG_TEMP_DIR = 'inc/qrcode/temp/';
//html PNG location prefix
<?php

require_once "../../inc/initialize.php";
$email = htmlspecialchars($_POST['email'], ENT_QUOTES);
$user = new User();
$user_exists = $user->find_by_sql("SELECT * FROM `personal_details` WHERE `email`='" . $email . "' LIMIT 1");
if (empty($user_exists)) {
    echo '<h4 class="alert alert-error">Error</h4>';
    echo '<hr>';
    echo "This E-mail: <font color='#FF0000'>'" . $email . "'</font> does not exist in our database";
    echo '<br>';
    echo 'Use the Close Button to Continue';
} else {
    $user->email = $email;
    $user_exists = array_shift($user_exists);
    if ($user_exists->progress == 'Completed') {
        $referees = new Referees();
        $referees_details = $referees->find_by_sql("SELECT * FROM referees WHERE applicant_id='" . $user_exists->applicant_id . "'");
        $mail_error = '';
        foreach ($referees_details as $referee_info) {
            $referees->referee_email = $referee_info->referee_email;
            $referees->referee_name = $referee_info->referee_name;
            $referees->referees_id = $referee_info->referees_id;
            if (!$referees->sendRefereeMail()) {
                $mail_error .= "Mail not sent to " . $referees->referee_email . "<br>";
            }
        }
        if ($mail_error == '') {
            echo '<h4 class="alert alert-success">Success</h4>';
            echo '<hr>';
            echo "Referee mails for applicant with email: <font color='#FF0000'>'" . $email . "'</font> has been successfully sent";
Example #25
0
<?php

require_once '../../inc/initialize.php';
/*if($session->is_logged_in()) {
  redirect_to("../../index.php");
}*/
$username = htmlspecialchars($_POST['username'], ENT_QUOTES);
$email = htmlspecialchars($_POST['email'], ENT_QUOTES);
$file = $_FILES['picture']['name'];
$sql = "SELECT * FROM admin WHERE `email` =  '" . $email . "' LIMIT 1";
$user_exists = User::find_by_sql($sql);
foreach ($user_exists as $user_exist) {
    $user_exist->username;
    $user_exist->email;
}
if ($user_exist->username == $username) {
    sleep(2);
    echo '<h4 class="alert alert-error">Error</h4>';
    echo '<hr>';
    echo "The Username:<font color='#FF0000'>'" . $user_exist->username . $file . "'</font> already exist in our database. \n";
    echo "Choose a new one";
} elseif ($user_exist->email == $email) {
    sleep(2);
    echo '<h4 class="alert alert-error">Error</h4>';
    echo '<hr>';
    echo "The E-mail:<font color='#FF0000'> '" . $user_exist->email . $file . "'</font> already exist in our database. \n";
    echo "Choose a new one";
} else {
    $user = new User();
    $user->username = htmlspecialchars($_POST['username'], ENT_QUOTES);
    $user->email = htmlspecialchars($_POST['email'], ENT_QUOTES);
Example #26
0
    if (empty($_POST['email'])) {
        $emailError = "Email is required!";
        $error = true;
    } else {
        $email = trim($_POST['email']);
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $emailError = "Invalid email format";
            $error = true;
        }
    }
    if (!$error) {
        $dup = User::find_by_sql("SELECT * FROM users WHERE username= '{$username}'");
        if (!empty($dup)) {
            $usernameError = "Username Already Exists!";
        } else {
            $dup = User::find_by_sql("SELECT * FROM users WHERE email = '{$email}'");
            if (!empty($dup)) {
                $emailError = "Email id already used!";
            } else {
                $user = new User(0, $fullname, $username, $password, $email);
                if ($user->save()) {
                    $session->set_message('You signed up successfully! Please login.');
                    redirect_to('signin.php');
                } else {
                    $error = true;
                    die($database->check_error());
                }
            }
        }
    }
}