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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,135
» Latest member: shf
» Forum threads: 67,041
» Forum posts: 419,783

Full Statistics

Latest Threads
Add key to header in all ...
Forum: General Help
27 minutes ago
» Replies: 1   » Views: 65
CI do not have model to m...
Forum: CodeIgniter 4 Feature Requests
1 hour ago
» Replies: 1   » Views: 62
Case Sensitive Filenames ...
Forum: CodeIgniter 4 Feature Requests
1 hour ago
» Replies: 6   » Views: 215
Session issue
Forum: Issues
2 hours ago
» Replies: 0   » Views: 20
[sysadmin] requirements t...
Forum: General Help
4 hours ago
» Replies: 4   » Views: 214
Fetch and Update Data in ...
Forum: General Help
7 hours ago
» Replies: 1   » Views: 89
Help!! I am new at this.
Forum: Installation & Setup
7 hours ago
» Replies: 4   » Views: 125
ion_auth's 1.2mb memory u...
Forum: Addins
7 hours ago
» Replies: 2   » Views: 102
still losing session user...
Forum: General Help
7 hours ago
» Replies: 27   » Views: 927
user_agent Chrome as Oper...
Forum: CodeIgniter 3.x
8 hours ago
» Replies: 2   » Views: 164

 
  How to check if user is banned.
Posted by: kirasiris - 12-08-2017, 03:37 AM - Forum: General Help - Replies (3)

So I'm not the type of guy who likes to type buch of line of non-sense. I will go straight to the reason for which I'm writing this post.

I'm working on a function in which the user logs in and can access to its views but only if his/her account is activated. So far I think it should already work but it does not.

Here is my function on my controller:

