#!/usr/local/bin/perl # # ecal_cookie.cgi # Redirects to pages as set by cookie # Susan Foster # use CGI qw(:standard);; $form = new CGI; chop($system = `uname -n`); $system = 'ww3' unless $system eq 'stage1'; # Check for eCal cookie, and the timezone value %cookie = $form->cookie('SportsLine'); #If the email is there, send straight to eCal if($cookie{email} && $cookie{userid}) { $cookie{email}=&escape($cookie{email}); $cookie{epass}=&escape($cookie{userid}); $url="http://calendar.sportsline.com/defaultcbs.asp?email=$cookie{email}&password=$cookie{epass}"; if ($sport = $form->param('changecat')) { $url = $url . "&changecat=$sport"; } print $form->redirect($url); } else { print $form->redirect("http://$system.sportsline.com/u/rewards/register/ecalregister.html"); } exit 0; sub escape { my $toencode = $_[0]; $toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg; return $toencode; }