Welcome Guest, Not a member yet? Register   Sign In
Noob needs help with email account verification
#1

[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);
#2

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

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

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

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

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

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

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

[eluser]zulubanslee[/eluser]
@jerry01

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

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

[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




Theme © iAndrew 2016 - Forum software by © MyBB