Loading ...
Sorry, an error occurred while loading the content.

login/match text with table value

Expand Messages
  • Bryan Schulz
    hi, hope someone can point me in the right direction. test data: tried user: Team_Valvoline and Team Valvoline with password: snoopy5x and the page resulting
    Message 1 of 1 , Dec 30, 2012
    • 0 Attachment
      hi,

      hope someone can point me in the right direction.
      test data:
      tried user: Team_Valvoline and Team Valvoline with password: snoopy5x
      and the page resulting from this code is blank:

      <?php
      //start the session
      session_start();

      $errMsg = "";
      //from owners1.php form:
      if (isset($_POST['teamname']) && isset($_POST['teampass'])) {
      include 'connect.php';
      $owner = $_POST['teamName'];
      $password = $_POST['teamPass'];

      // check if the user id and password combination exist in database
      //swap space for underscore to match the dbtName
      $owner = str_replace(" ", "_", $owner);

      $sqlLine = "SELECT dbtName FROM owners WHERE dbtName = '$owner' AND
      dbtPass = '$password')";

      $result = mysql_query($sqlLine)
      or die('Query failed. ' . mysql_error());

      if (mysql_num_rows($result) == 1) {
      // the user id and password match,
      //the owner didn't type _ so swap _ back
      $owner = str_replace("_", " ", $owner);

      // set the session
      $_SESSION['logged_in'] = true;
      $_SESSION['owner'] = $owner;
      // echo "owner is " .$owner;

      //show owners2.php to valid owner
      header("Location: owners2.php");
      //echo "valid <br>";
      //echo "owner is: " .$owner ."<br>";
      //echo "password is: " .$password ."<br>";
      // break;
      } else {
      $errMsg = 'Sorry, wrong team name or password';
      header("Location: owners1.php");
      echo $errMsg ."<br>";
      //echo "owner is: " .$owner ."<br>";
      //echo "password is: " .$password ."<br>";
      }
      }
      ?>

      Bryan Schulz
    Your message has been successfully submitted and would be delivered to recipients shortly.