rambabuforu Posted April 15, 2010 Share Posted April 15, 2010 <?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> 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...... Link to comment https://forums.phpfreaks.com/topic/198630-set-variable-_serverphp_auth_user-using-php/ Share on other sites More sharing options...
trq Posted April 15, 2010 Share Posted April 15, 2010 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. Link to comment https://forums.phpfreaks.com/topic/198630-set-variable-_serverphp_auth_user-using-php/#findComment-1042348 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.