PHP Code:
   public function login(){
        
        
//Check if logged in
        
$this->User_model->session_comprobate_member();
        
        
//Set rules
 
       $this->form_validation->set_rules('username''Username''trim|required|min_length[4]');
 
       $this->form_validation->set_rules('password''Password''trim|required|min_length[4]');


 
       if ($this->form_validation->run() == FALSE) {
 
           //Load View Into Template
 
           $this->template->load('public''login''users/login');
 
       } else {
 
           // Get Post Data
 
           $username $this->input->post('username');
 
           $password $this->input->post('password');
            
$active      =    $this->input->post('active'0);
 
           $enc_password md5($password);
 
           $user_id $this->User_model->login($username$enc_password$active);
            
/////// Check if banned
            
if($user_id->active == 0){

 
               // Create Error
 
               $this->session->set_flashdata('error''This account is suspended');

 
               // Redirect to pages
 
               redirect('dashboard/login');

                } else {
            
/////
            
            //Check if variables are true
 
           if ($user_id->active == 1) {
 
               $user_data = array(
 
                   'user_id'   => $user_id,
 
                   'username'  => $username,
 
                   'is_member' => true
                
);
                
 
               // Set Session Data
 
               $this->session->set_userdata($user_data);

 
               // Create Message
 
               $this->session->set_flashdata('success''You are logged in');

 
               // Redirect to pages
 
               redirect('dashboard');
 
           } else {
 
               // Create Error
 
               $this->session->set_flashdata('error''Invalid Login');

 
               // Redirect to pages
 
               redirect('dashboard/login');
 
           }
        }
    }


Right now the only thing it does is trowing me the error which I created with the set_flashdata "This account has been suspended."
Here is where I control whether or not an account is suspended(edit.php):

PHP Code:
<h2 class="page-header">Edit User</h2>
<!--
Display form validation errors-->
<?
php echo validation_errors('<p class="alert alert-dismissable alert-danger">'); ?>
<?php 
echo form_open('admin/users/edit/'.$item->id); ?>

    <!-- Is it Actived? -->
    <?php
        
if($item->active == 1){
            
$yes TRUE;
            
$no FALSE;
        } else {
            
$yes FALSE;
            
$no TRUE;
        }
    
?>
    <div class="form-group">
        <?php echo form_label('Activate''active'); ?>
        <?php echo form_radio('active'1$yes); ?> Yes 
        <?php echo form_radio('active'0$no); ?> No
    </div>

    <?php echo form_submit('mysubmit''Update User', array('class' => 'btn btn-primary')); ?>

<?php echo form_close(); ?>
and here is the view in which I register a new account:
PHP Code:
<h2 class="page-header">Add User</h2>
<!--
Display form validation errors-->
<?
php echo validation_errors('<p class="alert alert-dismissable alert-danger">'); ?>
<?php 
echo form_open('admin/users/add'); ?>

    <!-- Is it Actived? -->
    <div class="form-group">
        <?php echo form_label('Activate?''active'); ?>
        <?php echo form_radio('active'1TRUE); ?> Yes 
        <?php echo form_radio('active'0FALSE); ?> No
    </div>

    <?php echo form_submit('mysubmit''Add User', array('class' => 'btn btn-primary')); ?>

<?php echo form_close(); ?>

Can somebody help me; am I missing something?,
Thanks.


  [SOLVED] CI Tutorial Static Page -not recognizing controller- help
Posted by: aleifuu - 12-07-2017, 11:05 PM - Forum: Installation & Setup - Replies (5)

Hi all, 

background info
----
CI version : CI 3.1.6
Host : Raspberrypi3 running debian jessie/Apache2.4/MySQL 

I stumbled across what will appear as a humble mistake, but god for the life of me I just couldn't figure it out yet. hopefully by sharing in this forum, I'll get somewhere with my first step to CI and its goodies ... 

I'm following the tutorial from CI's https://www.codeigniter.com/user_guide/t...pages.html and basically creating new controller Pages and its related function/templates/pages/etc

Problem is when I hit my server http://localhost/codeigniter/pages/view, server doesn't seem to recognize that indeed there is the controller
called Pages, hence 404 ( and not the CI's 404 rendition )

Seem like a simple problem 

I have : 


  1. set base_URL to be : 'localhost/codeigniter/' ( yes, for time being the application name is codeigniter )
    i've tried various like : localhost, http://localhost/codeigniter/, http://localhost/codeigniter, http://localhost. doesn't seem to budge
  2. how do you turn on debug or get CI spit out error message in the log ? does it go to apache2/error.log at all ? 
  3. At this point of the tutorial, do I need to turn the rewrite_mod yet and modify the default .htaccess to include rewrite rules ?
Thanks guys

I just need to get over this obstacle to start learning and applying CI to my web application. I'm moving away from building things from scratch and going to utilize more of CI's library and helper function


  problems with multiple connections to databases and sessions
Posted by: mcaleirbag - 12-07-2017, 09:10 PM - Forum: Libraries & Helpers - Replies (2)

Hi,

I need to work with two simultaneous connections, mysql and oracle. But when registering my session with CI session by database it does not let me process the queries of oracle, I think it tries to do the search of the oracle tables in the mysql database.

I already tried, with loading the second connection to oracle but still not answering.

Before configuring the sessions, the development correctly executes the second connection with the instruction: variable = this load database oracle true

Do you know any solution to the case?
Thanks for your help.



Attached Files
.pdf   Database file with two conections.pdf (Size: 306.36 KB / Downloads: 22)

  CI4 can be able to use full asynchronous features of php within the framework
Posted by: bawa_d - 12-07-2017, 05:55 AM - Forum: CodeIgniter 4 Feature Requests - Replies (4)

Dear CI devs congratulations for CI4 from the bottom of my heart.

As the php 7.1 have huge performance comparatively to php 5.x there is a new project for asynchronous php on github which is equivalent to Nodejs.

please find below official link
https://reactphp.org/

github repos:
https://github.com/reactphp

framework equivalent to express.js
https://github.com/CapMousse/React-Restify

please have a look so the CI4 can be able to use full asynchronous features of php within the framework.

you did nice job as always.

with regards,
deepak bawa


  noindex?
Posted by: babybaby312 - 12-07-2017, 05:15 AM - Forum: Lounge - No Replies

Any special thoughts on why not let search engines index the site? Or just a simple misstake?


  CI4 mail
Posted by: scalla - 12-07-2017, 04:53 AM - Forum: CodeIgniter 4 Support - Replies (1)

would there be a continuity on CI4 mailer??


  PHP Excel CodeIgniter
Posted by: danangeloalcanar - 12-07-2017, 01:47 AM - Forum: Addins - Replies (2)

hello, programmers.

Would you help me in this problem?

I am using PHPExcel to generate excel files.

Now my query looks like this.

MODEL:

Code:
class ReportModel extends CI_Model
{
 public function getReport() {
     $this->db->select('a.LnCode as Line Code, c.MachDesc as Machine');
     $this->db->from('tbl_Audit_H as a');
     $this->db->join('tbl_Audit_D as b', 'a.ChkNum = b.ChkNum');
     $this->db->join('tbl_Machines as c', 'a.MachCode = c.MachCode');
   $result = $this->db->get();

   return $result->result_array();
 }

 public function getMachine() {
     $result =  $this->db->get('tbl_Machines');
     return $result->result_array();
 }
}



CONTROLLER:
Code:
 public function getReport() {
   $machines = $this->reportmodel->getMachine();
   $results = $this->reportmodel->getReport();
   $objPHPExcel = new PHPExcel();
   /* Cache Results */
   $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory;
   PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
   
   foreach ($machines as $machine) {
     // Create a new worksheet called “My Data”
     $myWorkSheet = new PHPExcel_Worksheet($objPHPExcel, $machine['MachDesc']);
     // Attach the “My Data” worksheet as the first worksheet in the PHPExcel object
     $objPHPExcel->addSheet($myWorkSheet);
     $objPHPExcel->setActiveSheetIndexByName($machine['MachDesc']);
     $activeSheet = $machine['MachDesc'];


   }
   $sheetIndex = $objPHPExcel->getIndex($objPHPExcel->getSheetByName('Worksheet'));
   $objPHPExcel->removeSheetByIndex($sheetIndex);
   
   header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
   header('Content-Disposition: attachment;filename="myfile.xlsx"');
   header('Cache-Control: max-age=0');
   $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
   $objWriter->save('php://output');

 }


Now I have attached an excel file. That is how the client wants the report to look like.

So basically the report create a sheet per machine.

It fills each sheet with the data related to that machine. 

It groups the result per line number, then per product then per date.

Please see the attached file. Thanks so much. I hope I explain myself well. If you have question for clarification please let me know. Thanks!



Attached Files
.xlsx   Checklist(With Findings) Summary.xlsx (Size: 27.31 KB / Downloads: 22)

  User Guide - ePUB edition - suggestions
Posted by: Crenel - 12-06-2017, 06:24 PM - Forum: CodeIgniter 3.x - Replies (3)

I may be in a distinct minority but I like and use the ePUB version of the User Guide. I use calibre to move it onto my Kobo reader and will occasionally browse through it to learn things I've missed in the past, e.g., when I'm stuck in a waiting room or something. Anyway, there are some things that stand out to me, as a CodeIgniter user (developer) and as a reader/writer/publisher:

1. The file type is not recognized by Chrome when I click the link to download it, so I have to remember to right-click and then choose the download option. I assume a MIME type adjustment on the codeigniter.com site would fix this.

2. The ePUB file lacks a cover, so a) it doesn't stand out from other books on my reader that aren't correctly assembled with covers and b) when I put the reader to sleep with the User Guide active, the sleep display is rather unsightly text instead of a tidy cover image. It looks like Sphinx supports adding covers via the epub_cover option, as of version 1.1, so adding a cover should be workable within the automated file generation routine. I've attached an image (if that works) in case there is interest in doing this but nobody wants to take time to make one (reasonable since it's not a high priority).


  Best way to store user activities
Posted by: theedo - 12-06-2017, 10:38 AM - Forum: General Help - Replies (7)

Hello!

I'm creating a website where users can put like to a post, where they can write a post, where they can put dislike to a post and so on. I'm writing also the "timeline" algorithm. I must write an algorithm that selects foreach user the posts to append to the "wall", like facebook.

So I thought to store the user's activities, like the like action, the dislike action, the comment action and so on. So which is the best practice? I thought about creating a table and store in it all activities, but:

EXAMPLE: I've an array of user's id like that: 

PHP Code:
$ids = array(234); 
suppose that my id is 1. I follow the user number 2, number 3 and number 4. So foreach user that I follow I'll search some activities in a time range and then I'll insert this data to my timeline. So, If I had millions/billions of data? Could there be speed problems?

Maybe you can reccomend me something that does not come to my mind ;P

Thank you!


  need raintpl and idiorm in CI 3.x.x
Posted by: ajaxian - 12-06-2017, 10:05 AM - Forum: Addins - No Replies

hi every body , i'm new in CI 
is there any way to use Raintpl 3 as template engine and Idiorm as ORM in CI?
i find just suggestion in forum , can some one explain with code and Tuts?
thanks



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