my_r31_baby Posted July 30, 2006 Share Posted July 30, 2006 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> Link to comment https://forums.phpfreaks.com/topic/15981-problem-with-this-test/ Share on other sites More sharing options...
my_r31_baby Posted July 30, 2006 Author Share Posted July 30, 2006 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 WORKINGif (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> Link to comment https://forums.phpfreaks.com/topic/15981-problem-with-this-test/#findComment-65671 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.