Here is the following code snippet of php i wrote.
$password=$_POST['password'];
//$password = crypt($password);
$key=md5($password);
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CFB);
$iv=mcrypt_create_iv($iv_size, MCRYPT_RAND);
$password=mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $password, MCRYPT_MODE_CFB, $iv);
/*if (!get_magic_quotes_gpc())
{
$_POST['password'] = addslashes($_POST['password']);
}*/
// now we insert it into the database
if($flag==0 && $flag1==0)
{
echo ' Login Success ' ;
$insert = "INSERT INTO users(email,password,date,month,year,city,state,country,name,sex,address,error,key,iv)
VALUES ('$_POST[email]' ,'$password' ,'$_POST[date]' ,'$_POST[month]', '$_POST[year]', '$_POST[city]',
'$_POST[state]', '$_POST[country]', '$_POST[name]', '$_POST[sex]', '$_POST[address]','nothing','$key','$iv')";
$add_member = mysql_query($insert,$con);
if(!$add_member)
die(mysql_error());
header("location:home.php");
}
but on execution m getting the following error:
Login Success You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key,iv) VALUES ('vxerj' ,'&¡ø' ,'-1' ,'-1', '-1', 'ada', ' at line 1
Help please!