|
代码如下,却导致Session丢失,需要重新登录
PHP复制代码
$urlregex = "^(https?|ftp)\:\/\/([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*(\:[0-9]{2,5})?(\/([a-z0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-z0-9;/&%=+\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?\$";
if (@eregi($urlregex, $this->input->post('url', TRUE)))
{
$headers = get_headers($this->input->post('url', TRUE), 1);
if ($headers[0] == 'HTTP/1.1 200 OK') {
$this->load->model('Download_model');
$this->load->database();
$this->Download_model->add_task($this->input->post('url', TRUE),$data['user_name']);
$this->session->set_flashdata('popup', 'index.php/downloads/submit_download_task/'.urlencode($this->input->post('url')).'/'.time());
} else {
$this->session->set_flashdata('vaild', '1');
}
redirect ('/downloads');
} else {
$this->session->set_flashdata('vaild', '1');
redirect ('/downloads');
}
复制代码 |
|