private function check_password($login, $password) { $find = admins::model()->findBySql("SELECT ID,Login,Password FROM admins WHERE Login='******'"); if ($find) { if ($this->admin_encoding($password) == $find->Password) { return true; } else { return false; } } else { return false; } }
<?php $admin = new admins(); if ($admin->isLoggedIn()) { $location = SITE_URL; header('Location: ' . $location . '/admin'); exit; } $this->user = new Users(); echo '<h3>Your Applications:</h3>'; $applications = $this->user->applications(); if ($applications) { $res = $applications->results(); $row = $res[0]; ?> <table id="review-table"> <tbody> <tr> <th>Reference ID</th> <th>Unit</th> <th>Payment</th> <th>Admit Card</th> </tr> <?php foreach ($res as $key) { echo '<tr><td>' . $key->id . '</td>'; echo '<td>' . $key->unit . '</td>'; if ($key->status === '0') { echo '<td><a href="#" style="color:red;">Print Payment Form</a></td>';
//Include the PS_Pagination class require_once 'php/db_interface/autoload.php'; session_start(); if (!isset($_SESSION['userid'])) { header('Location: /'); } $username = "******"; $user = new user(); $uid = $_SESSION['userid']; $user->set_variable('users_id', $uid); $userCreationDate; if ($user->load()) { $username = $user->get_variable('users_username'); $userCreationDate = $user->get_variable('users_creationdate'); } $admin = new admins(); $admin->set_variable('admin_user_id', $uid); $isAdmin = false; $showToAdminClass = ''; if ($admin->load()) { $isAdmin = true; $showToAdminClass = ''; } if (isset($_GET['lo'])) { session_destroy(); header('Location: /'); } $showClass = ""; $trialTimeClass = "none"; $showData = true; $paymentDates = payment_info::getPaymentDates($uid);
public function logout() { $user = new admins(); $user->logout(); header("Location: " . SITE_URL . "/admin"); }
<?php //Include the PS_Pagination class require_once 'php/db_interface/autoload.php'; session_start(); if (!isset($_SESSION['userid'])) { header('Location: /'); } $username = "******"; $user = new user(); $uid = $_SESSION['userid']; $user->set_variable('users_id', $uid); $admin = new admins(); $admin->set_variable('admin_user_id', $user->get_variable('users_id')); $isAdmin = false; if ($admin->load()) { $isAdmin = true; } else { header('Location: /'); } $referral = new referral(); $referral->set_variable("referral_id", intval($_POST['rid'])); if ($referral->load()) { $isPaid = $_POST['isPaid'] == "true" ? 1 : 0; $referral->set_variable("referral_paid", $isPaid); echo $referral->debug(); $referral->update(); echo "SUCCESS"; } else { echo "FAILURE"; }
static function LoginCheckAndRedirect(&$isAdmin, &$username) { session_start(); if (!isset($_SESSION['userid'])) { header('Location: /'); } $username = "******"; $user = new user(); $user->set_variable('users_id', $_SESSION['userid']); if ($user->load()) { $username = $user->get_variable('users_username'); } $admin = new admins(); $admin->set_variable('admin_user_id', $user->get_variable('users_id')); $isAdmin = false; if ($admin->load()) { $isAdmin = true; } else { header('Location: /'); } if (isset($_GET['lo'])) { session_destroy(); header('Location: /'); } return $isAdmin; }
<?php include 'classes/admins.php'; $oAdmins = new admins(); echo $oAdmins->getAppId() . PHP_EOL; echo 'Login status: ' . $oAdmins->login() . PHP_EOL; $sType = 'admins'; echo 'Password updated status: ' . $oAdmins->updatePassword($sType) . PHP_EOL; echo $oAdmins->getAge() . PHP_EOL; echo $oAdmins->getPin() . PHP_EOL;