Re: isset(), empty(), $_GET and $_POST problem

From: Chung Leong (chernyshevsky_at_hotmail.com)
Date: 07/26/04

  • Next message: Brandon Keepers: "Re: compile oracle support on linux for windows"
    Date: Sun, 25 Jul 2004 20:46:39 -0400
    
    

    "Dan" <agent@thwackspam.fathom.org> wrote in message
    news:5c08g0lv9te7dhhahudb4605la13rums13@4ax.com...
    > I was trying to troubleshoot a login page that doesn't work - it keeps
    > saying the login/password is missing - when my tracing discovered this
    > peculiar behavior.
    >
    > register_globals is off, so at the top of my script I assign a few
    > variables to incoming GET and POST values.
    >
    > $login = clean($_POST['login'], 30);
    > $passwd = clean($_POST['passwd'], 30);
    >
    > $message = $_GET['message'];
    >
    > clean() is simply a function that trims to the specified length and
    > applies EscapeShellCmd().
    >
    > Now, below that I have an if statement to check for whether a
    > login/password has been supplied or if an error message exists.
    >
    > if (isset($message) || empty($login) || empty($passwd))
    > {
    > // render the html page showing the form
    > } else {
    > // do some php/mysql stuff and redirect to another page
    > }
    >
    > Yet when I fill out those form fields and submit, it always redisplays
    > the form with my tracing errors stating that those fields are empty.
    >
    > When I echo out all $_GET and $_POST variables, indeed they are empty,
    > and strangely there is a $_GET['message'] that has no value, but
    > nevertheless is on the end of the url. (/index.php?message=) I can't
    > figure out how it got there. The form action is just "index.php" and
    > it uses the POST method, so what could be adding that GET variable?
    >
    > Now here's the weird part. If I simply add "1 ||" to the beginning of
    > that if statement, so basically it will always evaluate to true, then
    > suddenly the $_POST['login'] and $_POST['passwd'] are properly defined
    > and $_GET['message'] goes away!
    >
    > So this makes me wonder, are the isset() and empty() functions
    > actually modifying the variables passed to them somehow? And when I
    > put a true value in front of them, the if statement stops parsing
    > before it gets to those functions?

    Bet you a banana cupcake that your HTML is screwed up.

    -- 
    Obey the Clown - http://www.conradish.net/bobo/
    

  • Next message: Brandon Keepers: "Re: compile oracle support on linux for windows"

    Relevant Pages

    • isset(), empty(), $_GET and $_POST problem
      ... login/password has been supplied or if an error message exists. ... Yet when I fill out those form fields and submit, ... the form with my tracing errors stating that those fields are empty. ... When I echo out all $_GET and $_POST variables, indeed they are empty, ...
      (comp.lang.php)
    • Re: Word Fields for Forms: Determining if Empty
      ... cCount = cCount + 1 ... "Jay Freedman" wrote: ... field contains five nonbreaking spaces (the 'empty' condition). ... IsNull has nothing whatever to do with form fields. ...
      (microsoft.public.word.docmanagement)
    • Re: isset(), empty(), $_GET and $_POST problem
      ... >>cleanis simply a function that trims to the specified length and ... >>applies EscapeShellCmd(). ... >>Yet when I fill out those form fields and submit, ... >>the form with my tracing errors stating that those fields are empty. ...
      (comp.lang.php)
    • Re: Word Fields for Forms: Determining if Empty
      ... field contains five nonbreaking spaces (the 'empty' condition). ... "Jay Freedman" wrote: ... IsNull has nothing whatever to do with form fields. ...
      (microsoft.public.word.docmanagement)
    • database error - form field empty
      ... I am getting intermittent errors with a Front Page ASP form making a database ... and there are no empty fields in the table - I've triple checked ... [ODBC dBase Driver] System resource exceeded. ... One or more form fields were empty. ...
      (microsoft.public.frontpage.client)