[eluser]benners[/eluser]
I want to give registered users a personal public (not requiring login) page. E.g. mysite.com/username
I'm new to PHP and CI and I'm not sure how to about this. So far I have this but I get a 404 if I test mysite.com/username. I'm wondering if I need to do a .htaccess redirect if request is not in a list of controller names.
Code:
class MY_Controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->is_user_page();
}
function is_user_page()
{
$username = $this->uri->segment(1);
$query = $this->db->query('SELECT * FROM membership where username="'.$username.'"');
if($query->num_rows() > 0)
$data['user_page'] = $username;
$data['main_content'] = 'user';
$this->load->view('includes/template', $data);
}