<?php
$con = mysql_connect("-Private-","-Private-","-Private");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ThomasRdb", $con);
$sql="INSERT INTO accounts (id, Username, Key, Email)
VALUES
('','$_POST[charactername]','$_POST[password]','$_POST[email]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Your account has been made!";
mysql_close($con);
?>
<html> <body> <form action="insert.php" method="post"> Character name (i.e John_Smith):<input type="text" name="charactername" /> Password: <input type="text" name="password" /> Email: <input type="text" name="email" /> <input type="submit" /> </form> </body> </html>
<?php
echo hash('whirlpool', 'The quick brown fox jumped over the lazy dog.'); // put password in the second param
// DON'T ECHO - THIS IS JUST AN EXAMPLE
?>
I started working with php a few days ago, and I'm not really sure where to place this in my files
|
<?php
$con = mysql_connect("-Private-","-Private-","-Private");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ThomasRdb", $con);
$pwhash = $_POST[password];
$pwhash = hash('whirlpool', $pwhash);
$sql="INSERT INTO accounts (id, Username, Key, Email)
VALUES
('','$_POST[charactername]',$pwhash,'$_POST[email]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Your account has been made!";
mysql_close($con);
?>
<?php
$con = mysql_connect("-Private-","-Private-","-Private");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ThomasRdb", $con);
$pwhash = hash('whirlpool', $_POST[password]);
$sql="INSERT INTO accounts (id, Username, Key, Email)
VALUES
('','" . mysql_real_escape_string($_POST[charactername]) . "', " . $pwhash . ",'" . mysql_real_escape_string($_POST[email]) . "')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Your account has been made!";
mysql_close($con);
?>
$pwhash = hash('whirlpool', $_POST[password]);
$pwhash = $_POST[password];
$pwhash = hash('whirlpool', $pwhash);