Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php kespersy不允许在数据库中存储密码_Php_Html_Css_Ajax - Fatal编程技术网

Php kespersy不允许在数据库中存储密码

Php kespersy不允许在数据库中存储密码,php,html,css,ajax,Php,Html,Css,Ajax,我正在使用kespersy antivirus。我想在数据库中存储详细信息。但测试时未打印密码和确认密码值。 除了password和confirm password之外,所有字段值都会回显。$pass是password变量,$c_pass是confirm password变量 <form name="profile" method="post"> <p style="margin-left:1cm">Name<a style="margin-le

我正在使用kespersy antivirus。我想在数据库中存储详细信息。但测试时未打印密码和确认密码值。 除了password和confirm password之外,所有字段值都会回显。$pass是password变量,$c_pass是confirm password变量

<form name="profile" method="post">

         <p style="margin-left:1cm">Name<a style="margin-left:45px"></a>&nbsp: <input type="text" name="p_name" size=18 maxlength=50></p>
         <p style="margin-left:1cm">Email<a style="margin-left:45px"></a>&nbsp: <input type="text" name="email" size=18 maxlength=50></p>
         <p style="margin-left:1cm">Password<a style="margin-left:25px"></a>&nbsp: <input type="password" name="pass" size=18 maxlength=50></p>
         <p style="margin-left:1cm">Confirm<a style="margin-left:30px"></a>&nbsp: <input type="password" name="c_pass" size=18 maxlength=50></p>
         <p style="margin-left:1cm">Phone<a style="margin-left:45px"></a>&nbsp: <input type="text" name="phone" size=18 maxlength=50></p>
         <p style="margin-left:1cm">Address<a style="margin-left:30px"></a> : <textarea name="address" max=200></textarea></p>
         <p style="margin-left:1cm">EIN<a style="margin-left:50px"></a>  &nbsp :  <textarea name="ein" max=200></textarea></p>
         <center><input type="submit" name="edit" value="Edit" /> </center>
        </form>
 <?php
 include "config.php";
 if(isset($_REQUEST['edit']))
 {
  echo "hai";
  echo $pass=$_REQUEST['Pass'];
   echo $c_pass=$REQUEST['c_pass'];
   echo $address=$_REQUEST['address'];
   echo $p_name=$_REQUEST['p_name'];
   echo $phone=$_REQUEST['phone'];
   echo $email=$_REQUEST['email'];
   echo $ein=$_REQUEST['ein'];
    echo $datz=date('m-d-yy h:i:s');
    if($pass==$c_pass)
    {
    echo $c_pass;
    echo $pass;
      if($p_name!='' && $address!='' && $p_name!='' && $phone!='' && $email!='' && $ein!='' && $pass!='')
 {
  echo $sql="insert into register(name,address,contact_name,phone,email,password,ein,c_date) values ('$name','$address','$p_name','$phone','$email','$pass','$ein','$datz')";
   if(mysql_query($sql))
    {
      echo ("<SCRIPT LANGUAGE='JavaScript'>
       window.alert('registered successfully');

       </SCRIPT>");
    }
  else
  {
        echo ("<SCRIPT LANGUAGE='JavaScript'>
       window.alert('try again');

       </SCRIPT>");   
      } 
 }
}
 }

 ?>

首先,为什么要使用$\u请求变量

如果您使用$\u POST,则会更安全

你能用你的HTML表格更新你的问题吗,这样我们就可以看到你在那里做了什么

另一个建议是使用函数甚至

使用预先准备好的语句,您可以更好地抵御Jack提到的SQL注入

如果不使用预先准备好的语句,则在将用户输入保存到数据库中之前,必须先转义用户输入,这一点非常重要:

$name = mysqli_real_escape_string($dblink, $name);
你不应该以明文形式保存密码,至少使用MD5

$pass = md5($pass);
更好地使用BlackPearl提到的SHA1:

$pass = sha1($pass);
更新:

我在您的HTML中看到输入错误:

<input type="password" name="pass" size=18 maxlength=50></p>
这是错误的


您必须使用相同的名称,它区分大小写。

明文密码、XSS和SQL注入;你已经拥有了一切-sha1更好,但仍然脆弱。
$_REQUEST['Pass']