我对回答问题有点陌生,所以请耐心等待。而且我已经阅读了帖子,并且我已经看到不再使用 mysql_ 了。我知道,所以不要告诉我不要使用它。
无论如何,我有这个代码,每当我尝试使用它注册时,密码都不会在 MD5 中散列。我已经删除了
$mdhash = md5('$name');
因为我需要你的帮助。
这是代码:
<?php
session_start();
include('./dbconnect/global.php');
if (isset ($_POST['submit'])) {
$comment = mysql_escape_string (trim ($_POST['username']));
$id = 0;
$date = date("Y-m-d");
if(!empty($_POST['username']) && !empty($_POST['password']) && !empty($_POST['email'])){
if ($_POST['username']=="telamon" or $_POST['username']=="brick") {
die("This username is banned");
}
$name = mysql_escape_string (trim ($_POST['password']));
$mdehash = md5($name);
$email = mysql_escape_string (trim ($_POST['email']));
$picture = $_POST['def'];
$tweet = 'NoTweetsTweeted';
$g = mysql_query( "SELECT * FROM admin WHERE username='".$comment."'") or die(mysql_error());
if (mysql_num_rows($g) >= 1) {
$errMsg = "<p style='color:#999999;'>That username is already registerd!</p>";
}else {
if ( preg_match("/^[a-zA-Z0-9]+$/i", $comment) ) {
$sql = mysql_query ("INSERT INTO admin (id,username,password,date,picture,email,twitter) VALUES ('".$id."','".$comment."','".$name."','".$date."','".$picture."','".$email."','".$tweet."')");
header('location: home.php');
}else
$errMsg = "<p style='color:#999999;'>Please fill all fields!</p>";
}
}
}
?>
所以,如果我能得到一些帮助,那将不胜感激!提前致谢!