Forums

PHP

This topic is locked

displaying user name after login page?

Posted 22 Oct 2001 08:24:18
1
has voted
22 Oct 2001 08:24:18 Tyler Jensen posted:
Ok, my head is about to explode. What is the general UD theory behind how to manage sessions and user information with PHAkt? I will say that I'm not very fluent in PHP yet, so maybe I overestimated what you can do with PHAkt without having to learn to code well. Right now, I have created a MySQL db that houses usernames, passwords, first and last name, and other info. So I create a 'welcome.php' page, and place a bit of dynamic text that _should_ pull first and last name from the db based on who logged in, but no matter what, I always get the data from the first entry in the database. do I need to define sessions on each page, or ? I'm just wondering how I can tell PHAkt to get the data from the same record in the table as it used to check user and password. I have tried what I feel is almost every combination of filtering on a recordset created just to pull the first and last name of the person out and display it, but I'm stumped, and I think it's probably something I'm overlooking.

Thanks for any help!

Tyler

PS- I hope this was somewhat clear. I'm real tired right now, so I may have to do some further explaining of my question later on.

Replies

Replied 22 Oct 2001 09:30:32
22 Oct 2001 09:30:32 Michael O'Neill replied:
If you use the UD login behaviours and have

<?php
session_start();
?>

at the top of every page that you want to display the username on, the following code should echo the username to the screen.
The $KT_Username is case sensitive!!

<?php
echo $KT_Username;
?>

Have fun, hope this is of help.
Mike.



Edited by - carphone on 10/22/2001 09:39:44
Replied 22 Oct 2001 17:05:11
22 Oct 2001 17:05:11 Ryan Schwiebert replied:
If I may ask, how are you authenticating users? Are you using the User Authentication Server Behaviour?

Replied 22 Oct 2001 18:15:53
22 Oct 2001 18:15:53 Michael O'Neill replied:
Was your question directed to me 'Mike' or 'Tyler'


Replied 22 Oct 2001 18:20:22
22 Oct 2001 18:20:22 Ryan Schwiebert replied:
Er Sorry... Tyler I guess. It looks like you were refering to the $KT_Username set by the User Authentication Server Behaviour. (At least I think so)

Replied 22 Oct 2001 19:29:48
22 Oct 2001 19:29:48 Tyler Jensen replied:
Yes, I'm using the User Auth Server Behavior. Now, I haven't tried the little snippet carphone posted, but I don't think it will do what I want. Like when you arrive at UDzone.com, it says 'Welcome Tyler Jensen' , even though my username is tjanim. I'm going to try what carphone has posted, but I don't think it will work right for what I want. I'll let you all know!

Thanks a lot for the help!

Tyler

-Tyler

Replied 22 Oct 2001 20:34:05
22 Oct 2001 20:34:05 Keith Slater replied:
Carphone is right, put
<?php
session_start();
?>
on the page that displays the name. Then filter the recordset by Username = session variable KT_Username.

Then it should work.
Also if you restrict access to the page it puts session_start on the page for you.

Keith Slater
Replied 23 Oct 2001 01:08:37
23 Oct 2001 01:08:37 Tyler Jensen replied:
GOT IT! Damn, it's so simple. Is there a list of common PHAkt Variables or better documentation anywhere?

Thanks again!!

Tyler

Replied 23 Oct 2001 14:44:19
23 Oct 2001 14:44:19 Michael O'Neill replied:
After some digging through code many months ago I found that $KT_Username was the PHAkt equivalent of UD's
MM_valUsername variable I THINK!!.

I have not seen a list of variables anywhere or for that matter better or complete docs.

Maybe a project eh?
Mike.



Edited by - carphone on 10/23/2001 20:16:26
Replied 23 Oct 2001 15:06:47
23 Oct 2001 15:06:47 Keith Slater replied:
Yea I just wrote 3 topic up that its KT_Username... ehehhe



Edited by - keithslater on 10/23/2001 15:07:41

Reply to this topic