Hi Friends, I got an issue to discusss in here. I got a server X running a CGI script. After the user logs in, he is supposed to be redirected to a new server Y. Could you please give me the code for that. I was having the following code, but it doesnot work well.
#!/Usr/bin/perl use HTTP::Request::Common qw(POST); use LWP::UserAgent; use CWT::MySQL; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; my $cwt = new CWT::MySQL(); my $url = $cwt->url; my $cgi = new CGI; $cwt->set( page_title => "CAVE Software"); my $action = $cwt->param('action'); # Function map for setting permissions and for specifying the action b +uttons my %FunctionMap = ( SHOW_INDEX => { ROLES => [] }, SHOW_LOAD => { ROLES => [] }, SHOW_ML => { ROLES => [] }, SUBMIT_FORM => { ROLES => [] }, AUTO => { ROLES => [] }, SHOW_ETOOLS => {ROLES=> []}, ); # # Map verbose parameter names into short versions and set the command # to 'AUTO' if it isn't defined in the FunctionMap. # my $cmd = $cwt->param('CMD') || 'AUTO'; foreach (keys %FunctionMap) { $cmd = $_ if ($cmd eq $FunctionMap{$_}{BUTTON}); } $cmd = 'AUTO' unless defined $FunctionMap{$cmd}; $cwt->set( MAN_SECTION => $cmd ); # # Send'em packin' if they don't have permission to see this function. # $cwt->require_role($FunctionMap{$cmd}{ROLES}); #print $cwt->header(); #print $cwt->start_html(); print $cgi->header(); print $cgi->start_html(-title=>"CAVE Software"); # # SHOW_INDEX -- to see index.php # if ($cmd eq 'SHOW_INDEX') { show_index(); } elsif ($cmd eq 'SHOW_ETOOLS') { show_etools(); } else { print qq{<P>Invalid command ($cmd)}; } #print $cwt->end_html(); print $cgi->end_html(); exit 0; sub show_etools { my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('http://aristotle.eng.auburn.edu/Versi +on9/index.php'); if ($response->is_success) { print $response->content; }else{ die $response->status_line; } } #################################### # submit_form #################################### sub submit_form { my %form; my $pars; my $temp; foreach my $p (param()) { $form{$p} = param($p); $temp = $form{$p}; $pars .= qq{$p=>"$temp",}; } my $faction = qq{http://aristotle.eng.auburn.edu}; $faction .= $action; my $ua=LWP::UserAgent->new(); my $req= POST "$faction",Content=>\%form; my $content=$ua->request($req); if ($content->is_success){ print $content->content; }else{ print $content->status_line . "\n"; } } #################################### # main_links #################################### sub main_links { print qq{<p><table align="center" width="100%"><tr><td>\n}; print qq{<table border="0" cellpadding="4" cellspacing="4" width=" +90%">\n}; print qq{<center><font size=+3>CAVE Software</font></center>}; print qq{<tr><td><br><ul>\n}; print qq{<li>\n}; print qq{<a href="$url?CMD=SHOW_ETOOLS">Click to user eTools</a></ +li>\n}; print qq{</li></ul></td></tr></table>\n}; print qq{</td></tr></table>\n}; }
Please help me out. I know nothing about CGI Scripting Thanks in advance sri

In reply to Redirection from a server. by bogasrikanth

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.