Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#DATA
#name, username, password, address, zip
open(LOGIN1,"loginData.txt");
while ($ln = <LOGIN1>) {
my ($name, $username, $password, $address, $zip) = split(/\, /, $ln);
if($username =~ /^[$formdata{'usrname'}].*$/ ) {
print "username $username found";
die;
}
else
{
print "username $username not found";
}
}
close (LOGIN1);
if($username =~ /^[$formdata{'usrname'}].*$/ )
[$formdata{'usrname'}]
if( $username eq $formdata{'usrname'})
[url=http://perldoc.perl.org/functions/use.html][black][b]use[/b][/black][/url] [green]Text::CSV_XS[/green][red];[/red]
[black][b]use[/b][/black] [green]strict[/green][red];[/red]
[gray][i]# Data File[/i][/gray]
[gray][i]# - Fields: name, username, password, address, zip[/i][/gray]
[url=http://perldoc.perl.org/functions/my.html][black][b]my[/b][/black][/url] [blue]$datafile[/blue] = [red]'[/red][purple]loginData.txt[/purple][red]'[/red][red];[/red]
[black][b]my[/b][/black] [blue]$csv[/blue] = Text::CSV_XS->[maroon]new[/maroon][red]([/red][red])[/red][red];[/red]
[url=http://perldoc.perl.org/functions/open.html][black][b]open[/b][/black][/url][red]([/red]LOGIN, [red]'[/red][purple]<[/purple][red]'[/red], [blue]$datafile[/blue][red])[/red] or [url=http://perldoc.perl.org/functions/die.html][black][b]die[/b][/black][/url] [red]"[/red][purple]Can't open [blue]$datafile[/blue]: [blue]$![/blue][/purple][red]"[/red][red];[/red]
[black][b]my[/b][/black] [blue]$found[/blue] = [fuchsia]0[/fuchsia][red];[/red]
[maroon]USER[/maroon][maroon]:[/maroon]
[olive][b]while[/b][/olive] [red]([/red]<LOGIN>[red])[/red] [red]{[/red]
[blue]$csv[/blue]->[maroon]parse[/maroon][red]([/red][blue]$_[/blue][red])[/red] or [black][b]die[/b][/black] [red]"[/red][purple]parse() failed on [blue]$datafile[/blue] line [blue]$.[/blue]: [/purple][red]"[/red] . [blue]$csv[/blue]->[maroon]error_input[/maroon][red]([/red][red])[/red][red];[/red]
[black][b]my[/b][/black] [red]([/red][blue]$name[/blue], [blue]$username[/blue], [blue]$password[/blue], [blue]$address[/blue], [blue]$zip[/blue][red])[/red] = [blue]$csv[/blue]->[maroon]fields[/maroon][red]([/red][red])[/red][red];[/red]
[olive][b]if[/b][/olive] [red]([/red][blue]$formdata[/blue][red]{[/red][red]'[/red][purple]usrname[/purple][red]'[/red][red]}[/red] eq [blue]$username[/blue][red])[/red] [red]{[/red]
[url=http://perldoc.perl.org/functions/print.html][black][b]print[/b][/black][/url] [red]"[/red][purple]username [blue]$formdata[/blue]{'usrname'} found[/purple][red]"[/red][red];[/red]
[blue]$found[/blue] = [fuchsia]1[/fuchsia][red];[/red]
[olive][b]last[/b][/olive] USER[red];[/red]
[red]}[/red]
[red]}[/red]
[olive][b]if[/b][/olive] [red]([/red]! [blue]$found[/blue][red])[/red] [red]{[/red]
[black][b]print[/b][/black] [red]"[/red][purple]username [blue]$formdata[/blue]{'usrname'} not found[/purple][red]"[/red][red];[/red]
[red]}[/red]