Closed Thread
Results 1 to 5 of 5

Thread: Enter Password first

  1. #1
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Enter Password first

    I saw the tutorial on how to make simple register/lof in/log off system in the tutorials section, but it didn't work. Anyways I would like to know how to make just a simple password box and a button..if the password is correct then you enter in the next page. I can make it with JavaScript, but if someone views the source it can be easily detected, so I would like to use PHP.. any one can help me please?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jaan Guest
    i guess it's like this

    Code:
    <?php
    // You must define your password below
    $password "dang";
    $pass $_POST['pass'];
    $enter $_POST['enter'];

    if(isset(
    $enter) && $pass == $password){
    // Change this http:// thingy to your page address
    header("Location: http://yoursite.com");
    }elseif(isset(
    $enter) && $pass != $password){
    echo 
    "Your password is wrong!<br>";
    echo 
    "<form action='' method='post'>"
        
    ."Password: <input type='text' name='pass' size='30'>"
        
    ."<input type='submit' name='enter' value='Enter'>"
        
    ."</form>";
    }else{

    echo 
    "<form action='' method='post'>"
        
    ."Password: <input type='text' name='pass' size='30'>"
        
    ."<input type='submit' name='enter' value='Enter'>"
        
    ."</form>";
    }
    ?>
    i hope it helped
    Last edited by Jaan; 06-05-2007 at 12:17 PM.

  4. #3
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    You could always use .htaccess for this as well.

  5. #4
    Jaan Guest
    yea.. .htaccess is better for it

  6. #5
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Well thanks for helping me. Umm anyways I'm having 'problems' with .htaccess if you can help please see this:-
    http://forum.codecall.net/search-eng...endly-url.html

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem in function of enter key
    By newphpcoder in forum PHP Development
    Replies: 6
    Last Post: 02-24-2011, 05:15 AM
  2. Getting keypress Enter
    By Chan in forum C# Programming
    Replies: 6
    Last Post: 07-27-2010, 01:20 AM
  3. [REQ] Enter Button
    By InvisibleMan in forum C and C++
    Replies: 1
    Last Post: 01-24-2009, 12:26 PM
  4. ASCII value of enter key
    By Divya in forum JavaScript and CSS
    Replies: 1
    Last Post: 11-27-2008, 07:18 AM
  5. enter key code
    By flaviusikbv in forum C and C++
    Replies: 10
    Last Post: 06-24-2008, 05:07 AM

Tags for this Thread

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