This topic is locked

AutoLogin

1/19/2009 08:19:49
PHPRunner General questions
N
netmedia59 author

Hello,
Is there a way to give the users a direct link to bypass the Login Menu

Ex : wwww.mywebsite.com/login.php?Login&username=yourusername&password=yourpassword (or something like that)
Thanks very much
Netmedia59

J
Jane 1/20/2009

Hi,
to use direct link check passed parameters in the Login page: Before process event, fill $_SESSION variables if needed and redirect to the menu page.

Here is a sample:

global $conn;

if (@$_REQUEST["username"] && @$_REQUEST["password"])

{

$rs = db_query("select * from UsersTable where username='".$_REQUEST["username"]."' and password='".$_REQUEST["password"]."'",$conn);

if ($data = db_fetch_array())

{

//fill session variables here and redirect to the menu page

}

}

N
netmedia59 author 2/2/2009

Hello Jane,
Could you explain it a little bit more
My login table is called visiteurs

User name field : Email

Password field : Password
And after, how can the user could connect ?

login.php .........................
Thank You very much for your answer
netmedia59

J
Jane 2/2/2009

Hi,
here is a sample link:

wwww.mywebsite.com/login.php?username=yourusername&password=yourpassword
Here is a sample code:

global $conn;

if (@$_REQUEST["username"] && @$_REQUEST["password"])

{

$rs = db_query("select * from visiteurs where Email='".$_REQUEST["username"]."' and Password='".$_REQUEST["password"]."'",$conn);

if ($data = db_fetch_array())

{

//fill session variables here and redirect to the menu page

$_SESSION["UserID"] = $_REQUEST["username"];

header("Location: menu.php");

exit();

}

}


Here is a list of all PHPRunner session variables:

http://www.xlinesoft.com/phprunner/docs/ph...n_variables.htm

N
netmedia59 author 2/3/2009

Thank you very much Jane,
It works perfectly

In fact, I had to include one parameter as follow (in bold)

if ($data = db_fetch_array($rs))
Hope it can be also interesting for other users

Thanks again
netmedia59

Hi,

here is a sample link:

wwww.mywebsite.com/login.php?username=yourusername&password=yourpassword
Here is a sample code:
Here is a list of all PHPRunner session variables:

http://www.xlinesoft.com/phprunner/docs/ph...n_variables.htm

N
netmedia59 author 2/4/2009

Hello,
In fact, there is a problem !

I think it's in the security
I can Login with this method, no problem !
But after, I can't see the data correponding to the username
For example, if the username is test@test.com, I can't see it's data !!!
Thank you for your help
netmedia59

J
Jane 2/4/2009

Hi,
I suppose you need to fill $_SESSION["AccessLevel"] and $_SESSION["_TableName_OwnerID"] (if you use User can see and edit their own records only security method on the Security tab) variables.

$_SESSION["AccessLevel"] = ACCESS_LEVEL_USER;

$SESSION["TableName_OwnerID"] = $_REQUEST["username"];



where TableName is your actual table name.

N
nickc25 2/10/2009

Hi,

I suppose you need to fill $_SESSION["AccessLevel"] and $_SESSION["_TableName_OwnerID"] (if you use User can see and edit their own records only security method on the Security tab) variables.
where TableName is your actual table name.


I have a similar problem.
http://www.asprunner.com/forums/index.php?showtopic=10871