CodeIgniter

36

Solutions

52

Contributors

Share tech news, updates, or what's on your mind.

Sign up to Post

I am using codeigniter as a framework, and it keeps logging users out.

- it ethier logs out randomly after a few minutes, or hours.
- it logs out when a user updates their order
- then as an admin if i get logged out randomly, and i log in into another account, it logs me back to the first account (the one i got randomly logged out from).

Whats the issue here? i found that i need to change the session time, but im not sure its working for me.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012
LVL 12
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Hello!

We have an intranet that's behind a username/password page and one of our biggest struggles is search. We've implemented a basic search tool and it does okay at best. If searching for the word book, it'll return pages with the word book in it. However, it runs into issues when using multiple words, quotations, and does not rank the results for the user. Our intranet is using php and CodeIgniter. I looked around at codecanyon.net for php search engine scripts, but nothing really stuck out to me. Does an expert have a suggestion on what a good search solution might be for an intranet?
0
Hi,

My manager asked me updating a website from codeigniter to  
backend: API using PHP (Symfony) or node (expressjs) or Drupal 8 . or any other framework. can you give me explanations?

And for single page applications Angular 4 or Vue js
0
I keep getting this error every time I go to the chargeticket_list page.

Controller

public function chargeticket_list() {
$data['charge_tickets'] = $this->Chargeticket_model->list_charges($this->input->post('date1'), $this->input->post('date2'));
$this->load->view( 'inc/header' );
$this->load->view( 'chargeticket/chargeticket_list', $data );
$this->load->view( 'inc/footer' );
}

Open in new window

Model

public function list_charges($date1, $date2) //This function returns an array
    {   $this->db->join( 'customers', 'charges.idcustomers = customers.idcustomers' );
        $this->db->where('ch_date >=', $date1);
        $this->db->where('ch_date <=', $date2);
        $query = $this->db->get('charges'); //create query
        return $query->result_array(); //creates array from query
    }

Open in new window

View

<script type="text/javascript">

$(document).ready(function (){
    $('.date1').datepicker({
dateFormat: 'yy-mm-dd'});
});

$(document).ready(function (){
    $('.date2').datepicker({
dateFormat: 'yy-mm-dd'});
});
</script>

<div class="container">
<?php 
    $attributes = array('id'=>'chargeticket_list', 'class'=> 'form-horizontal');
    echo form_open('chargeticket/chargeticket_list', $attributes);
?>

<div class="form-group">
    <?php $ldata = array('class' => 'control-label col-sm-4');
    echo form_label('From','date1', $ldata ); 
    $data = array('class' => 'form-control date1','name' => 'date1');?>
    <div class="col-sm-4"><?php 

Open in new window

0
Hello! I'm trying to select some information from my database using drop-down lists, but when I pass my variables from my controller to the view, I get the "undefined variable" error. I can't understand why I get this error, because I've implemented other functions in a similar way and they worked. Also, I know the function in the model works, because I get my info using print_r.

This is my controller function.


This is my model function.


This is my view.
this is my view
This is the error I'm getting.
error.PNG
And this is what I get when I use print_r to see what my function in the controller is returning. It's correct,  just can't post it.
snip.PNG
Please, help me!
0
Hi All,

I am changing my http to https then session are not working when i am using codeigniter(PHP Frame work)

Please give me solution of my problem.

Thanks all.
0
This is what I am working with:

  • Window Server 2016
  • SQL Server 2017
  • IIS 10
  • Codeigniter 3

This is what I have done:

Installed IIS URL Rewrite 2.1

Modified the web.config file that is located in the application folder:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
    <rules>
        <rule name="Index">
            <match url="^(.*)$"/>
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
            </conditions>
            <action type="Rewrite" url="index.php/{R:1}"/>
        </rule>                
    </rules>
</rewrite>
</system.webServer>

Open in new window


Modified the config.php file:

$config['base_url'] = 'http://10.10.0.4/portalci/';
$config['index_page'] = '';

Open in new window


Modified the autoload.php file:

$autoload['helper'] = array('url');

Open in new window


The results:

When I go to http://10.10.0.4/portalci/index.php it works fine. When I remove the index.php I get the following error: 403 - Forbidden: Access is denied.

Thanks in advance for your help!

