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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 14,045
» Latest member: mtso86
» Forum threads: 69,686
» Forum posts: 432,611

Full Statistics

Latest Threads
User link - route all req...
Forum: CodeIgniter 4 Support
1 hour ago
» Replies: 3   » Views: 99
Installation Help
Forum: CodeIgniter 4 Support
1 hour ago
» Replies: 1   » Views: 23
file type crt as mime
Forum: CodeIgniter 3.x
4 hours ago
» Replies: 1   » Views: 21
preg_match not working we...
Forum: General Help
4 hours ago
» Replies: 3   » Views: 71
Search Criteria Ignored, ...
Forum: General Help
7 hours ago
» Replies: 17   » Views: 300
LightORM
Forum: Addins
7 hours ago
» Replies: 11   » Views: 1,610
Plugin/Script reccomendat...
Forum: Addins
9 hours ago
» Replies: 4   » Views: 206
Invisible Recaptcha
Forum: Addins
Today, 03:02 AM
» Replies: 5   » Views: 502
Why Codeigniter is better...
Forum: Choosing CodeIgniter
Today, 12:47 AM
» Replies: 19   » Views: 5,696
[feature] Database Handle...
Forum: CodeIgniter 4 Roadmap
Yesterday, 11:34 PM
» Replies: 7   » Views: 891

 
  file type crt as mime
Posted by: mtso86 - 5 hours ago - Forum: CodeIgniter 3.x - Replies (1)

I do face an issue when using upload library

since when trying to upload a CRT file (Certificate File) which has a mime type of Content-Type: application/pkix-cert 


it gives me file type not allowed Sad

I checked the mimes.php and it has a record for crt as follow:

'crt'   => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert')

so any suggestions please

note: when I use $config['allowed_types']        = '*'; 
it works without errors


  Installation Help
Posted by: dougwolf - 6 hours ago - Forum: CodeIgniter 4 Support - Replies (1)

I followed the composer installation and edited App.php to contain my base url. But I cannot get past this. What else can I try? 

Whoops!

We seem to have hit a snag. Please try again later..."


  Call $this->db from initController in __construct?
Posted by: Smil3y - Yesterday, 04:54 PM - Forum: CodeIgniter 4 Support - Replies (2)

Hi,

is it possible to use $this->db in controller in __construct function from BaseController?
This is my code:

PHP Code:
    public function __construct()
    {

        
$data = [];

        
$dbData $this->db->query("SELECT * FROM myTable");
        
$resultBots $dbData->getResultArray();



    } 

However, I get a "We hit a snag" error.


  preg_match not working we want to choose second title but it choose 1.
Posted by: aditya5670 - Yesterday, 05:39 AM - Forum: General Help - Replies (3)

Title tag use in same page one is button tag other is p tag  button tag is first title="watch later" other on a href tag title we want to import second a href tag title
source code

[Image: AUrk0j7.png]
[Image: ieuZsHk.png]

[img]hhttps://i.imgur.com/AUrk0j7.png[/img][Image: ufRsX6d.png]






i have tried many things to change /title but it import title is "watch later" i want second title import

            //Title
                    if(preg_match('/title="(.*?)"/', $match, $matches_title)) {
                        $video['title']    = htmlspecialchars_decode(strip_tags(stripslashes($matches_title[1])), ENT_QUOTES);
                    } else {
                        $this->errors[]    = 'Failed to get video title for '.$video['url'].'!';
                        if (!$this->debug) continue;
                        else $debug_e[] = 'TITLE';
                    }

how to choose second title under a tag ?
i want to remove watch later title .


  Intermittent page load delay
Posted by: btraill - 06-13-2019, 04:26 PM - Forum: General Help - Replies (1)

Hello,

Experiencing this rather odd issue, users have been complaining lately that when accessing our site every few refreshes are extremely delayed 10seconds-30seconds. Sometimes it it's OK for a little while, sometimes its not.

Our network team on-site says no issues, firewall team says no issues, etc. The only thing I've heard back is that it appears that for a few reloads it behaves normally, and then intermittently the following HTTP request(s) will delay on obtaining/setting the cookie (ci_session i think).

Any ideas? I've been going crazy the past week!


  Driver for Oracle Database in CI4
Posted by: ealegria - 06-13-2019, 02:33 PM - Forum: CodeIgniter 4 Feature Requests - No Replies

Hi guys, congratulations for the great job you do with CI4. I just want to know the date of the exit for the driver for the connection with oracle database.


  How to make dropzone upload without setting class dropzone in form ?
Posted by: sarath_unrelax - 06-13-2019, 04:03 AM - Forum: General Help - No Replies

