Discussion:
[TYPO3] cookie fe_typo_user
Korvo
2008-04-16 16:43:26 UTC
Permalink
Hi I'm trying to have a username in the Content of a cookie.
example:
Name: fe_typo_user
Content:jonh.paes

but what is stored in Content is encrypted.
what else do i need to add in order to make it so.

any help is appreciated.
Fernandes
--
View this message in context: http://www.nabble.com/cookie-fe_typo_user-tp16722784p16722784.html
Sent from the TYPO3 English mailing list archive at Nabble.com.
Dmitry Dulepov [typo3]
2008-04-16 17:07:11 UTC
Permalink
Post by Korvo
Hi I'm trying to have a username in the Content of a cookie.
Name: fe_typo_user
Content:jonh.paes
but what is stored in Content is encrypted.
what else do i need to add in order to make it so.
Nothing. You cannot have user name is this cookie. It is used for different purpose.
--
Dmitry Dulepov
TYPO3 core team
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
"Nothing is impossible. There are only limits to our knowledge"
Benjamin Todd
2008-04-17 08:49:43 UTC
Permalink
Hi Fernandes,

If you have FE users logged in, TYPO3 already stores the username in the
TypoScript Front End object.

Access it in any extension you are building like this:-

$TSFE->fe_user->user['username']

Access it in TypoScript setup like this:-

page.111 = TEXT
page.111.data = TSFE:fe_user|user|username

HTH,

Ben

------------------------
Benjamin Todd
Web Developer

b.todd at emnet.co.uk
EMNET, PO Box 559, Nottingham, NG1 3LB
Tel: +44 (0)115 956 8260
Fax: +44 (0)115 956 8264

www.emnet.co.uk
Company Registration No. 3144383 - VAT No. 694 620 609 - Registered
Office: Church House, 13-15 Regent Street, Nottingham NG1 5BS

www.emnetsolutions.co.uk
Company Registration No. 05384178 - VAT No. 856 671 781 - Registered
office: Church House, 13-15 Regent Street, Nottingham, NG1 5BS
-----Original Message-----
From: typo3-english-bounces at lists.netfielders.de
[mailto:typo3-english-bounces at lists.netfielders.de] On Behalf Of Korvo
Sent: 16 April 2008 05:43 PM
To: typo3-english at lists.netfielders.de
Subject: [TYPO3] cookie fe_typo_user


Hi I'm trying to have a username in the Content of a cookie.
example:
Name: fe_typo_user
Content:jonh.paes

but what is stored in Content is encrypted.
what else do i need to add in order to make it so.

any help is appreciated.
Fernandes
--
Sent from the TYPO3 English mailing list archive at Nabble.com.

_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english

Scanned for viruses by MailDefender
Korvo
2008-04-17 12:04:49 UTC
Permalink
Hi, thks for your answer

where i must put $TSFE->fe_user->user['username'] ??
in a ts_lib class?

Do you know what i must do to create a new cookie name
like for example
Name: user_typo3
(after maybe i can store username in his Content)

Fernandes
Post by Benjamin Todd
Hi Fernandes,
If you have FE users logged in, TYPO3 already stores the username in the
TypoScript Front End object.
Access it in any extension you are building like this:-
$TSFE->fe_user->user['username']
Access it in TypoScript setup like this:-
page.111 = TEXT
page.111.data = TSFE:fe_user|user|username
HTH,
Ben
------------------------
Benjamin Todd
Web Developer
b.todd at emnet.co.uk
EMNET, PO Box 559, Nottingham, NG1 3LB
Tel: +44 (0)115 956 8260
Fax: +44 (0)115 956 8264
www.emnet.co.uk
Company Registration No. 3144383 - VAT No. 694 620 609 - Registered
Office: Church House, 13-15 Regent Street, Nottingham NG1 5BS
www.emnetsolutions.co.uk
Company Registration No. 05384178 - VAT No. 856 671 781 - Registered
office: Church House, 13-15 Regent Street, Nottingham, NG1 5BS
-----Original Message-----
From: typo3-english-bounces at lists.netfielders.de
[mailto:typo3-english-bounces at lists.netfielders.de] On Behalf Of Korvo
Sent: 16 April 2008 05:43 PM
To: typo3-english at lists.netfielders.de
Subject: [TYPO3] cookie fe_typo_user
Hi I'm trying to have a username in the Content of a cookie.
Name: fe_typo_user
Content:jonh.paes
but what is stored in Content is encrypted.
what else do i need to add in order to make it so.
any help is appreciated.
Fernandes
--
Sent from the TYPO3 English mailing list archive at Nabble.com.
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
Scanned for viruses by MailDefender
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
--
View this message in context: http://www.nabble.com/cookie-fe_typo_user-tp16728296p16743548.html
Sent from the TYPO3 English mailing list archive at Nabble.com.
Benjamin Todd
2008-04-17 15:46:06 UTC
Permalink
Hi,

You don't create new cookies in TYPO3. Extensions (I'm guessing you are
writing an extension) can add their own data to the TYPO3 cookie using
the method shown at the bottom of this page -
http://typo3.org/documentation/document-library/references/doc_core_tsre
f/4.1.0/view/14/1/

HTH

Ben

------------------------
Benjamin Todd
Web Developer

b.todd at emnet.co.uk
EMNET, PO Box 559, Nottingham, NG1 3LB
Tel: +44 (0)115 956 8260
Fax: +44 (0)115 956 8264

