ip_address instead of session_id

This commit is contained in:
Claude 2012-06-26 17:41:36 +02:00
parent 0116204a40
commit 0523752675
2 changed files with 8 additions and 7 deletions

View File

@ -121,9 +121,9 @@ class Main extends CI_Controller
'type' => 'VARCHAR',
'constraint' => 8,
) ,
'session_id' => array(
'ip_address' => array(
'type' => 'VARCHAR',
'constraint' => 40,
'constraint' => 16,
'null' => TRUE,
) ,
);
@ -133,7 +133,7 @@ class Main extends CI_Controller
$this->dbforge->add_key('private');
$this->dbforge->add_key('replyto');
$this->dbforge->add_key('created');
$this->dbforge->add_key('session_id');
$this->dbforge->add_key('ip_address');
$this->dbforge->create_table('pastes', true);
}
@ -154,12 +154,13 @@ class Main extends CI_Controller
//check if field session_id exists
if (!$this->db->field_exists('session_id', 'pastes'))
if (!$this->db->field_exists('ip_address', 'pastes'))
{
$this->load->dbforge();
$fields = array(
'session_id' => array(
'ip_address' => array(
'type' => 'VARCHAR',
'constraint' => 40,
'constraint' => 16,
'null' => TRUE,
) ,
);

View File

@ -154,7 +154,7 @@ class Pastes extends CI_Model
$data['snipurl'] = false;
}
}
$data['session_id'] = $this->input->cookie('ci_session');
$data['ip_address'] = $this->input->ip_address();
$this->db->insert('pastes', $data);
return 'view/' . $data['pid'];
}