Forums

PHP

This topic is locked

Creating a session variable problem

Posted 05 Aug 2001 23:40:02
1
has voted
05 Aug 2001 23:40:02 Philippe Lê posted:
Hi
I made a login page with dreamwaver and phakt and I want, after validating the page , to make a query on a table with the login informations and put the result into a session variable.
I can't find how to do that.

So if anyone knows that I would be very happy

Philippe

Replies

Replied 05 Aug 2001 23:49:30
05 Aug 2001 23:49:30 Bob Costa replied:
I have installed a set of behaviors called tg php suite. Thre is a behavior there to set a cookie from a recordset value.

Of course, I just tried to test mine and found it is broken. SO I might need to reinstall it, but this looks like the right idrection for you. Let us know how it comes out.

Replied 06 Aug 2001 17:43:12
06 Aug 2001 17:43:12 Gerald Artman replied:
I am having a similar problem, but I believe it is based on the location of the startSession. In the page code, I moved it to the first line, then comes the include code for ADODB, then the behavior that checks the db for user validate. I am getting an error saying that headers are already output at line 1 of ADODB.INC. It as if it got included first before "SESSIONSTART()".

Replied 06 Aug 2001 20:06:46
06 Aug 2001 20:06:46 Tim Green replied:
To do this effectively, first you will have to apply the 'Restrict Access To Page' behaviour, to ensure that only validated (and authorised) users' information is processed.

When contructing your query, the only information that is available from the login is the Username, as the Password isn't stored anywhere (of course).

An easy way to filter your Recordset would be :-

1).In Simple Mode, select your connection.
2).Select the table you wish to perform the query on
3).Select your desired fields.
4).In 'Filter:' select the field you wish to compare against, and the comparison type.
5).Select Session Variable, and in the text box next to it type 'KT_Username' - Note: This is CaSe SeNsItIvE !
6).Select the Sort Order and then click on Test.

If everything is ok at this stage then click OK.

Once you have done this you can then assign the result to a session variable by using :-

<?php
session_register("mySessionVariable";
$mySessionVariable=$Recordset->Fields("MyResultField";
?>

I would advise that you don't do this on the same page as the user login, as this could be exploitable.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 06 Aug 2001 20:08:35
06 Aug 2001 20:08:35 Tim Green replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
I have installed a set of behaviors called tg php suite.<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

So that you are aware, there is no Suite of behaviours called tg php suite. This is the name of the folder that I assign to all my server behaviours, and shared files, to make them easily identifiable.

The suite you are referring to is the PHP Cookie Suite.


Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic