Welcome Guest, Not a member yet? Register   Sign In
Functions Do Not Load Correctly?
#1

[eluser]amw_drizz[/eluser]
I am witting out an application and working on a multi page registration form. And when the 1st registration page loads with my template/theme correctly. Then when you load the user verification that dispatches an email with a link to click and verify the account and to continue the template/themes do not load and just loads the text that is generated from the system to populate the template/theme.

the first form function

Code:
function NewUserFormA()
    {
        $this->themechooser->GetTheme();        

        $this->load->helper(array('form', 'url'));
        $rules['username'] = "callback_username_check|required|min_length[5]|max_legnth[12]|xss_clean";
        $rules['password'] = "required|matches[password1]|md5";
        $rules['password1'] = "required";
        $rules['email'] = "required|matches[email1]|valid_email";
        $rules['email1'] = "required";
        $rules['fname'] = "required|xss_clean";
        $rules['lname'] = "required|xss_clean";
        $rules['street'] = "required|xss_clean";
        $rules['city'] = "required|xss_clean";
        $rules['state'] = "required|xss_clean";
        $rules['zip'] = "required|xss_clean";
        $rules['tos'] = "required";
        $fields['username'] = "Username";
        $fields['password'] = "Password";
        $fields['password1'] = "Password Retype";
        $fields['email'] = "Email";
        $fields['email1'] = "Email Retype";
        $fields['fname'] = "First Name";
        $fields['lname'] = "Last name";
        $fields['street'] = "Street";
        $fields['city'] = "City";
        $fields['state'] = "State";
        $fields['zip'] = "Zip Code";
        $fields['tos'] = "Terms of Service";
        if($_SERVER['REMOTE_ADDR'] == '10.0.0.21'){
            $this->validation->set_rules($rules);
            $this->validation->set_fields($fields);            
            $data['captcha'] = 'not required';
        }
        else{
            $rules['recaptcha_response_field'] = 'required|callback_check_captcha';
            $fields['recaptcha_response_field'] = "Captcha Image Verification";        
            $this->validation->set_fields($fields);
            $this->load->library('recaptcha');
            $data = array(
              'captcha' => $this->recaptcha->recaptcha_get_html()
            );
            
            $this->validation->set_rules($rules);
    
            // Function to check to see if captcha is correctly submitted
            
            function check_captcha($val) {
              $this->recaptcha->recaptcha_check_answer($_SERVER["REMOTE_ADDR"],$this->input->post('recaptcha_challenge_field'),$val);
              if ($this->recaptcha->is_valid) {
                return true;
              } else {
                $this->validation->set_message('check_captcha','Incorrect Security Image Response');
                return false;
              }
            }
        }
        $this->validation->set_error_delimiters('<div class="error">', '</div>');
        if($this->validation->run() == FALSE ){
            $this->load->view('reg/forma',$data);
        }
        else{
            $this->Proc_New1();
        }
    }
That works

This doesn't
Code:
function authenticate(){
        $this->themechooser->GetTheme();        
        $id = $this->uri->segment(3);
        $hash = $this->uri->segment(4);
        $query = $this->db->query("SELECT * FROM users WHERE id='". $id ."' AND reg_hash='". $hash ."'");
        if($query->num_rows() == 1){
            $row = $query->row_array();
            $str['active'] = 'yes';
            $str['lvl'] = '2';
            $this->db->where('id',$id);
            $this->db->update('users',$str);
            $data['base'] = base_url();
            $data['msg'] = "Okay Continue";
            $data['login'] = base_url().'auth/login';
            $this->parser->parse('reg/continue',$data);
            
        }else{
            $data = array(
                'header' => "Error!",
                'msg' => 'Some problems came up, either you waited to long and your account was removed or the link is invalid',
                );
            $this->parser->parse('reg/problem',$data);
        }
    }

Using the same function from my class/library that is loaded and working to get the template to use.

Any Ideas why it does not work on the second one?


Messages In This Thread
Functions Do Not Load Correctly? - by El Forum - 06-24-2008, 08:01 PM
Functions Do Not Load Correctly? - by El Forum - 06-25-2008, 10:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB