$who = $_SESSION['logSyscuruser'];
                    $sql = $OP->dbh->prepare("UPDATE `oauth_session` SET `user` = ? WHERE `server` = ? AND `access_token` = ?");
                    $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) {
    ?>
Beispiel #2
0
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>
<!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>
Beispiel #4
0
<?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");
    });
Beispiel #5
0
 /**
  * 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";
     });
 }