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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,441
» Latest member: sushant
» Forum threads: 65,877
» Forum posts: 413,880

Full Statistics

Latest Threads
Where to store static arr...
Forum: General Help
4 minutes ago
» Replies: 3   » Views: 21
Unsetting Session In Arra...
Forum: General Help
1 hour ago
» Replies: 1   » Views: 55
XML error: Invalid docume...
Forum: CodeIgniter 2.x
3 hours ago
» Replies: 4   » Views: 80
CSV Importing Advice
Forum: General Help
9 hours ago
» Replies: 6   » Views: 192
Are there any CodeIgniter...
Forum: Jobs
Yesterday, 11:24 PM
» Replies: 4   » Views: 190
Redirect doesn't work wit...
Forum: General Help
Yesterday, 10:40 PM
» Replies: 7   » Views: 355
How to format template?
Forum: Model-View-Controller
Yesterday, 03:59 PM
» Replies: 6   » Views: 360
MongoCollection::update()...
Forum: General Help
Yesterday, 02:38 PM
» Replies: 0   » Views: 45
How to Get Banned
Forum: News & Discussion
Yesterday, 12:08 PM
» Replies: 12   » Views: 7,351
Create custom link url fo...
Forum: General Help
Yesterday, 11:47 AM
» Replies: 5   » Views: 219

 
  paypal payment gateway integration in codeigniter
Posted by: fakhrawy - 04-21-2017, 01:51 PM - Forum: Learn More - No Replies

in this tutorial i will introduce a full example to cover the whole process from clicking the buy button to insert the response into payments tables, and it will only focus for the PayPal payment standard because I have not seen any updated tutorial that cover this getaway until now with the Payments REST API 

let's do it 
paypal payment gateway integration in codeigniter


  how to display username in header using session
Posted by: sumant - 04-21-2017, 09:20 AM - Forum: General Help - Replies (2)

