By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,675 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

Problem in CGI Session

P: 4
I am having login.cgi. user enter id and password. if ok it redirects to main.cgi with user_id as main_page.cgi?user_id=$user_id.

main.cgi is having left menu and right part is for doing some action.

in all the CGI files including main.cgi I am writing this code before start_html to manage the session:

---------------------------------------
Expand|Select|Wrap|Line Numbers
  1. my $cgi = CGI->new;
  2.  
  3. my $login_user_id = $cgi->param('user_id');    
  4.  
  5. ########### -- Creating The session--##################
  6.  
  7. my $session = CGI::Session->new( undef, $cgi, {Directory=>'/tmp'} );
  8. my $cookie = $cgi->cookie(CGISESSID => $session->id );
  9. print $cgi->header(-cookie=>$cookie);
  10.  
  11. print $cgi->start_html("ADD CATEGORY");
  12.  
---------------------------------------
But when I click any link (like add payment) on the left menu. a new session is getting created every time.

Please help... I dont want a new session.

I m stuck in it since last 2 days and getting dumbheaded. Please help :-(
Jul 29 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.