Welcome Guest, Not a member yet? Register   Sign In
404 when passing value
#1

[eluser]Unknown[/eluser]
Hi, Im writing a registration system so far it is meant to send an email with a link to "activate" their account.

Code:
http://localhost:8888/CodeIgniter/index.php/register_user/e61ad8d481c669bb00ed9783fb30439b5d03d034

However when clicking on the link it just gives me a 404 and records this in the logs:

Code:
ERROR - 2012-11-18 12:47:07 --> 404 Page Not Found --> pages

I tried adding this in routes:

Code:
$route['register_user/(:any)'] = 'main/register_user/(:any)';

this is my controller:

Code:
public function register_user($key) {

        $this->load->model('model_users');
        if($this->model_users->is_key_valid($key)) {
            echo "valid key";
            if ($this->model_users->add_user($key))
            {
                    echo 'Success';
            }
            else {
                echo 'Failed to add user';
            }

    
        }
        else echo "invalid key";
    }

and my model_users is_key_valid :

Code:
public function is_key_valid($key) {
        $this->db->where('key', $key);
        $query = $this->db->get('temp_users');

        if ($query->num_rows() == 1) {
            return true;
        }
        else return false;
    }


I would really appreciate any help, also let me know If you want any more code that may help.

Thanks!
#2

[eluser]InsiteFX[/eluser]
Code:
$route['CONTROLLER/register_user/(:any)'] = 'main/register_user/$1;
#3

[eluser]Unknown[/eluser]
Thanks for the reply, although it still gives me a 404! Sad

Edit:

I just found in my routes I had this :

Code:
$route['(:any)'] = 'pages/view/$1';

I removed that and now it works! Thank you for the help




Theme © iAndrew 2016 - Forum software by © MyBB