hello... i want to display username in header using session but when i use ($this->session->userdataWink this i get '1' . please help me how to do it.

login controller:
public function admin_login(){
$this->load->library('form_validation');
       $this->form_validation->set_rules('username','USER NAME','required|alpha|trim');
$this->form_validation->set_rules('password','PASSWORD','required');
//$this->form_validation->set_error_delimiters("<p class='text-danger'>","</p>");
if($this->form_validation->run('admin_login')){
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->model('loginmodel');
$login_id = $this->loginmodel->login_valid($username,$password);
if($login_id){
//$this->load->library('session');
$this->session->set_userdata('user_id',$login_id);
return redirect('admin/dashboard');
} else{
$this->session->set_flashdata('login_failed','Invalid Username/Password');
return redirect('user');
}

}else{
//echo"not login";
$this->load->view('public2/login_form');
//echo validation_errors();

}
///login model:
public function login_valid($username,$password){
$q=$this->db->where(['uname'=>$username,'pword'=>$password])
           ->get('users');
if($q->num_rows()){
return $q->row()->id;
//return TRUE;

} else{
return false;
}
}


  Using class in model
Posted by: -V1cu- - 04-21-2017, 04:19 AM - Forum: Libraries & Helpers - Replies (2)

Hey guys,

I have a weird problem and i can't figure out how to solve it...

I have a custom library User.php with de following code:

PHP Code:
defined('BASEPATH') OR exit('No direct script access allowed');

class 
User
{
 
   public $session_prefix 'usrs_';

 
   public $cookie_prefix 'usrc_';

 
   public function __construct()
 
   {
 
       $this->load->model('users_model');

 
       $this->users_model->login_remembered_user();
 
   }

 
   public function __get($var)
 
   {
 
       return get_instance()->$var;
 
   }
 
   
    public 
function is_logged_in()
 
   {
 
       return true;
 
   }


And the model Users_model.php with the following code:
PHP Code:
defined('BASEPATH') OR exit('No direct script access allowed');

class 
Users_model extends CI_Model
{
    public function 
__construct()
    {
        
parent::__construct();
    }

    public function 
login_remembered_user()
    {
        
$cookie_id $this->user->cookie_prefix 'id';
        
$cookie_rc $this->user->cookie_prefix 'rc';

        if(
$this->user->is_logged_in() && get_cookie($cookie_id) && get_cookie($cookie_rc))
        {
            
        }
    }


The problem is that in the model at method login_remembered_user i get the error that class user isn't set, although the user library is autoloaded...

What i'm doing wrong?


  codeigniter 3.0.1 equiped with opencart filemanager
Posted by: shakalya195 - 04-21-2017, 02:10 AM - Forum: Addins - Replies (1)

Hello fellows,
I started working on Codeigniter and i missed Opencart filemanager a lot. So I modified and tried implementing Open cart file manager to the codeigniter 3.0.1.

  • This provides admin to view a file upload directory.
  • You can Create a new folder.
  • You can Delete a folder.
  • You can navigate inside upload folder.
  • This supports pagination.
  • Its build with Opencart file resize module. You can resize any image in desired size.
  • It also provides a CACHE folder which creates resized image at runtime. Best way to handle images.

You can download this from my site.

http://shakalya.com/filemanager-for-codeigniter/

or download from attachement.

See the Working here:
https://youtu.be/SnsA5sL2FhQ

Thanks.


  Helpers
Posted by: donpwinston - 04-20-2017, 11:15 AM - Forum: CodeIgniter 4 Support - Replies (4)

I noticed that making my own helper functions does not work?  Angry

form validation and sessions appear to work!  Smile


  [CI2.1.4] This page isn’t working website is currently unable to handle this request.
Posted by: cndunga - 04-20-2017, 10:37 AM - Forum: General Help - Replies (9)

When I try to access my website I get the following error message

This page isn’t working

website.co.ke is currently unable to handle this request.

The error log is as follows

ERROR - 2017-04-20 12:30:12 --> Severity: Notice  --> Undefined variable: ark_root /home/website/public_html/application/config/config.php 34

ERROR - 2017-04-20 12:30:12 --> Severity: Notice  --> Only variable references should be returned by reference /home/website/public_html/system/core/Common.php 257


What could be the problem?


  Deleting folders and their content.
Posted by: keithmclaughlin - 04-20-2017, 10:08 AM - Forum: General Help - Replies (9)

Hi,

I'm having problems when it comes to deleting specific folders. All folders get deleted inside an "uploads" folder when I only want a single folder deleted.

My application allows new companies to register on the system. When a company registers a new folder gets created inside the uploads folder specific to that company (a random md5 string is used).

My folder setup:

- public_html / htdocs
   - uploads
       - 731e315adc887be41cc84be0f5c73f76
           - avatars
       - b8218d22eaaca5deb91c741c4d7112dd
       - 71913f59e458e026d6609cdb5a7cc53d
       - etc...

In the app I provide admins the ability to delete companies. When a company is being deleted I want all files & subfolders inside the company specific folder deleted and then the folder itself.

The md5 string is stored in a MySQL database (as 'uploads_folder') along with other info about the company.

In the delete function in the Companies class I get the company info using the following:

PHP Code:
$company_folder $this->company_lib->get_uploads_folder($id); 

The get_uploads_folder function inside the Company_lib library simply returns the full path:

PHP Code:
public function get_uploads_folder($company_id)
{
 
   $company $this->CI->company_model->fields('uploads_folder')->get($company_id);

 
   return FCPATH 'uploads'DIRECTORY_SEPARATOR $company['uploads_folder'];


I then load the file helper and call the delete_files function:
PHP Code:
$this->load->helper('file');

// delete all uploaded files for the company
delete_files($company_folderTRUE); 

When the delete_files function runs it deletes all folders inside the uploads folder instead of just deleting the one specific to that company.

What am I doing wrong?

By the way this is happening when using WAMP on my windows computer. I haven't tested it on my host yet (which uses Unix/Linux) for fear of deleting even more folders!


  $this->validation->withRequest($this->request)->run() behavior
Posted by: donpwinston - 04-20-2017, 09:42 AM - Forum: CodeIgniter 4 Support - Replies (1)

CI4's $this->validation->withRequest($this->request)->run() behaves differently then CI3's $this->form_validation->run()?

When the page is loaded and no submit button is clicked CI3 will return FALSE. It appears CI4 returns TRUE.
I had to do the following:

if ($this->request->getVar('submitted') == NULL || ! $this->validation->withRequest($this->request)->run())


Is this the way it's supposed to work?


  GZip Compression for Website with Ajax
Posted by: Waschi - 04-20-2017, 07:20 AM - Forum: Best Practices - Replies (3)

Hi everyone,
i would like to enable gzip-compression for my website.
But than i have a problem with my ajax-requests.
E.g i run into js error (because i get a compressed json).
I guess i cant handle this with jQuery, so is it possible to disable the gzip compression for some controller-functions?

Eg. Controller/func1 = compression on
      Controller/func2 = compression off

Thank you !  Smile

//Im not sure if "Best Practices" or "General Help" is the correct section for this.


  View that prints all the array $data['personas'] in a table html.
Posted by: Angel_Debat - 04-20-2017, 05:58 AM - Forum: General Help - Replies (4)

Good morning and sorry for my english.
I have a very simple Controller, a very simple Model and I need the code of a simple View that prints all the array $data['personas'] in a html table.

The problem is:
I don't know the name of fields, I don't know how many fields has got the table, (or array)
And I need put the name of the fields in the first row of the html table...

Code of Controller:


Code:
class Controller_05_tabla_oracle extends CI_Controller {

  public function index()
  {
$this->load->helper('url');
$this->load->model('model_05_tabla_oracle');
$this->load->database();
$data['personas'] = $this->model_05_tabla_oracle->getPersonas_Ovh();
$this->load->view('view_05_tabla_oracle',$data);
  }
}

Code of Model:
Code:
class Model_05_tabla_oracle extends CI_Model{

function __construct()//model construct function
{
   parent::__construct();
   $this->ovh_db=$this->load->database('ovh',true);
}

public function getPersonas_Ovh()
{
$query = $this->ovh_db->query('select * from OVPRO.OVT_TRACKING_SESSION where rownum<=10');
return $query->result();
}
}


Code of View, (since now)

Code:
     <div class="page-header">
 
<?php foreach($personas as $p){ ?>
<Table border="1">
<tr><td><?php echo $p->USER_ID; ?></td></tr>
</Table>
<?php }//end foreach ?>
</br>
</br>
</br>
</br>
</br>
<pre><?php print_r($personas) ?></pre>

     </div>

This you can see:
[Image: 20170420035908.jpg]
And this is i need to see:
[Image: 20170420040000.jpg]
Thanks a lot for your atention.

Àngel Gimeno



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