How To Reset The Server Variable Php_auth_user

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

How To Reset The Server Variable Php_auth_user

TavoxPeru
Hi, i'm developing a web application which obviously requires a log in/log out script that i just implementing but i dont know why the log out script dont work fine.

The problem is related with the server variable $_SERVER['PHP_AUTH_USER'] which remains set even when in the log out script i unset it with the unset() function.

Does someone knows how can i reset or clear the server variable $_SERVER['PHP_AUTH_USER']???

Best regards,


Reply

vicky99
Dear TavoxPeru
I could not understand the meaning of the message which you tried to convey. Did you turned on the safe mode in the PHP configuration file, php.ini. You can find it under Windows folder if you are using Microsoft Windows. By default safe mode is turned off. The PHP safe mode is an attempt to solve the shared-server security problem. If this does not solve you problem then you must specify the error you are getting. Till then bye…

Reply

Hercco
I'm guessing that server always sets the variable. Even if the user is not authenticated (ie. has not typed anme and password) it sets the variable to empty string.

PHP itself gives a lot of liberties to the webserver regarding the _SERVER superglobal. In fact it allows to server to set none of the variables or set everything to empty or whatever. If you have access to the server configuration I'm sure you can change this behaviour. On the other hand, that wouldn't make for very portable code.

My suggestion is that, instead of checked whether the variable is set, you check whether it's an empty string or not. You could use strlen for example.


Reply

Quatrux
Well, using a login script with PHP Auth isn't the best method, but I had this problem too, I just did a simple login for one customer, I would do it differently for myself, I couldn't understand how to logout, the Authentication using this kind of way is saved in your browser I guess and server side, I never got into it, even changing the password on the script didn't help, I think that variable is created because the browser sends a http request with it. Anyway, I prefer to use sessions with cookies. wink.gif

Reply

TavoxPeru
Vicky99:
No, i dont turned on the safe mode in the php config file, so i turn it on to check if this solve the problem but this dont solve it.

Hercco:
I will try your suggestion, i think it would work.

Quatrux:
If the suggestion made by Hercco dont work my last chance is to use sessions with cookies as you suggest.

Thanks a lot,

Reply

TavoxPeru
Well, finally my client decide not to use this approach. What i do is simply change it to a standard login script using a form with a text box and a password box and all works very fine, so sorry dudes, i hope sometime i could complete this approach.

For me, it is an incomplete task that i must finish soon.

Best regards,

PS: please admins let me know if i'm doing wrong when i post again and if the correct way was simply to include this in my previous post.


Reply

Quatrux
the $_SERVER['PHP_AUTH_USER']; is always set because your browser sends a http request containing this, so I never really got deeper into this, but this is the right way it should work, even though I think there needs to be a solution, because you can log off from CPanel, but I think they know better how to control http requests and stuff and I don't think that CPanel is written with PHP. wink.gif

Reply

minnieadkins
I encountered this as well. I reset the password instead of resetting the auth I believe. I think that worked for me since you need a valid combo of auth/pass for my script to work.

Then as everyone else here stated I went with a standard input field login via post.

Reply

iGuest
I have same problem, Only close browser is the solution for that:) use window.Close () for the clear the sever variable.

Reply

iGuest
How To Reset The Server Variable Php_auth_user
How To Reset The Server Variable Php_auth_user

Simply in logout function you have to change the value of $_SERVER['PHP_AUTH_USER'];.And check again loin function. If user name will not matched that was set in $_SERVER['PHP_AUTH_USER'] variable automatically it will call header.(I have done it).

-reply by sana ullah

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. resetting server - 0.04 hr back. (1)
  2. php reset post - 2.04 hr back. (1)
  3. php auth user reset - 19.51 hr back. (1)
  4. set php server variables in apache - 24.24 hr back. (1)
  5. reset post vars php fsockopen - 32.16 hr back. (1)
  6. php_auth_user - 29.36 hr back. (2)
  7. php form reset server post - 48.38 hr back. (1)
  8. pmsystem control bit byte - 51.03 hr back. (1)
  9. reset $php_auth_user - 62.46 hr back. (2)
  10. html logout $_server[php_auth_user] - 78.00 hr back. (1)
  11. how to reset all variables in php - 85.65 hr back. (1)
  12. resetting php static variable - 89.29 hr back. (1)
  13. asp.net reset variable on closure - 101.40 hr back. (2)
  14. php, mysql and authentication reset variables - 107.51 hr back. (1)
Similar Topics

