Content-type: text/html $buffer = $ENV{'QUERY_STRING'}; @pairs = split(/&/,$buffer); $count = 0; $pname = ""; foreach $pair (@pairs){ ($name, $value) = split(/=/, $pair); $value =~ s/%27//g; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $name =~ tr/A-Z/a-z/; next if($name =~ /submit/); if ($name eq $pname){$name=$name.$count;} else {$pname = $name;} $data{$name} = $value; $count++; } if ($data{'orderby'} eq ""){ $data{'orderby'} = "no"; } if ($data{'orderby'} eq "location"){ $where = "(4h_jobs.status=0) and (4h_jobs.location=4h_locations.loc_no"; } else{ $where = "(4h_jobs.status=0"; } &create_query; if (($count == 0) and ($jobid_error != 1) and ($companyno_error != 1)){ $err_cnt = 1; $error[1] = "Please select search criteria. If you only entered keywords, please make a selection in at least 1 other field."; &form_error_page; } elsif ($jobid_error == 1){ $err_cnt = 1; $error[1] = "Invalid Job ID"; &form_error_page; } elsif ($companyno_error == 1){ $err_cnt = 1; $error[1] = "Invalid Company Number"; &form_error_page; } else{ &search_check_keywords; &execute_query; $matches = 0; for ($x=1; $x<=$rows;$x++){ @jobs{@fieldnames} = $sth->fetchrow; #print "$x: ", @jobs{@fieldnames}, "
\n"; if ($kwflag){ &process_keywords; } $company = $jobs{'company_name'}; $location = &lookup_location($jobs{'location'}); # Change location number to actual city,state #-- Check profile flag in Advertiser record--# $sql_adv = "select profile from 4h_advertiser where no=$jobs{'advertiser'}"; eval { $sth_adv = $dbh->prepare($sql_adv); $sth_adv->execute; @profile = $sth_adv->fetchrow; }; dberror(1, $@) if $@; if ($profile[0] == 1){ $profile_link = "". ""; } else{ $profile_link = ""; } #-- Update Query count --# $queries = $jobs{'queries'} + 1; $sql = "UPDATE 4h_jobs set queries=$queries where no=$jobs{'no'}"; eval { $sth1 = $dbh->prepare($sql); $sth1->execute; }; dberror(1, $@) if $@; $matches++; #-- Store matches as comma delimited string in array for display later --# $results[$matches] = qq($jobs{'no'}|$company|$jobs{'title'}|$location|$profile_link|$jobs{'advertiser'}); } if ($criteria ne "All Jobs"){ $what = " that match search criteria"; } if ($matches == 0){ &no_matches; } else{ print <
search results
endhtml ; $data{'start'} = $data{'start'} - 0; $data{'start'} = 1 if ($data{'start'} == 0); $this_page = 0; for ($x=$data{'start'};($x<=$matches) and ($x<=($data{'start'}+($data{'perpage'}-1)));$x++){ ($jobid,$company,$title,$location,$profile_link,$advertiser) = split(/\|/,$results[$x]); $link_company = $company; $link_company =~ s/ /+/g; $this_page++; #-- Determine row color $bg_color = "#ffffff" if (($x % 2) == 1); $bg_color = "#ffffcc" if (($x % 2) == 0); print < endhtml ; } print < endhtml ; $firstkey = 0; foreach $keys (keys %data){ $firstitem = 0; next if($$keys[0] eq ""); $label = ucfirst($keys); $label =~ s/_/ /; print < endhtml ; } print <
Click on the Job Title to view a job, or enter a new Search. Showing all Jobs that match search criteria sorted by $sortedby - Total: $matches
Title: Company: Location: Job # :
$title $company $location WITI-$jobid
endhtml ; if ((($x-1) > $data{'perpage'}) and ($matches > 0)){ $start = $x - $this_page - ($data{'perpage'}); print ""; print "Previous 10 Matches\n"; } $end = $x - 1; if ($matches > 0){ print "   Matches $data{'start'}-$end   \n"; } if (($matches - ($x-1)) < $data{'perpage'}){ $next_matches = $matches - ($x - 1); } else{ $next_matches = $data{'perpage'}; } if ($x < $matches){ print "Next $next_matches Matches\n"; } print <
Criteria Entered on Search Page:
$label: endhtml ; foreach $items (@$keys){ if ($firstitem != 0){ print ","; } else{ $firstitem = 1; } print "$items"; } print <
endhtml ; } print "\n\n\n\n\n\n"; &doubleclick_bottom; print < endhtml ; } sub query_error{ print <
Please select search criteria. If you only entered keywords, please make a selection in at least 1 other field.

Back
endhtml ; } !>