Here is the code:
###########
#!/usr/bin/perl
######################################################################################
##
## Program : login.pl
#&Template($template_head);
#&Template($template_template_maininfos1);
#&Template($template_template_maininfos2);
#&Template($template_foot);
#####################################################################
#### start setup ####
$template_login_form = 'H:/webtest/cgi-bin/demo/template_login_form.html';
$template_head = 'H:/webtest/cgi-bin/demo/template_head.html';
$template_foot = 'H:/webtest/cgi-bin/demo/template_foot.html';
$template_template_maininfos1 = 'H:/webtest/cgi-bin/demo/template_maininfos1.html';
$template_template_maininfos2 = 'H:/webtest/cgi-bin/demo/template_maininfos2.html';
$template_show_data_for_members = 'H:/webtest/cgi-bin/demo/data_for_members.html';
$template_head = 'H:/webtest/cgi-bin/demo/template_head.html';
$template_enable_error = 'H:/webtest/cgi-bin/demo/template_enable_error.html';
#### end of setup ####
#####################################################################
#####################################################################
#### start program ####
use DBI;
require "H:/webtest/cgi-bin/demo/config.pl";
require "H:/webtest/cgi-bin/demo/module.pl";
require 'H:/webtest/cgi-bin/admin/smart.cfg';
require 'h:/webtest/cgi-bin/admin/cookie.lib';
# Get the date
&get_date;
&get_host;
#&random_cookie();
&Indata();
$username = $input{'username'};
$password = $input{'password'};
print "Pragma: no-cache\n";
print "Content-type:text/html\n\n";
if (!$username || !$password) { &Template($template_login_form); exit; }
else { &Login(); }
#### end of program ####
#### Start sub program. Don't touch anything below ####
sub Login {
my $yes_members = '';
my $xusername = '';
my $xpassword = '';
&SQL_CONNECT();
# Check username and password
$sql_syntax = qq(SELECT USERNAME,PASSWORD FROM $table_sender WHERE (ACTIVE = 'NO'));
&SQL_EXE($dbh,$sql_syntax);
while (my $ref = $sth->fetchrow_hashref) {
$xusername = $ref->{USERNAME};
$xpassword = $ref->{PASSWORD};
if (($xusername eq $username) && ($xpassword eq $password)) { $yes_members = 1; last; }
}
#update database infos########################################
if (!$yes_members) { # Cannot find username to enable
&Template($template_enable_error);
exit;
}
else { # Store registration data to datable for confirmation
$sql_syntax =qq(
UPDATE $table_members
SET ACTIVE = 'YES', EMAIL = 'emailaddress'
WHERE (USERNAME = '$username')
);
&SQL_EXE($dbh,$sql_syntax);
#####################################################
$sql_syntax = qq(SELECT ID, sender_ID, NAME, EMAIL FROM $table_sender WHERE ( USERNAME = '$username'));
&SQL_EXE($dbh,$sql_syntax);
my( $ID, $sender_ID, $NAME, $EMAIL);
$sth->bind_columns( undef, \$ID, \$sender_ID, \$NAME, \$EMAIL );
#############################
&Template($template_head);
&Template($template_template_maininfos1);
###&Template($template_template_maininfos2);
###&Template($template_foot);
##############################
while( $sth->fetch() )
{
# print "($ID) $NAME / $EMAIL / $sender_ID \n";
#print "<P>*$username $password the end of first login sender part------------------------------------------------------------------</P>\n\n";
}
#}####### has combine two in one
#############the start of recipient
$sql_syntax = qq(SELECT id, recipID, Name FROM $table_recipient WHERE ( Sender_ID ='$sender_ID') );
&SQL_EXE($dbh,$sql_syntax);
my( $id, $recipID, $Name);
#$sth->bind_columns ( undef, \ $id, \$recipID, \$Name );
$sth->bind_columns( undef, \($id, $recipID, $Name));
#&Template($template_head);
# See if they have a cart already, if not, make one
&check_file; ( TO CHECK COOKIE)
&list_items88; ### list all purchased item
&list_items2;
#######the end of recipient data extract
#############################################$address
####
print<<"[HTML]";
<!-- TABLE II COLUMN II START ------------------------------>
<form action="
http://buypro.homeip.net/...ip.pl?command=recip1" method="post" >
<center>请选择收货人的姓名<br>--------------------------<br> <br>
<input type="hidden" name="senderID" value='$sender_ID'>
* <select name="recip">
<option value=" " selected>从我的地址簿中选择收货人</option>
[HTML]
###
while( $sth->fetch() )
{
print<<"[HTML]";
<option value="$recipID">$NAME</option>
[HTML]
###########
}
####
print<<"[HTML]";
<option value="newrecip" >**********>其它的收货人</option>
</select>
<input name type="submit" value=" next setp............. ">
</FORM>
<br>
<center>
[HTML]
#######the end of recipient data extract
&Template($template_template_maininfos2);
&Template($template_foot);
}
#######the end of recipient data extract
$sth->finish();
$dbh->disconnect();
#&Template($template_head);
}
exit;
###############