<?php

// load dependencies
require_once '../vendor/autoload.php';
use thom855j\PHPScrud\DB, thom855j\PHPAuthFramework\Auth, thom855j\PHPEmail\Email;
// start db
DB::load('mysql', 'localhost', 'php-auth-framework', 'root', '');
// start session
session_start();
// setup class
Email::load(DB::load());
Auth::load(DB::load());
// to activate an account, a token is generated in db
Email::load()->from = '*****@*****.**';
Email::load()->to = '*****@*****.**';
Email::load()->subject = 'Validate Account';
Email::load()->template = '../templates/auth_email.php';
Email::load()->data = array('firstname' => 'Thomas', 'username' => 'demo', 'password' => '123', 'token' => Auth::load()->authToken(1));
Email::load()->send();
示例#2
0
<?php

// load dependencies
require_once '../vendor/autoload.php';
use thom855j\PHPScrud\DB, thom855j\PHPAuthFramework\Auth;
// start db
DB::load('mysql', 'localhost', 'php-auth-framework', 'root', '');
// start session
session_start();
// setup class
Auth::load()->setAttribute('db', DB::load());
Auth::load()->setAttribute('token', 'H4qRRbMkUpgvw==');
// if the correct token is given, the user status is changed to active
Auth::load()->auth($key);
示例#3
0
<?php

// load files
require_once '../vendor/autoload.php';
use thom855j\PHPScrud\DB;
// instantiate object via singleton
DB::load('mysql', '127.0.0.1', 'php-scrud', 'root', '');
DB::load()->update('test', 'ID', 5, array('User' => 'Hansi', 'Password' => '2434LD'));
var_dump(DB::load());
示例#4
0
<?php

// load files
require_once '../vendor/autoload.php';
use thom855j\PHPScrud\DB;
// instantiate object via singleton
DB::load('mysql', '127.0.0.1', 'php-scrud', 'root', '');
// select with where statements
DB::load()->select(array('ID,User, Password'), 'test', null, null, array('ORDER BY' => 'ID DESC'));
var_dump(DB::load()->results());