[eluser]mfroseth[/eluser]
[quote author="the_unforgiven" date="1337803533"]When linking to css, js always use syntax like this:
Code:
<link rel="stylesheet" href="<?php echo base_url(); ?>css/main.css" type="text/css" />
As for the rest you are talking about post your code in
'[/code] tags and someone will answer you.[/quote]
Thank you very much! The base URL is what I set in config.php correct? So anything after that would be the actual directory (say: view/admin/style.css) right?
I haven't finished creating this function, so it probably doesn't even work as expected right now. I'm still trying to grasp this whole system but here is the login function and displayUsername function:
Code:
public function displayUsername ($username) {
$user_id = $this->session->userdata('user_id');
$query = "SELECT username FROM users WHERE id = $user_id";
$result = $this->db->query($query, array($username));
}
public function login()
{
$this->form_validation->set_rules('username', 'Username', 'required|trim|max_length[50]|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'required|trim|max_length[200]|xss_clean');
if($this->form_validation->run() == FALSE)
{
$this->load->view('view_login');
}
else
{
// process their input and login
$username= $this->input->post('username');
$password= $this->input->post('password');
$user_id = $this->User_model->check_login($username,$password);
if (!$user_id)
{
// login failed error
$this->session->set_flashdata('login_error', TRUE);
echo("Log In Failed");
redirect('user/login', 'refresh');
}
else
{
//log in
$this->session->set_userdata('logged_in',TRUE);
$this->session->set_userdata('user_id', $user_id);
redirect('user/admin_panel', 'refresh');
}
}