#!d:\perl\bin\perl.exe -w use strict; use CGI; use CGI::Cookie; my $user = &get_userid; print "

whoa whoa whao $user"; sub get_userid{ print "Content-type:text/html\n\n"; ##################################################### #Here are global things that might need to be changed #these will be required from another file... had to #add for coding post though ##################################################### #Where are the Members directories? my $member_dir = "../../Members/"; #what is the name of the file that list the members my $member_file ="memberslist.cgi"; ##################################################### my $file; #the concat file, used in opens my $exact_file = "noneyet"; #this is the exact member file my @user_list; #this is the users info file holds #real cookie with user name my $login; #compares variable to id my $junk_file; #junk variable my $id; #here is the cookie id my $password; #this is the password from the cookie my %cookies; #hash to hold cookies my $nli = "NOTLOGGEDIN";#my not logged in value to return if(%cookies = fetch CGI::Cookie){ if($cookies{'UserName'}){ $id = $cookies{'UserName'}->value; }else{ return "$nli"; } if($cookies{'Password'}){ $password = $cookies{'Password'}->value; }else{ return "$nli"; } }else{ return "$nli"; } $file = "$member_dir/$member_file"; open (FH, "$file") or die "Could not open $file: $!"; while(){ chomp; ($login, $junk_file) = split(/\|\!\!\|/); if ($login eq $id){ $exact_file ="$junk_file"; } } close FH; if ($exact_file eq "noneyet"){ return "$nli"; } $file ="$member_dir/$exact_file.cgi"; open (FH, "$file") or die "Could not open $file"; while(){ chomp; push @user_list, $_; } close FH; if($user_list[0] eq $id){ if($user_list[1] eq $password){ return "$user_list[0]"; }else{ return "$nli"; } }else{ return "$nli"; } } #### while(){ chomp; ($login, $junk_file) = split(/\|\!\!\|/); if ($login eq $id){ $exact_file ="$junk_file"; } }