Welcome Guest, Not a member yet? Register   Sign In
[Solved] Codeigniter & google chrome CSRF works fine in firefox
#1

(This post was last modified: 12-24-2016, 12:08 AM by wolfgang1983.)

Hi,

I have everything working so far with CSRF and fire fox.

How ever when I submit my form on google chrome my form validation error messages do not show up.

But the show up in fire fox? Any suggestions

Unless it's because CSRF is protecting form so I can only use one browser at a time?

I have attached the view

PHP Code:
$config['cookie_prefix']    'ci_';
$config['cookie_domain']    '.localhost';
$config['cookie_path']        '/';
$config['cookie_secure']    FALSE;
$config['cookie_httponly'    TRUE;

$config['csrf_protection'] = TRUE;
$config['csrf_token_name'] = 'my_post_key';
$config['csrf_cookie_name'] = 'cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array(); 


PHP Code:
<?php

class Newthread extends CI_Controller {

    public function 
__construct() {
        
parent::__construct();
        
$this->load->library('form_validation');
        
$this->load->model('newthread_model');
        
$this->load->helper('smiley');
    }

    public function 
index() {
        
$data['title'] = 'Newthread in ' $this->newthread_model->get_forum_title($this->uri->segment(2));

        if (
$this->input->post('preview_submit')) {
            
$data['preview'] = parse_smileys($this->input->post('message'), base_url('assets/images/smileys/'));
        } else {
            
$data['preview'] = '';
        }

 
       $data['smiley_table'] = get_clickable_smileys(base_url('assets/images/smileys/'), 'message');
        
        
$this->form_validation->set_rules('subject''subject''required');

        if (
$this->form_validation->run() == false) {

            
$this->load->view('header'$data);
            
$this->load->view('newthread'$data);
            
$this->load->view('footer');

        } else {

            if (
$this->input->post('preview_submit')) {}

            if(
$this->input->post('newthread_submit')) {

                
redirect("forum/" $this->uri->segment(2));

            }

        }
    }



Attached Files
.php   newthread.php (Size: 3.99 KB / Downloads: 118)
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#2

(This post was last modified: 12-24-2016, 12:38 AM by wolfgang1983.)

Solution for me now both browsers work fine now.

I have had to create a vHost instead of just using normal localhost.

And then on


PHP Code:
$config['cookie_prefix']    'ci_';
$config['cookie_domain']    '.dev_project.com';
$config['cookie_path']        '/';
$config['cookie_secure']    FALSE;
$config['cookie_httponly'    TRUE



It's fun learning what works and does not. Not sure why vhost better?
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB