Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.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
您的MySQL服务器版本提供了使用near'@hotmail.com';在1号线_Mysql_Codeigniter - Fatal编程技术网

您的MySQL服务器版本提供了使用near'@hotmail.com';在1号线

您的MySQL服务器版本提供了使用near'@hotmail.com';在1号线,mysql,codeigniter,Mysql,Codeigniter,我已经通过Codeigniter制作了表单,当我发送请求时重置密码,并返回错误信息 您的SQL语法有错误;在第1行“@hotmail.com”附近,查看与您的MySQL服务器版本对应的手册,了解要使用的正确语法 这是我的控制器 function index() { $this->load->model("user_model"); $config['protocol'] = 'smtp'; $config['smtp_host'] = 'ssl:

我已经通过Codeigniter制作了表单,当我发送请求时重置密码,并返回错误信息 您的SQL语法有错误;在第1行“@hotmail.com”附近,查看与您的MySQL服务器版本对应的手册,了解要使用的正确语法

这是我的控制器

function index()
{

    $this->load->model("user_model");
    $config['protocol']    = 'smtp';
    $config['smtp_host']    = 'ssl://abuqir.net';
    $config['smtp_port']    = '465';
    $config['smtp_timeout'] = '7';
    $config['smtp_user']    = 'myuser';
    $config['smtp_pass']    = 'mypass';
    $config['charset']    = 'utf-8';
    $config['newline']    = "\r\n";
    $config['mailtype'] = 'text'; // or html
    $config['validation'] = TRUE; // bool whether to validate email or not  
    $email_to  = $this->input->get('email');
    $pass_message = $this->user_model->get_pass($email_to);
    $this->email->initialize($config);

    $this->email->from('admin-team@abuqir.net', 'admin team');
    $this->email->to($email_to); 

    $this->email->subject('Reset password');
    $this->email->message($pass_message);  
    $this->email->send();

    echo $this->email->print_debugger();

    $this->load->view('email_view');
}
这是我的模型

public function get_pass($user_mail) {
    $user_mail = mysqli_real_escape_string($user_mail);
    $query = $this->db->query('SELECT password'
            . ' from users '
            . 'where email = '.$user_mail
            );

    return $query;

}
您忘记在查询中用单引号包装电子邮件

注意:我不确定如何使用CodeIgnitor构建参数查询,请使用该查询,因为此查询严重不安全,并且是密码重置查询,可能是更多的公共代码,不推荐使用

您忘记在查询中用单引号包装电子邮件

注意:我不确定如何使用CodeIgnitor构建参数查询,请使用该查询,因为此查询严重不安全,并且是密码重置查询,可能是更多的公共代码,不推荐使用


在型号中

public function get_pass($user_mail) 
{
    $user_mail = mysqli_real_escape_string($user_mail);
    $query = $this->db->query("SELECT password  from users where email = '$user_mail'");
    $result = $query->result_array();
    return $result;    
}
在控制器中

function index()
{

    $email_to  = $this->input->post('email'); //check GET otr POST
    $pass_message = $this->user_model->get_pass($email_to);
    if(!empty($pass_message))
    {
        $this->load->model("user_model");
        $config['protocol']    = 'smtp';
        $config['smtp_host']    = 'ssl://abuqir.net';
        $config['smtp_port']    = '465';
        $config['smtp_timeout'] = '7';
        $config['smtp_user']    = 'myuser';
        $config['smtp_pass']    = 'mypass';
        $config['charset']    = 'utf-8';
        $config['newline']    = "\r\n";
        $config['mailtype'] = 'text'; // or html
        $config['validation'] = TRUE; // bool whether to validate email or not  

        $this->email->initialize($config);

        $this->email->from('admin-team@abuqir.net', 'admin team');
        $this->email->to($email_to); 

        $this->email->subject('Reset password');
        $this->email->message($pass_message[0]['password']);  

        if(! $this->email->send())
        {
            echo $this->email->print_debugger();
        }
        else
        {
            //Email sending failed
            $this->load->view('email_view');
        }  
    }
    else
   {
        // Successfully sent
        echo 'Invalid E-Mail Address'
   }

}
在配置邮件之前,请检查电子邮件有效性,然后执行其余代码

当您使用
$this->input->post
时,它也将充当
mysqli\u real\u escape\u string
。对于进一步,您需要从
XSS
使用布尔
TRUE
进行安全保护。(
$this->input->post('some_data',TRUE);


在型号中

public function get_pass($user_mail) 
{
    $user_mail = mysqli_real_escape_string($user_mail);
    $query = $this->db->query("SELECT password  from users where email = '$user_mail'");
    $result = $query->result_array();
    return $result;    
}
在控制器中

function index()
{

    $email_to  = $this->input->post('email'); //check GET otr POST
    $pass_message = $this->user_model->get_pass($email_to);
    if(!empty($pass_message))
    {
        $this->load->model("user_model");
        $config['protocol']    = 'smtp';
        $config['smtp_host']    = 'ssl://abuqir.net';
        $config['smtp_port']    = '465';
        $config['smtp_timeout'] = '7';
        $config['smtp_user']    = 'myuser';
        $config['smtp_pass']    = 'mypass';
        $config['charset']    = 'utf-8';
        $config['newline']    = "\r\n";
        $config['mailtype'] = 'text'; // or html
        $config['validation'] = TRUE; // bool whether to validate email or not  

        $this->email->initialize($config);

        $this->email->from('admin-team@abuqir.net', 'admin team');
        $this->email->to($email_to); 

        $this->email->subject('Reset password');
        $this->email->message($pass_message[0]['password']);  

        if(! $this->email->send())
        {
            echo $this->email->print_debugger();
        }
        else
        {
            //Email sending failed
            $this->load->view('email_view');
        }  
    }
    else
   {
        // Successfully sent
        echo 'Invalid E-Mail Address'
   }

}
在配置邮件之前,请检查电子邮件有效性,然后执行其余代码

当您使用
$this->input->post
时,它也将充当
mysqli\u real\u escape\u string
。对于进一步,您需要从
XSS
使用布尔
TRUE
进行安全保护。(
$this->input->post('some_data',TRUE);


请不要在这里添加您的服务器密码!!这是一个公共站点。我强烈建议您更改服务器密码。现在你把它添加到这里,很可能它会被黑客攻击。在你问像这样的新手问题之前,先看看谷歌。可能是重复的请不要在这里添加你的服务器密码!!这是一个公共站点。我强烈建议您更改服务器密码。现在你添加到这里,很可能它会被黑客攻击。在你问新手这样的问题之前,先看看谷歌。可能的严重性重复:4096消息:类CI_DB_mysqli_结果的对象无法转换为字符串严重性:4096消息:类CI_DB_mysqli_结果的对象无法转换为字符串