Hi all.. I made this code for the login.php page.. it will compare A value from the users machine (Serial) and with a value inside the database (In that users' row).. so after logging it will check if also this value is the same and then echo something..is the following code is right for that? :
<?php $link = mysql_connect("localhost", "Database username", "Database password) or die("Could not connect: " . mysql_error()); mysql_select_db("Table name", $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $Serial = $_GET['Serial']; $query = "SELECT Serial, Password from accounts where UserName='$UserName'"; $result = mysql_query($query) or die("Query errort: " . mysql_error()); $row = mysql_fetch_row($result) or die("User Not found: " . mysql_error()); $Serial = htmlspecialchars($row[0]); $UserPassword = $row[1]; $UserSerial = $row[1]; mysql_close($link); if($UserSerial == $Serial){ print<<<END <HTML> <BODY> Right serial! </BODY></HTML> END; }else{ print<<<END <HTML> <BODY> Sorry, wrong serial! </BODY></HTML> END; } if($UserPassword == $Password){ print<<<END <HTML> <BODY> Logged in successfully </BODY></HTML> END; }else{ print<<<END <HTML> <BODY> Sorry, wrong password! </BODY></HTML> END; } ?> -------------------------------------------------------------------------------- Please notice : " PHP: ------------------------------------------------------------------------------ $UserSerial = $row[1]; ------------------------------------------------------------------------------ " must I put it " PHP: ------------------------------------------------------------------------------ $UserSerial = $row[2]; ------------------------------------------------------------------------------ " or something else? Regards.. Waiting your reply..