Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

External Login Configuration

–1 vote
90 views
asked Nov 5 in Q2A Core by Shrisun
edited 4 days ago by Shrisun

In Need of urgent help!!!!

My Project has been stopped due to the configuration!

Can anyone help me in configuring the qa-external-users.php ?

I want to configure this:

function qa_get_logged_in_user()

{

// Until you edit this function, nobody is ever logged in

return null;

Q2A Website:- www.domain.com

Login Page:- www.domain.com/tools/login.php
Class Page:- www.domain.com/tools/class.user.php

login.php:

session_start();

require_once 'class.user.php';

$user_login = new USER();

if($user_login->is_logged_in()!="")

{

$user_login->redirect($web);

}

if(isset($_GET['user']) && isset($_GET['password']))

{

$uname = trim($_GET['user']);

$upass = trim($_GET['password']);

$red = trim($_GET['redirect']);

if($user_login->get_login($uname,$upass))

{

$user_login->redirect($red);

}

}

Login function is in class.user.php:

public function get_login($uname,$upass)

{

try

{

$stmt = $this->conn->prepare("SELECT * FROM tbl_users WHERE CRN=:username");

$stmt->execute(array(":username"=>$uname));

$userRow=$stmt->fetch(PDO::FETCH_ASSOC);

if($stmt->rowCount() == 1)

{

if($userRow['userStatus']=="Y")

{

if($userRow['userAccess']=="Y")

{

if(password_verify($upass, $userRow['userPass']))

{

//some hidden code

if($userRow['userNotify']=="Y")

{

//Some Hidden Code

}

$_SESSION['userSession'] = $userRow['userID'];

$_SESSION['loggedin_time'] = time();

$_SESSION['user_name'] = $userRow['CRN'];

return true;

}

else

{

header("Location: signin.php?error");

exit;

}

}

else

{

header("Location: default.php");

exit;

}

}

else

{

header("Location: inactive.php");

exit;

}

}

else

{

header("Location: signin.php?error");

exit;

}

}

catch(PDOException $ex)

{

echo $ex->getMessage();

}

}

is_logged_in function is in class.user.php:

public function is_logged_in()

{

if(isset($_SESSION['userSession']))

{

return true;

}

}

Q2A version: 1.8 Beta

Please log in or register to answer this question.

...