CodeIgniter Forums
Noob needs help with email account verification - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Noob needs help with email account verification (/showthread.php?tid=43662)

Pages: 1 2


Noob needs help with email account verification - El Forum - 07-19-2011

[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/someusername-458492829853473

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);



Noob needs help with email account verification - El Forum - 07-20-2011

[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');



Noob needs help with email account verification - El Forum - 07-20-2011

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


Noob needs help with email account verification - El Forum - 07-20-2011

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

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



Noob needs help with email account verification - El Forum - 07-21-2011

[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?


Noob needs help with email account verification - El Forum - 07-21-2011

[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.


Noob needs help with email account verification - El Forum - 07-21-2011

[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.


Noob needs help with email account verification - El Forum - 07-21-2011

[eluser]zulubanslee[/eluser]
@jerry01

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


Noob needs help with email account verification - El Forum - 07-21-2011

[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?


Noob needs help with email account verification - El Forum - 07-21-2011

[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