www.emnet.co.uk
Company Registration No. 3144383 - VAT No. 694 620 609 - Registered
Office: Church House, 13-15 Regent Street, Nottingham NG1 5BS

www.emnetsolutions.co.uk
Company Registration No. 05384178 - VAT No. 856 671 781 - Registered
office: Church House, 13-15 Regent Street, Nottingham, NG1 5BS

-----Original Message-----
From: typo3-english-bounces at lists.netfielders.de
[mailto:typo3-english-bounces at lists.netfielders.de] On Behalf Of Korvo
Sent: 17 April 2008 01:05 PM
To: typo3-english at lists.netfielders.de
Subject: Re: [TYPO3] cookie fe_typo_user


Hi, thks for your answer

where i must put $TSFE->fe_user->user['username'] ??
in a ts_lib class?

Do you know what i must do to create a new cookie name
like for example
Name: user_typo3
(after maybe i can store username in his Content)

Fernandes
Post by Benjamin Todd
Hi Fernandes,
If you have FE users logged in, TYPO3 already stores the username in the
TypoScript Front End object.
Access it in any extension you are building like this:-
$TSFE->fe_user->user['username']
Access it in TypoScript setup like this:-
page.111 = TEXT
page.111.data = TSFE:fe_user|user|username
HTH,
Ben
------------------------
Benjamin Todd
Web Developer
b.todd at emnet.co.uk
EMNET, PO Box 559, Nottingham, NG1 3LB
Tel: +44 (0)115 956 8260
Fax: +44 (0)115 956 8264
www.emnet.co.uk
Company Registration No. 3144383 - VAT No. 694 620 609 - Registered
Office: Church House, 13-15 Regent Street, Nottingham NG1 5BS
www.emnetsolutions.co.uk
Company Registration No. 05384178 - VAT No. 856 671 781 - Registered
office: Church House, 13-15 Regent Street, Nottingham, NG1 5BS
-----Original Message-----
From: typo3-english-bounces at lists.netfielders.de
[mailto:typo3-english-bounces at lists.netfielders.de] On Behalf Of Korvo
Sent: 16 April 2008 05:43 PM
To: typo3-english at lists.netfielders.de
Subject: [TYPO3] cookie fe_typo_user
Hi I'm trying to have a username in the Content of a cookie.
Name: fe_typo_user
Content:jonh.paes
but what is stored in Content is encrypted.
what else do i need to add in order to make it so.
any help is appreciated.
Fernandes
--
Sent from the TYPO3 English mailing list archive at Nabble.com.
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
Scanned for viruses by MailDefender
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
--
Sent from the TYPO3 English mailing list archive at Nabble.com.

_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english

Scanned for viruses by MailDefender
bernd wilke
2008-04-17 16:07:49 UTC
Permalink
Post by Korvo
Hi, thks for your answer
where i must put $TSFE->fe_user->user['username'] ?? in a ts_lib class?
you just can read it anywhere in your extension PHP.
It is written by the TYPO3 core.

example:
if ($TSFE->fe_user->user['username']=='Korvo') {
do_some_special_things_for_Korvo();
}
Post by Korvo
Do you know what i must do to create a new cookie name like for example
Name: user_typo3
(after maybe i can store username in his Content)
Fernandes
go to http://de3.php.net/docs.php
you may select a language you prefer.
then enter 'cookies' in the searchfield at top
you will find references to the php-function setcookie() and the global
array $_COOKIE

this will do if you need the values in your extension (server-side).

if you need the info in the browser (client-side) you have to access the
cookies by javascript. Writing is easy in the way:

function setCookie ( cookieName, cookieValue, cookieLifeTimeInSecs ) {
var now = new Date();
var cookieExpire = new Date(now.getTime() + cookieLifeTimeInSecs);
document.cookie = cookieName + "=" + cookieValue + ";"
+" expires=" + cookieExpire.toGMTString() + ";";
}

this will ADD the cookie. other cookies are NOT removed!

reading a cookie with javascript is more complicated, because you can't
access one cookievalue alone.
all cookies are stored in one single string, separated by ';' in the way:

'cookieName1=CookieValue1;cookieName2=CookieValue2;cookieName3=CookieValue3;'

you have to split the string like this:

cookieList = document.cookie.split(';');
for ( i = 0 ; i< cookieList.length ; i++ ) {
c = cookieList[i].split('=');
cookieArray[c[0]] = c[1];
}

now you have your cookie in cookieArray[cookieName]


bernd
--
http://www.pi-phi.de/t3v4/cheatsheet.html
Dmitry Dulepov [typo3]
2008-04-17 16:37:55 UTC
Permalink
Hi!
Post by Korvo
where i must put $TSFE->fe_user->user['username'] ??
in a ts_lib class?
Do you know what i must do to create a new cookie name
like for example
Name: user_typo3
(after maybe i can store username in his Content)
I think you are asking wrong question. May be you should read this:
http://typo3bloke.net/post-details/archive/2007/december/20/asking_proper_questions/

Next tell what exactly you want to achieve and we will tell you how. Surely just setting a cookie is not your final goal?
--
Dmitry Dulepov
TYPO3 core team
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
"Nothing is impossible. There are only limits to our knowledge"
Michael Stucki
2008-04-17 06:28:54 UTC
Permalink
Post by Korvo
Hi I'm trying to have a username in the Content of a cookie.
Name: fe_typo_user
Content:jonh.paes
but what is stored in Content is encrypted.
what else do i need to add in order to make it so.
The cookie just contains a reference to the corresponding fe_sessions
record.

- michael
--
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/
Loading...