Header problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lee David

    Header problem

    I am using code to validate a user against a database and then if they are
    valid, redirecting the page to the working page. I copied the code from
    another application I have where it works, but it doesn't work here. What
    happens is if the Header is included, a blank page appears with the URL of
    the validation page (SQL_User_Valid ate.php). If the Header is commented
    out, the form appears and you can enter the data and see the results, but
    not with a redirection.

    Most likely is I've made an obvious (to everyone else) mistake that you will
    see in 20 seconds. And that I have not seen in the past hour of working on
    it. Here is the code (to the Header):

    <?php
    include("SQL_A_ Connect.inc");
    $name_table = "User";

    // error_reporting (E_ALL & ~E_NOTICES);
    error_reporting (E_ALL);

    // testing *************** **********
    $testcode0 = "valid: " . isset($_POST['uservalid']);
    $testcode1 = "";
    $testcode2 = "";

    if ((isset($_POST['uservalid'])) && ($_POST['uservalid'] == "yes"))
    {
    $frmID = $_POST["frmID"];
    $frmPWD = $_POST["frmPWD"];

    $sql_code = "SELECT Password, Level FROM " . $name_table . " ";
    $sql_code .= "WHERE UserID = '$frmID'";

    // testing only *************** ********
    $testcode1 = "query: " . $sql_code;

    $sql_result = mysql_query($sq l_code,$name_co nnect) or die(mysql_error ());
    $output = mysql_fetch_arr ay($sql_result) ;

    $sqlPWD = $output["Password"];
    $sqlLVL = $output["Level"];

    // testing only *************** ***********
    $testcode2 = "sql pwd: '" . $sqlPWD . "'<br>sql lvl: '" . $sqlLVL .
    "'<br>rows: '" . mysql_num_rows( $sql_result) . "'<br>post pwd: '" . $frmPWD
    .. "'<br>post id: '" . $frmID . "'<br>";

    $hold = time() + 60 * 60 * 24 * 180;
    if ($sqlPWD == $frmPWD)
    {
    // validated user - write cookie and continue
    setcookie("user ", $frmID, $hold);
    setcookie("leve l", $sqlLVL, $hold);
    setcookie("auth orized", "yes", $hold);
    // header("Locatio n: ../SQL_User.php);
    }
    else
    {
    setcookie("user ", "guest", $hold);
    setcookie("leve l", "0", $hold);
    setcookie("auth orized", "no", $hold);
    // header("Locatio n: ../SQL_User_Valida te.php);
    }
    }
    ?>

    Any ideas?


  • Dave

    #2
    Re: Header problem

    On Fri, 05 Aug 2005 23:11:20 -0500, Lee David decided we needed to hear:
    <snip>[color=blue]
    > if ($sqlPWD == $frmPWD)
    > {
    > // validated user - write cookie and continue setcookie("user ",
    > $frmID, $hold);
    > setcookie("leve l", $sqlLVL, $hold);
    > setcookie("auth orized", "yes", $hold);
    > // header("Locatio n: ../SQL_User.php);[/color]

    Double quote missing.
    [color=blue]
    > }
    > else
    > {
    > setcookie("user ", "guest", $hold);
    > setcookie("leve l", "0", $hold);
    > setcookie("auth orized", "no", $hold);
    > // header("Locatio n: ../SQL_User_Valida te.php);[/color]

    Double quote missing.

    <snip>
    --
    Dave <dave@REMOVEbun dook.com>
    (Remove REMOVE for email address)

    Comment

    • Lee David

      #3
      Re: Header problem

      Thank you. I was sure it was something stupid I was doing, but I just
      couldn't see it. I'll fix that after the morning meeting.

      Lee


      Comment

      Working...