<?php /** * Created by Kent M. Patrick * Project: BPU * Company: Fingerprints Ltd * Date: 21/09/2016 * Time: 9:58 AM */ require_once 'header.php'; if (isset($_POST['submit'])) { $gen = new Generators(); $username = $_POST['username']; $password = $gen->salted($_POST['password']); $result = $db->select("users", "username = '******' AND password = SHA('{$password}')", "id,username", 1); if ($db->num_rows == 1) { $_SESSION['userid'] = $result['id']; $_SESSION['username'] = $result['username']; $html->redirection("index.php"); } else { $alerts->display("danger", "error", "Username/password combination is incorrect."); } } $users = new Users(); $users->login_form("logon.php"); require_once 'footer.php';
public static function updateNumberByType($type) { $gen = Generators::model()->findByAttributes(array( 'Gen_Type'=>$type )); $gen->Gen_Next_Value++; $gen->save(); }
protected function afterSave() { parent::afterSave(); if ($this->isNewRecord) { if ($this->Temp_Fed_ID_Flag == 'N') { Generators::updateNumberByType(1); } if ($this->Temp_Fed_ID_Flag == 'T') { Generators::updateNumberByType(2); } } }
if($success) { //prep the data for saving in a new user object $userData['emailId'] = $emailId; $userData['mobileNo'] = $mobileNo; $userData["lastName"] = $lastName; $userData["firstName"] = $firstName; $userData["middleName"] = $middleName; $userData["isActive"] = 0; //For the first time the user is not approved by admins $userData["isAdmin"] = 0; $userData["createdDate"] = date("Y-m-d H:i:s"); //prepare account related information to save in account object $accountData["userId"] = $emailId; $accountData["balance"] = INITIAL_BALANCE; $accountData["accountNo"] = Generators::generateUniqueAccountNo(); $accountData['password'] = $password; $accountData['securitytype'] = $securityType; //create the new user object $newUser = new User($userData); //create the new account object for this user $newAccount = new Account($accountData); //save the new user to the database $newUser->save(true); //save the account details to the database $newAccount->save(true);
$html2 = '<tr> <td class="blanktotal" colspan="5" rowspan="6"></td> </tr> <tr> </tr> </tbody> </table> <div style="text-align: center; font-style: italic;">Do keep the statement safe</div> </body> </html> '; $fileName = date("Y-m-d H:i:s")."_".$emailIdToRetrieveData; $password = Generators::randomPasswordGenerate(8); // SEND THE PASSWORD TO THE ONE WHO IS ACCESSING THE PDF $message = Swift_Message::newInstance() ->setSubject(MAIL_SUBJECT_PDF) ->setFrom(array(MAIL_FROM => MAIL_FROM_NAME)) ->setTo(array($emailId)) ->setBody("Password: ". $password) ; $mailer->send($message);
public static function getGetNextTempFedIDNumber($type) { $gen = Generators::model()->findByAttributes(array( 'Gen_Type'=>$type )); if ($type==1) {$prefix = 'IN-';} if ($type==2) {$prefix = 'T0-';} return $prefix.str_pad($gen->Gen_Next_Value, 7, '0', STR_PAD_LEFT); }
public function set_data() { $gen = new Generators(); $this->user_id = $_POST['user_id']; $this->username = $_POST['username']; $this->password1 = $_POST['password1'] != "" ? $gen->salted($_POST['password1']) : ""; $this->password2 = $_POST['password2'] != "" ? $gen->salted($_POST['password2']) : ""; $this->password_admin = $_POST['password_admin'] != "" ? $gen->salted($_POST['password_admin']) : ""; $this->role = isset($_POST['role']) ? $_POST['role'] : 0; }
<?php require_once("../../classes/PluploadHandler.php"); require_once '../../includes/global.inc.php'; require_once '../../utils/Account.util.php'; require_once '../../utils/Generators.util.php'; $emailToUpdate = "*****@*****.**"; $tanNos = Generators::generateTANs ($emailToUpdate, 10); $tanEmailMessage = ""; for ($i=0; $i < count($tanNos); $i++) { $tanEmailMessage .= $i . ": " . $tanNos[$i] . "<br/>"; $tanEmailMessage .= "<br/><hr>"; } echo $tanEmailMessage; $tanToDecrypt = "dHDhS024hPzH/T8GxZiWFZoVDNVVJWCj/nfi7rBeNxBKQf904WD5zSEV4KppYKCzpC4mldvM9THJB2gwlw=="; echo "====>".AccountUtils::checkTANValidity($emailToUpdate, $tanToDecrypt);
function create_admin() { global $db, $tables_report; if ($this->adminuser == "" || $this->adminuser == null) { $this->adminuser = "******"; $this->adminpass = "******"; } $select = $db->select("users", "username = '******'"); if ($select == false) { $gen = new Generators(); $salted = $gen->salted($this->adminpass); $success = $db->insert('users', 'username,password', "{$this->adminuser}||{$salted}"); $this->report($success, $this->adminuser, "user"); if ($success) { $this->role_associate($db->affected_id, $this->adminuser); } } else { $this->report(false, $this->adminuser, "user"); } }
if (!in_array(strtolower($extension), $allowed)) { echo '{"status":"error"}'; exit; } $date_time = date("Ymdhis"); if (file_exists($dir_ . $_FILES['upl']['name'])) { $file_name = preg_replace('/[^A-Za-z0-9\\-\\.]/', '', str_replace(' ', '-', $_FILES['upl']['name'])) . $date_time; } else { $file_name = preg_replace('/[^A-Za-z0-9\\-\\.]/', '', str_replace(' ', '-', $_FILES['upl']['name'])); } $file_name = str_ireplace('image', 'no_image_name', $file_name); if (move_uploaded_file($_FILES['upl']['tmp_name'], $dir_ . $file_name)) { $file_url = $dir_ . $file_name; $user = $db->select("users", "`username` = '{$ebay_user}'", '*', 1); if (!$user) { $gen = new Generators(); $db->insert("users", "username,password", "{$ebay_user}||" . $gen->salted("chocolatefrog")); $user_id = $db->affected_id; $db->insert("users_in_roles", "user_id,role_id", "{$db->affected_id}||4"); } else { $user_id = $user['id']; } $order = $db->select("orders", "`name` = '{$ebay_order}'", '*', 1); if (!$order) { $db->insert("orders", "name", $ebay_order); $order_id = $db->affected_id; } else { $order_id = $order['id']; } $db->insert("uploads", "user_id,order_id,filename", "{$user_id}||{$order_id}||{$file_name}"); echo '{"status":"success"}';
{ $counter = $start; if ($start > $end) { return; // Iterator is backwards so don't do it. } while ($counter <= $end) { (yield $counter); $counter += $step; } return; } } echo '<h1>Generators</h1>'; echo '<h2>Basic</h2>'; $gen = new Generators(); $basic = $gen->getBasicIterator(); foreach ($basic() as $key => $word) { echo $key . '=>' . $word . '<br>'; } echo '<br><br>'; $evenCounter = $gen->xRangeGenerator(0, 10, 2); foreach ($evenCounter as $number) { echo "Number: {$number}<br>"; } echo '<br><br>'; // Looping a generator and manually advancing another in the loop $evenCounter = $gen->xRangeGenerator(0, 10, 2); $oddCounter = $gen->xRangeGenerator(1, 11, 2); foreach ($evenCounter as $number) { echo "Number: {$number}<br>";