Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTPD and .htaccess

Status
Not open for further replies.

PaulBarbeau

Programmer
Nov 23, 2000
109
CA
I am trying to make it so when every you connect the the website (on the box ) it asked you for username and password
In my root folder (/var/ i have put the .htaccess file however it does not seam to be picking it up. i have looked at the manual and have no idea what i am doing wronge. anyone have any ideas? I have created the password using htpasswd.

Paul
 
Giving u a partial list of a program code. The program uses PHP. and after color green]else[/color] part check for the Paswd in database.
But the idea is same U have to send it firt throgh header. Probably uare also using Apache web server. Then better ask in Apache Forum forum65
Code:
<?PHP

/* Program for Correction of Name and passing of discounts */

/* Get the
	Student ID
	Name
	Fee Pd Details - also the actual fees
	Discount
	and balance
*/

$head=&quot;Maintenance Modules&quot; ;
$title = 'Grade Keeping Project - Discount Entry' ;

if (!isset($PHP_AUTH_USER))
{
	HEADER(&quot;[URL unfurl="true"]WWW-Authenticate:[/URL] Basic Realm=\&quot;My Realm\&quot;&quot;) ;
	HEADER(&quot;HTTP 1.0 401 Unauthorized&quot;) ;
	include (&quot;Basics.inc&quot;) ;
	html_head($head, $title, $PHP_SELF) ;
	echo &quot;<MARQUEE><H2 STYLE='color:red; margin-left: 15%'>
					You have Cancelled the request</h2></marquee>\n&quot; ;
}
else
{
	include (&quot;Basics.inc&quot;) ;

	define (INITIAL_PAGE, 0) ;
	define (EDIT_STUDENT, 1) ;
	define (UPDATE_STUDENT, 2) ;

	html_head($head, $title, $PHP_SELF) ;

	db_connect() ;

	// Now Search for the name and Password. Bothe are case sensitive'

	$qry = &quot;SELECT 1 FROM UserAuth
	        WHERE User = '$PHP_AUTH_USER'
	        AND Pasword = '$PHP_AUTH_PW'\n&quot; ;

    $res = mysql_query($qry)
           OR err('Sorry!! Cannot get user Name', mysql_errno(), mysql_error(),
 1) ;



[ponder]
----------------
ur feedback is a very welcome desire
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top