Это контроллер
public function register(){
require_once(APPPATH.'libraries/PHPMailer1/class.phpmailer.php');
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
$this->form_validation->set_rules('email', 'Email', 'valid_email|required');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[7]|max_length[30]');
if ($this->form_validation->run() == FALSE) {
$this->load->view('collg_admin/register', $this->data);
}
else{
//get user inputs
$email = $this->input->post('email');
$password = $this->input->post('password');
//generate simple random code
$set = '123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$code = substr(str_shuffle($set), 0, 12);
//insert user to users table and get id
$user['email'] = $email;
$user['password'] = $password;
$user['code'] = $code;
//$user['active'] = false;
$id = $this->front->insert($user);
//set up email
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'example@domain.com',
'smtp_pass' => 'XXXXXXXX',
'mailtype' => 'html',
'newline' => "\r\n",
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = "
<html>
<head>
<title>Verification Code</title>
</head>
<body>
<h2>Thank you for Registering.</h2>
<p>Your Account:</p>
<p>Email: ".$email."</p>
<p>Password: ".$password."</p>
<p>Please click the link below to activate your account.</p>
<h4><a href='https://aplusedu.in/demoserver/college_panel/activate/".$id."/".$code."'>Activate My Account</a></h4>
</body>
</html>
";
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from($config['smtp_user']);
$this->email->to($email);
$this->email->subject('Signup Verification Email');
$this->email->message($message);
//sending email
if($this->email->send()){
$this->session->set_flashdata('message','Activation code sent to email');
}
else{
$this->session->set_flashdata('message', $this->email->print_debugger());
}
redirect(base_url().'access/college_panel/register');
// redirect('verify');
}
}
public function verify()
{
$this->load->view('collg_admin/verify');
}
public function activate(){
$id = $this->uri->segment(3);
$code = $this->uri->segment(4);
//fetch user details
$user = $this->front->getUser($id);
//if code matches
if($user['code'] == $code){
//update user active status
$data['active'] = true;
$query = $this->front->activate($data, $id);
if($query){
$this->session->set_flashdata('message', 'User activated successfully');
}
else{
$this->session->set_flashdata('message', 'Something went wrong in activating account');
}
}
else{
$this->session->set_flashdata('message', 'Cannot activate account. Code didnt match');
}
redirect('register');
}
Это verify.php
<?php
echo "Thank you for verify";
?>
Я получаю страницу ошибки 404, когда нажимаю ссылку Gmailв URL в учетной записи Gmail:
https://aplusedu.in/demoserver/college_panel/activate/272/R7C19jGIfxo3
Приведенная выше ссылка показывает страницу 404 не найдена.По вышеуказанной ссылке я должен получить сообщение:
«Спасибо за проверку».
Почему я получаю страницу ошибки 404, не найденную.В чем проблема в коде?