Jump to content

set variable _SERVER["PHP_AUTH_USER"] using php


rambabuforu

Recommended Posts

<?php

$username = "username";

$password = "password";

if(($_POST['PHP_AUTH_USER'] == $username)&& ($_POST['PHP_AUTH_PW'] == $password))

{

echo apache_setenv("PHP_AUTH_USER",$username);

echo apache_setenv("PHP_AUTH_PW",$password);

echo putenv("PHP_AUTH_USER =$username");

echo putenv("PHP_AUTH_PW = $password");

$PHP_AUTH_USER =$username;

$PHP_AUTH_PW = $password;

$_SERVER['PHP_AUTH_USER'] =$username;

$_SERVER['PHP_AUTH_PW'] = $password;

}

?>

<form method="post">

<p>Username : <input type="textbox" name="PHP_AUTH_USER" id="PHP_AUTH_USER" /><br />

<p>Password : <input type="password" name="PHP_AUTH_PW" id="PHP_AUTH_PW" /><br />

<p> <input type="submit" name="submit" />

</form>

:confused:

I need to set the variables $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] using php, passing form values.

 

Please help me to sort out this......

You just did, whats the problem?

 

There not going to persist requests however which is what I assume you want to do. For that to happen you would need to store the data submitted by your form within the $_SESSION array and then use that to populate the $_SERVER array on each request.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.