1  sub selectdatafile {
2
3      if (!(-e "$basedir/$orgdir/passwdfail.txt")){
4         $source = "$basedir/$orgdir/$orgdata.txt";
5         if (!(-e "$source")){
6            &error(orgdata_file);
7         }
8      }else{
9         unlink("$basedir/$orgdir/passwdfail.txt");10 
11        open(PREFS,"$basedir/$orgdir/prefs.txt");
12        $pref = <PREFS>; 
13        close(PREFS);
14        if ($ENV{'REMOTE_ADDR'} eq $pref) {
15           $source = "$basedir/$orgdir/tempdata.txt";
16           if (!(-e "$source")){
17              &error(tempdata_file);
18           }
19        }else{
20           $source = "$basedir/$orgdir/orgdata.txt";
21           if (!(-e "$source")){
22              &error(orgdata_file);
23           }
24        }
25     }
26  }