CodeIgniter Forums

Full Version: Noob needs help with email account verification
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

El Forum

[eluser]zulubanslee[/eluser]
Ok so I have user create account, create a random string, store it in the database and send the user this link:

http://example.com/login/verifyaccount/s...2829853473

User clicks on the link naturally, but when they do I get a 404 error.

Here is my controller
Code:
$string    = $this->uri->segment(3);            
$verification= preg_split('/-/', $string);
$username = $verification[0];
$security_string         = $verification[1];
$verification_array = array($username, $security_string);
$this->load->model('usersmodel');
$status = $this->usersmodel->verifyaccount($verification_array);
$data['status'] = $status;
$this->load->view('verifyaccountview', $data);

El Forum

[eluser]Emkay[/eluser]
I'm not 100% sure but I don't think CI allows hyphens in the parameters or function names. Try using GET queries instead if you want to pass multiple variables.

Use the form

Code:
http://example.com/login/verifyaccount?username=someusername&code=458492829853473

Get the username and code using $this->input->get()

Code:
$username = $this->input->get('username');
$security_string = $this->input->get('code');

El Forum

[eluser]zulubanslee[/eluser]
thanks i'll try this in a bit and get back

El Forum

[eluser]jerry01[/eluser]
i thought hyphen was allowed, as per the config statement:

Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

El Forum

[eluser]osci[/eluser]
@jerry01 hyphens are allowed as you showed.

@zulubanslee getting a 404 means it doesn't find your controller or method. Is your class Login and method verifyaccount?

El Forum

[eluser]jerry01[/eluser]
i had a similar problem at one point. It's because i had coded my link as

Code:
www.example.com/mtcontrlr/mymthd/123545
and really the code was missing
Quote:index.php

the working link was

Code:
www.example.com/index.php/mtcontrlr/mymthd/123545

i assume that your issue is not something so simple though.

El Forum

[eluser]zulubanslee[/eluser]
[quote author="osci" date="1311264928"]@jerry01 hyphens are allowed as you showed.

@zulubanslee getting a 404 means it doesn't find your controller or method. Is your class Login and method verifyaccount?[/quote]

Yes it is.

El Forum

[eluser]zulubanslee[/eluser]
@jerry01

I thought of that and tried it, and it still doesn't work.

El Forum

[eluser]osci[/eluser]
You should check error log files.

Mind posting your controller in full?
If you don't want to, do you have any other method in Login class? Is it working?

El Forum

[eluser]zulubanslee[/eluser]
The controller is called login. Here is the function.
Code:
function verifyaccount($security_code)
{
  $this->load->model('usersmodel');
  $status = $this->usersmodel->verifyaccount($security_code);
  $data['status'] = $status;
  $this->load->view('verifyaccountview', $data);
}

Also, where is the error log file;


thanks
Pages: 1 2