I have a form with multiple form inputs and image upload using dropzone. The image upload area has a class called dropzone. When I put the class dropzone into the form the entire upload area style is going.

Means the uploaded thumbnails showing out side of the upload area. I want to use the dropzone without changing the class dropzone in from.  I tried initialising the dropzone programatically but that time the images is not posting into the controller.


Dropzone :

Code:
 Dropzone.options.propertyForm = {
          maxFiles:11,
          autoProcessQueue: false,
          paramName: "file",
          uploadMultiple: true,
          acceptedFiles: "image/*",
          maxFilesize: 1,
          parallelUploads: 100,

          init: function () {
              var myDropzone = this;
              this.element.querySelector("button[type=submit]").addEventListener("click", function(e) {
                  console.log('Click');
                e.preventDefault();
                e.stopPropagation();
                $(window).scrollTop(0);
                if ( $("#property-form").valid() ) {
                   myDropzone.processQueue();
                   $("#property-form").submit();

                 }

                });
                      // Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
               // of the sending event because uploadMultiple is set to true.
               this.on("sendingmultiple", function() {
                 console.log('send event');
               });
               this.on("successmultiple", function(files, response) {
                 console.log(response);
               });
               this.on("errormultiple", function(files, response) {
                 console.log('error');
               });

           }
       };


HTML Form :

Code:
<form name="property-form" action="<?php echo site_url() ?>list-property" enctype="multipart/form-data" method="post" id="property-form">

                       <div class="main-title-2">
                           <h1><span>Tell Me</span> Something About Your Property</h1>
                       </div>
                       <div class="search-contents-sidebar mb-30">
                           <div class="form-group">
                               <label>Property Title</label>
                               <input class="input-text" name="prop_title" id="prop_title" placeholder="Property Title">
                               <?php echo form_error('prop_title'); ?>
                           </div>
                           <div class="row">
                               <div class="col-md-6 col-sm-6">
                                   <div class="form-group">
                                       <label>Status</label>
                                       <select class="form-control required" id="prop_status" name="prop_status">
                                         <option value="">Select</option>
                                           <option value="Sale">For Sale</option>
                                           <option value="Rent">For Rent</option>
                                       </select>
                                   </div>
                               </div>
                               <div class="col-md-6 col-sm-6">
                                   <div class="form-group">
                                       <label>Type</label>
                                       <select class="form-control required" id="prop_type" name="prop_type">
                                         <option value="">Select</option>
                                           <option value="Modern">Modern</option>
                                           <option value="Traditional">Traditional</option>
                                           <option value="Arabic">Arabic</option>

                                       </select>


                                   </div>

                               </div>
                           </div>
                           <div class="row">
                               <div class="col-md-3 col-sm-6">
                                   <div class="form-group">
                                       <label>Price (Dirham)</label>
                                       <input class="input-text" name="prop_price" id="prop_price" placeholder="AED">
                                       <?php echo form_error('prop_price'); ?>

                                   </div>
                               </div>
                               <div class="col-md-3 col-sm-6">
                                   <div class="form-group">
                                       <label>Sqft</label>
                                       <input class="input-text" name="prop_sqft" id="prop_sqft" placeholder="SqFt">
                                       <?php echo form_error('prop_sqft'); ?>


                                   </div>
                               </div>
                               <div class="col-md-3 col-sm-6">
                                   <div class="form-group">
                                       <label>Bed Rooms</label>
                                       <select class="form-control required" name="prop_rooms" id="prop_rooms">
                                           <option value="">Select</option>
                                           <option value="3">3</option>
                                           <option value="4">4</option>
                                           <option value="5">5</option>

                                       </select>


                                   </div>
                               </div>
                               <!-- <div class="col-md-3 col-sm-6">
                                   <div class="form-group">
                                       <label>Bathroom</label>
                                       <select class="selectpicker search-fields" name="1">
                                           <option>1</option>
                                           <option>2</option>
                                           <option>3</option>
                                           <option>4</option>
                                           <option>5</option>
                                           <option>6</option>
                                       </select>
                                   </div>
                               </div> -->
                           </div>
                       </div>


                       <div class="main-title-2">
                           <h1><span>Location</span></h1>
                       </div>
                       <div class="row mb-30 ">
                           <div class="col-md-6 col-sm-6">
                               <div class="form-group">
                                   <label>Address</label>
                                   <input class="input-text" id="prop_address" name="prop_address"  placeholder="Address">
                               </div>
                               <?php echo form_error('prop_address'); ?>


                           </div>



                       </div>
                       <div class="main-title-2">
                           <h1><span>Contact</span> Details</h1>
                       </div>
                       <div class="row">
                           <div class="col-md-4 col-sm-4">
                               <div class="form-group">
                                   <label>Name</label>
                                   <input class="input-text" name="prop_owner_name" id="prop_owner_name" placeholder="Name">
                                   <?php echo form_error('prop_owner_name'); ?>

                               </div>
                           </div>
                           <div class="col-md-4 col-sm-4">
                               <div class="form-group">
                                   <label>Email</label>
                                   <input class="input-text" name="prop_owner_email" id="prop_owner_email" placeholder="Email">
                                   <?php echo form_error('prop_owner_email'); ?>

                               </div>
                           </div>

                           <div class="col-md-4 col-sm-4">
                               <div class="form-group">
                                   <label>Contact No</label>
                                   <input class="input-text" name="prop_owner_phone" id="prop_owner_phone" placeholder="Phone">
                                   <?php echo form_error('prop_owner_phone'); ?>

                               </div>
                           </div>
                           </div>
                       <div class="main-title-2">
                       <h1><span>Upload</span> Photos Of Villa </h1>
                       </div>

                       <div id="myDropzone" class="dropzone dropzone-design mb-10">
                         <div class="dz-default dz-message" data=""><span>Drop files here to upload</span></div>
                                               </div>

                       <div class="main-title-2">
                           <h1><span>Detailed</span> Information</h1>
                       </div>

                       <div class="row mb-30">
                           <div class="col-md-12">
                               <div class="form-group">
                                   <textarea class="input-text" id="prop_detailed_info" name="prop_detailed_info" placeholder="Detailed Information"></textarea>
                               </div>
                               <?php echo form_error('prop_detailed_info'); ?>
                           </div>

                       </div>
                           <div class="col-md-12">
                             <button type="submit" id="submit-all" class="btn button-sm button-theme">Submit</button>

                           </div>

                   </form>


What I tried :

I tried getting the dropzone programatically but that time, the images is not posting to the controller because the form also has the action attribute. Without form action attribute I can't validate using the Codeigniter  form validation.

What I need :

1. I need the dropzone posted to my controller without adding the class in <form> element. Because here

Code:
<div id="myDropzone" class="dropzone dropzone-design mb-10">
                         <div class="dz-default dz-message" data=""><span>Drop files here to upload</span></div>
                                               </div>

Here I'm showing the upload area for the images. The class I'm used is dropzone so when I use the same class name in form element the entire form is getting changed.

I got what I'm expecting ?


  Query builder subquery added multiple quotes if select more than 1 column
Posted by: nata - 06-12-2019, 10:03 PM - Forum: Issues - Replies (10)

Hi,

I use Postgress with Codeigniter V.3.1.10

I try to add subquery like this:

Code:
$this->db->select("pendaftaran_id, pendaftaran_tanggal");
$this->db->join("t_pendaftaran", "t_pendaftaran.pendaftaran_id = t_trx.pendaftaran_id");
$this->db->from("(SELECT trx_no, pendaftaran_id FROM t_transaksi GROUP BY trx_no, pendaftaran_id) as t_trx");
$q = $this->db->get();
return $q->result_array();

and the result is 
Code:
SELECT "pendaftaran_id", "pendaftaran_tanggal" FROM (SELECT trx_no, "pendaftaran_id FROM t_transaksi GROUP BY" "trx_no", pendaftaran_id) as t_trx
JOIN "t_pendaftaran" ON "t_pendaftaran"."pendaftaran_id" = "t_trx"."pendaftaran_id"


  Search Criteria Ignored, Only Redirects to Else Statement
Posted by: Josh1985 - 06-12-2019, 01:27 PM - Forum: General Help - Replies (17)

Hello all!

I am experiencing a weird issue with a site now. Up until my web host updated PHP to 7.3.6, I had no issues with my search feature. I have read through the changelogs on php.net all with no help pointing me in the direction of what is now broken.

Code Modules In Use:

Code:
PHP 7.3.6
CodeIgniter 3.1.9

My_Controller.php:
Code:
<?php

class MY_Controller extends CI_Controller{
function __construct() {
 parent::__construct();
 $this->load->vars(array('toc' => $this->recipe_model->read_names_categories(),
 'admin_menu_items' => array(),
 'admin' => $this->is_logged_in()));
 if($this->is_logged_in()){
  date_default_timezone_set($this->session->userdata('tz'));
 }
 else{
  date_default_timezone_set('America/New_York');
 }
}
   
function is_logged_in(){
 $logged_in = $this->session->userdata('logged_in');
  if(isset($logged_in) && $logged_in){
   return true;
  }
  else{
   return false;
  }
 }
   
function require_login(){
 if(!$this->is_logged_in()){
  redirect('login');
 }
}
   
function format_date($datestr) {
 //date_default_timezone_set('UTC');
  $date = strtotime($datestr.' UTC');
 //date_default_timezone_set('America/New_York');
  $datestr = date("n/j/Y @ g:i A T", $date);
   return $datestr;
}  
}  
//End MY_Controller.php

Recipe.php Controller:
Code:
<?php
class Recipe extends MY_Controller{

function __construct() {
 parent::__construct();
  $uri = $this->uri->uri_string();
  $this->session->set_flashdata('uri', $uri);
}

function index(){
 $recipe_linkname = $this->uri->rsegment(3);
 if(!$recipe_linkname){
  $recipe_linkname = $this->recipe_model->first_linkname();
 }
 $recipe = $this->recipe_model->read_record($recipe_linkname);
 if(count($recipe) == 0){
  show_404('');
  die();
 }
 $data = array(
    'title' => "Shirley's Recipes : ".$recipe['name'],
  'columns' => array('toc', 'recipe'),
   'recipe' => $recipe
 );
 $this->load->view('includes/template', $data);
}

function flipbook(){
 $this->require_login();
 $this->load->library('pagination');
   
       $config['base_url'] = site_url('recipe/flipbook');
     $config['total_rows'] = $this->recipe_model->num_rows();
    $config['uri_segment'] = '3';
       $config['per_page'] = 1;
      $config['num_links'] = 1;
  $config['display_pages'] = FALSE;
  $config['full_tag_open'] = '<div id="pagination">';
 $config['full_tag_close'] = '</div>';
 
 $this->pagination->initialize($config);
 $recipe = $this->recipe_model->read_records($config['per_page'], $this->uri->segment(3))->row_array();
   $data = array(
     'title' => "Shirley's Recipes : ".$recipe['name'],
     'columns' => array('toc', 'recipe_flipbook'),
      'recipe' => $recipe
 );
 $this->load->view('includes/template', $data);
}
 
function search(){
 if($this->input->post('submit')){
   $search = $this->input->post('query');
  $results = $this->recipe_model->search($search);
     $data = array(
     'title' => "Shirley's Recipes : Search Results",
     'columns' => array('toc', 'recipe_search'),
     'recipes' => $results,
  );
  $this->load->view('includes/template', $data);
  }
  else{
   redirect('recipe');
  }
}

function add(){
 $this->require_login();
 if($this->input->post('submit')){
  $data = array(
       'name' => $this->input->post('name'),
 'buttontext' => $this->input->post('buttontext'),
           'linkname' => $this->input->post('linkname'),
                'img' => $this->input->post('img'),
               'time' => $this->input->post('time'),
   'category' => $this->input->post('category'),
        'subcategory' => $this->input->post('subcategory'),
' ingredients' => $this->input->post('ingredients'),
  'equipment' => $this->input->post('equipment'),
'preparation' => $this->input->post('preparation'),
 'directions' => $this->input->post('directions')
  );
  $recipeid = $this->recipe_model->create_record($data);
  redirect('recipe/'.$this->input->post('linkname'));
 }
 else{
  $data = array(
     'title' => "Shirley's Recipes : Add New Recipe",
   'columns' => array('toc', 'admin/recipe_edit'),
    'recipe' => array('name' => '',
                      'buttontext' => '',
                        'category' => '',
                     'subcategory' => '',
                        'linkname' => '',
                             'img' => '',
                            'time' => '',
                     'ingredients' => '',
                       'equipment' => '',
                     'preparation' => '',
                      'directions' => '')
  );
  $this->load->view('includes/template', $data);
 }
}

function edit(){
 $this->require_login();
 $id = $this->uri->segment(3);
 if($this->input->post('submit')){
  $data = array(
          'name' => $this->input->post('name'),
  'buttontext' => $this->input->post('buttontext'),
    'linkname' => $this->input->post('linkname'),
           'img' => $this->input->post('img'),
           'time' => $this->input->post('time'),
      'category' => $this->input->post('category'),
   'subcategory' => $this->input->post('subcategory'),
   'ingredients' => $this->input->post('ingredients'),
     'equipment' => $this->input->post('equipment'),
   'preparation' => $this->input->post('preparation'),
    'directions' => $this->input->post('directions')
   );
   $this->recipe_model->update_record($id, $data);
   redirect('recipe/'.$this->input->post('linkname'));
 }
 else{
  $recipe = $this->recipe_model->read_record($id);
  $data = array(
   'title' => "Shirley's Recipes : Edit Recipe : ".$recipe['name'],
   'columns' => array('toc', 'admin/recipe_edit'),
        'id' => $id,
  'recipe' => $recipe
  );
  $this->load->view('includes/template', $data);
 }
}

function delete(){
 $this->require_login();
 $this->recipe_model->delete_record($this->uri->segment(3));
 redirect('/');
}
}
// End - recipe.php
?>

