Web Registration Error

Socius Decennalis
Decennium
Joined
Jun 16, 2009
Messages
103
Reaction score
16
i have this error when try to reg an accont
SQLSTATE[HY000]: General error: 1364 Field 'PasswordRecovery' doesn't have a default value
please help me
 
Last edited:
You have a problem in your Database row or in the registration form, the field 'PasswordRecovery' is probably NULL or EMPTY on form submission (when you INSERT the query) and generate an exception, check in your database if the account has been created and if the value exist and is NULL or EMPTY, you can just change the value with a query ( UPDATE tablename SET PasswordRecovery='SOMEVALUE' WHERE id=1 ) or from PHPMyAdmin or Navicat, if the PasswordRecovery field is missing, try to drop the database and restore it again, or try to use another web registration script.
 
Upvote 0
please help and thanks in advance!!! i have the same error when try to register an account i am a noob so be gentle i got lost around here.

''( UPDATE tablename SET PasswordRecovery='SOMEVALUE' WHERE id=1 ) or from PHPMyAdmin or Navicat, if the PasswordRecovery field is missing, try to drop the database and restore it again, or try to use another web registration script.''

not exactly shure what you mean about somevalue or should i copy and paste? and i have no idea how to?? drop the database and restore it again??


here is a copy paste of my sql database password section
-- ----------------------------
-- Table structure for `accounts`
-- ----------------------------
DROP TABLE IF EXISTS `accounts`;
CREATE TABLE `accounts` (
`AccountId` int(11) NOT NULL AUTO_INCREMENT,
`Username` varchar(32) NOT NULL,
`Password` varchar(512) NOT NULL,
`Email` varchar(32) NOT NULL,
`AccessLevel` int(1) NOT NULL DEFAULT '0',
`Membership` int(1) NOT NULL DEFAULT '0',
`isGM` int(1) NOT NULL DEFAULT '0',
`LastOnlineUtc` bigint(64) NOT NULL DEFAULT '0',
`Coins` int(11) NOT NULL DEFAULT '0',
`Ip` varchar(64) NOT NULL,
`EmailVerify` varchar(256) NOT NULL,
`PasswordRecovery` varchar(128) NOT NULL, <---not sure what is wrong here?
PRIMARY KEY (`AccountId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
and my register.php
<?php
require 'core/init.php';
$general->logged_in_protect();

if (isset($_POST['submit']))
{
if(empty($_POST['username']) || empty($_POST['password']) || empty($_POST['email']) || empty($_POST['re-password']) || empty($_POST['re-email']))
{
$errors[] = 'Missing some data...';
}
if(empty($_POST['username']))
{
$errors[] = '<br>-Username not found!';
}
if(empty($_POST['password']))
{
$errors[] = '<br>-Password not found!';
}
if(empty($_POST['re-password']))
{
$errors[] = '<br>-Password Check not found!';
}
if(empty($_POST['email']))
{
$errors[] = '<br>-E-Mail not found!';
}
if(empty($_POST['re-email']))
{
$errors[] = '<br>-E-Mail check not found!';
}
if($_POST['password'] != $_POST['re-password'])
{
$errors[] = '<br>-Password and Password check not the same!';
}
if($_POST['email'] != $_POST['re-email'])
{
$errors[] = '<br>-E-Mail and E-Mail check not the same!';
}
if(!ctype_alnum($_POST['username']))
{
$errors[] = '<br>-Username not allowed! Only alphabets and numbers allowed';
}
if (strlen($_POST['password']) <4 || strlen($_POST['password']) >32)
{
$errors[] = '<br>-Password must be at least 4 and maximal 32 characters long';
}
if ($accounts->username_exists($_POST['username']) === true || $accounts->email_exists($_POST['email']) === true)
{
$errors[] = '<br>-This Username or E-Mail already exists';
}
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false)
{
$errors[] = '<br>-E-Mail Address is not a valid input!';
}
if(empty($errors) === true)
{
$username = htmlentities($_POST['username']);
$password = $_POST['password'];
$email = htmlentities($_POST['email']);

$accounts->register($username, $password, $email );
header('Location: register.php?success');

exit();
}
}

?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/style.css" >
<title>Register</title>
</head>
<body>
<div id="header"></div>

<div id="container">
<?php include 'includes/menu.php'; ?>
<h1>Create Account</h1>

<?php
if (isset($_GET['success']) === true && empty($_GET['success']) === true)
{
?>
<h2_std>Registration complete,<br> please check your E-Mail to activate your Account.</h2_std>
<?php
}
else
{
?>
<?php
if(empty($errors) === false)
{
echo '<h2_std>' . implode('</h2_std><h2_std>', $errors) . '</h2_std>';
}
?>
<form method="post" action="">
<input type="text" class="inputs" placeholder="Username" name="username" value="<?php if(isset($_POST['username'])) echo htmlentities($_POST['username']); ?>" ><br>
<input type="password" class="inputs" placeholder="Password" name="password" /><br>
<input type="password" class="inputs" placeholder="Password" name="re-password" /><br>
<input type="text" class="inputs" placeholder="E-Mail" name="email" value="<?php if(isset($_POST['email'])) echo htmlentities($_POST['email']); ?>"/><br>
<input type="text" class="inputs" placeholder="E-Mail" name="re-email" value="<?php if(isset($_POST['email'])) echo htmlentities($_POST['email']); ?>"/><br>
<input type="submit" class="css_button" value="Register" name="submit" />
</form>
<?php
}
?>
</div>
</body>
</html>
 
Upvote 0
Back