A little help, required with this insert.php script, which is meant to add a new user to mysql user, unfortunately when this script is executed, and username and password inserted, it doesn't actually add the new MYSQL USER, instead i just get the error message .
<?php
if(isset($_POST))
{
include ('config.php');
include ('opendb.php');
mysql_select_db($mysql);
$username = $_POST;
$password = $_POST;
$query = "INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) VALUES ('localhost', '$username', PASSWORD('$password'), 'Y', 'Y', 'Y')";
mysql_query($query) or die('Error, insert query failed ');
$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');
include ('closedb.php');
echo "New MySQL user added";
}
else
{
?>
<form method="post">
<table width="400" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="100">Username</td>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td width="100">Password</td>
<td><input name="password" type="text" id="password"></td>
</tr>
<tr>
<td width="100"> </td>
<td> </td>
</tr>
<tr>
<td width="100"> </td>
<td><input name="add" type="submit" id="add" value="Add New User"></td>
</tr>
</table>
</form>
<?php