SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member SiteViper's Avatar
    Join Date
    Feb 2001
    Location
    USA
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm toying with adding passwords to the "Jokes" db that I am building while following Kevin's 10 Part lesson.
    Note: I know this is not a very secure means, I'm just trying to drive some of the funtions into my brain.
    Code:
    I have the field set, and I am bringing it in as part of my $authors variable.
     Then I am defining it as $password in my fetch_array.
    I am using <INPUT TYPE=TEXT NAME="PASS" SIZE=20 MAXLENGTH=8> to 
    ask the user to enter their password (this is a registered user with a password
     already in the db) and I want to match it to $password.
    
    OK, so I think...Add an if statement to the submit area. Make it something like
     if("PASS" == $password) {
    //plug in the submit and delete stuff//
    } else {
    echo("<P> Sorry Bubba, that's the wrong password! </P>");
    end();
    }
    But I get parse errors on lines late in the submit section when I do this.

    I don't want to post the full code because it's rather lengthy but if needed, I will put up a txt file on my site and link it here.
    Last edited by SiteViper; Mar 1, 2001 at 21:41.

  2. #2
    SitePoint Zealot moshe_be's Avatar
    Join Date
    Dec 2000
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The form process page is diffrent page then the form itself. thus if you want to have them on same page it would require to have like this:

    ----- login.php -----

    if($submit)
    {
    // Process the form here
    if($form_password == $password) {
    //plug in the submit and delete stuff//
    } else {
    echo("<P> Sorry Bubba, that's the wrong password!</P>");
    exit;
    }
    } else {
    // Show form here
    ?>
    <form method="POST" action="<?=$PHP_SELF?>">
    <input type="text" name="form_password">
    <input type="submit" name="submit" value="Login">
    <?
    }

    Hope that helps

  3. #3
    SitePoint Member SiteViper's Avatar
    Join Date
    Feb 2001
    Location
    USA
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I would they would have to put their password in before they are alowed to post, and not at the time of the post?

  4. #4
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No - that last post there is the code you need. It's not 100% done - it's just the password field. It's up to you to fill in the rest.

  5. #5
    SitePoint Member SiteViper's Avatar
    Join Date
    Feb 2001
    Location
    USA
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I've played with this thing most of the day and I just don't get it.

    The "stuff" between //plug in the submit and delete stuff// contains more if( statements that seem to confuse things for me.

    I wen't back and did what moshe_be indicated (correcting the variable and missing areas.

    The result is that it hangs because if($SUB2) is not met. I know because I put a cute little echo in the else parameter.
    Here the text file of this code.

    I've tried several other things that make me think that I am just not seeing the flow.

    Is there some basic rule for the order in which events are placed?

    I'm gonna break off this thing for a bit and try again tomorrow if anyone has any suggestions, I would be greatful.

    BEER TIME!
    Last edited by SiteViper; Mar 2, 2001 at 18:01.

  6. #6
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    see my post earlier on PHP cookies... it provides a simple, fairly secure tiblet... sorry I'm in a rush!
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services


Bookmarks

Posting Permissions

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