Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 8 of 8

Thread: .httaccess

  1. #1
    59
    posts
    Registered User

    .httaccess

    guys, i need to protect a page called "admin.php"

    wat can i add to my .httaccess which is in the same directory to protect it?

  2. #2
    1,839
    posts
    Registered User
    just use sessions to password protect it....I wouldnt bother with changing .htaccess

    a simple script
    <?php
    session_start();
    if(isset($_POST['username'] && isset($_POST['password'])){
    if($_POST['username'] == 'admin' && $_POST['password'] =='admin'){
    $_SESSION['logged_in'] = 'yes'
    }
    }
    if(!isset($_SESSION['logged_in']){
    showLoginForm()
    }
    ?>

  3. #3
    It's actually easier to use htaccess than PHP, though I'd recommend using edit:/[the] latter.
    Last edited by hl; January 26th, 2008 at 12:08 AM.
    got pwnt?

  4. #4
    1,839
    posts
    Registered User
    yeh im just trying to create good coding practices

  5. #5
    the best coding practice is the fastest and most secure one.

    (and truth be told I still have a hard time conceiving the hold session thing )

  6. #6
    If you are gunna use htaccess the filename is ".htaccess" exactly.
    I noticed you spelt it with two t's.
    Web Design and Web Development blog
    Designer Notice: Browser List for design compatibility

  7. #7
    59
    posts
    Registered User
    Quote Originally Posted by alexgeek View Post
    If you are gunna use htaccess the filename is ".htaccess" exactly.
    I noticed you spelt it with two t's.
    sry.... i meant to say t, im still not getting a definite answer... wat exctly do i do with the htaccess file? i dont want to mess around with the php file...

  8. #8

Thread Information

Users Browsing this Thread

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

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012