#!/usr/bin/perl -w use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard :cgi-lib escapeHTML); use Mail::Sendmail; #@ USE_STATEMENTS use Digest::MD5; use Crypt::CBC; use Crypt::Blowfish; use LWP::UserAgent; push(@inc, "/home/mydom/my_mods"); use FRHWebDB::Session; # This contains the MySQL connections #@ USE_STATEMENTS ReadParse(\%in); use vars qw($cookie $sess_id $sess_ref $page $logged_in %in);# These are global $sess_id = cookie ("session_id"); if ($sess_id eq "" && $in{sess_id} ne "") { $sess_id = $in{sess_id};#if no cookies then it's in the url } $sess_ref = FRHWebDB::Session->open_with_expiration(undef, $sess_id) if defined ($sess_id);#Open with Expriration require "/home/mydom/site/data.conf";#This contains header # information and other stuff, like menu and things like # that if ($in{pg} eq "quit" && defined($sess_ref)) { if ($sess_ref->attr ("remember_me") == 1) { $sess_ref->attr ("loggedin", 0); $message = qq~You have been Logged Out$nname_ws!

~;#$nname_ws is their nickname with a # space in front of it, if no nick name then it's blank # (Out!) } else { Delete_Session_Forever($sess_ref); } } if (!defined ($sess_ref))# no session yet, so create one. { defined ($sess_ref = FRHWebDB::Session->open (undef, undef)) or error ("Could not create new session: $FRHWebDB::Session::errstr"); $cookie = cookie (-name => "session_id", -value => $sess_ref->session_id(), -path => url (-absolute => 1), -expires => "+1y" );#Create the cookie to put on user pc at top_header() } get_cookie_values($sess_ref) if defined ($sess_id);#Ok, get # session values from the $sess_ref [apache::session]. get_company_values() if !defined($sess_id);#No session so # just define the company variables($co_name and such) require "/home/mydom/site/config.data";#Ok this one has all # the javascripts, css and lots of configuration variables, # and such. Plus a browser check. #Set expiration of session if none exists. $sess_ref->expires ($sess_ref->now() + (60*60*24*365)) if !defined ($sess_ref->expires()); $Page_Dir = "/home/mydom/site/pages";#directory where all # the pages in .conf files are stored. $pg = $in{pg}; $test_cookie2 = cookie ("session_id"); if (!defined ($test_cookie2)) {#users pc has cookies # Turned off, so add the session to every link and form # using the variables I've defined here. $nocookies = 1; $inc_sess_id = "&sess_id=" . $sess_ref->session_id(); $hidden_inc_sess_id = hidden(-name=>"sess_id", -value=>$sess_ref->session_id()); } else {#Ok, they do have cookies turned on! $nocookies = 0; $inc_sess_id = ""; $hidden_inc_sess_id = ""; } if (!$pg || !-e "$Page_Dir/$pg.conf") {#No page so load home require "$Page_Dir/home.conf"; $page .= $page_content; } elsif(-e "$Page_Dir/$pg.conf") {#Ok there is a page so # load it instead of home require "$Page_Dir/$pg.conf"; $page .= $page_content; } top_header("$title","","");#ok, now this is in # data.conf, it is the header and it uses CGI.pm's header() # start_html() etc. #ok, now below closes the table and creates the right menu # if any. right_menu() is defined in config.data $page .= qq~ </div /> </font /> </p />\n</td />~ . right_menu("in_table_cell","125",$overrideit) . end_page_footer(); print $page; exit; # Exit system.