Welcome Guest, Not a member yet? Register   Sign In
  creating libraries in subdirectories
Posted by: El Forum - 10-26-2007, 03:52 PM - No Replies

[eluser]Majd Taby[/eluser]
Hey, I want to create a new validation library, MY_Validation, it works, but only if i put the file in application/libraries/ I need to be able to put it in application/backend/libraries.

I looked at system/codeigniter/Common.php and it seems to accomodate for it (using APPPATH, which includes the subdirectory), but it just doesn't work. Here's the error:

Fatal error: Cannot redeclare class CI_Validation in /Users/majd/Sites/portal_wc/system/libraries/Validation.php on line 43

here's how the code looks:

Code:
class MY_Validation extends CI_Validation{
    
    function MY_Validation()
    {    
        parent::CI_Validation();
    }


  Scaffolding without mod_rewrite
Posted by: El Forum - 10-26-2007, 03:26 PM - No Replies

[eluser]datdesignguy[/eluser]
Hi,

I'm currently developing my first CI application, and one of the limitations I'm working with is that our office is running IIS 6, and the IT guys won't let me install an IIS equivalent to apache's mod_rewrite.

So, I've got my database all set up here, and I configured CI to run in querystring mode, but now I'm wondering how the heck I trigger scaffolding?

I tried http://example.com?c=scaffolded_controller&scaffold;_trigger

where 'scaffold_trigger' is the trigger word I set in my routes.php file but nothing happened.

Is there currently anyway to trigger scaffolding when .htacces/URL rewriting is not available?

Thanks,

Greg J


  uploading pdf file is giving me fits of numb
Posted by: El Forum - 10-26-2007, 03:06 PM - No Replies

[eluser]FuzzyJared[/eluser]
I am able to upload all necessary files for my application with the exception of pdf files. I have gone through a couple of posts about this. One of which was posted just over a year ago.

Long story short when I echo out the $this->file_type within the Upload.php I get the following -
application/unknown

Which is obviously a problem as I can't exactly allow application/unkown

The weird part is this happens using Firefox 2.0.0.08 but not in safari on a mac. I have not validated yet on a pc.

I should also mention that Apache 2 and PHP 5.2.3

Tanx in advance


  Will CI Let Me Redirect to another Controller?
Posted by: El Forum - 10-26-2007, 03:05 PM - Replies (4)

[eluser]scottelundgren[/eluser]
I'm writing an application that requires authentication & authorization. I've written a controller that handles these requirements but now I face a dilemma and need some architectural advice.

Once my "login" controller performs the authentication and authorization routines I'd like to redirect my user into another controller based on their role. What I envision is that these "role controllors" would then load the role models, fetch data and perform the view:

Code:
if ($this->_authenticate() && $this->_authorize()) {
  if ($this->session->userdata('role') == "instructor") {
    $this->redirect('instructor');
  } elseif ($this->session->userdata('role') == "administrator") {
    $this->redirect('administrator')
  } else {
    $data['error'] = "Could not authorize ".$this->session->userdata('username');
    $this->load->view('login_authorize', $data);
  }
} else {
  <!-- snip load the login form snip -->
}

I'm having trouble with my redirects firing. Is this not the "CI" way to accomplish this? what's the better way of making sure they user is logged in and shuffling them off to their respective task screen. It seems like I'm clouding my "login" controller if I write 2 functions for each task to seperately load the models & views for my seperate roles.


  Active Record select question
Posted by: El Forum - 10-26-2007, 02:08 PM - Replies (3)

[eluser]Eric Barnes[/eluser]
Hi,

I have this query:

Code:
SELECT * FROM kb_articles WHERE a_display = 'Y' AND a_id IN ( 1,2 )

I am trying to use something similar with active record and it appears this isn't possible because it always comes out as:

Code:
SELECT * FROM kb_articles WHERE a_display = 'Y' AND a_id IN '1,2'

My ci code looks like this:
Code:
foreach ($query->result() as $row)
{
    $aID.=$row->article_id.',';
}
$aID = rtrim($aID, ', ');
$this->db->from('articles');
$this->db->where('a_display', 'Y');
$this->db->where('a_id IN', $aID);

Does any one have any advice on a work around or maybe an easier way to set this up?


  Protecting Web-Accessible Directory and Subcontents
Posted by: El Forum - 10-26-2007, 01:17 PM - Replies (4)

[eluser]skfriese[/eluser]
Is there any way to restrict access to the content within a web-accessible folder using the login details contained within a PHP session? Please read scenario below before replying. ;-)

I have an existing CodeIgniter application that happens to serve up web accessible content. Users are required to login to view the content, and their sessions are managed through DB-based PHP sessions. This all works fine, for the most part. However, it is still possible to access the web-accessible content directly by bypassing the CodeIgnitor application altogether and entering the URL to the content within the browser's address bar.

