bas
|
| Posted: 08/13/2008, 1:56 PM |
|
I have been asked to maintain an app written by someone else acouple of
years ago...
App uses a single table (very BIG table 240 fields)
very messy but works! (I would have used multiple tables)
When a user logs in his "User" record contains all the details used within
the app
Anyway I need to allow a SUPERVISOR to log in access details for individual
accounts
One way would be if Supervisor logs in with is credentials which gives him a
user list
Then when user is selected the login changes to the Selected user
essentially login in
as the user...
I'm trying to avoid a re-write if I can at this stage
Is it possible to change the Login on the fly ??
Any ideas welcome
|
|
|
 |
datadoit
|
| Posted: 08/13/2008, 3:14 PM |
|
Yes, just change the appropriate session variables if you're using CCS
authentification features.
CCSetSession("UserID", "NewUserID");
etc.
However, how will they get back to the supervisor without logging out
and back in again?
|
|
|
 |
bas
|
| Posted: 08/14/2008, 2:19 AM |
|
I've put this in the BeforeShow event of a link page
CCSetSession("UserID", "sitename");
select * from users where user_login = "sitename";
But I get a T_String error on the last line
Can I issue a SQL statement like this??
"datadoit" <datadoit@forum.codecharge> wrote in message
news:g7vmbr$oa9$1@news.codecharge.com...
> Yes, just change the appropriate session variables if you're using CCS
> authentification features.
>
> CCSetSession("UserID", "NewUserID");
> etc.
>
> However, how will they get back to the supervisor without logging out and
> back in again?
|
|
|
 |
bas
|
| Posted: 08/14/2008, 4:18 AM |
|
or figured I do that by looking old posts
So I tried
CCSetSession("UserID", $sitename);
$db = new clsDBConnection1();
$SQL = "select * from users where user_login = " . $sitename;
$db->query($SQL);
$db->close();
Still dosn't do what I wanted ie. fetch the data of the swapped user
I this because I'm using a New connection with this $db = new
clsDBConnection1();
Is there a way to re-issue the Query for the current connection??
"bas" <bas@nospam.com> wrote in message
news:g80tb8$e8q$1@news.codecharge.com...
> I've put this in the BeforeShow event of a link page
>
> CCSetSession("UserID", "sitename");
> select * from users where user_login = "sitename";
>
> But I get a T_String error on the last line
>
> Can I issue a SQL statement like this??
>
>
> "datadoit" <datadoit@forum.codecharge> wrote in message
>news:g7vmbr$oa9$1@news.codecharge.com...
>> Yes, just change the appropriate session variables if you're using CCS
>> authentification features.
>>
>> CCSetSession("UserID", "NewUserID");
>> etc.
>>
>> However, how will they get back to the supervisor without logging out and
>> back in again?
>
>
|
|
|
 |
wkempees
Posts: 1679
|
| Posted: 08/14/2008, 4:57 AM |
|
Some comments:
CCSetSession("UserID", $sitename);
What is in $sitename ?
I suspect it to be a word, session variable UserID by default is a number!
User_Login is a session variable (default) available for storing the users login name.
Also in your SQL you are NOT using the session variable you have (CCSetSession) set.
And you are correctly testing "where user_login...." the login name.
$db = new clsDBConnection1();
$SQL = "select * from users where user_login = " . $sitename;
$db->query($SQL);
$db->close();
I suspect you are mixing things up.
Your original post was about changing the UserID.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
bas
|
| Posted: 08/14/2008, 7:50 AM |
|
Confused - you bet....
Been looking at the help :)
This will work CCLoginUser(user_login, user_password);
where user_login & user_password comes from User table
I tried CCLoginUser("test", "testpass" ); and it works as I planned
========= Now I need to get this from the current linkpage1 & 2 variables
===
Stuck trying to get values of a couple of variable of the current
record ---- tried this but...
$un = $Component->$users->GetLink(linkpage1);
$pwd = $Component->$users->GetLink(linkpage2);
CCLoginUser($un, $pwd);
"wkempees" <wkempees@forum.codecharge> wrote in message
news:548a41d8c61a95@news.codecharge.com...
> Some comments:
> CCSetSession("UserID", $sitename);
> What is in $sitename ?
> I suspect it to be a word, session variable UserID by default is a number!
> User_Login is a session variable (default) available for storing the users
> login name.
>
> Also in your SQL you are NOT using the session variable you have
> (CCSetSession)
> set.
> And you are correctly testing "where user_login...." the login name.
>
> $db = new clsDBConnection1();
> $SQL = "select * from users where user_login = " . $sitename;
> $db->query($SQL);
> $db->close();
>
> I suspect you are mixing things up.
> Your original post was about changing the UserID.
>
> Walter
>
> _________________
> Origin: NL, Timezone GMT+1 (Forumtime +9)
> CCS3/4.01.006 PhP, MySQL (Vista/XP, XAMPP)
>
> if you liked this info PAYPAL me: http://donate.consultair.eu
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
DonP
|
| Posted: 08/14/2008, 9:01 AM |
|
Another option might be to redirect the supervisor to a special page
when logging in (or providing them a link to it directly), accessible
only by someone with that security level, which will list all records
either in a select box or on a grid. That way they'll have access to
everything while others will have access only to their own record.
Don (DonP)
bas wrote:
> I have been asked to maintain an app written by someone else acouple of
> years ago...
>
> App uses a single table (very BIG table 240 fields)
> very messy but works! (I would have used multiple tables)
>
> When a user logs in his "User" record contains all the details used within
> the app
>
> Anyway I need to allow a SUPERVISOR to log in access details for individual
> accounts
>
> One way would be if Supervisor logs in with is credentials which gives him a
> user list
> Then when user is selected the login changes to the Selected user
> essentially login in
> as the user...
>
> I'm trying to avoid a re-write if I can at this stage
>
> Is it possible to change the Login on the fly ??
>
> Any ideas welcome
>
>
|
|
|
 |
|