SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member segebee's Avatar
    Join Date
    Mar 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    authenticate function

    pls can someone tell me whats wrong wt my code:

    Code PHP:
    function Authenticate ($realm='secure area', $errmsg='Please enter a correct username and password') {
    if (!$PHP_AUTH_PW == 'kingdomfish') {
     
    Header('WWW-Authenticate: Basic realm =$realm');
    Header('HTTP/1.0 401 Unauthorized');
    die($errmsg);

  2. #2
    SitePoint Enthusiast thenk83's Avatar
    Join Date
    Sep 2005
    Location
    Hacienda Heights, CA
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After your function add..

    Authenticate(); or Authenticate($realm,$errmsg);

    You weren't calling the function.. just setting it up. I hope thats it.

    Also.. you need to add two closing brackets at the end of the function. Thats why you might be getting the $end error.
    Mmmmm .NET...PHP...CF...
    AIM: THENK83
    MSN: thenk83@hotmail.com

  3. #3
    SitePoint Evangelist praetor's Avatar
    Join Date
    Aug 2005
    Posts
    479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    SitePoint Evangelist superuser2's Avatar
    Join Date
    Aug 2006
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unless I'm missing something.... you never close the function either.

  5. #5
    SitePoint Addict Robert_2006's Avatar
    Join Date
    Jun 2006
    Location
    Tarpon Springs Fl.
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The IF is not closed either...


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
  •