Password Checker - NEED SYNTAX HELP...PLEASE!

Results 1 to 2 of 2

Thread: Password Checker - NEED SYNTAX HELP...PLEASE!

  1. #1
    Join Date
    Dec 1969

    Default Password Checker - NEED SYNTAX HELP...PLEASE!

    Hello... <BR><BR>Anybody who is capable of troubleshooting ASP Syntax... PLEASE take the time to help me out - I&#039;ve never been so desperate and I barely know my *** from my elbow when it comes to ASP coding... yet a deadline still stands.<BR><BR>I&#039;ve been trying to put together a fairly simple script in ASP that basically takes an entered username and password from a user, checks them against a text file containing valid username/password combos - and sends the user to a different URL depending on which user/password combo they entered. I need some help, however... there are a few things I don&#039;t know how to write properly- Not sure how to read a specific line (by number) from a file. I set the following variables:<BR><BR>----<BR><BR>Set MyFileObject=Server.CreateObject("Scripting.FileSy stemObject")<BR> Set MyTextFile=MyFileObject.OpenTextFile(Server.MapPat h("aspcode") & "passwords.txt") <BR> Set MyPathFile=MyFileObject.OpenTextFile(Server.MapPat h("aspcode") & "paths.txt") <BR><BR>----<BR><BR>As you can see, I&#039;m loading two files .. one is the username/passwords file - and the other is one called "paths.txt" - which contains the path of where to take the user, for each username. I have set it up so that each line in the paths.txt file corresponds to the line it&#039;s specific username/password combo lies in within the passwords.txt file.<BR><BR>Here is the bulk of the code - I&#039;ve commented what I feel are the issues as far as syntax goes:<BR><BR>----<BR>&#039;Repeat through each line in the text file using ThisLine as a counter/index. Not sure the structure of a repeat with index loop but should be something like this. Also not sure of syntax for CountLines (to get the number of lines in the file)<BR>REPEAT WITH INDEX ThisLine from 1 to MyTextFile.CountLines <BR><BR>IF MyTextFile.ReadLine.ThisLine = Request.form("username") & " " & Request.form("password") THEN <BR> &#039; Close the text file<BR> MyTextFile.Close<BR> &#039; Go to login success page<BR> Session("GoBack")=Request.ServerVariables("SCRIPT_ NAME")<BR> Response.Redirect MyPathFile.ReadLine.ThisLine <BR> Response.end<BR> END IF<BR> END REPEAT -- Not sure of the syntax for END REPEAT.. may be REND<BR><BR> &#039; Close the text file<BR> MyTextFile.Close<BR> &#039; Go to error page if login unsuccessful<BR> Session("GoBack")=Request.ServerVariables("SCRIPT_ NAME")<BR> Response.Redirect "invalid.asp"<BR> Response.end<BR><BR>%&#062; <BR><BR>----<BR><BR>I&#039;m sure it&#039;s a little confusing the way I have it written there - but I&#039;m hoping some brilliant coder is able to help me out just in the knick of time (ie. SOON) ... The code is really close to working (it&#039;s even sending me to the invalid.asp page when the password doesn&#039;t match up to any of the lines in the password.txt page) ... however it returns a 500 internal server error when the password is correct. <BR><BR>ANY HELP would be KILLER - I&#039;m desperate!!!<BR><BR>I look forward to hearing suggestions...<BR><BR>Sincerely,<BR><BR>Matt<BR><B R>

  2. #2
    Join Date
    Dec 1969

    Default RE: Password Checker - NEED SYNTAX HELP...PLEASE!

    have you considered using XML or even a database? you can select by record very easily using either of those. textfiles would be a lot more tricky, and let&#039;s face it, why make something difficult if it could be easier?<BR><BR>there are a few articles on that may help. if you need direct help, let me know via that site.<BR><BR>j

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts