Page 1 of 1
Cookies with PERL and PHP?
Posted: Sat Nov 25, 2006 8:09 am
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
Posted: Sat Nov 25, 2006 9:51 am
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'?
Posted: Sat Nov 25, 2006 10:25 am
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.
Posted: Sat Nov 25, 2006 10:42 am
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
Posted: Sat Nov 25, 2006 11:37 am
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.
Posted: Sat Nov 25, 2006 12:10 pm
by volka
They can both access databases. And you can write your own session handler in perl as well as in php.
Posted: Sat Nov 25, 2006 12:11 pm
by a94060
so does that mean,if i store a session file with php,i can read it up with perl?
Posted: Sat Nov 25, 2006 1:07 pm
by volka

Unlikely.
Posted: Sat Nov 25, 2006 1:32 pm
by a94060
oh allright,that was what i was trying to get at this whole time. Would i just use cookies then?
Posted: Sat Nov 25, 2006 1:43 pm
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.
Posted: Sat Nov 25, 2006 1:46 pm
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?
Posted: Sat Nov 25, 2006 5:58 pm
by volka
The data, not the handler.
Posted: Sat Nov 25, 2006 6:01 pm
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?