Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 27th, 2004, 06:51 AM
Authorized User
 
Join Date: Jun 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Authentication

I wanted to upload pictures to an image gallery. I've seen somewhere an example of uploading but the authentication doesn't work.

This is an example of how i do my authentication

<?php
  if(!isset($PHP_AUTH_USER)) {
   Header("WWW-Authenticate: Basic realm=\"Mijn Realm\"");
   Header("HTTP/1.0 401 Unauthorized");
   echo "Tekst om te sturen als de gebruiker op Annuleren klikt.\n";
   exit;
  } else {
   echo "Hallo $PHP_AUTH_USER.<P>";
   echo "Je gebruikte $PHP_AUTH_PW als je password.<P>";
  }
?>

When i run this the readme file says that a login window should be displayed but i get a message "Unauthorized"
I read something about authentication where i have to install PHP on Apache module or something ?
Can someone clear this out for me ??

Thx in advance

 
Old September 25th, 2004, 11:34 AM
Authorized User
 
Join Date: Aug 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to dkittell Send a message via AIM to dkittell Send a message via Yahoo to dkittell
Default

I have run into this a few times myself, I used a similar code to what you have posted but I found it better to password protect directories using .htaccess some think this is not the way to go but I find .htaccess is a quick and painless solution.

---
David Kittell





Similar Threads
Thread Thread Starter Forum Replies Last Post
Authentication stu9820 ASP.NET 1.0 and 1.1 Professional 4 December 7th, 2009 05:31 AM
Authentication r_ganesh76 ASP.NET 1.0 and 1.1 Professional 3 January 18th, 2008 11:34 AM
Authentication koco ASP.NET 2.0 Professional 1 August 21st, 2007 09:02 AM
Authentication PbsiGuru General .NET 6 March 24th, 2004 02:41 PM
Authentication dbradley ASP.NET 1.0 and 1.1 Basics 2 August 13th, 2003 10:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.