what's wrong with this code? i am getting a blank page when i pass my form data to it

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • anon@the.net

    what's wrong with this code? i am getting a blank page when i pass my form data to it

    <?php

    if(! isset($_POST['username'])) {
    header("Locatio n: login.php");
    }

    mysql_connect(D ELETED)
    mysql_select_db (DELETED)

    $username = $_POST['username'];
    $username = mysql_real_esca pe_string($user name);
    $result = mysql_query("SE LECT userid, pswd FROM users WHERE username = '$username'");

    if(mysql_num_ro ws($result) > 0) {
    $row = mysql_fetch_ass oc($result);
    $userid = $row['userid'];
    $pswd = $row['pswd'];
    }

    $formpswd = $_POST['password'];
    $formpswd = md5($formpswd);

    if(mysql_num_ro ws($result) == 0) {
    header("Locatio n: login.php");
    } else if($pswd == $formpswd) {
    session_unset() ;
    session_destroy ();
    session_start() ;
    $_SESSION['userid'] = $userid;
    header("Locatio n: userhome.php");
    }

    mysql_close();

    ?>
    --
    ----------------------------------------------
    Posted with NewsLeecher v3.0 Final
    * Binary Usenet Leeching Made Easy
    * http://www.newsleecher.com/?usenet
    ----------------------------------------------
  • Mark Rees

    #2
    Re: what's wrong with this code? i am getting a blank page when i pass my form data to it

    > <?php[color=blue]
    >
    > if(! isset($_POST['username'])) {
    > header("Locatio n: login.php");
    > }
    >
    > mysql_connect(D ELETED)
    > mysql_select_db (DELETED)[/color]

    Put semicolons on the end of the two lines above for starters
    [color=blue]
    > $username = $_POST['username'];
    > $username = mysql_real_esca pe_string($user name);
    > $result = mysql_query("SE LECT userid, pswd FROM users WHERE username =[/color]
    '$username'");[color=blue]
    >
    > if(mysql_num_ro ws($result) > 0) {
    > $row = mysql_fetch_ass oc($result);
    > $userid = $row['userid'];
    > $pswd = $row['pswd'];
    > }
    >
    > $formpswd = $_POST['password'];
    > $formpswd = md5($formpswd);
    >
    > if(mysql_num_ro ws($result) == 0) {
    > header("Locatio n: login.php");
    > } else if($pswd == $formpswd) {
    > session_unset() ;
    > session_destroy ();
    > session_start() ;
    > $_SESSION['userid'] = $userid;
    > header("Locatio n: userhome.php");
    > }
    >
    > mysql_close();
    >
    > ?>[/color]


    Comment

    • Justin Koivisto

      #3
      Re: what's wrong with this code? i am getting a blank page when ipass my form data to it

      anon@the.net wrote:
      [color=blue]
      > mysql_connect(D ELETED)
      > mysql_select_db (DELETED)[/color]

      lines don't end with ;

      --
      Justin Koivisto, ZCE - justin@koivi.co m

      Comment

      • Jan Declercq

        #4
        Re: what's wrong with this code? i am getting a blank page when i pass my form data to it

        nomopofom (anon@the.net) wrote:
        [color=blue]
        > <?php
        >
        > if(! isset($_POST['username'])) {
        > header("Locatio n: login.php");
        > }
        >
        > mysql_connect(D ELETED)
        > mysql_select_db (DELETED)
        >
        > $username = $_POST['username'];
        > $username = mysql_real_esca pe_string($user name);
        > $result = mysql_query("SE LECT userid, pswd FROM users WHERE username =
        > '$username'");
        >
        > if(mysql_num_ro ws($result) > 0) {
        > $row = mysql_fetch_ass oc($result);
        > $userid = $row['userid'];
        > $pswd = $row['pswd'];
        > }
        >
        > $formpswd = $_POST['password'];
        > $formpswd = md5($formpswd);
        >
        > if(mysql_num_ro ws($result) == 0) {
        > header("Locatio n: login.php");
        > } else if($pswd == $formpswd) {
        > session_unset() ;
        > session_destroy ();
        > session_start() ;
        > $_SESSION['userid'] = $userid;
        > header("Locatio n: userhome.php");
        > }
        >
        > mysql_close();
        >
        > ?>[/color]

        If you want the php error reporting, who will tell you what's wrong, instead
        of a white page put: error_reporting (E_ALL); at the beginning of your
        php code
        (if everything works it's better to put it back to: error_reporting (0);
        (http://www.php.net/error_reporting)

        Comment

        Working...