Current location: Hot Scripts Forums » Programming Languages » Perl » Checking the contents of a file


Checking the contents of a file

Reply
  #1 (permalink)  
Old 08-01-05, 06:30 PM
vana vana is offline
New Member
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Checking the contents of a file

I have a file that I am checking the contents of to match username that is input into a form. If there is a match, a welcome message should be displayed. If not, then an error message. The first part works, but if I enter a bogus username, it still gives the welcome message, but using the last record in my file. Am I missing a line of code or something?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 08-02-05, 04:01 AM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
Code:
#!/usr/bin/perl
use CGI;
print "Content-type: text/html\n\n";

$cgi = new CGI;
$user = $cgi->param('username');

#code to get original username
$original_user = "whatever";

if ($user eq $original_user) {
print "Good!";
}
else {
print "Bad!";
}
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Contents of file as var hakone PHP 1 07-30-04 02:14 PM
compare the contents of 2 file in php rani PHP 5 04-15-04 12:47 AM
Displaying TEXT file contents to HTML tables Mendo PHP 2 02-18-04 12:19 PM
change the contents of an html file in asp jaleen ASP 4 01-21-04 08:41 AM
change the contents of an html file in asp jaleen Script Requests 0 12-30-03 02:53 PM


All times are GMT -5. The time now is 12:51 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.