Exemple #1
0
<?php

require_once '../php/Connection.php';
require_once '../php/LoginSystem.php';
require_once '../php/GroupSystem.php';
$db = new Connection();
$loginSys = new LoginSystem($db);
$groupSys = new GroupSystem($db);
$success = false;
if (isset($_POST['user'], $_POST['pass'])) {
    $success = $loginSys->Login($_POST['user'], $_POST['pass']);
}
?>
<!doctype html>
<html>
    <head>
        <title>Login</title>
        
        <meta charset="utf-8"/>
        <meta http-equiv="refresh" content="2; url=index.php" />
        
        <link rel="stylesheet" type="text/css" href="css/php.css"/>
    </head>
    <body>
        <div><!-- wrapper div -->
            <div id="message">
                <?php 
if ($success) {
    echo '<b>' . $loginSys->user['handle'] . '</b> is now logged in!';
} else {
    echo $loginSys->error;
<header id="fixed-header" class="fixed-header--signin section-padding">
    <hgroup class="align-vertical">
        <h1>RESEND VALIDATION EMAIL</h1>
    </hgroup>
</header>

<main>

    <section>
        <div class="section-padding align-centre lgrey">
            <?php 
require_once 'php/LoginSystem.php';
$loginSystem = new LoginSystem();
if ($_POST) {
    $email = $_POST['email'];
    if (!empty($email)) {
        $response = $loginSystem->resendValidationEmail($email);
        echo $response;
    } else {
        echo '<p class="full warn"><i class="ico-warning"></i>Please enter your email.</p>';
    }
}
?>

            <form method="post" class="half-padding">
                <table>
                    <tr>
                        <td><label for="email">Email:</label></td>
                        <td><input type="email" name="email" required autofocus/></td>
                    </tr>
<?php

include_once '../../conf/config.inc.php';
$logout = new LoginSystem();
$logout->logout();
//echo '<script>location.href="'.DEFAULT_ADMIN_URL.'/login/login.php";</script>';
redirectUrl(DEFAULT_ADMIN_URL . '/login/login.php');
exit;
?>



	







Exemple #4
0
<?php

if (isset($_GET['group'])) {
    require_once '../php/Connection.php';
    require_once '../php/LoginSystem.php';
    require_once '../php/GroupSystem.php';
    $db = new Connection();
    $loginSys = new LoginSystem($db);
    $groupSys = new GroupSystem($db);
    $userGroups = $groupSys->GetUserGroups($loginSys->user['id']);
    foreach ($userGroups as $group) {
        if ($group == $_GET['group']) {
            // user is in group
            $loginSys->SelectGroup($_GET['group']);
            break;
        }
    }
}
// Redirect back
header('Location: index.php');
<?php

/*************************************************************/
# coder:Kapil Verma
# checking that if admin is logged in or not if not
# then redirect to login page if yes then redirect to home page
/*************************************************************/
include_once '../conf_superadmin/config.inc.php';
$loginCheck = new LoginSystem();
if ($loginCheck->isLoggedIn()) {
    echo '<script>location.href="' . DEFAULT_ADMIN_URL . '/home/home.php";</script>';
    exit;
} else {
    echo '<script>location.href="' . DEFAULT_ADMIN_URL . '/login/login.php";</script>';
    exit;
}
Exemple #6
0
<?php

require_once '../php/Connection.php';
require_once '../php/LoginSystem.php';
$db = new Connection();
$loginSys = new LoginSystem($db);
$loginSys->Logout();
?>
<!doctype html>
<html>
    <head>
        <title>Logout</title>
        
        <meta charset="utf-8"/>
        <meta http-equiv="refresh" content="2; url=index.php" />
        
        <link rel="stylesheet" type="text/css" href="css/php.css"/>
    </head>
    <body>
        <div><!-- wrapper div -->
            <div id="message">
                You are now logged out!
            </div>
        </div><!-- wrapper div -->
        
    </body>
</html>
Exemple #7
0
<?php

require_once '../php/Connection.php';
require_once '../php/LoginSystem.php';
require_once '../php/GroupSystem.php';
$success = true;
$error_msg = '';
try {
    if (!($params = json_decode(file_get_contents('php://input')))) {
        throw new Exception("Couldn't decode incoming data!");
    }
    if (!($db = new Connection())) {
        throw new Exception("Couldn't connect to database!");
    }
    if (!($loginSys = new LoginSystem($db))) {
        throw new Exception("Couldn't connect to login system!");
    }
    if (!($groupSys = new GroupSystem($db))) {
        throw new Exception("Couldn't connect to group system!");
    }
    if (!($params->user && $params->pass)) {
        throw new Exception('Form incomplete!');
    }
    // Login
    $user = $params->user;
    $pass = $params->pass;
    if (!($success = $loginSys->Login($user, $pass))) {
        throw new Exception('Wrong username/password!');
    }
    // Find a group for user if not a member of any.
    $userId = $loginSys->user['id'];
<?php

require_once '../php/Connection.php';
require_once '../php/LoginSystem.php';
$success = true;
$error_msg = '';
try {
    if (!($params = json_decode(file_get_contents('php://input')))) {
        throw new Exception("Couldn't decode incoming data!");
    }
    if (!($db = new Connection())) {
        throw new Exception("Couldn't connect to database!");
    }
    if (!($loginSys = new LoginSystem($db))) {
        throw new Exception("Couldn't connect to login system!");
    }
    if (!$params->email) {
        throw new Exception('Form incomplete!');
    }
    if (!$loginSys->OpenRecoveryTicket($params->email)) {
        throw new Exception($loginSys->error);
    }
} catch (Exception $e) {
    $error_msg = $e->getMessage();
    $success = false;
}
echo json_encode(array('success' => $success, 'error_msg' => $error_msg));
Exemple #9
0
<?php

require "class.loginsys.php";
$LS = new LoginSystem();
$LS->init();
if (isset($_POST['act_login'])) {
    $user = $_POST['login'];
    $pass = $_POST['pass'];
    if ($user == "" || $pass == "") {
        $msg = array("Error", "Username / Password Wrong !");
    } else {
        if (!$LS->login($user, $pass)) {
            $msg = array("Error", "Username / Password Wrong !");
        }
    }
}
?>
<html>
 <head>
  <title>Log In</title>
 </head>
 <body>
  <div class="content">
   <h2>Log In</h2>
   <form action="login.php" method="POST" style="margin:0px auto;display:table;">
    <label>Username / E-Mail</label><br/>
    <input name="login" type="text"/><br/>
    <label>Password</label><br/>
    <input name="pass" type="password"/><br/>
    <label>
     <input type="checkbox" name="remember_me"/> Remember Me
Exemple #10
0
<?php

require_once 'php/LoginSystem.php';
$loginSystem = new LoginSystem();
?>

<header id="fixed-header" class="fixed-header--signin section-padding">
    <hgroup class="align-vertical">
        <h1>SIGN IN / REGISTER</h1>
    </hgroup>
</header>

<main>

    <section>
        <div class="section-padding align-centre mblue">
            <?php 
if (isset($_SESSION['status'])) {
    if ($_SESSION['status'] == 'notsignedin') {
        echo '<p class="full warn"><i class="ico-warning"></i>You must be logged in to view this page.</p>';
        unset($_SESSION['status']);
    } elseif ($_SESSION['status'] == 'signedin') {
        header("location: /user/{$_SESSION['username']}");
    }
}
?>
            <h1>SIGN IN</h1>
            <?php 
if (!empty($_POST['signin-submit'])) {
    if (!empty($_POST['email']) && !empty($_POST['password'])) {
        $response = $loginSystem->signin($_POST['email'], $_POST['password']);
Exemple #11
0
<?php

require_once '../php/Connection.php';
require_once '../php/LoginSystem.php';
require_once '../php/GroupSystem.php';
require_once '../php/PostSystem.php';
require_once '../php/Time.php';
$db = new Connection();
$loginSys = new LoginSystem($db);
$groupSys = new GroupSystem($db);
$postSys = new PostSystem($db);
// Not logged in
if (!$loginSys->user) {
    ?>

<!doctype html>
<html>
    <head>
        <meta http-equiv="refresh" content="0; url=/"/>
    </head>
    <body></body>
</html>

<?php 
    // Logged in
} else {
    // Get Associated groups
    $groups = $groupSys->GetUserGroups($loginSys->user['id']);
    // Get Group Members
    $members = $loginSys->GetUsers($groupSys->GetMembers($loginSys->group_id));
    // Get group posts
Exemple #12
0
<?php

require_once '../php/Connection.php';
require_once '../php/LoginSystem.php';
$success = false;
$error_msg = '';
try {
    if (!($db = new Connection())) {
        throw new Exception("Couldn't connect to database!");
    }
    if (!($loginSys = new LoginSystem($db))) {
        throw new Exception("Couldn't connect to login system!");
    }
    // Perform Logout
    if (!$loginSys->Logout()) {
        throw new Exception("Couldn't logout!");
    } else {
        $success = true;
    }
} catch (Exception $e) {
    $error_msg = $e->getMessage();
}
echo json_encode(array('success' => $success, 'error_msg' => $error_msg));
Exemple #13
0
<?php

include "class.loginsys.php";
$LS = new LoginSystem();
$LS->init();
?>
<!DOCTYPE html>
<html>
	<head></head>
	<body>
 		<div class="content">
  			<h1>Register</h1>
  			<form action="register.php" method="POST">
   			<label>
    				<input name="username" placeholder="username"/>
   			</label><br/>
   			<label>
    				<input name="email" placeholder="EMail"/> 
   			</label><br/>
	   		<label>
	    			<input name="pass" type="password" placeholder="Password"/>
	   		</label><br/>
	   		<label>
	    			<input name="pass2" type="password" placeholder="Retype pass"/>
	   		</label>
	   		<label><br/>
	    			<input name="name" placeholder="Name"/>
	   		</label><br/>
	   		<button name="submit">Register</button>
	  		</form>  
	  		<?php 
 function create($usertype, $name, $passwrd, $email)
 {
     $password = md5($passwrd);
     $sql = "SELECT * FROM users WHERE username='******' or email_address='{$email}';";
     $sql1 = "SELECT * FROM group_members WHERE member_name='{$name}' or member_email='{$email}';";
     //checking if the username or email is available in db
     $check = $this->db->query($sql);
     $count_row = $check->num_rows;
     $check1 = $this->db->query($sql1);
     $count_row1 = $check1->num_rows;
     //if the username is not in db then insert to the table
     if ($count_row == 0 && $count_row1 == 0) {
         $sql1 = "INSERT INTO `users` (`user_id`, `username`, `email_address`, `password`) VALUES (NULL, '{$name}', '{$email}', '{$password}')";
         $result = mysqli_query($this->db, $sql1) or die(mysqli_connect_errno() . "Data cannot inserted");
         session_start();
         $user = new UserModel($name);
         $this->usertype = $user->get_usertype();
         $this->id = $user->get_id();
         $_SESSION['user'] = $user;
         $_SESSION['usertype'] = $user->get_usertype();
         return $result;
     } else {
         if ($count_row == 0 && $count_row1 == 1) {
             $sql1 = "INSERT INTO `users` (`user_id`, `username`, `email_address`, `password`, `usertype`, `group_created`, `member_active`) VALUES (NULL, '{$name}', '{$email}', '{$password}', 'user', '0', '1')";
             $result = mysqli_query($this->db, $sql1) or die(mysqli_connect_errno() . "Data cannot inserted");
             $ls = new LoginSystem();
             $ls->attach(new NewUserMailer());
             $ls->createUser($name);
             session_start();
             $user = new UserModel($name);
             $this->usertype = $user->get_usertype();
             $this->id = $user->get_id();
             $_SESSION['user'] = $user;
             $_SESSION['usertype'] = $user->get_usertype();
             return $result;
         } else {
             return false;
         }
     }
 }
        }
    } else {
        $result = "Please fill all the required fields.";
    }
    unset($objLogin);
} else {
    if (isset($forgot_submit)) {
        $objValidation = new validation();
        $objValidation->add_fields($email, 'req', 'Please Enter Email Address');
        $error = $objValidation->validate();
        if ($error) {
            $errorForgot = $error;
            $flag = 1;
            unset($objValidation);
        } else {
            $objLogin = new LoginSystem();
            $objCommon = new common();
            $result_forgot = $objCommon->read(TBL_ADMIN, "email='" . $objLogin->clean($email) . "'");
            $row_forgot = $db->fetchNextObject($result_forgot);
            //pr($row_forgot);exit;
            if ($row_forgot->email == $email && isset($row_forgot->email)) {
                $message = '
									<p>Your Login Details are as follows :</p>
									<table width="75%" border="0" cellpadding="2" cellspacing="0">
									<tr>
									<td>Username:</td>
									<td>' . $row_forgot->username . '</td>
									</tr>
									<tr>
									<td>Password:</td>
									<td>' . $row_forgot->password . '</td>
<header id="fixed-header" class="fixed-header--signin section-padding">
    <hgroup class="align-vertical">
        <h1>FORGOTTEN YOUR PASSWORD</h1>
    </hgroup>
</header>

<main>

    <section>
        <div class="section-padding align-centre lgrey">
            <?php 
require_once 'php/LoginSystem.php';
$loginSystem = new LoginSystem();
if ($_POST) {
    $email = $_POST['email'];
    if (!empty($email)) {
        $exists = $loginSystem->checkUserExists($email, '');
        if ($exists) {
            $response = $loginSystem->sendResetPasswordLink($email);
            echo $response;
        } else {
            echo '<p class="full warn"><i class="ico-warning"></i>No account with this email exists.</p>';
        }
    } else {
        echo '<p class="full warn"><i class="ico-warning"></i>Please enter your email.</p>';
    }
}
?>

            <form method="post">
                <table>
Exemple #17
0
<?php

require_once '../php/Connection.php';
require_once '../php/LoginSystem.php';
require_once '../php/GroupSystem.php';
$db = new Connection();
$loginSys = new LoginSystem($db);
$groupSys = new GroupSystem($db);
$success = false;
if (isset($_POST['user'], $_POST['pass1'], $_POST['pass2'], $_POST['email'], $_POST['name'], $_POST['location'], $_POST['birthdate'])) {
    // Register New User
    $success = $loginSys->Register($_POST['user'], $_POST['pass1'], $_POST['pass2'], $_POST['email'], $_POST['name'], $_POST['location'], $_POST['birthdate']);
    // Login
    if ($success) {
        // Login
        $loginSys->Login($_POST['user'], $_POST['pass1']);
        // Find group
        if ($openGroups = $groupSys->FindGroup($loginSys->user['id'])) {
            if ($groupSys->AddToGroup($openGroups[0], $loginSys->user['id'])) {
                $loginSys->SetDefaultGroup($openGroups[0]);
                $loginSys->SelectGroup($openGroups[0]);
            }
        }
    }
}
?>
<!doctype html>
<html>
    <head>
        <title>Register</title>
        
Exemple #18
0
<header id="fixed-header" class="fixed-header--signin section-padding">
    <hgroup class="align-vertical">
        <h1>VERIFY ACCOUNT</h1>
    </hgroup>
</header>

<main>

    <section>
        <div class="section-padding align-centre lgrey">
            <?php 
if (!isset($_GET['e']) || !isset($_GET['r'])) {
    header('location: /');
}
require_once 'php/LoginSystem.php';
$loginSystem = new LoginSystem();
$response = $loginSystem->validateUser($_GET['e'], $_GET['r']);
echo $response ? '<p class="full success"><i class="ico-info"></i>User account verified. You may now <a href="signin">sign in</a>.</p>' : '<p class="full warn"><i class="ico-warning"></i>An error has occurred whilst verifying your account. Please contact <a href="mailto:info@cell-industries.co.uk">info@cell-industries.co.uk</a>.</p>';
?>
        </div>
    </section>

</main>
Exemple #19
0
<?php

require "class.loginsys.php";
$LS = new LoginSystem();
$LS->init();
?>
<!DOCTYPE html>
<html>
	<head></head>
	<body>
 		<?php 
$LS->changePassword();
?>
	</body>
</html>
Exemple #20
0
<?php

require "class.loginsys.php";
$LS = new LoginSystem();
$LS->logout();
Exemple #21
0
<?php

require "class.loginsys.php";
$LS = new LoginSystem();
$LS->init();
?>
<!DOCTYPE html>
<html>
	<head></head>
	<body>
 		<p>The Index Page</p>
 		<a href="login.php">Login</a>
	</body>
</html>
Exemple #22
0
<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();
require '../classes/LoginSystem.class.php';
global $database;
$loginSys = new LoginSystem();
$time = new DateTime();
$time = $time->format('Y/m/d H:i:s');
//$time=time();
$a = $_SESSION['sessionnum'];
$lsql = "UPDATE ACCESSLOG SET LOGOUTTIME=TO_DATE('{$time}','yyyy/mm/dd hh24:mi:ss') WHERE SESSIONID='{$a}'";
$q = oci_parse($conn, $lsql);
oci_execute($q);
$loginSys->logout();
Exemple #23
0
<?php

require "class.loginsys.php";
$LS = new LoginSystem();
$LS->init();
if (isset($_POST['newName'])) {
    $_POST['newName'] = $_POST['newName'] == "" ? "Dude" : $_POST['newName'];
    $LS->updateUser(array("name" => $_POST['newName']));
}
?>
<html>
	<head></head>
	<body>
		<a href="logout.php">Log Out</a>
		<p>
			You registered on this website <strong><?php 
echo $LS->timeSinceJoin();
?>
</strong> ago.
		</p>
		<p>
			Here is the full data the database stores on this user :
		</p>
		<pre><?php 
$details = $LS->getUser();
print_r($details);
?>
</pre>
		<p>
			Change the name of your account :
		</p>
Exemple #24
0
 static function resetPassword($email, $password, $rand)
 {
     require 'db.php';
     $sth = $dbh->query("SELECT resetRand FROM users WHERE email='{$email}'");
     $sth->setFetchMode(PDO::FETCH_OBJ);
     $result = $sth->fetch();
     if ($result->resetRand == $rand) {
         require_once 'Encryption.php';
         $passwordE = Encryption::encrypt($password);
         $newRand = LoginSystem::generateRandomNumber();
         $sth = $dbh->prepare("UPDATE users SET password='******', resetRand='{$newRand}' WHERE email='{$email}'");
         $sth->execute();
         return '<p class="full success"><i class="ico-info"></i>Password successfully reset. Please <a href="signin">sign in</a>.' . LoginSystem::wrapEnd;
     } else {
         return LoginSystem::wrapStart . 'This link has expired. Please <a href="forgotten-password">request a new password reset link</a>.' . LoginSystem::wrapEnd;
     }
 }
$success = true;
$error_msg = '';
$memberIds = array();
$members = array();
try {
    // Test Parameters
    if (!isset($_GET['group_id'])) {
        throw new Exception("Request not received!");
    } else {
        $group_id = $_GET['group_id'];
    }
    // Setup API
    if (!($db = new Connection())) {
        throw new Exception("Couldn't connect to database!");
    }
    if (!($loginSys = new LoginSystem($db))) {
        throw new Exception("Couldn't connect to login system!");
    }
    if (!($groupSys = new GroupSystem($db))) {
        throw new Exception("Couldn't connect to group system!");
    }
    // Get Group Member Ids
    if (!($memberIds = $groupSys->GetMembers($group_id))) {
        throw new Exception("Couldn't retreive group members!");
    }
    // Get Member Details
    if (!($members = $loginSys->GetUsers($memberIds))) {
        throw new Exception("Couldn't retreive member details!");
    }
    // Prepare output array
    $output = array();
Exemple #26
0
<?php

require_once '../php/Connection.php';
require_once '../php/LoginSystem.php';
require_once '../php/GroupSystem.php';
$db = new Connection();
$loginSys = new LoginSystem($db);
$groupSys = new GroupSystem($db);
// Find group
$openGroups = $groupSys->FindGroup($loginSys->user['id']);
if ($groupSys->AddToGroup($openGroups[0], $loginSys->user['id'])) {
    $loginSys->SelectGroup($openGroups[0]);
}
// Redirect back
header('Location: index.php');
<?php

extract($_GET);
extract($_POST);
# ----------------------------------------------------------------------------------------------------
if ((isset($submit) || isset($submit_x)) && ($submit != "" || $submit_x != '')) {
    if ($user_name != '' && $password != '') {
        $objLogin = new LoginSystem();
        if ($objLogin->doLogin($user_name, $password)) {
            //echo '<script>location.href="'.DEFAULT_ADMIN_URL.'/home/home.php";</script>';
            redirectUrl(DEFAULT_ADMIN_URL . '/home/home.php');
            exit;
        } else {
            $result = "Invalid username or password";
        }
    } else {
        $result = "please fill all the required fields.";
    }
}
Exemple #28
0
<?php

require_once 'php/LoginSystem.php';
$loginSystem = new LoginSystem();
$loginSystem->signout();
Exemple #29
0
<?php

require_once '../php/Connection.php';
require_once '../php/LoginSystem.php';
$success = false;
$error_msg = '';
try {
    if (!($params = json_decode(file_get_contents('php://input')))) {
        throw new Exception("Couldn't decode incoming data!");
    }
    if (!($db = new Connection())) {
        throw new Exception("Couldn't connect to database!");
    }
    if (!($loginSys = new LoginSystem($db))) {
        throw new Exception("Couldn't connect to login system!");
    }
    if (!($params->handle && $params->email && $params->pass1 && $params->pass2)) {
        throw new Exception('Form incomplete!');
    } else {
        $handle = $params->handle;
        $email = $params->email;
        $pass1 = $params->pass1;
        $pass2 = $params->pass2;
        if (!($success = $loginSys->Register($handle, $email, $pass1, $pass2))) {
            throw new Exception($loginSys->error);
        } else {
            $success = true;
        }
    }
} catch (Exception $e) {
    $error_msg = $e->getMessage();
Exemple #30
0
<html>
 <head></head>
 <body>
  <?php 
require "class.loginsys.php";
$LS = new LoginSystem();
$LS->init();
$LS->forgotPassword();
?>
 </body>
</html>