Now, the reason why this is now a problem is that there was never a requirement to "lock down" the content. The application merely tracks the user's progress through the content using AJAX if the user is logged into the application. No such progress is tracked if accessed "outside of the application". No big deal, but the client wishes to lock this content down now, and only allow those logged into the system to access it.

Being familiar with htaccess/htpasswd, I am able to restrict access to main content folder, but then the users must login again to launch the content. Thus my question above. Is there any way to "set" the $_SERVER['PHP_AUTH_USER'] or $_SERVER['PHP_AUTH_PW'] through PHP, so that I can set the HTTP authentication criteria when the user logs into the application? I'm also familiar with passing requests to the content using a "proxy" PHP script and authenticating that way instead, but that is not an option with this type of content as it is structured.

Any direction is greatly appreciated. I've attempted some serious Google-Fu over the past couple of days with no luck so far. :-S


  POST data in model
Posted by: El Forum - 10-26-2007, 12:36 PM - Replies (3)

[eluser]maadmac[/eluser]
Quick question:

There shouldn't be any problem with invoking the Input class in a model, correct? Something like this:

Code:
<?php

class Test_model extends Model {

    function __construct() {
        parent::Model();
    }
    
    function test_function() {
        $this->session->set_userdata('some_data') = $this->input->post('some_data');
        }
?>

I've seen it in other posts in the forum, so I'm fairly sure it should work, but I was having some trouble earlier with empty variables and am wondering if it's related...


  Dynamic dropdown menus
Posted by: El Forum - 10-26-2007, 11:50 AM - Replies (4)

[eluser]phester[/eluser]
This is not really a purely CI related question, but I was wondering if any of you have a quick easy solution!

I am trying to create 2 drop down menus where the options in the second menu is dependent on the value selected in the first menu. For example, let's say the first menu has the following options:

BMW
Mercedes
Lexus

The second option will have the following options depending on which value was selected:

If BMW was selected:
3 Series
5 Series
7 Series

If Lexus was selected:
IS
ES
GS
LS

And so on...

I am curious for a simple javascript solution using AJAX with jQuery or Prototype. I would like the options of the second menu be fed from a client side script using AJAX.

Any help is greatly appreciated!


  Session best practice question
Posted by: El Forum - 10-26-2007, 10:24 AM - Replies (4)

[eluser]maadmac[/eluser]
How do you normally direct logged in users? My initial inclination would be something like this:

Code:
<?php if ($this->session->userdata['logged_in'] == true) redirect('/somewhere'); ?>

at the top of each page. But I'm running into a 'headers sent' issue, and so I'm wondering if I should try to address it via ob_flush or move the code somewhere else on the page, so the headers get sent first, or something else? Any tips are appreciated, thanks.


  Pass variables from config to library
Posted by: El Forum - 10-26-2007, 09:06 AM - Replies (4)

[eluser]codex[/eluser]
I'm trying to pass vars from a config file to a library, but I can't get it to work. What I have so far (The config file is autoloaded):

In config

Code:
$config['path_imagemagick']    = '/usr/bin/convert ';
$config['path_tempdir']        = '/home/name/public_html/temp/';
$config['path_photosdir']    = '/home/name/public_html/photos/';

The library
Code:
class CI_ImgResizer_IM {
    
    var $CI;
    var $imagick         = $this->config->item('path_imagemagick');
    var $temppath         = $this->config->item('path_tempdir');
    var $newpath         = $this->config->item('path_photosdir');
    
    /**
     * Constructor
     *
     */    
    function CI_ImgResizer_IM()
    {    
        $this->CI =& get_instance();
        log_message('debug', "ImgResizer_IM Class Initialized");
    }
    
// the functions here

}

What am I missing or doing wrong??


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

Username
  

Password
  





Latest Threads
Validation Rules: Valid e...
by sevmusic
3 hours ago
Changing Session cookie -...
by codeus
6 hours ago
which linter to use (and ...
by paulbalandan
7 hours ago
Update from 4.6.0 to 4.6....
by Vespa
Yesterday, 01:17 AM
hot-reload side effects s...
by InsiteFX
05-17-2025, 10:11 PM
using app/Config/App.php ...
by sam547
05-16-2025, 03:04 PM
Setting baseURL in Regist...
by grimpirate
05-15-2025, 02:20 PM
CRUD Code Generator
by DeanE10
05-15-2025, 05:31 AM
CI debugging tools
by Montasser
05-14-2025, 02:54 PM
CodeIgniter.com - Report ...
by Harry Lyre
05-14-2025, 04:26 AM

Forum Statistics
» Members: 146,904
» Latest member: bj88gamesonline1
» Forum threads: 78,393
» Forum posts: 379,480

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB