Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,192
» Latest member: vjci
» Forum threads: 66,447
» Forum posts: 417,006

Full Statistics

Latest Threads
Server config causing CSR...
Forum: General Help
1 hour ago
» Replies: 2   » Views: 40
routing to IIS though I a...
Forum: Installation & Setup
3 hours ago
» Replies: 0   » Views: 9
dynamic input field valid...
Forum: CodeIgniter 3.x
4 hours ago
» Replies: 0   » Views: 26
Errors In Code
Forum: CodeIgniter 4 Support
9 hours ago
» Replies: 7   » Views: 196
Version/System update not...
Forum: General Help
Yesterday, 10:14 AM
» Replies: 3   » Views: 194
Multilingual site
Forum: Lounge
Yesterday, 09:36 AM
» Replies: 3   » Views: 185
encryption_key in CI 3.x
Forum: Installation & Setup
Yesterday, 08:12 AM
» Replies: 3   » Views: 204
oops in codeigniter
Forum: Choosing CodeIgniter
Yesterday, 06:02 AM
» Replies: 1   » Views: 187
Switch button active/inac...
Forum: General Help
Yesterday, 03:38 AM
» Replies: 3   » Views: 146
[Solved] Files-Sessions s...
Forum: General Help
Yesterday, 02:20 AM
» Replies: 2   » Views: 74

 
  Page for [An Error Was Encountered]
Posted by: RAMP - 08-16-2017, 10:10 AM - Forum: General Help - No Replies

Sry for my english  Angel

How do I change a page for ERROR: An Error Was Encountered
This error occurs when characters are invalid. ( For example: http:[email protected] )

I know that CI have static file: \application\views\errors\cli

But I want to show controller. It's real?


Thx.


  Session problem
Posted by: Ramzy - 08-16-2017, 04:57 AM - Forum: CodeIgniter 3.x - Replies (1)

Hello everyone;
help me ;
Since i am going to version 3.1.3 of codeigniter. I a problem that keeps me from putting my site online.
In local everything works well;
But as soon as I put the site online I errors regarding the sessions.


Here is an apperception of the error:

   


  how to access the data i posted through ajax on my controller
Posted by: Lestah - 08-16-2017, 03:08 AM - Forum: General Help - Replies (5)


Code:
$.ajax({
                    type: "POST",
                    url: '<?php echo site_url('login/identifying_usertype'); ?>',
                    data: { 'email' : email, 'password' : password },
                    success: function(response){
                        
                        //console.log(response);
                        //alert(email);
                        console.log(response);
                        $('#myModal').modal('hide');
                        },
                        error: function (XHR, status, error){
                            console.log('error', error);
                        }
                    });

and this is my controller
Code:
public function identifying_usertype()
{
    $email = $_POST['email'];

     echo "$email";
}
I can't get the posted value on my ajax Is there something I'm missing? what could be wrong?


Photo Custom Plugin Integration
Posted by: pruthvidarji - 08-16-2017, 02:07 AM - Forum: General Help - No Replies

Is it possible to use any plugin from another project language to our codeigniter project ?


  CI3 Session Not Expiring On Browser Close
Posted by: elabuwa - 08-16-2017, 01:18 AM - Forum: General Help - Replies (4)

Hi guys,

Using Codeigniter 3.1.2.

Below are my config details for session.

PHP Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 7200;
$config['sess_regenerate_destroy'] = FALSE

I am told that upon setting the sess_expiration to 0 that it would be destroyed upon browser close.

However, this does not seem to happen.

Any idea?
Any method I can use to utilise this?

Using javascript seems not practical since it gets triggered when used the back button and when going to a different URL.


  Improved secure login form
Posted by: Marcolino92 - 08-16-2017, 12:25 AM - Forum: Model-View-Controller - Replies (7)

Hi guys, I created a very simple login form for a small administrative area. Unfortunately, it is currently very basic, in fact the password is not encrypted and there is no verification.

I tried with password_hash and then password_verify, but I missed something in the code.

You could help me improve my login, I'm not going to make it super safe, but also the least.

At this time, this is the files in the controller and the model:

PHP Code:
   public function index() {
 
       $this->admin_model->isLoggedIn();
 
       $this->load->view('admin/index');
 
   }
 
   
    public 
function login(){

 
       $username $this->input->post('username');
 
       $password $this->input->post('password');
 
       
        
//call the model for auth
 
       if($this->admin_model->login($username$password)){
 
           redirect('admin/index');
 
       }

 
       else {
 
           $this->load->view('admin/login');
 
       }
 
   

admin_model.php

PHP Code:
   public function login($username$password) { 
 
       $this->db->where('username'$username);
 
       $this->db->where('password'$password);
 
       $query $this->db->get('user');
 
       if($query->num_rows()==1){
 
           foreach ($query->result() as $row){
 
               $data = array(
 
                           'username'=> $row->username,
 
                           'logged_in'=>TRUE
                        
);
 
           }
 
           $this->session->set_userdata($data);
 
           return TRUE;
 
       }
 
       else{
 
           return FALSE;
 
        
    
}
 
       
    public 
function isLoggedIn(){
 
           $is_logged_in $this->session->userdata('logged_in');
 
           if(!isset($is_logged_in) || $is_logged_in!==TRUE)
 
           {
 
               redirect('admin/login');
 
               exit;
 
           }
 
   

Thanks for your help


  [Solved] Multidimensional input error.
Posted by: wolfgang1983 - 08-15-2017, 08:53 PM - Forum: General Help - Replies (1)

On my controller I get a error even though is set on controller functin though as you can see in image below for some reason the banner_title not set in the second array

[Image: 3X2jIHXzIm9M.png]


I use multidimensional input 

Code:
<?php echo $header;?>
<div class="container">


<?php 

$form = array(
    'id' => '',
    'role' => 'form',
    'class' => 'form-horizontal'
);

echo form_open_multipart($action, $form);?>

<div class="panel panel-default">
<div class="panel-heading"></div>

<div class="panel-body">

<div class="form-group">
<label class="col-lg-2">Banner Status</label>
<div class="col-lg-10">
<input type="text" name="banner_name" class="form-control" placeholder="Enter Banner Name" value="<?php echo $banner_name;?>" size="50"/>    
<?php echo form_error('banner_name', '<div class="text-danger" style="margin-top: 2rem;">', '</div>'); ?>
</div>
</div>

<div class="form-group">
<label class="col-lg-2">Banner Name</label>
<div class="col-lg-10">
<?php 

$options = array('1' => 'Enabled', '0' => 'Disabled');

echo form_dropdown('banner_status', $options, $banner_status, array('class' => 'form-control'));

?>

</div>
</div>

<table id="images" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<td class="text-left">Title</td>
<td class="text-left">Image</td>
<td>Sort Order</td>

</tr>
</thead>
<tbody>
<?php $image_row = 0; ?>
<?php foreach ($banner_images as $banner_image) { ?>
<tr id="image-row<?php echo $image_row; ?>">
 
<td class="text-left">
<input type="text" name="banner_image[<?php echo $image_row; ?>][title]" value="<?php echo $banner_image['title']; ?>" class="form-control">
</td>

<td class="text-left">
<a href="" id="thumb_image_<?php echo $image_row; ?>" data-toggle="image" class="img-thumbnail">
<img src="<?php echo $banner_image['thumb']; ?>" alt="" title="" data-placeholder="<?php echo $placeholder; ?>" />
</a>
<input type="hidden" name="banner_image[<?php echo $image_row; ?>][image]" value="<?php echo $banner_image['image']; ?>" id="input_image_<?php echo $image_row; ?>" /></td>

<td class="text-right"><input type="text" name="banner_image[<?php echo $image_row; ?>][sort_order]" value="<?php echo $banner_image['sort_order']; ?>" placeholder="Sort Order" class="form-control" /></td>

<td class="text-left">
<button type="button" onclick="$('#image-row<?php echo $image_row; ?>').remove();" class="btn btn-danger"><i class="fa fa-trash" aria-hidden="true"></i></button></td>

</tr>
<?php $image_row++; ?>
<?php } ?>


    
</tbody>
<tfoot>
<tr>
<td colspan="3"></td>
<td class="text-left">
<button type="button" onclick="addImage();" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button>
</td>
</tr>
</tfoot>
</table>

</div>

<div class="panel-footer">
<div class="text-right"><button type="submit" class="btn btn-primary"><i class="fa fa-floppy-o" aria-hidden="true"></i> Save</button></div>
</div>

</div>

<?php echo form_close();?>


</div>

<script type="text/javascript">
var image_row = <?php echo $image_row; ?>;

function addImage()
{
    html = '<tr id="image-row' + image_row + '">';
    html += '<td class="text-left">';
    html += '<input type="text" name="banner_image[<?php echo $image_row; ?>][title]" class="form-control" value="">';
    html += '</td>';
    html += '<td class="text-left">';
    html += '<a href="" id="thumb_image_' + image_row + '" data-toggle="image" class="img-thumbnail">';
    html += '<img src="<?php echo $placeholder; ?>" data-placeholder="<?php echo $placeholder; ?>"/>';
    html += '</a>';
    html += '<input type="hidden" name="banner_image[' + image_row + '][image]" value="" id="input_image_' + image_row + '" />';
    html += '</td>';
    html += '<td class="text-right">';
    html += '<input type="text" name="banner_image[' + image_row + '][sort_order]" value="" placeholder="Sort Order" class="form-control" />';
    html += '</td>';
    html += '</tr>';

    $('#images tbody').append(html);
    
    image_row++;
}

</script>
<?php echo $footer;?>


On the controller function

PHP Code:
$banner_image_post $this->input->post('banner_image');

if (isset(
$banner_image_post)) {
    
$banner_images $banner_image_post;
} elseif (isset(
$banner_id)) {
    
$banner_images $this->admin_model_banner->getBannerImages($banner_id);
} else {
    
$banner_images = array();
}

$data['banner_images'] = array();

foreach (
$banner_images as $banner_image)
{
    if (
is_file(FCPATH  'image/' $banner_image['image'])) {
        
$image $banner_image['image'];
        
$thumb $banner_image['image'];
    } else {
        
$image '';
        
$thumb 'catalog/no_image.jpg';
    }

 
  $data['banner_images'][] = array(
        
'image' => $image,
        
'thumb' => $this->model_tool_image->resize($thumb100100),
        
'title' => $banner_image['title'],
        
'sort_order' => $banner_image['sort_order']
    );



Attached Files
.php   Banners.php (Size: 6.83 KB / Downloads: 7)
.php   banner_form_view.php (Size: 3.74 KB / Downloads: 7)

  POSTing to CodeIgniter API
Posted by: Simon_Startup - 08-15-2017, 11:05 AM - Forum: General Help - Replies (1)

Hey Guys,

I'm working with a codeigniter website with API and for some reason I am unable to get server-side content from POST requests. 

Here is some code samples of the API. Everything works fine when POSTing from the website to the server, but via a service like POSTman I cannot seem to view data as I normally would aka $this->input->post('my_field') 

https://gist.github.com/simistern/6af216...81dd050745
https://gist.github.com/simistern/063d3e...101ee33781



Any help would be greatly appreciated!


  someone is trying to change my ci index file how to make it secure
Posted by: Marku - 08-15-2017, 07:52 AM - Forum: Issues - Replies (1)

[13-Aug-2017 11:27:58 PRC] PHP Warning:  preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Compilation failed: unmatched parentheses at offset 17 in /home/nmcth/public_html/index.php(12) : runtime-created function on line 1

[13-Aug-2017 11:27:58 PRC] PHP Warning:  strlen() expects parameter 1 to be string, array given in /home/nmcth/public_html/index.php(12) : runtime-created function on line 1

i found this in my error_log file. how can i fix it and know from which root it has been done


  database error
Posted by: [email protected] - 08-15-2017, 07:51 AM - Forum: Installation & Setup - Replies (1)

please find attached



Attached Files Thumbnail(s)
   


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.