Saldash
18-04-11, 20:29
Hey folks,
Wondering if you guys might be able to help me out with a problem I'm having getting a PHP script to work correctly.
To start off, the script is designed to take input from $_POST (scrubbing of $_POST will be added when I get the main script working), fetch all columns from a record in a database table and compare two strings.
mysql_connect("dbhost", "dbuser", "dbpass") or die(mysql_error());
mysql_select_db("databasename");
If (!empty($_POST)) {
$post_user = $_POST['usr'];
$post_pass = $_POST['pas'];
$result = mysql_query("SELECT * FROM vbnet_auth WHERE username = $post_user") or die(mysql_error());
$row = mysql_fetch_array( $result );
If ( $post_user == $row['username'] ) {
If ( $post_pass == $row['app_key'] ) {
Echo "auth_yes";
} Else {
Echo "auth_no";
}
} Else {
Echo "auth_no";
}
} Else {
die("Hacking Attempt!");
}
Problem is I keep getting a return error Unknown column '{username}' in 'where clause'
Where {username} is the username submitted through $_POST['usr'] to $post_user
The basic purpose of this script is purely to verify that registered username's product key is valid.
(I submit the POST data using httpwebrequest and read off the scripts Echo in httpwebresponse using my vb.net application.)
Again, I know it's far from secure, but I want to get the basic system working before I make it more complex.
Any help would be super appreciated!
Wondering if you guys might be able to help me out with a problem I'm having getting a PHP script to work correctly.
To start off, the script is designed to take input from $_POST (scrubbing of $_POST will be added when I get the main script working), fetch all columns from a record in a database table and compare two strings.
mysql_connect("dbhost", "dbuser", "dbpass") or die(mysql_error());
mysql_select_db("databasename");
If (!empty($_POST)) {
$post_user = $_POST['usr'];
$post_pass = $_POST['pas'];
$result = mysql_query("SELECT * FROM vbnet_auth WHERE username = $post_user") or die(mysql_error());
$row = mysql_fetch_array( $result );
If ( $post_user == $row['username'] ) {
If ( $post_pass == $row['app_key'] ) {
Echo "auth_yes";
} Else {
Echo "auth_no";
}
} Else {
Echo "auth_no";
}
} Else {
die("Hacking Attempt!");
}
Problem is I keep getting a return error Unknown column '{username}' in 'where clause'
Where {username} is the username submitted through $_POST['usr'] to $post_user
The basic purpose of this script is purely to verify that registered username's product key is valid.
(I submit the POST data using httpwebrequest and read off the scripts Echo in httpwebresponse using my vb.net application.)
Again, I know it's far from secure, but I want to get the basic system working before I make it more complex.
Any help would be super appreciated!