Recipe_model
Code:
<?php
class Recipe_model extends CI_Model {

function create_record($data){
 if(isset($data['buttontext']) and $data['buttontext'] == ''){
  $data['buttontext'] = NULL;
 }
 $this->db->insert('recipe', $data);
 return $this->db->insert_id();
}
 
function read_records($limit, $offset){
 $this->db->order_by('name', 'asc');
 if(isset($limit) && isset($offset)){
  $this->db->limit($limit, $offset);
 }
 $q = $this->db->get('recipe');
 return $q;
}
 
function read_record($key){
 if(is_numeric($key)){
  $this->db->where('id', $key);
 }
 else{
  $this->db->where('linkname', $key);
 }
 $q = $this->db->get('recipe');
 return $q->row_array();
}
 
function first_linkname(){
 $this->db->select('linkname, name');
 $this->db->order_by('name', 'asc');
 $this->db->limit(1);
 $q = $this->db->get('recipe');    
 return $q->row()->linkname;
}

function read_names(){
 $this->db->select('linkname, name');
 $this->db->order_by('name', 'asc');
 $q = $this->db->get('recipe');
 return $q->result();
}
 
function read_names_categories(){
 $this->db->select('buttontext, linkname, name, category, subcategory');
 $this->db->order_by('name', 'asc');
 $q = $this->db->get('recipe');
 return $q->result();  
}

function search($search){
 $terms = explode(" ", $search);
 $match = "";
 foreach($terms as $term){
  $match .=  $term;
 }
 $querystr = "SELECT *, MATCH(name, linkname, ingredients, equipment, preparation, directions, category, subcategory, keywords) AGAINST('".$match."') as score FROM recipe WHERE MATCH(name, linkname, ingredients, equipment, preparation, directions, category, subcategory, keywords) AGAINST('".$match."') ORDER BY score DESC;";
 $q = $this->db->query($querystr);
 return $q->result();
}

function update_record($id, $data){
 if(isset($data['buttontext']) and $data['buttontext'] == ''){
  $data['buttontext'] = NULL;
 }
 $this->db->where('id', $id);
 $this->db->update('recipe', $data);
}
 
function delete_record($id){
 $this->db->where('id', $id);
 $this->db->delete('recipe');
}
 
function num_rows(){
 return $this->db->get('recipe')->num_rows();
}
}
// End - recipe_model.php
?>

Recipe_search View (This should load whether or not results were found but it NEVER loads)
Code:
<div id="recipelist" class="content">
<h1>Recipe Search</h1>
 <div class="recipesearch">
  <ol>
   <?php if(!empty($recipes)): foreach($recipes as $recipe): ?>
    <li><a href="/recipe/<?=$recipe->id ?>"><?=$recipe->name ?></a><span class="confidence"><?=$recipe->score ?></span></li>
    <?php endforeach; ?>
  </ol>
 </div>
 <?php else: ?>
 <h3>No matching recipes</h3>
 <?php endif; ?>
</div>

I hope that is all the code you need to help me. If not, I will be happy to provide more.

A brief overview of the issue is if someone comes to the site to search for a recipe, no matter what they put in and submit; the search redirects them back to the first alphabetical recipe on the site. No matter what is entered.

What used to happen when a search was performed is the site would open up the "Recipe_search.php" View and show them that. Now, all I get is the first alphabetical recipe page. What am I missing here?

Thank you in advance!


  Select Query Error
Posted by: lfmluis - 06-12-2019, 12:51 PM - Forum: General Help - Replies (3)

Hi everyone, i have a problem with a select query, 


Code:
$where = "SELECT FORMAT(SUM(payed), 2) AS payedAmount FROM client_credit WHERE creditStatus = 2 AND idperson = '"
           .$post_data['idperson']. "' AND contractDate
       BETWEEN '"
           . $startDate . "' AND '" . $endDate . "'";
$query = $this->db->query($where);
       if ($query->num_rows() > 0) {
           return $query->result();
       } else {
           return null;
       }

But i get a boolean result, $query = false, and when i execute the same query in mysql console i get the right result, but here i get boolean.

Thank you. Confused



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