This topic is locked

Session Variables for login

2/19/2007 11:42:53
PHPRunner General questions
rsawchuk author

I have 3 to 4 PHPRunner applications embedded in various Joomla websites. I have managed to get the PHPRunner applications to use the Joomla username and password database.
However, users are complaining about having to log into the various components (even though if they checked Remember Password, they could get in easily).
For other php scripts, I have manage to automate the login by using session variables. However, I have been unable to do so for PHPRunner.
Here is the script:

<?php
// Enable sessions

session_start();
// Turn on magic quotes to prevent SQL injection attacks

if(!get_magic_quotes_gpc())

set_magic_quotes_runtime(1);
// Obtain Username from passing URL

$username = $_REQUEST['username'];
// Enable Sessions for this component
$_SESSION['UserID'] = $_REQUEST['username'];

$_SESSION['OwnerID'] = $data['username'];



// Go to List Page

header("Location: cxt_plans_list.php");
?>


I am passing the username within the url link from Joomla. Using the above, I am able to successfully login with the username, BUT it does not obtain the member's data. Security is set to members being only able to see and edit their own data.
So the problem is probably with the $_SESSION['OwnerID'] variable. I haven't been able to figure out what to set this SESSION to in order to get the right member's data.
Any suggestions? Thanks,
Russ

Sergey Kornilov admin 2/19/2007

Russ,
it all depends on what field you use as an OwnerID field.
data['username'] doesn't mean anything in this context. Most probably you need to run a SQL query to get OwnerID value based on UserID value:

$sql = "select * from LoginTable where username = '". $_REQUEST['username'] . "'";