codeigniter

How can I download file in codeigniter?

妖精的绣舞 提交于 2019-12-24 03:27:31
问题 I am trying to download file in my codeigniter web application using javascript and codeigniter controller, it shows the file contents in ASCII format but not download the file directly view.php <a href="javascript:prd_download(this)">Download</a> <img src="<?php echo site_url()."/../images/uploads/".$jobno."/thumb_".$prd_row->filename; ?>" alt="Loading Image..." > <input type="checkbox" name="img_check" id="img_check" class="img_check" image="<?php echo $prd_row->filename ?>"> <script type=

CodeIgniter and htaccess - Protect a specific controller and its methods via AuthType?

假装没事ソ 提交于 2019-12-24 03:19:37
问题 I have an admin controller which has some methods that I want to protect. http://blabla.com/admin/ http://blabla.com/admin/edit_coupon/ http://blabla.com/admin/edit_photo/ I don't need a full blown authentication system for this site, so I'd prefer to just utilize htaccess and AuthType for any /admin/ URLs. My current .htaccess is a basic CI one. RewriteEngine on RewriteRule ^$ /index.php [L] RewriteCond $1 !^(index\.php|uploads|images|css|js|videos|code|robots\.txt|favic on\.ico) RewriteRule

Configure htaccess to work with IIRF on IIS6 - codeigniter

六月ゝ 毕业季﹏ 提交于 2019-12-24 03:18:08
问题 i just created a website with CodeIgniter, the problem was with our server that running on windows server 2003 with IIS6, when calling the website it displays only the homepage, and the other pages displays 404 error page due to .htaccess limitation on IIS6, the support told me that he did a setup for a program called IIRF to enable moderewrite but still i need to use another rewrite expression that the one was in the htaccess here is my htaccess content <IfModule mod_rewrite.c> RewriteEngine

Extend Codeigniter Exceptions class to add a custom method

天涯浪子 提交于 2019-12-24 03:12:49
问题 I created a new method to handle with 401 apache error. My core class extends CI core class but when I call the method name I receive this message: Fatal error: Call to undefined function show_401() in G:\Path\application\controllers\loader.php on line 29 class MI_Exceptions extends CI_Exceptions { function __construct() { parent::__construct(); } /** * 401 Unauthorized * * @access private * @param string the page * @param bool log error yes/no * @return string */ function show_401($page = ''

Codeigniter session problems

守給你的承諾、 提交于 2019-12-24 03:07:47
问题 I've created user authentication using an awesome codeigniter authentication library ion auth in my codeigniter application, the authentication works fine but when i logout and click back button of the browser i can go through all the pages that i've visited in my application which raise concern aver user privacy but if i try to refresh the page it recognises that I'm logged out. How can i force the browser to reload when a user click back button of the browser? Any suggestion on how to solve

How to create Error log in PHP Codeigniter Framework [duplicate]

橙三吉。 提交于 2019-12-24 03:06:48
问题 This question already has answers here : How to do error logging in CodeIgniter (PHP) (4 answers) Closed 5 years ago . How to create Error log in PHP Codeigniter Framework? The Error log has Possible to create in localhost ? 回答1: Yes you can enable for localhost. just go to applications/config/config.php and add $config['log_threshold'] = 1; $config['log_path'] = '';// add your path $config['log_path'] = '' default will be applications/logs dir log threshold values :- 0 = Disables logging,

PHP Write string to new line for the first time and not at the end of file

那年仲夏 提交于 2019-12-24 03:06:46
问题 Using Codeigniter function write_file() , I can write to an existing file like this: write_file("path_to_file", "String four"."\n", "a+"); Assume I already have a file like this: String one String two String three With write_file("path_to_file", "String four"."\n", "a+") , I have the ouput below when writing to file for the first time: String one String two String three String four Any idea about how I can write String four to new line for the first time? Like shown below: String one String

Optimising SQL Queries

你离开我真会死。 提交于 2019-12-24 03:04:04
问题 I'm developing a content management system at the moment, and I wanted to hear your thoughts on the following: I have one table, page . Let's assume it looks like this ID | Title | Content 1 | Test | This is a test As well as this, I have a page_option table (so I can store options relating to the page, but I don't want to have a finite list of options - modules could add their own options to a page if required.) The page_option table could look like this: page_id | option_key | option_value

How to destroy Codeigniter library instance

百般思念 提交于 2019-12-24 02:44:10
问题 I would like to know if there is any way I can destroy a Codeigniter library instance. What I want to do is something like this: $this->load->library('my_library'); /** Code goes here **/ $this->my_library->destoy_instance(); The reason I need to do this is because I need to liberate RAM memory while executing a large scripts. Any help will be greatly appresiated. 回答1: You can do simply like that by using unset or setting null . unset($this->my_library); OR $this->my_library = null; This

Codeigniter: Redirect to another URL from view page

帅比萌擦擦* 提交于 2019-12-24 02:42:43
问题 google-php-client example calls the authorization URL when user clicks a link. I want to call it when page loads without any user click. The way it is implemented in google-client example: $client = new Google_Client(); $client->setApplicationName('Google Contacts PHP Sample'); $client->setScopes("http://www.google.com/m8/feeds/"); $auth = $client->createAuthUrl(); print "<a class=login href='$auth'>Connect Me!</a>"; I am trying to remove dependency on clicking on Connect Me link and call url