Side note: I have spent the last 16 hours and reviewed hundreds of other post to try to resolve this myself.
0
I am working with some folk who are using Expression Engine Version 2. something.  They are considering upgrading to the latest version.  I know that version 2 and version 3 have a different directory setup.  Is there any definitive docs on how to upgrade with minimal pain? Tutorials? Plugins? How to videos?  I'm in the exploratory phase of this project and will appreciate any input on upgrading EE from 2.... to 3.0 - 4.0 and beyond!
0
I have an admin panel in codeigniter project.
There is a sidebar (<ul> <li>xxxxxx</li> </ul>) at the left and the content area in the right.
I store the content of the relevent option of sidebar in a variable , i.e the whole view and show inside a particular div in the right side content.
The functionality is working , but i want to do this without page load (i.e, by using ajax)
Here is the code in my master page
But it does not seem working

I shall be thankful if you kindly look into the issue

<script>
$(document).ready(function(){
 $('#a1').click(function(e){
            //alert("ok");
        e.preventDefault(); //To prevent the default anchor tag behaviour
        var url = this.href;
        //alert(url);
        $(".content").load(url);
        $('.content').load(<?php $this->load->view('admin/manage_student_form',$data, TRUE); ?>);
 });
 });
</script>
0
how code update image and display current image if i don't want to update the image using CodeIgniter version 2.2.6 ?
0
Ultimate Tool Kit for Technology Solution Provider
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Hi Experts

Have an odd request to get done.  I have two applications, one in normal php (property application) and other in framework codeigniter (support application).  I need a way to be able to login from property app into support application automatically once logged into Property application.  Hope that makes...

When i click a link "support", goes to external application, and will prompt to login.  The same login credentials exist on both applications..and what needs to happen is some kind of login process based on the session from property app...that way a user would not have to login again..

Is this possible?
0
I have a list in Flexigrid and the edit form in a different page. Problem is after edit process is completed I would like to return the same page number from which row is edited. Instead it always goes to the first page of the list.

All of the this done in Codeigniter., after searching for a while I got below solution but still I am not sure how to get to the history page from the edit is clicked.

$('#MyFlex') .flexOptions({ url: urlAction, newp: 1 }).flexReload();

Open in new window

0
OK I think this is the weirdest yet.  To me, anyway.

If I leave in lines 3,4,5 the code appears to work (displays the array, shows no error).

If I comment out those lines, it fails
Severity: Notice

Message: Undefined offset: 0

Filename: models/Week_fixtures_model.php

Line Number: 490

if ( $query->num_rows() == 1)
		{
			echo "<PRE>";
			print_r($query->result_array());
			echo "</PRE>";
			$arr_venue_info['name'] = $query->result_array[0]['name'];
			$arr_venue_info['mapref'] = $query->result_array[0]['mapref'];
			return $arr_venue_info;	
		}
		else // no ground found.
		{
			$arr_venue_info['name'] = $venue;
			$arr_venue_info['mapref'] = 'No map';
			return $arr_venue_info;	
		}

Open in new window


Can anyone shed any light on this please?  I'm using CodeIgniter if that is relevant.
0
Parse error: syntax error, unexpected T_CONST in C:\wamp\www\codeigniter\system\core\CodeIgniter.php on line 58
0
Hi experts,
I need to reproduce this query in CodeIgniter, using ActiveRecord.  I've got very close but CI is putting backquotes where they are not wanted (the yellow-highlighted ones).
Here's the query and CI's interpretation of it...
query as interpreted by CIand here's the code I used to get it.  Part of this stems from CI's lack of support for UNION.
public function get_squad ($fixture_id, $side)
	{	
		$team_clause = 'X';
		if($side=='1') {$team_clause = ' p_1sts ';}
		if($side=='2') {$team_clause = ' p_2nds ';}
		if($side=='3') {$team_clause = ' p_3rds ';}
		if($side=='4') {$team_clause = ' p_4ths ';}
		if($side=='S') {$team_clause = ' p_sundays ';}
		if($side=='T') {$team_clause = ' p_sundays_res ';}
		if($side=='V') {$team_clause = ' p_young_vets ';}
		if($side=='W') {$team_clause = ' p_senior_vets ';}
		
		$this->db->select('first_name, surname, id AS "player_id", "Y" AS "player_picked", fp_keeper AS "keeper", fp_owes_subs AS "subs", fp_if_fit AS "fit", fp_if_available AS "available"');
		$this->db->from('fixtures_players');
		$this->db->join('players_members', 'fp_player_id = id', 'INNER');
		$this->db->where('fp_fixture_id', $fixture_id);
		$this->db->group_by(array('first_name', 'surname'));
		$first_half_inner_union = $this->db->get_compiled_select(); 		
		
		$this->db->select('first_name, surname, id AS "player_id", "N" AS "player_picked", "" AS "keeper", "" AS "subs", "" AS "fit", "" AS "available"');
		$this->db->from('players_members');
		

Open in new window

0
Weird!  Hopefully this is an easy 1000 points for someone.

This is taken straight from the manual, and I get an error - anyone see it?  I'm using CodeIgniter if that's relevant at all.

syntax error, unexpected '$v' (T_VARIABLE) in C:\xampp\htdocs1\fobg\application\controllers\week_fixtures.php on line 31

public function date_chosen()
      {            
            $a = array(1, 2, 3, 17);

            foreach ($a as $v) {
                echo "Current value of \$a: $v.\n";
            }
      }

also flagged up in Dreamweaver:
DW screenshot
0
Hello experts,

I am trying to check if the post data obtained for 'fields' is empty. I have tried different conditions to check if the array is empty or not. Even if the 'fields' is empty, the if condition executes. It would be great if someone could suggest me as to how to go about with this.

View:
<h4>Alternatives</h4><input type="text" style="width:700px;display: inline" id="fields" name="fields[]" placeholder="Enter Method Name" class="form-control method_list_list"/> <input type="button" name="addmore" id="addmore" class="btn btn-success" value="Add More"/>

Model:
public function addmethodtotask(){
	 $conn= mysqli_connect("localhost","root","","cognitivewalkthrough");
	 $taskid=  $_POST['taskid'];
	$description =  $_POST['reason'];
	$action = $_POST['action'];

//if (isset($_POST['fields']) && $_POST['fields'] != "") {
	if (isset($_POST['fields']) && $_POST['fields'] != NULL) {
	// if (count($_POST['fields'])>0 && !empty($_POST['fields'])) {
		 echo "whey am i here";
				foreach ( $_POST['fields'] as $key=>$value ) {
					$sql_website = sprintf("INSERT INTO method (methodname,description,action) VALUES ('%s','%s','%s')",mysqli_real_escape_string($conn,$value),mysqli_real_escape_string($conn,$description),mysqli_real_escape_string($conn,$action) );
					$this->db->query($sql_website);
					$inserted_method_id = $this->db->insert_id();
				}
	}
        

Open in new window

0
Hello,

I have piece of code here. I am trying to create something like a quiz application. In  <h4>Add question</h4> part, I can add a question if I want to and I store all the details I entered into the database by making an ajax call. Upon success, this piece of code gets replaced by the same code with other data so that the user can enter all the details. What I am trying to do is once I add a question in 'Add question' part, then I should be able to display it throughout the quiz. How can I do a post for new_questions in ajax and send it to the controller?

Can anyone suggest me how to do proceed with this?

Any kind of suggestion would be helpful.
   
<?php
foreach($substeps as $row) {
 ?>
 <div id='img_div'>
      <h2 id="stepslist_<?php echo $row->stepid;?>" class="step"><p><?php echo $row->stepname;?></p></h2>
      <img src='http://localhost/project/uploads/<?php echo $row->image; ?>'>
</div>
<?php } ?>
 <?php
      foreach($questions as $each){
      ?><br><br>
      <input type="text" name="questions[]" class='form-control' id="questions_<?php echo $each->questionid; ?>"  value="<?php echo $each->questionname; ?>" disabled/><br/>
   
    <h4>Add question</h4>
    <input type="text" class="form-control" name="newquestion[]"  id="new_questions_<?php echo $each->questionid; ?>" /><br>
    <h4>Answer:</h4>  <select class="form-control" name="answer[]" id="answer" required>
 <option value="">Select</option>
 <option value="no">no</option>
 <option 

Open in new window

0
I did tutorial located here:, what i would like to do is add edit functionality, i would like to have an edit button and be able to edit record, the tutorial did no cover this, i have researched but i just cant wrap my head around it, i am new to codeigniter as you can tell.

here is my controller:
<?php

class Site extends CI_Controller
{

	function index()
	{

		$data = array();
		
		if($query = $this->site_model->get_records())
		{
			$data['records'] = $query;
		} 
		//$this->load->library('table');
		$this->load->view('options_view',$data);
	}

	function create()
	{
		$data = array(
			'title' => $this->input->post('title'),
			'content' => $this->input->post('content')
			);

		$this->site_model->add_record($data);		
		$this->index();
	}

	function update()
	{
		$data = array (
			'title' => 'My NEW UPDATED title',
			'content' => 'NEW UPDATED content; UPDATED'
			);
		$this->site_model->update_record($data);
	}

	

	 function delete()
	 {
	 	$this->site_model->delete_row();
	 	$this->index();
	 }

}

?>

Open in new window


Here is my model:
<?php

class Site_model extends CI_Model {

	function get_records()
	{
		 $query = $this->db->get('assets');
		 return $query->result();
		// $query = $this->db->query('SELECT * FROM assets');
	    //echo $this->table->generate($query);

	}


	function add_record($data)
	{
		$this->db->insert('assets', $data);
		return;
	}

	function update_record($data)
	{
		$this->db->where('id', 3);
		$this->db->update('assets', $data);
	}


	 function delete_row()
       {
	  	$this->db->where('id', $this->uri->segment(3));
	  	$this->db->delete('assets');

	   }


}

Open in new window


Here is my view:

Open in new window

0
Introducing the "443 Security Simplified" Podcast
LVL 1
Introducing the "443 Security Simplified" Podcast

This new podcast puts you inside the minds of leading white-hat hackers and security researchers. Hosts Marc Laliberte and Corey Nachreiner turn complex security concepts into easily understood and actionable insights on the latest cyber security headlines and trends.

I added codeigniter 'table' to my project and i got desired outcome for view except for the fact that the way i had it before i was able to delete record by clicking on them since they were anchor tags, i would like to know how to recreate this in new table format. Thanks!
site_model.php
site.php
options_view.php
Capture2.PNG
Capture.PNG
0
I have attached files, i am trying to display results in a table, i am new to codeigniter is there a way to do this? what would be the best way to implement this? i have read about codeigniter tables but i am not sure how to apply to my code. Any guidance will be appreciated.
Thank You!
site.php
site_model.php
options_view.php
0
I am following the tutorial from here: "http://itsolutionstuff.com/post/codeigniter-3-and-angularjs-crud-with-search-and-pagination-exampleexample.html"

I am getting these errors: errors
Where am i going wrong ? i have tried exhaustively to search for answer or hint but i am lost, i am obviously pretty new to codeigniter.
Here is link to github files that i downloaded for tutorial. I appreciate any help or suggestion. Thank You all.
0
how to logout in php using codeignter
0
how to create login page in php using codeigniter
0
Hi Experts

Could you point a way to make a Codeigniter view have a very long timeout?

This view maintains a dashboard open in a TV during a long time. This dashboard presents information from time to time by using code like:

 $.getJSON("survey_dashboard/get_totais", function (data) {
	$.each(data, function (g, grupo) {
		if (grupo.GRUPO == 'TOTAL') {
			total = grupo;
		} else if (grupo.GRUPO == 'ATIVO') {
			ativo = grupo;
		} else if (grupo.GRUPO == 'RECEPTIVO') {
			receptivo = grupo;
		} else if (grupo.GRUPO == 'VIVO') {
			vivo = grupo;
		}
	});

Open in new window


Where
survey_dashboard/get_totais

Open in new window


is a Controller function  that calls a SP

...
  public function get_totais() {

        $data = array();
        $data = $this->survey_model->new_get(array('query' => "CALL proc_pesquisa_totais()"));
        die(json_encode($data));
    }

Open in new window


Because an user first need to login the system to charge the dashboard-  this start countnig time,  after the timeout is reached the dashboard closes.

Does CI has a way to extend this time?

Thanks in advance
0

CodeIgniter

36

Solutions

52

Contributors

Top Experts In
CodeIgniter
<
Monthly
>

No Top Experts for this time period. Answer questions to earn the title!