Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:





Name:


Age:


Email:


Password:


Phonenumber:



Register



prepare("SELECT * FROM register WHERE Email= :Email");
$email = $_POST['email'];
$checkEmail->bindParam("Email", $email);
$checkEmail->execute();
if ($checkEmail->rowCount() > 0) {
echo 'Email already used before try to use another one please';
} else {

$email = $_GET['email'];
$phonenumber = $_POST['phonenumber'];
$age = $_POST['age'];
$name = $_GET['name'];
$password = $_POST['password'];

$addUser = $database->prepare("INSERT INTO register (name,Email,Phonenumber,Birthdate,Password)
VALUES(:Name,:Email,:Phonenumber,:Birthdate,:Password) ");
$addUser->bindParam("Name", $name);
$addUser->bindParam("Email", $email);
$addUser->bindParam("Phonenumber", $phonenumber);
$addUser->bindParam("Age", $age);
$addUser->bindParam("Password", $password);
if ($addUser->execute()) {
echo "Signed up successfully";

} else {
echo "failed to sign up";
}
}
}
?>

What I have tried:

how can i solve that error pls?
Posted
Updated 20-Dec-22 8:26am
v2
Comments
Member 15627495 18-Dec-22 6:30am    
in the 'prepare' section, you register the var as 'birthdate' , then in bindparam , you use 'Date' as name field. choose between the two. the error is here. ( parameter not defined ) because Date is unknown for your bindparam statement.
Member 15627495 18-Dec-22 6:50am    
about your PDO use :
you're missing the best part, the 'filtering by Types'

you only use the 'prepare' ( and 'bind' ) , it's simply a 'String build' as it.

read here, Types are used for filtering, and so strenghing security
$sth->bindParam('calories', $calories, PDO::PARAM_INT);
the last parameter is needed, it's the Type to use ,
without this one, you're just processing a string build only


read : https://www.php.net/manual/en/pdostatement.bindparam.php
Richard Deeming 19-Dec-22 4:22am    
You are storing your users' passwords in plain text. Don't do that!
Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]

PHP has built-in functions to help you do the right thing:
PHP: password_hash[^]
PHP: password_verify[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900