Cookies with PERL and PHP?

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Cookies with PERL and PHP?

Post by a94060 »

Hi,

I was wondering if it was possible to set a cookie with php and have it read again by perl. is this possible? if so,what would be the function i would use in perl to read it?


Thanks
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

A http uer-agent only sees an http response (statusline + headers + content). Why do you think that the client would care which program (if the webapplication is not using pigeons) was used to generated that response?

Anyway, which investigation have you already performed to find more information about 'perl cookies'?
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

Well,actually i dont really know perl. But i know that php and perl have some things in common. My main goal was to put a check on top of a premade script to see if the user is logged in before allowing them access to the script.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

a94060 wrote:My main goal was to put a check on top of a premade script to see if the user is logged in before allowing them access to the script.
But you wouldn't set a cookie like "allowedToAccessMyScript=yes" anyways because it can be modified be the user.
Take a look at http://search.cpan.org/~sherzodr/CGI-Se ... utorial.pm and compare it to http://de2.php.net/session
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

The main problem between this is that im not sure how much php and pelr can talk to each other,if they both use the same sessions,it will be easy then.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

They can both access databases. And you can write your own session handler in perl as well as in php.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

so does that mean,if i store a session file with php,i can read it up with perl?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

:?: Unlikely.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

oh allright,that was what i was trying to get at this whole time. Would i just use cookies then?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

a94060 wrote:oh allright,that was what i was trying to get at this whole time. Would i just use cookies then?
volka wrote:They can both access databases. And you can write your own session handler in perl as well as in php.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

ah ha,so that means that i can write the handler to the database and then read it with perl? this would cause the session to be shared?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The data, not the handler.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

i think i may have found a way around this. Since im protecting the place of access with a .htaccess file,i could just have a cron php script that would check what numbers have time_left >1,if it did,i would use a crypt generated password and then attach each to each value,implode the id and pass with a : and then finally write it to the file. this is my thinking,does it make sense?
Post Reply