1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

validation from atext file and adding to text file

Discussion in 'Perl' started by Devashish_saha, May 31, 2005.

  1. Devashish_saha

    Devashish_saha New Member

    I am new to perl . i have been given ap project to validation username and pssword form text file and store login date and login time to a text file . Ihave written a below code in which i have done the validation and i can show the logodte and time in the browser
    but i canot the information in atext file pls help me out


    use CGI;
    $var=new CGI;

    print "Content-type: text/html\n\n";

    if (-e "/httpd/GuestDB/Emp.txt"){
    open (example, "/httpd/GuestDB/Emp.txt") || die ("Could not open file <br> $!");

    @text = <example>;

    $flag = 0;
    foreach $file1 (@text)


    my ($data1, $data2)=split(":",$file1);

    sub trim
    my $string = shift;
    for ($string)
    return $string;


    $user = trim($data1);
    $pass = trim($data2);

    if(($user eq $username) && ($pass eq $password))




    my $now = localtime;

    if ($flag eq 1)

    print $username,$now;

    # open (example1, ">/httpd/GuestDB/Log.txt") || die ("Could not open file $!");
    # @db_lines1 = <example1>;

    else {
    print "Error ...";

    close (example);
  2. shabbir

    shabbir Administrator Staff Member

    can you explain what you mean by the above line.

Share This Page