⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

POST http://localhost/xxx/index.php/asl/istituto_management/insert 403 (Forbidden)



giuseppe

giuseppe
  • profile picture
  • Member

Posted 05 September 2017 - 15:11 PM

Hello,

 

i have the error in the title in my console ....

 

if I resend the data  change the function but not the error 

 

http://localhost/xxx/index.php/asl/istituto_management/insert_validation 403 (Forbidden)

 

what or how I can set to enable the resource?

 

Thanks in advance

Giuseppe

 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 06 September 2017 - 04:42 AM

Sorry my friend, could not understand your concern - as what you wanted to convey. If you can demonstrate the issue using the code & screen outputs, it will be easy / simple for us to identify what / where is the issue and give u appropriate solution.


giuseppe

giuseppe
  • profile picture
  • Member

Posted 06 September 2017 - 08:27 AM

Ok... right....

 

I develop a controller with this function in my controller

 

public function istituto_management()
{
 
if($this->require_min_level(1))  // tramite questa richiesta chiedo il login
{
 
echo $this->load->view('page_header', '', TRUE);
//$this->_example_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));
}
 
//echo $this->load->view('examples/page_header', '', TRUE);
$crud = new grocery_CRUD();
 
$a_Istituto = array('Istituti_Intestazione','Istituti_Indirizzo','Istituti_CAP','Istituti_Citta','Istituti_ResponsabileASL');
$crud->set_table('istituti');
$crud->columns($a_Istituto);
$crud->display_as('Istituti_Intestazione',$this->lang->line('liceo'))
->display_as('Istituti_DescrizioneBreve',$this->lang->line('desbreve'))
->display_as('Istituti_Indirizzo',$this->lang->line('indirizzo'))
->display_as('Istituti_CAP',$this->lang->line('cap'))
->display_as('Istituti_Citta',$this->lang->line('citta'))
->display_as('Istituti_DirigenteScolastico',$this->lang->line('respist'))
->display_as('Istituti_PEC',$this->lang->line('pec'))
->display_as('Istituti_Mail',$this->lang->line('email'))
->display_as('Istituti_Telefono',$this->lang->line('tel'))
->display_as('Istituti_Nazione',$this->lang->line('naz'))
->display_as('Istituti_ResponsabileASL',$this->lang->line('respasl'));
$crud->set_subject($this->lang->line('istituto'));
$crud->fields('Istituti_Intestazione','Istituti_DescrizioneBreve',
'Istituti_Indirizzo','Istituti_CAP','Istituti_Citta',
'Istituti_Nazione','Istituti_DirigenteScolastico','Istituti_ResponsabileASL',
'Istituti_PEC','Istituti_Mail','Istituti_Telefono');  //i campi nel form di add o edit
// posso anche definire i campi in add $crud->add_fields e in edit $crud->edit_fields
$crud->set_rules('Istituti_Mail', 'Mail','valid_email')
->set_rules('Istituti_PEC', 'PEC','valid_email'); 
 
$crud->required_fields('Istituti_Intestazione', 
'Istituti_DescrizioneBreve','Istituti_Mail','Istituti_DirigenteScolastico','Istituti_ResponsabileASL'); // indica i campi obbligatori
 
//$crud->set_relation('salesRepEmployeeNumber','employees','lastName');
 
if ($this->auth_role != 'Admin') {
$crud->unset_add();
$crud->unset_delete();
$crud->unset_export();
$crud->unset_print();
}
 
 
$output = $crud->render();
 
 
$this->_example_output($output);
}

 

and when I tried to save the record the result is displayed in the attach...   

 

I hope it's more clearly now....  please let me know if it's necessary more information or code

 

thanks in advance

Giuseppe

 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 06 September 2017 - 12:25 PM

Well - this is what is causing the issue - 

 

if ($this->auth_role != 'Admin')  ....

 

Somehow what is happening is - it is either losing the auth token or is not actually getting re-initiated for some reason. That is where when u try to save, it unsets the actions .. and in such a scenario - it wont save - give 403- Forbidden error. 

Check your auth component / session ID is being passed while submitting the code or not. 


giuseppe

giuseppe
  • profile picture
  • Member

Posted 06 September 2017 - 13:40 PM

thanks Amit.

 

I tried to delete the code but the result is always the same and the role in that moment is really Admin (look the attach).

I have verificated that the token is always present...  

is it possible that some directive in the htaccess file are wrong?

 

 

Giuseppe


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 06 September 2017 - 17:07 PM

i never encountered a 403 due to htaccess.. unless u having it something like password protected directory...

It will be difficult 2 comment unless i see the code working. Let me PM u for further things that can be done over this,


giuseppe

giuseppe
  • profile picture
  • Member

Posted 07 September 2017 - 10:38 AM

Hello Amit,

 

I tried to install a new grocery crud from scratch and my cod run....  there is somethings else ....   thanks for the answers and the patience!!!..  

 

Giuseppe