In the program below the if statement that qualifies the IP address
never evaluates to be false, for what ever reason the form is always
processed. Can anybody help me with this problem?

 

The code should only allow computers with certain IP's to access the
data to be processed. I know it sound different, but I have been asked
to validate the IP's which are assigned by building location to access
the data#! 

 

The first time through the code it will always generate the form, and
the second time through it has the ip address and validates the IP and
then processes the form if it has a valid IP.

 

I have tried the code with "eq" and "==" and it makes no difference. I
would think I need to use the "eq" because it is not a valid number...
[uhm]I could be wrong...would not be the first time!

It does not matter what the IP is; the "if statement" is always true and
processes the form. 

 

Any suggestions would be appreciated.

 

See code below 

 

TIA

Larry

#-----------------------------------------------------------------

 

<begin snip>

 

 

if ( $ip == "192.168.100.100" )

{

    &process_form;

}

else

{

    &generate_form("NOT A VALID LOCATION");

    exit;

}

 

sub generate_form         # this is the default screen for a web page
for logging in 

{

    local($message = @_;

    $ip = $ENV{REMOTE_ADDR};

 

    print <<EOT

 

            # yada yada yada

            # something on the screen

            # select data

EOT

 

}

sub process_form          # this is the second page that allow for view
data selected

{

            my $dbh=DBI->connect("DBI:XBase:/save") || die $DBI::errstr;

 

            # generate table for data selected

}

 

<end snip>

 

 

Larry Sandwick

Sarreid, Ltd.

Network Administrator

(252) 291-1414 x223

 

Reply via email to