Jump to content


Photo

Problem with this test


  • Please log in to reply
1 reply to this topic

#1 my_r31_baby

my_r31_baby
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 30 July 2006 - 01:25 AM

I have written    "// THIS IS NOT WORKING"    in the script below and im having issues with the if statement under that. Any help would be great...

Cheers

Brendan



<?php
include("db_connect.php");
include("main/functions.php");

//Start Authentication process
$auth = false; // Assume user is not authenticated
$uname = $_POST['username']; //convert all the posts to variables:
$pword = $_POST['password']; //convert all the posts to variables:
$pword = md5($pword); // Hashes password as is in DB

// THIS IS NOT WORKING
if (isset( $_POST['username'] ) && isset( $_POST['password'] )) { // Starts testing if uname and pword match in DB
$sql = "SELECT * FROM online_dvd_users WHERE odvdu_username = $_POST['username'] AND odvdu_password = $_POST['password']"; // Build query for processing
$result = mysql_query( $sql ) or die ( 'Unable to execute query.' ); // Execute the query and put results in $result
$num = mysql_num_rows( $result ); // Get number of rows in $result.

// while ($row = mysql_fetch_assoc($result)) { 
// $u_pk = $row['odvdu_id'];
// $fname = $row['odvdu_firstname'];
// $lname = $row['odvdu_lastname'];

// };

// if ( $num != 0 ) {
// $auth = true; // A matching row was found - the user is authenticated.
// };
};




?>


<!-- ------------------------------------ html starts here ----------------------------------------- -->

<head>

<link href="./css/style.css" rel="stylesheet" type="text/css">
</head>

<body>

<div align="center">
  <p><br>
    <br>
    <br>
    <h1>Online<br>DVD Collections</h1>
  <form name="form1" method="post" action="index.php">
    <p>Username:
      <input type="username" name="username">
      <br>
      Password:
      <input type="password" name="password">
    </p>
    <p>
      <input type="reset" name="reset" value="Reset">
      <input type="submit" name="submit" value="Submit">
    </p>
  </form>
</div>
</body>


#2 my_r31_baby

my_r31_baby
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 30 July 2006 - 01:36 AM

Solved...

Using the $variables is the G O...





<?php
include("db_connect.php");
include("main/functions.php");

//Start Authentication process
$auth = false; // Assume user is not authenticated
$uname = $_POST['username']; //convert all the posts to variables:
$pword = $_POST['password']; //convert all the posts to variables:
$pword = md5($pword); // Hashes password as is in DB

// THIS IS NOT WORKING
if (isset( $uname ) && isset($pword)) { // Starts testing if uname and pword match in DB
$sql = "SELECT * FROM pb_users WHERE odvdu_username = '$uname' AND odvdu_password = '$pword'"; // Build query for processing
$result = mysql_query( $sql ) or die ( 'Unable to execute query.' ); // Execute the query and put results in $result
$num = mysql_num_rows( $result ); // Get number of rows in $result. // Get number of rows in $result.

// while ($row = mysql_fetch_assoc($result)) { 
// $u_pk = $row['odvdu_id'];
// $fname = $row['odvdu_firstname'];
// $lname = $row['odvdu_lastname'];

// };

// if ( $num != 0 ) {
// $auth = true; // A matching row was found - the user is authenticated.
// };
};




?>


<!-- ------------------------------------ html starts here ----------------------------------------- -->

<head>

<link href="./css/style.css" rel="stylesheet" type="text/css">
</head>

<body>

<div align="center">
  <p><br>
    <br>
    <br>
    <h1>Online<br>DVD Collections</h1>
  <form name="form1" method="post" action="index.php">
    <p>Username:
      <input type="username" name="username">
      <br>
      Password:
      <input type="password" name="password">
    </p>
    <p>
      <input type="reset" name="reset" value="Reset">
      <input type="submit" name="submit" value="Submit">
    </p>
  </form>
</div>
</body>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users