#!/usr/bin/perl use strict; require "a.pl"; require "jcode.pl"; my $html_file = "template/login.html"; my $html_source; my %out = (form_error => 0); my $cknm = "friend"; if ($ENV{HTTP_COOKIE}) { my %data = &GetCookie($ENV{HTTP_COOKIE}); ($out{email}, $out{password}) = split(/::/, $data{$cknm}); $out{email} =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack("C", hex($1))/eg; $out{password} =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack("C", hex($1))/eg; $out{save_status} = "checked" if $out{email} && $out{password}; } open HTML_FILE, $html_file or die "can't open $html_file: $!"; $html_source .= $_ while ; close HTML_FILE; $html_source = &a($html_source, \%out); print "Content-type: text/html\n\n"; print $html_source; exit; sub GetCookie { my $cookie = $ENV{HTTP_COOKIE}; my %data; my @cookie = split(/ /, $cookie); foreach (@cookie) { my ($key, $val) = split(/=/); $data{$key} = $val; } return %data; }