CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Simple Question

 



Meth-net
Deleted

Aug 13, 2000, 6:07 PM

Post #1 of 3 (317 views)
Simple Question Can't Post

Ok,I need to know how I would go about making a registration and then after they register it would store the data in a text file that was their username(ie their username is BoB therefore the text file is BoB.txt)
Then when they login they put in their password and username it reads the file to see if passwords match(case senstive)and if it doesnt it displays and error
the only part i would have trouble with is the creating a file and being able to read the variables from the text file.
Thanks in advance!


dwarf
Deleted

Aug 13, 2000, 7:50 PM

Post #2 of 3 (317 views)
Re: Simple Question [In reply to] Can't Post

You can create a file as simple as this:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

open(FILE,">$username.txt");</pre><HR></BLOCKQUOTE>

Then simply write to the file something like this:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

print FILE "$username|password";</pre><HR></BLOCKQUOTE>

When you try to verify your user, a loop wil do:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


foreach (<FILE> ){
($user, $pass) = split(/\|/);
if ($user eq $username && $pass eq $password){
found = 1;
last;
}
}

if ($found){
print "I see you are from here\n";
}else{
print "You are not from here\n";
}</pre><HR></BLOCKQUOTE>

HTH.


Meth-net
Deleted

Aug 13, 2000, 8:48 PM

Post #3 of 3 (317 views)
Re: Simple Question [In reply to] Can't Post

Thanks!
Another Question right quick
Can you tell me 3 ways to write to a file. The begining,end,and replacing the text?
Thanks in advance!

Sorta what I mean is how could I change those variables?

[This message has been edited by Meth-net (edited 08-13-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives