每次填写表格时,系统会将数据两次插入表格?为什么会这样?
// This checks if variabes are not empty, and if username is less than 11 characters long.
if (!empty($username) && !empty($password) && !empty($message) && strlen($username) < 11) {
// Shortcut for our ID generator function.
$ID = generateID();
// Now lets insert (register the account) these datas to our database.
$insert = $connect->prepare(
"INSERT INTO users (
username,
password,
message,
`date`,
`time`,
id
) VALUES (
:username,
:password,
:message,
CURDATE(),
CURTIME(),
:id
)");
// Executing in array, because if …Run Code Online (Sandbox Code Playgroud) 我想问一下,是否可以为每个用户生成一个唯一的salt然后哈希,就好像
sha1(sha1($password . $salt))
$ salt是一个随机生成的字符串?
如果是,我将如何在登录时加密密码?
Xenforo使用这个,我想知道如果他们为每个用户使用独特的盐,他们如何加密密码?
非常感谢.
您好我想检查电子邮件是否有效,如blabla@blabla.com,而不仅仅是纯文本'BLbalbalba'.
我有这个功能:
function VerifyEmail($address)
{
$Syntax='#^[w.-]+@[w.-]+.[a-zA-Z]{2,5}$#';
if(preg_match($Syntaxe,$adrdess))
return true;
else
return false;
}
Run Code Online (Sandbox Code Playgroud)
并检查它像这样:
$email = htmlentities($_POST['email']);
if (!empty($email) && !empty($password) && !empty($message) && VerifyEmail($email) === true) {
Run Code Online (Sandbox Code Playgroud)
得到这些错误:
Notice: Undefined variable: Syntaxe in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Notice: Undefined variable: adrdess in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Warning: preg_match() [function.preg-match]: Empty regular expression in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Notice: Undefined variable: Syntaxe in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Notice: Undefined variable: adrdess in C:\xampp\htdocs\recover\inc\functions.inc.php on line 20
Warning: preg_match() [function.preg-match]: Empty …Run Code Online (Sandbox Code Playgroud)