The code works, but i want to check if they used my java program to get their infomation. (This is suppose to be a registration form for a gathering, and im using the registration to ensure that we keep track who is there or not) My problem is however, i can't get the if (md5($mac) == $seq) {} to work, no mater what i do it returns false. To clarify the java applet pulls the mac adress from the active adapter and displays it, aswell it converts it into a md5 hash to ensure that the mac address provided is generated by my software. Anyone had this problem before or can see the wrong doings in my code?
<?PHP
$seq = $_POST['seq'];
$mac = $_POST['mac'];
if (md5($mac) == $seq) {
//Database Information
$dbhost = localhost;
$dbname = *****;
$dbuser = *****;
$dbpass = *****;
//Connect to database
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$name = $_POST['name'];
$email = $_POST['email'];
$nick = $_POST['nick'];
$phone_number = $_POST['phone_number'];
$pref_game = $_POST['pref_game'];
$ref = $_POST['ref'];
$firewall_sts = $_POST['firewall_sts'];
$query = "INSERT INTO users (name, email, nick, phone_number, pref_game, ref, firewall_sts, seq, mac)
VALUES('$name', '$email', '$nick', '$phone_number', '$pref_game', '$ref', '$firewall_sts', '$seq', '$mac')";
mysql_query($query) or die(mysql_error());
mysql_close();
printf("<script>location.href='index.html'</script>");
} else {
echo 'Noe gikk galt :S Er du sikker på at du brukte programmet som fulgte med? Prøv igjen eller kontakt admin';
}
?>
The echo at the bottom is norwegian and says something about whether they used my software or not.
Cheers for help
-Thomas
This post has been edited by tomasud: 03 March 2010 - 05:46 PM

New Topic/Question
Reply




MultiQuote





|