User Validation Script Doesnt Validate Correctly, Help Please

Discussion in 'PHP' started by burkem, Feb 18, 2009.

  1. #1
    Hi All

    I have fixed my parse error thanks Tihan, the script validates true on every user, whether they have a username and password in the text file or not.

    I thought the while(!feof($filehandle)) would read each row of the text file then using this line of code if(preg_match("/$student_name/", $student_name)&&(preg_match("/$student_id/", $student_id))) would try and match against the text file if no match, then execute the Else statement, this is not happening. Can someone help me with making this work please.

    Cheers
    Mark
     

    Attached Files:

    burkem, Feb 18, 2009 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    change:

    if(preg_match("/$student_name/", $student_name)&&(preg_match("/$student_id/", $student_id)))

    to

    if(preg_match("/([a-zA-Z-- ]+)/", $student_name)&&(preg_match("/([0-9]+)/", $student_id)))

    or something..
     
    EricBruggema, Feb 24, 2009 IP