public function page($page) { if ($page === "/logout") { \Fr\LS::logout(); \Response::redirect("/admin/login"); } else { return "auto"; } }
?> <div class="contents"> <h2>Change Password</h2> <?php if (isset($_POST['change_password'])) { $curPass = $_POST['current_password']; $newPass = $_POST['new_password']; $retypePass = $_POST['retype_password']; if ($curPass != null && $newPass != null && $retypePass != null) { if (!\Fr\LS::login("admin", $curPass, false, false)) { echo ser("Login Failed", "Couldn't login to your account to change password."); } else { if ($newPass !== $retypePass) { echo ser("Passwords Doesn't match"), "The passwords you entered didn't match. Try again.</p></p>"; } else { $changePass = \Fr\LS::changePassword($newPass); if ($changePass === true) { echo sss("Password Changed Successfully", "Your password was updated."); } } } } else { echo "<p><h2>Password Fields was blank</h2><p>Form fields were left blank</p></p>"; } } ?> <form action="<?php echo \Lobby::u(); ?> " method='POST'> <label>
<?php require __DIR__ . "/../class.logsys.php"; $config = array("basic" => array("company" => "My Site", "email" => "*****@*****.**"), "db" => array("host" => "localhost", "port" => 3306, "username" => "root", "password" => "backstreetboys", "name" => "test", "table" => "users"), "features" => array("auto_init" => true, "two_step_login" => true), "pages" => array("no_login" => array("/Francium/logSys/example-two-step-login/", "/Francium/logSys/example-two-step-login/reset.php", "/Francium/logSys/example-two-step-login/register.php"), "login_page" => "/Francium/logSys/example-two-step-login/login.php", "home_page" => "/Francium/logSys/example-two-step-login/home.php"), "two_step_login" => array("instruction" => "A token was sent to your E-Mail Address. Please see the mail in your inbox and paste the token found in the textbox below :", "send_callback" => function ($userID, $token) { $email = \Fr\LS::getUser("email", $userID); \Fr\LS::sendMail($email, "Verify Yourself", "Someone tried to login to your account. If it was you, then use the following token to complete logging in : <blockquote>" . $token . "</blockquote>If it was not you, then ignore this email and please consider to change your account's password."); })); \Fr\LS::config($config);
<?php $docRoot = realpath(__DIR__); define("docRoot", $docRoot); /* Load the configuration */ require_once "{$docRoot}/config.php"; require_once "{$docRoot}/inc/class.open.php"; require_once "{$docRoot}/inc/class.logsys.php"; $db = unserialize(DATABASE); \Fr\LS::config(array("db" => array("host" => $db['host'], "port" => $db['port'], "name" => $db['name'], "username" => $db['user'], "password" => $db['pass'], "table" => "users"), "keys" => array("cookie" => "cantMakePublic", "salt" => "cantMakePublic"), "pages" => array("no_login" => array("/", "/register", "/me/ResetPassword"), "login_page" => "/login", "home_page" => "/home"), "features" => array("email_login" => false), "cookies" => array("domain" => CLEAN_HOST))); /* Basic Variables */ $loggedIn = \Fr\LS::$loggedIn; /* Boolean on status of current user (logged in or not) */ $who = \Fr\LS::$user; /* The current user */ /* Global Variables */ $_P = count($_POST) > 0 ? true : false; /* Boolean Variable whether POST data is sent with the request */ define("loggedIn", $loggedIn); define("curUser", $who); $OP = new Open(); if (!function_exists("get")) { function get($key, $uid = "", $json = true) { global $OP; return $OP->get($key, $uid, $json); } } /* Do these if user is logged in */ if (loggedIn && !isset($uimg)) { $uimg = get("img");
<h1>Welcome</h1> <p>You have been successfully logged in.</p> <p> <a href="logout.php">Log Out</a> </p> <p> You registered on this website <strong><?php echo \Fr\LS::joinedSince(); ?> </strong> ago. </p> <p> Here is the full data, the database stores on this user : </p> <pre><?php $details = \Fr\LS::getUser(); print_r($details); ?> </pre> <p> Change the name of your account : </p> <form action="home.php" method="POST"> <input name="newName" placeholder="New name" /> <button>Change Name</button> </form> <p> <a href="change.php">Change Password</a> </p> </body> </html>
$client->scope = 'https://www.google.com/m8/feeds/'; if ($success = $client->Initialize()) { if ($success = $client->Process()) { if (strlen($client->authorization_error)) { $client->error = $client->authorization_error; $success = false; } elseif (strlen($client->access_token)) { $success = $client->CallAPI('https://www.google.com/m8/feeds/contacts/default/full?max-results=2500', 'GET', array(), array('FailOnAccessError' => true), $data); } } $success = $client->Finalize($success); } if ($client->exit) { $OP->ser("Something Happened", "<a href='" . $client->redirect_uri . "'>Try Again</a>"); } if ($success) { $firstName = get("fname"); $name = get("name", $who, false); $xml = new SimpleXMLElement($data); $xml->registerXPathNamespace('gd', 'http://schemas.google.com/g/2005'); $result = $xml->xpath('//gd:email'); foreach ($result as $title) { $email = $title->attributes()->address; if (!\Fr\LS::userExists($email)) { $msg = "{$name} has sent you an inviation to join <a href='http://open.subinsb.com'>Open</a>.<br/>Open is an open source social network. It's growing by the support of developers and people like you. Please join <a href='http://open.subinsb.com'>Open</a> and enjoy society like never before.<br/>You can connect with {$name} and hunderds of others.<br/><a href='http://open.subinsb.com/register'><button style='padding:5px 15px;'>Accept Invitation</button></a> <a href='http://open.subinsb.com/{$who}'><button style='padding:5px 15px;'>See {$firstName}'s Profile</button></a>"; $sql = $OP->dbh->prepare("INSERT INTO `mails` (`email`, `sub`, `message`) VALUES (?, ?, ?)"); $sql->execute(array($email, "{$firstName} Sent You An Invitation", $msg)); } } $OP->redirect("/invite?gmail=success"); }
<?php class logSysLobbyDB { public function prepare($query) { $obj = \Lobby\DB::$dbh->prepare($query); return $obj; } } require_once __DIR__ . "/class.logsys.php"; $salt = getOption("admin_secure_salt"); $cookie = getOption("admin_secure_cookie"); \Fr\LS::$config = array("db" => array("table" => \Lobby\DB::$prefix . "users"), "features" => array("auto_init" => false, "start_session" => false, "email_login" => false), "keys" => array("cookie" => $cookie, "salt" => $salt), "pages" => array("no_login" => array(), "login_page" => "/admin/login", "home_page" => "/admin/")); \Fr\LS::construct();
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Home | AUN Online Attendance Management System</title> </head> <body> <?php include_once '/attendanceupload.php'; require "/thirdpartylib/class.logsys.php"; session_start(); //\Fr\LS::init(); print_r($_SESSION); if (isset($_GET['logout'])) { \Fr\LS::logout(); } ?> <form name="excel" action="home.php" method="POST" enctype="multipart/form-data"> <input type="file" name="file" id="uploadfile"/> <input type="submit" name="submit" value="Submit Attendance"/> </form> <a href="/aun_attendance_system/home.php?logout=logingout">Log Out</a> </body> </html>
<?php /** * User is logged in, so redirect to Admin main page */ if (\Fr\LS::$loggedIn) { \Response::redirect("/admin"); } if (isset($_POST["username"]) && isset($_POST["password"])) { $user = $_POST["username"]; $pass = $_POST["password"]; if ($user == "" || $pass == "") { $error = array("Username / Password Wrong", "The username or password you submitted was wrong."); } else { $login = \Fr\LS::login($user, $pass, isset($_POST['remember_me'])); if ($login === false) { $error = array("Username / Password Wrong", "The username or password you submitted was wrong."); } else { if (is_array($login) && $login['status'] == "blocked") { $error = array("Account Blocked", "Too many login attempts. You can attempt login again after " . $login['minutes'] . " minutes (" . $login['seconds'] . " seconds)"); } else { \Response::redirect("/admin"); } } } } ?> <html> <head> <?php \Hooks::doAction("head.begin");
<html> <head> <title>Log In With Two Step Verification</title> </head> <body> <div class="content"> <h2>Two Step Log In</h2> <p>The list shows the devices currently authorized to login using your account</p> <?php if (isset($revoked)) { if ($revoked) { echo "<h2>Successfully Revoked Device</h2>"; } else { echo "<h2>Failed to Revoke Device</h2>"; } } $devices = \Fr\LS::getDevices(); if (count($devices) == 0) { echo "<p>No devices are authorized to use your account without 2 Step Verification.</p>"; } else { echo "<table border='1' cellpadding='10px'>\n <thead>\n <th>Session ID</th>\n <th>Last Accessed</th>\n <th></th>\n </thead>\n <tbody>"; foreach ($devices as $device) { echo "<tr>\n <td>{$device['token']}</td>\n <td>{$device['last_access']}</td>\n <td><a href='?revoke_device={$device['token']}" . \Fr\LS::csrf("g") . "'>Revoke Access</a></td>\n </tr>"; } echo "</tbody></table>"; } ?> </div> </body> </html>
<!DOCTYPE html> <?php require "/thirdpartylib/class.logsys.php"; //\Fr\LS::init(); if (isset($_POST['register'])) { $fields = ['id', 'full_name', 'email', 'password']; foreach ($fields as $req_field) { if (empty($_POST[$req_field])) { echo $req_field . ' is Required'; break; } else { $id = $_POST['id']; $instructor_name = $_POST['full_name']; $email = $_POST['email']; $password = $_POST['password']; \Fr\LS::register($id, $password, array("instructor_name" => $instructor_name, "email" => $email)); } } } ?> <html> <head> <title> </title> </head> <body> <form method="POST"> <label>Instructor ID:</label> <input name="id" type="text"><br>
<html> <head></head> <body> <?php require "config.php"; \Fr\LS::init(); \Fr\LS::forgotPassword(); ?> </body> </html>
/** * Add routes */ public function routes() { /** * Add the Login Page in /admin/login route */ \Lobby\Router::route("/admin/login", function () { if (LS::userExists("admin") === false) { LS::register("admin", "admin", array("name" => "Admin", "created" => date("Y-m-d H:i:s"))); } include __DIR__ . "/page/login.php"; }); }
<?php require "class.logsys.php"; \Fr\LS::config(array("basic" => array("company" => "American University of Nigeria", "email" => "*****@*****.**", "email_callback" => 0), "db" => array("host" => "localhost", "port" => 3306, "username" => "root", "password" => "", "name" => "attendance", "table" => "instructor", "token_table" => "resetTokens"), "keys" => array("cookie" => "ckxc436jd*^30f840v*9!@#\$", "salt" => "^#\$4%9f+1^p9)M@4M)V\$"), "features" => array("start_session" => true, "email_login" => true, "remember_me" => true, "auto_init" => false, "block_brute_force" => false, "two_step_login" => false), "brute_force" => array("tries" => 5, "time_limit" => 300), "pages" => array("no_login" => array(), "login_page" => "login.php", "home_page" => "home.php"), "cookies" => array("expire" => "+30 days", "path" => "/", "domain" => "local.dev"), 'two_step_login' => array('instruction' => '', 'send_callback' => '', 'devices_table' => 'user_devices', 'token_length' => 4, 'numeric' => false, 'expire' => '+45 days', 'first_check_only' => true)));
<?php \Fr\LS::init(); ?> <!DOCTYPE html> <html> <head> <?php $OP->head("Reset Password - Manage Account"); ?> </head> <body> <?php include "{$docRoot}/inc/header.php"; ?> <div class="wrapper"> <div class="content"> <h2>Reset Password</h2> <?php $rePass = \Fr\LS::forgotPassword(); if ($rePass == "resetPasswordForm") { echo "<p>Enter your <strong>email</strong> in the field above (username is the email)</p>"; } ?> <style>input[type=text], input[type=password]{width: 250px;}</style> </div> </div> </body> </html>
<?php class logSysLobbyDB { public function prepare($query) { $obj = \Lobby\DB::getDBH()->prepare($query); return $obj; } } require_once __DIR__ . "/class.logsys.php"; $salt = Lobby\DB::getOption("admin_secure_salt"); $cookie = Lobby\DB::getOption("admin_secure_cookie"); \Fr\LS::config(array("db" => array("table" => \Lobby\DB::getPrefix() . "users"), "features" => array("auto_init" => false, "start_session" => false, "email_login" => false), "keys" => array("cookie" => $cookie, "salt" => $salt)));
<?php \Lobby::doHook("admin.body.begin"); ?> <div class="workspace"> <div class="contents"> <h2>Change Password</h2> <?php if (isset($_POST['change_password'])) { if (isset($_POST['current_password']) && $_POST['current_password'] != "" && isset($_POST['new_password']) && $_POST['new_password'] != "" && isset($_POST['retype_password']) && $_POST['retype_password'] != "" && isset($_POST['current_password']) && $_POST['current_password'] != "") { $curpass = $_POST['current_password']; $new_password = $_POST['new_password']; $retype_password = $_POST['retype_password']; if ($new_password != $retype_password) { echo "<p><h2>Passwords Doesn't match</h2><p>The passwords you entered didn't match. Try again.</p></p>"; } else { $change_password = \Fr\LS::changePassword($curpass, $new_password); if ($change_password === true) { echo "<h2>Password Changed Successfully</h2>"; } } } else { echo "<p><h2>Password Fields was blank</h2><p>Form fields were left blank</p></p>"; } } ?> <form action="<?php echo \Lobby::u(); ?> " method='POST'> <label> <p>Current Password</p>
if (isset($_POST['submit'])) { $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['pass']; $retyped_password = $_POST['retyped_password']; $name = $_POST['name']; if ($username == "" || $email == "" || $password == '' || $retyped_password == '' || $name == '') { echo "<h2>Fields Left Blank</h2>", "<p>Some Fields were left blank. Please fill up all fields.</p>"; } elseif (!\Fr\LS::validEmail($email)) { echo "<h2>E-Mail Is Not Valid</h2>", "<p>The E-Mail you gave is not valid</p>"; } elseif (!ctype_alnum($username)) { echo "<h2>Invalid Username</h2>", "<p>The Username is not valid. Only ALPHANUMERIC characters are allowed and shouldn't exceed 10 characters.</p>"; } elseif ($password != $retyped_password) { echo "<h2>Passwords Don't Match</h2>", "<p>The Passwords you entered didn't match</p>"; } else { $createAccount = \Fr\LS::register($username, $password, array("email" => $email, "name" => $name, "created" => date("Y-m-d H:i:s"))); if ($createAccount === "exists") { echo "<label>User Exists.</label>"; } elseif ($createAccount === true) { echo "<label>Success. Created account. <a href='login.php'>Log In</a></label>"; } } } ?> <style> label{ display: block; margin-bottom: 5px; } </style> </div>
$pass = $OP->format($_POST['pass']); $pass2 = $OP->format($_POST['pass2']); $name = $OP->format($_POST['name']); $decoded = $OP->decrypt($_POST['user']); $origSTR = "{$_POST['nuser']}cantMakePublic"; if ($origSTR != $decoded) { $OP->ser("User Not Verified.", "The user in which this form was sent have not verified his/her E-Mail."); } if ($email == "" || $pass == '' || $pass2 == '' || $name == '') { $OP->ser("Fields Left Blank", "Some Fields were left blank. Please fill up all fields. You now have to start over the signup process."); } if (!ctype_alnum(strtolower(str_replace(" ", "", $name)))) { $OP->ser("Invalid Name", "The Name is not valid. Only ALPHANUMERIC characters are allowed."); } if ($pass != $pass2) { $OP->ser("Passwords Don't Match", "The Passwords you entered didn't match"); } $json = '{"joined":"' . date("Y-m-d H:i:s") . '"}'; \Fr\LS::register($email, $pass, array("name" => $name, "udata" => $json, "seen" => "")); $OP->sss("Registration Success", "Your account has been created. Log In <a href='login'>here</a>"); } ?> </div> </div></div> <style>#ppbar{background:#CCC;width:400px;height:20px;margin: 5px auto;position: relative;}#pbar{margin:0px;width:0px;background:lightgreen;height: 100%;}#ppbartxt{text-align: right;position: absolute;right: 5px;top: 1px;}</style> <?php include "{$docRoot}/inc/footer.php"; ?> </body> </html>
<?php require __DIR__ . "/../class.logsys.php"; \Fr\LS::config(array("db" => array("host" => "localhost", "port" => 3306, "username" => "root", "password" => "backstreetboys", "name" => "test", "table" => "users"), "features" => array("auto_init" => true), "pages" => array("no_login" => array("/Francium/logSys/", "/Francium/logSys/example-basic/reset.php", "/Francium/logSys/example-basic/register.php"), "login_page" => "/Francium/logSys/example-basic/login.php", "home_page" => "/Francium/logSys/example-basic/home.php")));
<!DOCTYPE html> <?php require "/thirdpartylib/class.logsys.php"; \Fr\LS::init(); if (isset($_POST['action_login'])) { //echo 'this'; $username = $_POST['login']; echo $username . '<br>'; $password = $_POST['password']; echo $password . '<br>'; if ($username == "" || $password == "") { $msg = array("Error", "Username / Password Wrong !"); print_r($msg); echo '<br>'; } else { $login = \Fr\LS::login($username, $password, isset($_POST['remember_me'])); print_r($login); if ($login === false) { $msg = array("Error", "Username / Password Wrong !"); print_r($msg); echo '<br>'; } else { if (is_array($login) && $login['status'] == "blocked") { $msg = array("Error", "Too many login attempts. You can attempt login after " . $login['minutes'] . " minutes (" . $login['seconds'] . " seconds)"); print_r($msg); echo '<br>'; } } } } ?>
$sql->execute(array($who, "Facebook", $client->access_token)); $OP->redirect($location); } else { /** * Make it DD/MM/YYYY format */ $birthday = date('d/m/Y', strtotime($user->birthday)); $image = get_headers("https://graph.facebook.com/me/picture?width=200&height=200&access_token=" . $client->access_token, 1); /* Facebook Redirects the above URL to the image URL, We get that new URL ! PHP is Magic */ $image = $image['Location']; /* An array containing user details that will made in to JSON */ $userArray = array("joined" => date("Y-m-d H:i:s"), "gen" => $gender, "birth" => $birthday, "img" => $image); $json = json_encode($userArray); \Fr\LS::register($email, "", array("name" => $name, "udata" => $json, "seen" => "")); /* Login the user */ \Fr\LS::login($email, ""); $client->SetUser($id); $OP->redirect($location); } } } } $success = $client->Finalize($success); } if ($client->exit) { $OP->ser("Something Happened", "<a href='" . $client->redirect_uri . "'>Try Again</a>"); } if (!$success) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<?php \Fr\LS::init(); ?> <!DOCTYPE html> <html> <head> <?php $OP->head("Change Password - Manage Account"); ?> </head> <body> <?php include "{$docRoot}/inc/header.php"; ?> <div class="wrapper"> <div class="content"> <h2>Change Password</h2> <div style="margin:0px auto;width: 60%;"> <?php $status = \Fr\LS::changePassword(); if ($status == "changePasswordForm") { echo "<p>If you have created account with Facebook or Google, leave the current password blank</p>"; } ?> </div> </div> </div> </body> </html>
if (\Fr\LS::login(\Fr\LS::getUser("username"), "", false, false) == false) { echo "<h2>Current Password Wrong!</h2><p>The password you entered for your account is wrong.</p>"; } else { $change_password = \Fr\LS::changePassword($new_password); if ($change_password === true) { echo "<h2>Password Changed Successfully</h2>"; } } } } else { echo "<p><h2>Password Fields was blank</h2><p>Form fields were left blank</p></p>"; } } ?> <form action="<?php echo \Fr\LS::curPageURL(); ?> " method='POST'> <label> <p>Current Password</p> <input type='password' name='current_password' /> </label> <label> <p>New Password</p> <input type='password' name='new_password' /> </label> <label> <p>Retype New Password</p> <input type='password' name='retype_password' /> </label> <button style="display: block;margin-top: 10px;" name='change_password' type='submit'>Change Password</button>
<?php require "config.php"; if (isset($_POST['action_login'])) { $identification = $_POST['login']; $password = $_POST['password']; if ($identification == "" || $password == "") { $msg = array("Error", "Username / Password Wrong !"); } else { $login = \Fr\LS::login($identification, $password, isset($_POST['remember_me'])); if ($login === false) { $msg = array("Error", "Username / Password Wrong !"); } else { if (is_array($login) && $login['status'] == "blocked") { $msg = array("Error", "Too many login attempts. You can attempt login after " . $login['minutes'] . " minutes (" . $login['seconds'] . " seconds)"); } } } } ?> <html> <head> <title>Log In</title> </head> <body> <div id="content"> <h1>Log In</h1> <?php if (isset($msg)) { echo "<h2>{$msg[0]}</h2><p>{$msg[1]}</p>"; }
<?php require_once "{$docRoot}/inc/render.php"; \Fr\LS::init(); if (isset($_POST['load'])) { $sql = $OP->dbh->prepare("SELECT id FROM notify WHERE uid=? ORDER BY id DESC LIMIT 10"); $sql->execute(array($who)); if ($sql->rowCount() == 0) { echo '$(".notifications .loading").hide();$(".notifications .nfs").html("<br/><br/><center><h2>No Notifications</h2></center>");'; } else { $nfs = ""; while ($r = $sql->fetch()) { $nfs .= Render::notification($r['id']); } $nfs = $OP->rendFilt($nfs); $nfs .= "<br/><a href='" . Open::URL("/notifications") . "' style='text-align:center;display:block;'>See All Notifications</a><br/>"; ?> $(".notifications .loading").hide(); $(".notifications .nfs").html("<?php echo $nfs; ?> "); $(".notifications #nfn_button").text("0"); $(".notifications #nfn_button").removeClass("b-red"); <?php } }
<?php require_once __DIR__ . "/config.php"; /** * Add the Login Page in /admin/login route */ \Lobby\Router::route("/admin/login", function () { if (\Fr\LS::userExists("admin") === false) { \Fr\LS::register("admin", "admin", array("name" => "Admin", "created" => date("Y-m-d H:i:s"))); } include __DIR__ . "/page/login.php"; }); /** * Add the Change Password Page in /admin/ChangePassword route */ \Lobby\Router::route("/admin/ChangePassword", function () { include __DIR__ . "/page/change_password.php"; }); if (\Fr\LS::$loggedIn) { /** * Logged In */ \Lobby::hook("init", function () { /** * Add Change Password Item in Top Panel -> Admin before Log Out item * This is done by first removing the Log Out item, adding the Change * Password item and then adding back the Log Out item */ \Lobby\Panel::$top_items['left']['lobbyAdmin']['subItems']['ChangePassword'] = array("text" => "Change Password", "href" => "/admin/ChangePassword"); \Lobby\Panel::$top_items['left']['lobbyAdmin']['subItems']['LogOut'] = array("text" => "Log Out", "href" => "/admin/login?logout"); });