Keywords : reset, server, variable, php, auth, user

  1. Permanent Variable
    (7)
  2. How To Create/edit/delete Ftp Accounts With Php
    Help me to create one php page to create FTP user accounts in Unix Ser (1)
    Thanks /cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" /> ....
  3. Make A Script Run Even If No User Is Online
    (6)
    Hey! Is there any way to make a script run, even if no user is online. Because at the moment, my
    scripts run, only when a user is online. And another thing: How can i make the following: (this is
    just an example) mysql_query"SELECT maxhp FROM users WHERE username = 'allusers'"; How can I
    select all users maxhp, in the same query? Thanks //Feelay....
  4. Automated Product Suggestion Script
    Compare user lists and suggest related items based on pattern matching (2)
    I recently got an idea for a project and one of the features I wanted the project to have was an
    automated suggestion service. If anyone has been to Amazon, it would work much like their
    recommended product feature. What I want to do is take several users lists of whatever but for this
    example, I'll use web links like from the browser history. I would want to suggest links to a
    user based on common links in many other users lists. User A: Amazon, Ebay, Excite, Google, Yahoo,
    MySpace, Walmart User B: Amazon, Ebay, Google, Yahoo, You Tube, MySpace, CVS User C: Amazo....
  5. Send Php Variable To Javascript
    (5)
    Right i had a look across the internet as well as a search on here but you cannot search for
    anything less than 3 characters. But this is a really quick question. Would the following code
    allow me to send a php variable to a javascript? CODE <?php $color = "green";
    ?> <script language="JavaScript"> BackColor= "<?php
    echo($color);?>"; </script> ....
  6. Unexpected Error
    Undefined variable??? (2)
    Is this script correct? index.php : CODE <?php     if
    (isset($_COOKIE["disp_name"]))
              $_GET['name'] = $_COOKIE['disp_name'];     else
            setcookie("disp_name", Anonymous, date()+99); ?> <html>
        <head>         <title>Display Name - DZN</title>         <!--
    METAS -->         <meta name="verify-v1"
    content="oyEmG+TJ87xHGXl8NQS6GHJ8rcRDkFG4oXnYWtqddGk=" />     </head>....
  7. Using Php With A Mail Server
    (2)
    We all know you can use PHP with a web server, but can you use it with a mail server? I've made
    a personal messenger system, and I was thinking about adding additional functionality in the future,
    such as the ability to send mail from it. Then I started thinking, would it be possible to recieve
    mail with it? Say, have a PHP script that checked when a message arrived at the server, and when it
    does, check for something in the message (e.g. "pmsystem-to: admin") that would tell it to send it
    to a certain user, and then have it do the scripts to send a PM. So, is it....
  8. Php Any Variable In String.
    (1)
    OK well I am making a new php program and I am trying to add bbcode to it. Anyway I was going to
    replace each thing by it self, but that could cause errors. Anyway is there a way to make a variable
    be anything? Here is an example: CODE This is the bbcode:
    [color=00FF00]Hey[/color] In my php: $bbcode =
    array("[color=".$a."]"); $html = array( "<font
    color='#".$a."'>"); $topic_content =
    str_replace($bbcode, $html, $posted_bbcode)....
  9. Proper Way To Grab User Data?
    (1)
    I'm working on a script where there is a custom user profile and I was wondering if there was a
    more efficient way to grab data stored in a database than this method: CODE $sql =
    "SELECT * FROM users WHERE `access_name` = \""  .$active_user.
    "\""; $row = mysql_fetch_array(mysql_query($sql)); //Link
    the two tables together; grab the most common thing that is the *SAME* $user_id =
    $row['id']; $sql2 = "SELECT * FROM content WHERE `cid` =
    \&#....
  10. Quickly Create Form Variables
    simple form, variable creation, referer check, safe guard variables (5)
    The reason I wanted to share this is I've seen so many people do this with their forms when
    using PHP. CODE $username = $_POST['username']; $password =
    sha1($_POST['password']); $another_var =
    $_POST['another_var']; ... and so on, just imagine if you had a large
    number of form inputs, do you really want to create each and every variable name? Why people do
    this, is probably due to most of the examples I've seen on the web, that does not show an easier
    and much quicker ....
  11. Backing Up User Forms As Static HTML
    (5)
    System: Activity System for use in Universities Users: Faculty members Scenario: User fills out a
    list of activites they participated in. Example: A faculty member attended a seminar about Object
    Orientated Programming. They record that seminar into their records by filling out a form and
    adding that activity into the database and identifying it with a designed term id. Spring terms are
    different than fall terms etc etc. We want to create html snapshots of these forms that can be
    included by a simple include('oldForm.html') into another form for review. ....
  12. Variable From Line Further Then Current Line?
    (13)
    Hello, Is it in some way possible to load a variable that further then the current line in the
    script? I don't know if you know what i mean so I'll try to point it out in the script
    below. CODE 1 <?php 2      echo $var1; 3      # $var1 needs to be loaded from
    foo.php 4     # Lets say i want $var1 to be echoed in <title>$var1</title>
    5       - - - -       bla bla bla 55      - - - -
    56      switch($_GET['page']) { 57          case "foo":
    58              include("foo.php....
  13. User Authentication Session Handling Problems
    Authorization server variables not staying across pages (14)
    This is quite a bit of problem I am facing, and I cannot point exactly where I am going wrong. I
    have been lurking around here at the Asta Host forums with regard to login and user authentication
    scripts and I have got as far as this: - Starting a session - Registering a session variable -
    Using the variable to check if the user is authenticated or not. - Authenticating the user through
    MySQL database - Logging of the user, by setting the session variable to un-authenticated I have
    been able to achive the following things too that I think is not related to this proble....
  14. Generating A Table Into A File In CSV Format
    and letting user download the file (6)
    I'm working on a project, part of which consists of working with large tables of different
    kinds. Now, I'm using a page seeking technique which allows you to browse through the records
    depending on which page you want to see and how many records you want to see on each page. Now, I
    need a link (or a form button) on each page which, when clicked, will throw a file to the user for
    download (the download window should popup immediatly) which will give the part of the table,
    currently being viewed, in CSV format. One way I can think of to generate the file is manu....
  15. Help: $_post Variable For Options From Select Types?
    (6)
    I want to know if there is a way to get the variables in $_POST for the options (not just the
    selected ones, but the unselected ones as well) of a type. Objective: Creating an application for
    my school. Issue: I am successful in receiving all the variables from the forms except the ones
    added to the options of a type. Just wanted to know what is the variable to access the options of
    types. Here is what I am trying to do with it: View Page If the server is down or unable to
    load file, here is the script: CODE <html> <head>     ....
  16. Multilingual Site: Send The User To Page Of Choice
    (6)
    If you have one site in diferent laanguages, this simple script can redirect the user to the correct
    page acording to his/her language: CODE <?php // Enslish EUA elseif
    ($HTTP_ACCEPT_LANGUAGE == "en-us"){ header("Location:
    index_eng.html"); } // Inglęs UK elseif ($HTTP_ACCEPT_LANGUAGE ==
    "en-gb"){ header("Location: ingles_enuk.html"); } // Portuguese
    [Brazil] if ($HTTP_ACCEPT_LANGUAGE == "pt-br"){
    header("Location: index_ptbr.....
  17. Saving A Php Generated Image To The Server
    Help Needed Please (5)
    I'm trying to create a script that will generate an image and send it back to the browser while
    saving the same image to the server. I'm doing this because the image should be dynamically
    generated but because of the load that would place on a server if the image happened to be requested
    frequently, I've decided to build in a means to serve the static version of the image most of
    the time. What isn't included here is the function that will check the age of the file in cache
    directory and serve the static image if it is less than an hour old. This isn....
  18. Include Directives And Efficancey
    Server preformance, response time (4)
    Hello there. Most of my programming experiance has been with compiled languages. However, I am now
    working in PHP. In a compiled languages (or even a client-side scripting language), include
    directive only effect the preformance at compile-time. It has always been my style to make all
    global variables, functions, and data structures available to all source files by including a header
    file that would then in turn include all the project's headers in the correct sequence. Now, as
    I have said, I am working in PHP. The design of my page is that of a program, with the ....
  19. Server-friendly Php Scripts
    (5)
    Hi I'm relativly new to php... I'm interested in writing server-friendly php scripts and i
    was wandering in what cases php scripts are harmfull to server i runs on... i was thinking about
    issues like: * Which php functions are expensive from the point of view of server's
    performance and resources? * What is considered to be a long array in php context if ,say, each
    record is 100 bytes long? (100+ element ? a few thousands?) * Are there some assumptions that php
    programmer should avoid? (comes to mind this example: http://il.php.net/register_globals )....
  20. Php Variable Concatenation
    Something New I learned Today! :P (7)
    I was coding one of my php page today, when I realized that I had to add multiple values to a
    variable (now that I think of it, a solution with arrays is possible too). But, the problem is that
    I have to add them in different parts of the code, so the new line that defines the variable will
    cover up the previous one. I played around with the code, and I finally got this solution:
    $message = "test1"; $message .= "test2"; $message .= "test3"; echo $message;
    By adding a dot in front of the = sign, I could concatenate the previous value with the ne....
  21. Mini Apache Server W/ Php
    Grab it right now ... (5)
    Hi, Those who don't want to go into all the hassle of configuring Apache with PHP - here's
    a quick alternative. Grab MiniApache_PHP from http://213.106.116.50/james/ . It's a much
    downscaled version of the real Apache server but includes the PHP modules too - very little
    headache over installation and you can start hosting your own sites rightaway. Good alternative for
    testing your custom php codes too... This is what the site says about the software: QUOTE
    MiniApache_PHP is a cut-down version of the open-source Apache web server software for Wind....
  22. User Ip And City Tracing In Php
    User IP and City Tracing in PHP (3)
    Hi, Am in damm need of tracing the Users IP and City hwre they are from with PHP, Any help
    please....... Thanks in Advance Arunkumar.H.G....
  23. [PHP]fsockopen(): Timed_out
    fsockopen() on a Irc Server (7)
    I have create a script that open a connection on a irc server like a BnC; when i test it on my local
    machine it's all ok, but here i receive every time Timed_out, and i don't know why, Someone
    can me explaine why? /sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /> ....
  24. All in 1 server
    PHP4,PHP5,ASP.Net (13)
    Hello, I'm hosting my own site web on my computer. I'm using IIS6 with ASP.NET and PHP4
    running on it and I would like to install also PHP5 to try it. Do you think it's possible ?....

    1. Looking for reset, server, variable, php, auth, user

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for reset, server, variable, php, auth, user
advertisement




How To Reset The Server Variable Php_auth_user



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE