Click to See Complete Forum and Search --> : Unwanted space written to .dat database...


HDC
07-11-2006, 05:58 PM
Hello, I've got a perl snippet here that will write into a text .dat file the member who clicked on a link if the member was logged meaning has a login name. The problem is that if a member is not logged in and clicks on a link to this page then a blank is written to the database. Is there a way to only write that specific data and ignore the blank space. Basically If "login" equals nothing then don't write anything to the database.

Sorry if this is confusing...


sub display_cgi
{
if($input{'login'} ne ""){
my ($vlogin) = split(/\|/, pm_decode($input{'session'}));
if( ($input{'login'} ne $vlogin)
&& ($vlogin !~ m/admin/i ))
{
my @visitedby;
if( open(V, "<${root}data/visitedby/$input{'login'}.dat") ){
@visitedby = <V>;
close V;
}
if($visitedby[0] ne "$vlogin\n"){
open(V, ">${root}data/visitedby/$input{'login'}.dat");
print V "$vlogin\n";
for(my $i=0; $i<9; $i++){
print V $visitedby[$i]
}
close V;
}

}
}

&pm_display;
&tempwiz("display");
}