EllisLab Community Forums http://ellislab.com/forums/ EllisLab Community Forums en Copyright 2013 2013-05-21T18:43:41-05:00 How to block URL access to the controller http://ellislab.com/forums/viewthread/235522/ http://ellislab.com/forums/viewthread/235522/#When:20:29:43Z <p>Hi, I developed a small application in CI that works well… Codeigniter is my first framework that I use that is why I think following question: my default_controller is named “site” where I placed all the functions that are linked to the basic buttons on the site to view the pages etc. What about all the other controllers? – I mean all the classes that handle some special functionalities like user authentication – these controllers are accessible via URL. It means that any user can access any public function of my application. As there are some functions that I can’t declare as protected/private (because of ajax call for example) how can I protect them? Thank you for advice? PS:&nbsp; BASEPATH at the top of the controller doesnt change anything and the classes functions are still accessible via URL :(</p> <p>Example:</p> <p>http://www.my_site.com/site/index.html - ok</p> <p>http://www.my_site.com/site/authentificate/validate - run public function of form validation! how to prevent it?</p> 2013-05-20T20:29:43-05:00 Is CodeIgniter development dead? http://ellislab.com/forums/viewthread/234985/ http://ellislab.com/forums/viewthread/234985/#When:16:27:52Z <p>I’ve been lurking and watching github for a number of months, and lately it seems that CodeIgniter’s development has slowed to the point where I wonder if it is a dead project. I think it has been a year since a version release, and wonder if anyone knows if V3 will ever be released.</p> 2013-04-25T16:27:52-05:00 Command Line Follies http://ellislab.com/forums/viewthread/235482/ http://ellislab.com/forums/viewthread/235482/#When:08:54:54Z <p>I am trying to run a command line call to a codeigniter method.</p> <p>It works perfectly on my Mac (OSX) and does not work on the server (HostMonster) on the internet.</p> <p>The problem is the same whether I run the codeigniter from a command line on the server or use a cron call.&nbsp; In both cases the default codeigniter page is displayed rather than running the method.</p> <p>Oh, if I call the method from a browser on the server it works perfectly.</p> <p>Here are the various incarnations:</p> <p>php index.php scores create &nbsp; (Work in OSX and not on server)</p> <p>path/index.php/scores/create (Works on OSX and on server)</p> <p>And to be complete here is the cron .sh script that I ulitmately want to run:</p> <p>#!/bin/bash<br /> cd path<br /> ls<br /> /ramdisk/bin/php5 index.php scores create </p> <p>The ls is obviously just for testing and the cron run displays a directory listinbg and then the default page on the server and works perfectly on OSX.</p> <p>Any suggestions?</p> <p>Maybe there is some server configuration that is required for the command line call to work in codeigniter?&nbsp; </p> <p>Thanks.</p> <p>Bill</p> 2013-05-19T08:54:54-05:00 Google Analytics - help! http://ellislab.com/forums/viewthread/235532/ http://ellislab.com/forums/viewthread/235532/#When:10:09:09Z <p>Hi all.</p> <p>This is my first post on the forum, and I’m hoping to receive quick helping hand from someone about implementing Google Analytics tracking in a CodeIgniter website.</p> <p>Basically, we had our website developed in CodeIgniter and our developers had forgotten to implement the Google Analytics tracking.&nbsp; Being relatively comfortable with editing a few lines of PHP, I figured this can’t be too difficult.&nbsp; However, finding a plethora of topics on implementing hooks and redirects and access rights has made me too scared to touch anything.</p> <p>Would someone <strong>please</strong> help illustrate to me where I should paste the Google Analytics tracking script (e.g. in the header.php file, which is called for every page, or in a separate PHP file as Google suggests - but where do I link it?)</p> <p>Any advice would be greatly apprecaited.&nbsp; Thanks everyone <img src="http://ellislab.com/asset/images/smileys/smile.gif" width="19" height="19" alt="smile" style="border:0;" /></p> 2013-05-21T10:09:09-05:00 Using model in a model http://ellislab.com/forums/viewthread/69833/ http://ellislab.com/forums/viewthread/69833/#When:06:09:06Z <p>Hello</p> <p>I’ve got following Problem:<br /> I’d like to use a model in an other model. Something like this:</p><div class="codeblock"><code><span style="color: #000000"> <span style="color: #91f291">class&nbsp;</span><span style="color: #f5f8cc">Location&nbsp;</span><span style="color: #91f291">extends&nbsp;</span><span style="color: #f5f8cc">Model{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #91f291">public&nbsp;function&nbsp;</span><span style="color: #f5f8cc">get</span><span style="color: #91f291">(</span><span style="color: #f5f8cc">$ID</span><span style="color: #91f291">)</span><span style="color: #f5f8cc">{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #479fd1">//Other&nbsp;Stuff<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #f5f8cc">$this</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">load</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">model</span><span style="color: #91f291">(</span><span style="color: #FFFFFF">'locationType'</span><span style="color: #91f291">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #f5f8cc">$this</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">locationType</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">setID</span><span style="color: #91f291">(</span><span style="color: #f5f8cc">$result</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">LocationTypeID</span><span style="color: #91f291">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #f5f8cc">$this</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">locationType</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">setTitle</span><span style="color: #91f291">(</span><span style="color: #f5f8cc">$result</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">TypeTitle</span><span style="color: #91f291">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #f5f8cc">$this</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">_locationType&nbsp;</span><span style="color: #91f291">=&nbsp;</span><span style="color: #f5f8cc">$this</span><span style="color: #91f291">-&gt;</span><span style="color: #f5f8cc">locationType</span><span style="color: #91f291">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #479fd1">//Other&nbsp;Stuff<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #f5f8cc">}<br />}&nbsp;</span> </span> </code></div> <p>But there is allways following error-message:</p><blockquote> <p>A PHP Error was encountered</p> <p>Severity: Notice</p> <p>Message: Undefined property: Location::$locationType</p> <p>Filename: models/location.php</p> <p>Line Number: 62</p> </blockquote> <p>Can anybody help me please?</p> <p>Greets</p> 2008-01-25T06:09:06-05:00 line dotted or dashed pdf http://ellislab.com/forums/viewthread/235531/ http://ellislab.com/forums/viewthread/235531/#When:08:52:13Z <p>does anyone knows how to put line dotted or dashed in pdf? thanks guys!<br /> e.g.:&nbsp; cell(0,0…text 1 ....)<br />———————————————————————<br /> cell(0,0…text 2 ....)<br /> ..........................................................</p> 2013-05-21T08:52:13-05:00 wampserver in window : CodeIgniter doesn’t show my pages http://ellislab.com/forums/viewthread/235525/ http://ellislab.com/forums/viewthread/235525/#When:03:46:09Z <p>Hi<br /> I’ve just moved to CodeIgniter! In my windows I’ve installed wamp server and when i load the localhost/ci , <br /> The welcome_message.php will load success.<br /> But , I’ve created a file named : site.php and have written on : </p> <div class="codeblock"><code><span style="color: #000000"> <span style="color: #f5f8cc">&lt;?php<br /><br /></span><span style="color: #91f291">class&nbsp;</span><span style="color: #f5f8cc">Site&nbsp;</span><span style="color: #91f291">extends&nbsp;</span><span style="color: #f5f8cc">Controller&nbsp;{<br />&nbsp;<br />&nbsp;</span><span style="color: #91f291">function&nbsp;</span><span style="color: #f5f8cc">index</span><span style="color: #91f291">()&nbsp;</span><span style="color: #f5f8cc">{<br />&nbsp;&nbsp;</span><span style="color: #91f291">echo&nbsp;</span><span style="color: #FFFFFF">'something'</span><span style="color: #91f291">;<br />&nbsp;</span><span style="color: #f5f8cc">}<br />&nbsp;<br />}&nbsp;</span> </span> </code></div> <p>Then , when I load the address : localhost/ci/index.php/site .&nbsp; It shows nothing in firefox and in other browser will get error : server not found</p> <p>why?</p> <p>Please help, I’m new in CodeIgniter and this is my first try <img src="http://ellislab.com/asset/images/smileys/smile.gif" width="19" height="19" alt="smile" style="border:0;" /><br /> Thank you.</p> 2013-05-21T03:46:09-05:00 CodeIgniter Session Problems Thread http://ellislab.com/forums/viewthread/135722/ http://ellislab.com/forums/viewthread/135722/#When:16:05:43Z <p><span style="font-size:16px;"><b>CI’s Session Library is FLAWED.</b></span></p> <p>UPDATED: 11/20/2009</p> <p>The following applies to version 1.7.2 of CodeIgniter.</p> <p> - <i>Trying to use DX_auth or other authentication libraries but end-users using Internet Explorer experience mysterious spontaneous log-outs or people can’t log in?</i></p> <p> - <i>Is your session data disappearing for IE users while your FireFox and Safari users have no problems?</i></p> <p> - <i>Tired of seasoned CI veterans on this forum telling you the problem is YOU not CI?</i></p> <p>If so, you’re at the right thread.</p> <p><span style="font-size:16px;">Here is what you need to know about CI’s Sessions.</span></p> <p>Okay, so here’s the long and short of it.&nbsp; CI’s session library creates standards-compliant cookies that work reliably on all web browsers except for Internet Explorer 6,7,8 and so on.&nbsp; The reason being, Internet Explorer doesn’t follow standards (<a href="http://blogs.msdn.com/ieinternals/archive/2009/08/20/WinINET-IE-Cookie-Internals-FAQ.aspx">link</a>).&nbsp; Kudos for CI. Shame on IE.&nbsp; We all know that Microsoft’s browser is a piece of poop.&nbsp; It still doesn’t change the fact that tons of people still use it because they either don’t care, don’t know, or don’t have a choice (company-owned computer).&nbsp; Rather than accommodate Internet Explorer users, CI coders and CI uber-fans would prefer that you start a revolt, shun the 40% to 50% of users who use IE, lose your paying web development clients, and/or get fired.</p> <p>Obviously, lots of people encounter no problems whatsoever when using CI’s session class, which makes those of us who <i>do</i> have problems frustrated.&nbsp; Just know your not alone. A quick search on this forum revealed over 600 other posts from people having questions or issues with CI’s session class. The problem may lie with your host’s web server, it may lie with your visitor’s web browser, it may be that your code doesn’t accomodate CI somehow.&nbsp; Regardless, by introducing a new layer between PHP’s perfectly adequate native session routines and the end user, CI’s session class also inevitably introduces new and annoyingly mysterious problems.</p> <p>So, why invest time and effort writing code that relies on CI’s sessions when, at some point in the future, unforeseen server or browser changes have the potential of ruining your code?</p> <p>I say, avoid the problems in the first place. So…</p> <p><b>IF YOU HAVE A CHOICE:</b></p> <p>- Starting a new project? <b>Don’t use CI’s session class</b>.&nbsp; Just write code like you normally would outside of the CI framework.&nbsp; Meaning: use PHP’s native session handling functions like session_start(), unset(), session_destroy() and the $_SESSION superglobal.</p> <p>- By default, PHP stores data on the server in a world-readable location, like “/tmp”.&nbsp; If you are hosted on a chrooted virtual or dedicated server, then (for the most part) there is no need to be worried. However, if you are on a traditional shared server, like at an ISP, there are PHP configuration settings you can tweak to change the location where PHP stores session data.&nbsp; For example, on Apache servers you can set up a special .htaccess file.&nbsp; Google that for more information.</p> <p><b>IF YOU’RE STUCK WITH CI_SESSION:</b></p> <p>- Did you inherit a project that relies on CI’s session class?</p> <p>- Is your favorite 3rd party library dependant on CI’s session class?</p> <p><i><b>If you absolutely MUST use CI’s session class, your best option is to completely replace CI’s session class with one that uses PHP’s rock-solid native session handling routines.<br /> </b></i></p> <p>Current Recommended Replacements:</p> <p><b>Dariusz Debowczyk’s Session Class</b></p> <p>I found this solution while surfing the net for constructive help.&nbsp; Dariusz’s orginal class was intended for versions prior to 1.7.2.&nbsp; You place it in your application/libraries folder and it completely circumvents CI’s session class.&nbsp; I tweaked some method and property names to make it work with 1.7.2.&nbsp; You can find the updated code here…</p> <p><a href="http://codeigniter.com/wiki/Dariusz_Debowczyks_Session_Class/">http://codeigniter.com/wiki/Dariusz_Debowczyk’s_Session_Class/</a></p> <p>Directions for how to install the class in your application are also on the above wiki page.&nbsp; Please keep in mind, the Dariusz hack is that, a hack.&nbsp; It needs to be improved.&nbsp; Hopefully you, the reader, can improve it over time.&nbsp; If you do end up improving it, please reply to this thread with your updated code.</p> <p><span style="font-size:16px;">Can’t Replace CI session class?</span></p> <p>I feel your pain, but like I said earlier, lots of people don’t have issues with CI’s session class.&nbsp; Perhaps all you need to do is…</p> <p><b>Double check your settings.</b></p> <p>- Examine your cookie settings in /application/config/config.php A CI vetran recomended removing underscores from the cookie name (<a href="http://ellislab.com/forums/viewthread/130577/#669406">link</a>). This can be done by changing:</p> <div class="codeblock"><code><span style="color: #000000"> <span style="color: #f5f8cc">$config[</span><span style="color: #FFFFFF">'sess_cookie_name'</span><span style="color: #f5f8cc">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #91f291">=&nbsp;</span><span style="color: #FFFFFF">'ci_session'</span><span style="color: #91f291">;&nbsp;</span> </span> </code></div> <p>to</p> <div class="codeblock"><code><span style="color: #000000"> <span style="color: #f5f8cc">$config[</span><span style="color: #FFFFFF">'sess_cookie_name'</span><span style="color: #f5f8cc">]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #91f291">=&nbsp;</span><span style="color: #FFFFFF">'cisession'</span><span style="color: #91f291">;&nbsp;</span> </span> </code></div> <p><br /> Also remove any underscore in $config[‘cookie_prefix’] since it is prefixed to the cookie name.</p> <p><b>Double-Check Your Server’s Time and Timezone</b></p> <p>Make sure your server’s time is correct. All browsers set cookies based on the client’s time.&nbsp; IE on the other hand, goes by server time.&nbsp; If the server’s time is in the past, cookies will expire as soon as they are set thus giving the illusion that your cookie never arrived.</p> 2009-11-19T16:05:43-05:00 Problem when i deploy in web host http://ellislab.com/forums/viewthread/235524/ http://ellislab.com/forums/viewthread/235524/#When:02:41:55Z <p>I have problem when i uploaded my website on the web host.&nbsp; i got this error <br /> HTTP Error 500 (Internal Server Error):&nbsp; the page is connected to the database. </p> <p>but in my local pc it works fine.</p> <p>a few months ago i deploy a website on the same web host and database but i don’t encounter any error. the main difference between before and now is the CI version. is there a factor on it? </p> <p>the deployment procedure i made now is pattern on the procedure i did last time. </p> <p>pls help.</p> 2013-05-21T02:41:55-05:00 where/how can I edit the layout on a category page? http://ellislab.com/forums/viewthread/235516/ http://ellislab.com/forums/viewthread/235516/#When:14:13:48Z <p>Hi,<br /> Excuse me if I ask a stupid question. I’m working on my first codeigniter project and so far I think it’s great.<br /> I’ve been brought on board this project to change the format of the blog/category feed on a live site.<br /> This live site has several categories, including “blog” which is set up as a category and that is how they want it. Some of the category pages are styled to display the title, image and excerpt of the first three entries for that category. I would like to style the “blog” category to display the same way. <br /> 1. How and where can I change the layout of that one category page? I imagine I can borrow some of the code for the already styled categories for the blog category.<br /> 2. How and where can I edit that feed so that the first 6 entries are displayed?<br /> Thanks in advance for your help!</p> 2013-05-20T14:13:48-05:00