PHP code example of eld / bridgevb

1. Go to this page and download the library: Download eld/bridgevb library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eld / bridgevb example snippets


'providers' => array(
				...
				...
				'Eld\Bridgevb\BridgevbServiceProvider',
),

'aliases' => array(
				...
				...
				'Bridgevb'		  => 'Eld\Bridgevb\Facades\BridgeVb',
),

array(
	'connection' => 'mysql',
	'cookie_hash' => 'AdflkjEr90234asdlkj1349SDFkl',
	'cookie_prefix' => 'bb_',
	'db_prefix' => 'vb_',
	'forum_path' => 'http://example.com/',
	'user_groups' => array(
		'Admin' => array(6),
		'Moderator' => array(7),
		'Super Moderator' => array(5),
		'User' => array(2),
		'Banned' => array(8),
		'Guest' => array(3),
	),
	'user_columns' => array(
		'userid',
		'username',
		'password',
		'usergroupid',
		'membergroupids',
		'email',
		'salt'
	),
);

Route::filter('vbauth', function()
{
	if (!Bridgevb::isLoggedIn()) return Redirect::to('login');
});

Route::post('/login', function()
{
	$creds = array(
		'username' => Input::get('username'),
		'password' => Input::get('password'),
		'remember_me' => Input::get('remember_me', false),
	);

	if (Bridgevb::attempt($creds))
		return Redirect::to('/');
	else
		return Redirect::to('/login');
});

Route::get('/isgroup', function()
{
	return (Bridgevb::is('Banned') ? 'You are banned' : 'You are not banned');
});

Route::post('/login', function()
{
	$creds = array(
		'username' => Input::get('username'),
		'password' => Input::get('password'),
		'remember_me' => Input::get('remember_me', false),
	);

	if (Bridgevb::attempt($creds))
		return Redirect::to('/');
	else
		return Redirect::to('/login');
});

Route::get('/login', function()
{
	if(Bridgevb::isLoggedIn())
		return Redirect::to('/');
	return View::make('login');
});

$user = Bridgevb::getUserInfo();
echo 'Hello, ' . $user->username;

$username = Bridgevb::get('username');
echo 'Hello, ' . $username;

return '<a href="http://www.example.com/login.php?do=logout&logouthash=' . Bridgevb::getLogoutHash() . '">Logout</a>';

Bridgevb::logout();