Current location: Hot Scripts Forums » Programming Languages » ASP » Checking Passwords from TextFiles

Checking Passwords from TextFiles

Reply
  #1 (permalink)  
Old 08-20-09, 06:27 AM
ElphieFabalaFae's Avatar
ElphieFabalaFae ElphieFabalaFae is offline
New Member
 
Join Date: Aug 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Checking Passwords from TextFiles

Code:
<%
IF Request.form("username")="Joe" AND Request.form("password")="please" THEN
%>
<%
Session("permission")="YES"
Session("username")="Joe"
%>
I have been using the above to test logins and display 'member only' pages to those that have permissions. However, I now need to proceed to checking usernames and passwords against information stored in a text file. The text file has the username, password and email stored for each individual. File is called users.txt.

I am at a loss as to where to start in order to get the code to check the file. I assume the Request.form("username")= stays in place, but I have no idea where to start in calling and checking the file. Any tips, pointers, or sample codes would be gratefully accepted!

This is a purely academic exercise while I get to grips with calling information and checking information against text files. I know keeping such information in a text file is unsafe and unwise.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 08-23-09, 05:13 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 2,726
Thanks: 0
Thanked 32 Times in 32 Posts
This should give you the basics on how to read and write to a text file.
Active server pages tutorial: Open, Read and Create files
__________________
Jerry Broughton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 08-23-09, 03:54 PM
ElphieFabalaFae's Avatar
ElphieFabalaFae ElphieFabalaFae is offline
New Member
 
Join Date: Aug 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks. I had read that already, but it didn't show, or even help me understand, how I find a certain line of text within the file and then select certain lines, that may not be consecutive, and that are limited to two lines, instead of calling the entire file, if that makes sense?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 08-24-09, 07:28 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 2,726
Thanks: 0
Thanked 32 Times in 32 Posts
Quote:
Originally Posted by ElphieFabalaFae View Post
Thanks. I had read that already, but it didn't show, or even help me understand, how I find a certain line of text within the file and then select certain lines, that may not be consecutive, and that are limited to two lines, instead of calling the entire file, if that makes sense?
If you are going to use a file that stores information that is needed to login, then that file must have some order to it, otherwise it won't make any sense.

So as long as your file has some order to it, then reading a record should be as simple as reading in so many lines and then checking the appropriate lines for the desired information.

What's hard about that?
__________________
Jerry Broughton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 08-25-09, 06:30 PM
ElphieFabalaFae's Avatar
ElphieFabalaFae ElphieFabalaFae is offline
New Member
 
Join Date: Aug 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
While I test this out, there will be three fields to every user file - username, password, email - it that order, over and over, for three users (at the moment). I understand the principle of going to the right record, finding the info and then checking it, but it's actually transferring the principle into practice. I guess I will have to keep playing around and searching the net for some more help/information.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 08-26-09, 08:08 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 2,726
Thanks: 0
Thanked 32 Times in 32 Posts
Quote:
Originally Posted by ElphieFabalaFae View Post
While I test this out, there will be three fields to every user file - username, password, email - it that order, over and over, for three users (at the moment). I understand the principle of going to the right record, finding the info and then checking it, but it's actually transferring the principle into practice. I guess I will have to keep playing around and searching the net for some more help/information.
The principal is the same, no matter which language you choose.
You just need to learn the proper syntax for that language.

You already have the basics, you just need to put them together.

It is easier to understand if you give it an order.
Setup your variables first.
Perform your logic second.
And then output the results.

So once you get the data from the form, you store it in variables.
Let's say we use:
username
password
email

Then we open the text file and read in the first three lines,
that would represent the first record.
And store them in variables.
Let's say we use:
usernamef
passwordf
emailf

Then we check to see if username == usernamef and password == passwordf and email == emailf.
If all three checks come up true, then we store the variables from the text file into the output variables; usernameo = usernamef and passwordo = passwodf and emailo = emailf.
Otherwise you read in the next three lines from the file and run the checks again.

Then you check to see if usernameo and passwordo and emailo have values.
If they do, then output them to the screen.
__________________
Jerry Broughton

Last edited by job0107; 08-26-09 at 08:25 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 08-26-09, 06:55 PM
ElphieFabalaFae's Avatar
ElphieFabalaFae ElphieFabalaFae is offline
New Member
 
Join Date: Aug 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Brilliant! Put like that, it makes a whole lot more sense!!! I think I just needed someone to explain it in very simple terms. So I'm looking for a few variables and some loop/if..else instructions. Thank you so much for the pointer. I can now start to figure out the next step! =)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 08-26-09, 11:28 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 2,726
Thanks: 0
Thanked 32 Times in 32 Posts
Your welcome.
Feel free to pick my brain again.
__________________
Jerry Broughton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 08-26-09, 11:37 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 2,726
Thanks: 0
Thanked 32 Times in 32 Posts
While I am trying to instruct one of my students, tideshoes.com posted a business advertisement.

I feel that this action is very unethical as the student is open for suggestions.

This behavior is similar to subliminal messaging and is against the law.
__________________
Jerry Broughton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share 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
Checking the contents of a file vana Perl 1 08-02-05 03:01 AM
CPanel Reset Passwords Ic3CoLd Script Requests 0 04-20-05 04:37 PM
New Alternative to WhatIsMyIP for IP checking - FlashMyIP.com akaz The Lounge 0 09-19-04 01:27 PM
Encypting passwords into a BD lordmerlin ASP 0 03-11-04 03:32 AM


All times are GMT -5. The time now is 10:56 PM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.