freelanceprogrammers.org Forum Index » PHP

Re: php Session in linux


View user's profile Post To page top
sevillar Posted: Fri Aug 05, 2005 10:10 pm


Joined: 05 Aug 2005

Posts: 1
Re: php Session in linux
Papis,
If you have your session ID set then when you call the next program all you have
to do is
check the session_id() and it will have the session id number. you do not have
to
save it to session variable, unless you are checking to make sure that you are
dealing with the same person.

I hope I understood your question

Nestor :-)

-----Original Message-----
From: Papis <papiseckfr@...>
Sent: Aug 5, 2005 2:54 AM
To: php-objects@yahoogroups.com
Subject: [php-objects] php Session in linux


Hi all,

I�have a greate problem using php session in linux.

I want to share session variable between to application typo3 and dotproject .

What i have done is very simple

In somme classe in typo3,

session_start();

$_SESSION["tpuser"]=$GLOBALS["TSFE"]->fe_user->user[`username`];

$_SESSION["tppass"]=$GLOBALS["TSFE"]->fe_user->user[`password`];

$_SESSION["tpredirect"]="m=tasks";

And I create somme link whith <a href > </a> to dotproject index.php

In the first line of dotproject index.php, I try to get the variable i created
in typo3

session_start();

if (isset( $_SESSION["tpuser"])){

$vartypo3user = $_SESSION["tpuser"];

$vartypo3pass = $_SESSION["tppass"];

$vartypo3redirect= $_SESSION["tpredirect"];

}

But theye are empty.

Enven I name the session with session_name(�typo3�) and try with that
nothing.

Notice that i dont have any virtual host and the to application are on the same
virtual directory.

What is curious in that is , it is working very well in windows OS with easyphp
1.8

Would you mind to help me please I�m losting all my hair.

Any suggestion is welcome



Alioune Seck
Ing�nieur en Informatique
Tel: (+221) 516 97 77




---------------------------------
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
T�l�chargez le ici !

[Non-text portions of this message have been removed]






PHP Data object relational mapping generator - http://www.meta-language.net/
Yahoo! Groups Links
Reply with quote
Send private message
View user's profile Post To page top
markgroen@... Posted: Mon Aug 08, 2005 7:05 pm


Joined: 18 May 2005

Posts: 18
Re: php Session in linux
----- Original Message -----
From: "Papis" <>
To: <php-objects@yahoogroups.com>
Sent: Friday, August 05, 2005 2:54 AM
Subject: [php-objects] php Session in linux


I want to share session variable between to application typo3 and
dotproject .

I haven`t looked at Typo3 since last winter, so will assume that your
variables etc. are correct...

First off, is sessions working okay? Does a phpinfo.php file show
"Session Support enabled"?

contents of phpinfo.php file, upoaded to the root directory of your web
space:

<?php phpinfo(); ?>

If I don`t know the configuration, at the top of the first file it looks
like this:

<?php session_start();
header("Cache-control: private"); // IE 6 Fix
// below gets rid of the automatic insertion of the hidden sesson field,
// used if you need to validate to xhtml strict and the field gets put
where you
// don`t want it
ini_set("url_rewriter.tags", "a=href,area=href,frame=src,input=src");

then I explicitly include the hidden session input field with my form:

<form action="/dotproject-index.php" method="post" id="step_one"
onsubmit="return validateForm()">
<input type="hidden" name="PHPSESSID" value="<?php echo session_id();
?>" />
your other input(s)....
<input class="btn_input" type="submit" name="submit" value="Click to
Continue &gt;&gt;" />
</form>

> > In the first line of dotproject index.php, I try to get the variable
i created in typo3

I would make it look for each variable you want to pass like this then:

<?php session_start();
$tpuser = $_POST[`tpuser`];
$tppass = $_POST[`tppass`];
// etc.

// Register session key with the value
$_SESSION[`tpuser`] = $tpuser;
$_SESSION[`tppass`] = $tppass;
// etc.

then it`s easy to change your variables:

$vartypo3user = $tpuser;
$vartypo3pass = $tppass;

although you may not need to do the above step...

if (isset( $_SESSION["tpuser"])){
// you don`t need this below now possibly
//$vartypo3user = $_SESSION["tpuser"];
//$vartypo3pass = $_SESSION["tppass"];
//$vartypo3redirect= $_SESSION["tpredirect"];

// just do what ever you had to do with your information here
echo "whole bunch of your info" . "$tpuser" . "$tppass"; // etc.
}

> > But theye are empty.

Add this right after your <body> element on the second page to see if
you are getting everything:

print "your session id is: ".session_id();
echo "<br />
";
echo "Sessions: <pre>";
print_r($_SESSION);

Also, the Firefox browser with the Web Developer Toolbar will show you
the "Page Info" with a right click and you can see the values of the
sessionid and form fields etc. easily.

> > Would you mind to help me please I`m losting all my hair.

lol! none left to lose over here... try the above, adding the fields you
want as needed to the form and where it says `etc.`, it`s an old
fashioned way of doing things but should work on any platform as long as
Session Support is enabled. You may want to check to make sure the
syntax is correct, my server calls it PHPSESSID, yours may be different,
the phpinfo.php file will tell you.

hth!

Warm Regards,

Mark Groen

MG Web Services
FREE WEB SITE HOSTING! - find out how
at www.mgwebservices.ca/referral-info.php
mark@...
604-780-6917
Bowen Island, B.C., Canada
Reply with quote
Send private message
View user's profile Post To page top
papiseckfr Posted: Tue Aug 09, 2005 5:28 pm


Joined: 05 Aug 2005

Posts: 2
Re: php Session in linux
Thank for all your help Mark,

but I can’t use forms and post methode, because in typo3 in the class that I
want to modify it is so embedded and customized that I could hardly put any
forms in it. Thats why I wanted to use SESSION variable and not hiden values.

Thanks a lot




Mark Groen <markgroen@...> a écrit :
----- Original Message -----
From: "Papis" <>
To: <php-objects@yahoogroups.com>
Sent: Friday, August 05, 2005 2:54 AM
Subject: [php-objects] php Session in linux


I want to share session variable between to application typo3 and
dotproject .

I haven`t looked at Typo3 since last winter, so will assume that your
variables etc. are correct...

First off, is sessions working okay? Does a phpinfo.php file show
"Session Support enabled"?

contents of phpinfo.php file, upoaded to the root directory of your web
space:

<?php phpinfo(); ?>

If I don`t know the configuration, at the top of the first file it looks
like this:

<?php session_start();
header("Cache-control: private"); // IE 6 Fix
// below gets rid of the automatic insertion of the hidden sesson field,
// used if you need to validate to xhtml strict and the field gets put
where you
// don`t want it
ini_set("url_rewriter.tags", "a=href,area=href,frame=src,input=src");

then I explicitly include the hidden session input field with my form:

<form action="/dotproject-index.php" method="post" id="step_one"
onsubmit="return validateForm()">
<input type="hidden" name="PHPSESSID" value="<?php echo session_id();
?>" />
your other input(s)....
<input class="btn_input" type="submit" name="submit" value="Click to
Continue &gt;&gt;" />
</form>

> > In the first line of dotproject index.php, I try to get the variable
i created in typo3

I would make it look for each variable you want to pass like this then:

<?php session_start();
$tpuser = $_POST[`tpuser`];
$tppass = $_POST[`tppass`];
// etc.

// Register session key with the value
$_SESSION[`tpuser`] = $tpuser;
$_SESSION[`tppass`] = $tppass;
// etc.

then it`s easy to change your variables:

$vartypo3user = $tpuser;
$vartypo3pass = $tppass;

although you may not need to do the above step...

if (isset( $_SESSION["tpuser"])){
// you don`t need this below now possibly
//$vartypo3user = $_SESSION["tpuser"];
//$vartypo3pass = $_SESSION["tppass"];
//$vartypo3redirect= $_SESSION["tpredirect"];

// just do what ever you had to do with your information here
echo "whole bunch of your info" . "$tpuser" . "$tppass"; // etc.
}

> > But theye are empty.

Add this right after your <body> element on the second page to see if
you are getting everything:

print "your session id is: ".session_id();
echo "<br />
";
echo "Sessions: <pre>";
print_r($_SESSION);

Also, the Firefox browser with the Web Developer Toolbar will show you
the "Page Info" with a right click and you can see the values of the
sessionid and form fields etc. easily.

> > Would you mind to help me please I`m losting all my hair.

lol! none left to lose over here... try the above, adding the fields you
want as needed to the form and where it says `etc.`, it`s an old
fashioned way of doing things but should work on any platform as long as
Session Support is enabled. You may want to check to make sure the
syntax is correct, my server calls it PHPSESSID, yours may be different,
the phpinfo.php file will tell you.

hth!

Warm Regards,

Mark Groen

MG Web Services
FREE WEB SITE HOSTING! - find out how
at www.mgwebservices.ca/referral-info.php
mark@...
604-780-6917
Bowen Island, B.C., Canada




PHP Data object relational mapping generator - http://www.meta-language.net/



---------------------------------
YAHOO! GROUPS LINKS


Visit your group "php-objects" on the web.

To unsubscribe from this group, send an email to:
php-objects-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


---------------------------------




Alioune Seck
Ingénieur en Informatique
Tel: (+221) 516 97 77




---------------------------------
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez le ici !

[Non-text portions of this message have been removed]
Reply with quote
Send private message
View user's profile Post To page top
markgroen@... Posted: Tue Aug 09, 2005 6:36 pm


Joined: 18 May 2005

Posts: 18
Re: php Session in linux
----- Original Message -----
From: "Papis" <>
To: <php-objects@yahoogroups.com>
Sent: Tuesday, August 09, 2005 5:28 AM
Subject: Re: [php-objects] php Session in linux

> because in typo3 in the class that I want to modify it is so embedded
> and customized that I could hardly put any forms in it.

yeah. that`s mostly why I dropped it as a cms for my clients, too
complicated for them, and way too much time for me to customize for an
existing site to look the same. groovin` on websitebaker.org right now,
easiest interface for end user/admin I`ve seen in a long time, very fast
templating for the developer too.

> Thats why I wanted to use SESSION variable and not hiden values.

see your point, bummer - if your php ini is set to session.auto_start =
off, then I don`t know of a way to change that without access to the php
ini file. Perhaps this particular host keeps a copy for everyone in the
cgi-bin maybe though? Long shot, but seen it done working on sites
hosted on servers other than my own. That path will also show in your
phpinfo.pfp file under: "Configuration File (php.ini) Path"

> Thanks a lot

glad to help if I can :-)

cheers,

Mark
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help