Re: Cake warning Cannot modify header information and CORE/Cake/Network/CakeResponse.php, line 398
thanks a lot. it is working. On Sunday, September 14, 2014 8:42:41 AM UTC+3, Anthony GRASSIOT wrote: > > HK, it has been fixed yesterday in 3.x > The view is now rendered and a warning is displayed in debugKit's request > panel. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Cake warning Cannot modify header information and CORE/Cake/Network/CakeResponse.php, line 398
HK, it has been fixed yesterday in 3.x The view is now rendered and a warning is displayed in debugKit's request panel. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Cake warning Cannot modify header information and CORE/Cake/Network/CakeResponse.php, line 398
In cakephp 2 you could debug from controller before pages is rendered. You did get the error of headers already been sent but page rendered after. Now in cakephp3 if I debug in controller I get the same error but page stops rendering and produces a Fatal error: [RuntimeException] . Why is that? Can I change that behavior? On Thursday, February 14, 2013 9:37:03 PM UTC+2, Jeremy Burns wrote: > > Looks like you are debugging out some information before the page is > rendered. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 14 Feb 2013, at 18:19:41, Mehrdad Dadkhah > wrote: > > > hi all > > > > what's the reason of this warning? > > > > > > Warning (2): Cannot modify header information - headers already sent > > by (output started at > > /home/hy4wtsgf/public_html/lib/Cake/Utility/Debugger.php:780) > > [CORE/Cake/Network/CakeResponse.php, line 398] > > Code Context > > > > setcookie - [internal], line ?? > > CakeResponse::_setCookies() - CORE/Cake/Network/CakeResponse.php, line > 398 > > CakeResponse::send() - CORE/Cake/Network/CakeResponse.php, line 375 > > Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 168 > > [main] - APP/webroot/index.php, line 92 > > > > how can i resolve it? > > > > thanks in advance > > > > -- > > Like Us on FaceBook https://www.facebook.com/CakePHP > > Find us on Twitter http://twitter.com/CakePHP > > > > --- > > You received this message because you are subscribed to the Google > Groups "CakePHP" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to cake-php+u...@googlegroups.com . > > To post to this group, send email to cake...@googlegroups.com > . > > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: CakePHP - Warning - Cannot modify header information - headers already sent by
Very good Marcus Silva work fine :). On Thursday, October 16, 2008 6:05:54 PM UTC+7, Marcus Silva wrote: > > Try removing any hidden character you may have after the php closing > tag (?>). > > Example: > > ?>remove anything after the tag > > Hope it helps > > Cheers > > Marcus > > > On Oct 16, 11:31 am, imu wrote: > > > > > > > > > controller file is messages_controller.php > > > > > > > > > > class MessagesController extends AppController{ > > var $name = 'Messages'; > > > >var $helpers = array ( > > 'Html', > > 'Form', > > 'Time' > > ); > > > > function index($id = null ){ > > if (!$id) { > > $this->Session->setFlash('Invalid Topic'); > > $this->redirect(array ( > > 'action' => 'index' > > ), null, true); > > } > > $this->Message->recursive = 1; > > > > $messages = $this->Message->find('all', > > array( 'conditions' => array( 'topic_id' => $id ),'order' => > > 'Message.id DESC') ); > > $this->set('topic_id',$id); > > $this->set('messages',$messages); > > } > > > > function add($id = null) { > > if (!empty ($this->data)) { > > $this->Message->create(); > > if ($this->Message->save($this->data)) { > > > > $this->Session->setFlash('The message has been > > added'); > > $this->redirect(array ( > > 'action' => 'index' > > ), null, true); > >} else { > > $this->Session->setFlash('message posting > > failed. Try again.'); > > } > > } > > $users = $this->Message->User->find('list'); > > $this->set('topic_id',$id); > > $this->set('users',$users); > > } > > > > } > > ?> > > > > > - > > > > > > My view file is messages folders in views as add.ctp > > > > > - > > > > > > create('Message',array( 'url' => 'add/'. > > $topic_id ));?> > > > > New topic > > > echo $form->input('message_text'); > > echo $form->input('user_id'); > > echo $form->hidden('topic_id',array( 'value' => $topic_id)); > > ?> > > > > end('post a message');?> > > > > > echo $html->link('Go back', array('action'=>'index')); > > ?> > > > > > - > > > > > > When I fill up the add form and submit. > > The data gets inserted into the messages table without any hiccups. > > > > But I get an error during redirection back to the index page like this > > > > > > > > > > > Warning (2): Cannot modify header information - headers already sent > > by (output started at /opt/lampp/htdocs/cake/message_board/app/ > > controllers/messages_controller.php:115) [CORE/cake/libs/controller/ > > controller.php, line 587] > > > > Code | Context > &g
Re: Cake warning Cannot modify header information and CORE/Cake/Network/CakeResponse.php, line 398
Loom for stray characters after ending ?> php tags. Jeremy Burns Class Outfit http://www.classoutfit.com On 14 Feb 2013, at 20:11:20, Mehrdad Dadkhah wrote: > thanks but i check everwhere! > i can't find where debugging out some information before render !! > > > -- > > $sudo chmod 777 /var/www/myInfo.php > $gedit /var/www/myInfo.php > > #I love these sentences : > echo 'آرزوهایتان را به کسانی متوجه کنید که دلهایتان آنها را دوست دارد.'; > echo 'حکمت را با نااهل نگویید که به حکمت ستم کرده اید.'; > echo 'زشت ترین سخن راست ستایش انسان از خویشتن است'; > /* > *yahoo: “dadkhah.ir70 [at] yahoo [dot] com” > *resume: “http://www.rdb.ir/resume.aspx?mehrdaddadkhah” > *weblog: “http://geeknerd.blogveb.com” > *PGP Key: > */ > ?> > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Cake warning Cannot modify header information and CORE/Cake/Network/CakeResponse.php, line 398
thanks but i check everwhere! i can't find where debugging out some information before render !! -- $sudo chmod 777 /var/www/myInfo.php $gedit /var/www/myInfo.php http://www.rdb.ir/resume.aspx?mehrdaddadkhah” *weblog: “http://geeknerd.blogveb.com” *PGP Key: */ ?> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Cake warning Cannot modify header information and CORE/Cake/Network/CakeResponse.php, line 398
Looks like you are debugging out some information before the page is rendered. Jeremy Burns Class Outfit http://www.classoutfit.com On 14 Feb 2013, at 18:19:41, Mehrdad Dadkhah wrote: > hi all > > what's the reason of this warning? > > > Warning (2): Cannot modify header information - headers already sent > by (output started at > /home/hy4wtsgf/public_html/lib/Cake/Utility/Debugger.php:780) > [CORE/Cake/Network/CakeResponse.php, line 398] > Code Context > > setcookie - [internal], line ?? > CakeResponse::_setCookies() - CORE/Cake/Network/CakeResponse.php, line 398 > CakeResponse::send() - CORE/Cake/Network/CakeResponse.php, line 375 > Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 168 > [main] - APP/webroot/index.php, line 92 > > how can i resolve it? > > thanks in advance > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Cake warning Cannot modify header information and CORE/Cake/Network/CakeResponse.php, line 398
hi all what's the reason of this warning? Warning (2): Cannot modify header information - headers already sent by (output started at /home/hy4wtsgf/public_html/lib/Cake/Utility/Debugger.php:780) [CORE/Cake/Network/CakeResponse.php, line 398] Code Context setcookie - [internal], line ?? CakeResponse::_setCookies() - CORE/Cake/Network/CakeResponse.php, line 398 CakeResponse::send() - CORE/Cake/Network/CakeResponse.php, line 375 Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 168 [main] - APP/webroot/index.php, line 92 how can i resolve it? thanks in advance -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Warning (2): Cannot modify header information - headers already sent by
Thanks man ... you saved me ... !!! On Tuesday, October 4, 2011 6:27:46 AM UTC-3, BLABLABLA wrote: > > HI.. > > The problem was the encoding. I have had the encoding UTF8, but needed the > encoding UTF8 without BOM. > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/Warning-2-Cannot-modify-header-information-headers-already-sent-by-tp4860658p4867920.html > Sent from the CakePHP mailing list archive at Nabble.com. > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Warning (2): Cannot modify header information - headers already sent by
On Oct 4, 2011, at 19:45, Matt Kaufman wrote: > What is BOM? http://en.wikipedia.org/wiki/Byte_order_mark -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: PLEASE HELP ME! Warning (2): Cannot modify header information - headers already sent by cake php
No, what Larry meant was ob_start() is an ugly hack, and you shouldn't use it. You might want to take a look at the other thread. Most probably, your controller file has a Byte Order Mark (BOM). Use a UTF-8 text editor that doesn't insert BOMs into your file, or if you can disable BOM insertions from your editor, do so. It's a given fact that BOMs don't work well with PHP. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Warning (2): Cannot modify header information - headers already sent by
BOM is short for Byte Order Mark. It acts like a "magic bit" for the application to detect if the document is Unicode, some other variant of Unicode, or any other encoding. And yes, coders should turn off BOM in their editors by default. :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: PLEASE HELP ME! Warning (2): Cannot modify header information - headers already sent by cake php
Lol- yeah I was taken back by this! 'good tip' is all I could come up with. Sent from my iPhone On Oct 4, 2011, at 5:46 PM, "Larry E. Masters" wrote: > You have got to be kidding me. You would not seriously suggest this to > someone would you? > > -- > Larry E. Masters > > > On Mon, Oct 3, 2011 at 11:34 PM, vaibhav pathak > wrote: > hi friend > try ob_start(); function before the starting of class > CategoriesController extends AppController like in following manner. > ob_start(); > class CategoriesController extends AppController > { > > > } > > ?> > from > vaibhav pathak > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: PLEASE HELP ME! Warning (2): Cannot modify header information - headers already sent by cake php
You have got to be kidding me. You would not seriously suggest this to someone would you? -- Larry E. Masters On Mon, Oct 3, 2011 at 11:34 PM, vaibhav pathak wrote: > hi friend > try ob_start(); function before the starting of class > CategoriesController extends AppController like in following manner. > ob_start(); > class CategoriesController extends AppController > { > > > } > > ?> > from > vaibhav pathak > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Warning (2): Cannot modify header information - headers already sent by
What is BOM? Sent from my iPhone On Oct 4, 2011, at 2:27 AM, BLABLABLA wrote: > HI.. > > The problem was the encoding. I have had the encoding UTF8, but needed the > encoding UTF8 without BOM. > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/Warning-2-Cannot-modify-header-information-headers-already-sent-by-tp4860658p4867920.html > Sent from the CakePHP mailing list archive at Nabble.com. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: PLEASE HELP ME! Warning (2): Cannot modify header information - headers already sent by cake php
Nice tip Sent from my iPhone On Oct 3, 2011, at 9:34 PM, vaibhav pathak wrote: > hi friend > try ob_start(); function before the starting of class > CategoriesController extends AppController like in following manner. > ob_start(); > class CategoriesController extends AppController > { > > > } > > ?> > from > vaibhav pathak > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Warning (2): Cannot modify header information - headers already sent by
HI.. The problem was the encoding. I have had the encoding UTF8, but needed the encoding UTF8 without BOM. -- View this message in context: http://cakephp.1045679.n5.nabble.com/Warning-2-Cannot-modify-header-information-headers-already-sent-by-tp4860658p4867920.html Sent from the CakePHP mailing list archive at Nabble.com. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: PLEASE HELP ME! Warning (2): Cannot modify header information - headers already sent by cake php
hi friend try ob_start(); function before the starting of class CategoriesController extends AppController like in following manner. from vaibhav pathak -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Warning (2): Cannot modify header information - headers already sent by
look at your Category model at line 1, there is output :) Check whitespaces in this file -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/10/1 BLABLABLA > PLEASE HELP ME! > > FAILURE: > Warning (2): Cannot modify header information - headers already sent by > (output started at > /var/customers/webs/usr05/mkn151/app/models/category.php:1) > [CORE/cake/libs/controller/controller.php, line 742] > > CONTROLLER: > class CategoriesController extends AppController { >var $name = 'Categories'; >// Zugriff ohne Login >function beforeFilter(){ >parent::beforeFilter(); >$this->Auth->allow('choosecategories'); >} >// Liste der Kategorien >function index() { >$this->Category->recursive = 0; >$this->set('categories', $this->paginate()); >} >// Detailansicht >function view($id = null) { >if (!$id) { >$this->Session->setFlash(__('Ungültige Kategorie', > true)); >$this->redirect(array('action' => 'index')); >} >$this->set('category', $this->Category->read(null, $id)); >} >// Kategorie hinzufügen >function add() { >if (!empty($this->data)) { >$this->Category->create(); >if ($this->Category->save($this->data)) { >$this->Session->setFlash(__('Kategorie wurde > gespeichert.', true)); >$this->redirect(array('action' => 'index')); >} else { >$this->Session->setFlash(__('Kategorie > konnte nicht gespeichert werden. > Versuchen Sie es nochmal.', true)); >} >} >$highscores = $this->Category->Highscore->find('list'); >$this->set(compact('highscores')); >} >// Kategorie bearbeiten >function edit($id = null) { >if (!$id && empty($this->data)) { >$this->Session->setFlash(__('Ungültige Kategorie', > true)); >$this->redirect(array('action' => 'index')); >} >if (!empty($this->data)) { >if ($this->Category->save($this->data)) { >$this->Session->setFlash(__('Kategorie wurde > gespeichert.', true)); >$this->redirect(array('action' => 'index')); >} else { >$this->Session->setFlash(__('Kategorie > konnte nicht gespeichert werden. > Versuchen Sie es nochmal.', true)); >} >} >if (empty($this->data)) { >$this->data = $this->Category->read(null, $id); >} >$highscores = $this->Category->Highscore->find('list'); >$this->set(compact('highscores')); >} >// Kategorie löschen >function delete($id = null) { >if (!$id) { >$this->Session->setFlash(__('Ungültige Kategorie > Id', true)); >$this->redirect(array('action'=>'index')); >} >if ($this->Category->delete($id)) { >$this->Session->setFlash(__('Kategorie wurde > gelöscht.', true)); >$this->redirect(array('action'=>'index')); >} >$this->Session->setFlash(__('Kategorie wurden nicht > gelöscht.', true)); >$this->redirect(array('action' => 'index')); >} >// Kategorien auswählen >function choosecategories() { >//Session zu Beginn des neuen Spieles leeren >$this->Session->destroy(); >//Kategorien auslesen >if(empty($this->data)){ >$this->set('categories', > $this->Category->find('all')); >}else{ >
Re: PLEASE HELP ME! Warning (2): Cannot modify header information - headers already sent by cake php
Argh, I remember having this problem myself on a production deployment. Thanks for the tip on debugkit Sent from my iPhone Matt Kaufman http://mkfmn.com/ On Oct 3, 2011, at 6:14 PM, Sam Sherlock wrote: > It could be that you have some whitepace after a php closing tag (does the > cats controller have any whitespace before the opening of php - very first > line) > > the debugkit plugin has a command to search for whitespace > - S > > > > > On 1 October 2011 21:30, Dragana Kuzmanovic wrote: > failure: > Warning (2): Cannot modify header information - headers already sent > by (output started at /var/customers/webs/usr05/mkn151/app/controllers/ > categories_controller.php:1) [CORE/cake/libs/controller/controller.php > > my controller: > class CategoriesController extends AppController { >var $name = 'Categories'; >// Zugriff ohne Login >function beforeFilter(){ >parent::beforeFilter(); >$this->Auth->allow('choosecategories'); >} >// Liste der Kategorien >function index() { >$this->Category->recursive = 0; >$this->set('categories', $this->paginate()); >} >// Detailansicht >function view($id = null) { >if (!$id) { >$this->Session->setFlash(__('Ungültige Kategorie', > true)); >$this->redirect(array('action' => 'index')); >} >$this->set('category', $this->Category->read(null, $id)); >} >// Kategorie hinzufügen >function add() { >if (!empty($this->data)) { >$this->Category->create(); >if ($this->Category->save($this->data)) { >$this->Session->setFlash(__('Kategorie wurde > gespeichert.', > true)); >$this->redirect(array('action' => 'index')); >} else { >$this->Session->setFlash(__('Kategorie konnte > nicht gespeichert > werden. Versuchen Sie es nochmal.', true)); >} >} >$highscores = $this->Category->Highscore->find('list'); >$this->set(compact('highscores')); >} >// Kategorie bearbeiten >function edit($id = null) { >if (!$id && empty($this->data)) { >$this->Session->setFlash(__('Ungültige Kategorie', > true)); >$this->redirect(array('action' => 'index')); >} >if (!empty($this->data)) { >if ($this->Category->save($this->data)) { >$this->Session->setFlash(__('Kategorie wurde > gespeichert.', > true)); >$this->redirect(array('action' => 'index')); >} else { >$this->Session->setFlash(__('Kategorie konnte > nicht gespeichert > werden. Versuchen Sie es nochmal.', true)); >} >} >if (empty($this->data)) { >$this->data = $this->Category->read(null, $id); >} >$highscores = $this->Category->Highscore->find('list'); >$this->set(compact('highscores')); >} >// Kategorie löschen >function delete($id = null) { >if (!$id) { >$this->Session->setFlash(__('Ungültige Kategorie Id', > true)); >$this->redirect(array('action'=>'index')); >} >if ($this->Category->delete($id)) { >$this->Session->setFlash(__('Kategorie wurde > gelöscht.', true)); >$this->redirect(array('action'=>'index')); >} >$this->Session->setFlash(__('Kategorie wurden nicht gelöscht.', > true)); >$this->redirect(array('action' => 'index')); >} >// Kategorien auswählen >function choosecategories() { >//S
Re: PLEASE HELP ME! Warning (2): Cannot modify header information - headers already sent by cake php
It could be that you have some whitepace after a php closing tag (does the cats controller have any whitespace before the opening of php - very first line) the debugkit plugin has a command to search for whitespace - S On 1 October 2011 21:30, Dragana Kuzmanovic wrote: > failure: > Warning (2): Cannot modify header information - headers already sent > by (output started at /var/customers/webs/usr05/mkn151/app/controllers/ > categories_controller.php:1) [CORE/cake/libs/controller/controller.php > > my controller: > class CategoriesController extends AppController { >var $name = 'Categories'; >// Zugriff ohne Login >function beforeFilter(){ >parent::beforeFilter(); >$this->Auth->allow('choosecategories'); >} >// Liste der Kategorien >function index() { >$this->Category->recursive = 0; >$this->set('categories', $this->paginate()); >} >// Detailansicht >function view($id = null) { >if (!$id) { >$this->Session->setFlash(__('Ungültige Kategorie', > true)); >$this->redirect(array('action' => 'index')); >} >$this->set('category', $this->Category->read(null, $id)); >} >// Kategorie hinzufügen >function add() { >if (!empty($this->data)) { >$this->Category->create(); >if ($this->Category->save($this->data)) { >$this->Session->setFlash(__('Kategorie wurde > gespeichert.', > true)); >$this->redirect(array('action' => 'index')); >} else { >$this->Session->setFlash(__('Kategorie > konnte nicht gespeichert > werden. Versuchen Sie es nochmal.', true)); >} >} >$highscores = $this->Category->Highscore->find('list'); >$this->set(compact('highscores')); >} >// Kategorie bearbeiten >function edit($id = null) { >if (!$id && empty($this->data)) { >$this->Session->setFlash(__('Ungültige Kategorie', > true)); >$this->redirect(array('action' => 'index')); >} >if (!empty($this->data)) { >if ($this->Category->save($this->data)) { >$this->Session->setFlash(__('Kategorie wurde > gespeichert.', > true)); >$this->redirect(array('action' => 'index')); >} else { >$this->Session->setFlash(__('Kategorie > konnte nicht gespeichert > werden. Versuchen Sie es nochmal.', true)); >} >} >if (empty($this->data)) { >$this->data = $this->Category->read(null, $id); >} >$highscores = $this->Category->Highscore->find('list'); >$this->set(compact('highscores')); >} >// Kategorie löschen >function delete($id = null) { >if (!$id) { >$this->Session->setFlash(__('Ungültige Kategorie > Id', true)); >$this->redirect(array('action'=>'index')); >} >if ($this->Category->delete($id)) { >$this->Session->setFlash(__('Kategorie wurde > gelöscht.', true)); >$this->redirect(array('action'=>'index')); >} >$this->Session->setFlash(__('Kategorie wurden nicht > gelöscht.', > true)); >$this->redirect(array('action' => 'index')); >} >// Kategorien auswählen >function choosecategories() { >//Session zu Beginn des neuen Spieles leeren >$this->Session->destroy(); >//Kategorien auslesen >if(empty($this->data)){ >$this->set('categories', > $this->
Warning (2): Cannot modify header information - headers already sent by
PLEASE HELP ME! FAILURE: Warning (2): Cannot modify header information - headers already sent by (output started at /var/customers/webs/usr05/mkn151/app/models/category.php:1) [CORE/cake/libs/controller/controller.php, line 742] CONTROLLER: Auth->allow('choosecategories'); } // Liste der Kategorien function index() { $this->Category->recursive = 0; $this->set('categories', $this->paginate()); } // Detailansicht function view($id = null) { if (!$id) { $this->Session->setFlash(__('Ungültige Kategorie', true)); $this->redirect(array('action' => 'index')); } $this->set('category', $this->Category->read(null, $id)); } // Kategorie hinzufügen function add() { if (!empty($this->data)) { $this->Category->create(); if ($this->Category->save($this->data)) { $this->Session->setFlash(__('Kategorie wurde gespeichert.', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('Kategorie konnte nicht gespeichert werden. Versuchen Sie es nochmal.', true)); } } $highscores = $this->Category->Highscore->find('list'); $this->set(compact('highscores')); } // Kategorie bearbeiten function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Ungültige Kategorie', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Category->save($this->data)) { $this->Session->setFlash(__('Kategorie wurde gespeichert.', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('Kategorie konnte nicht gespeichert werden. Versuchen Sie es nochmal.', true)); } } if (empty($this->data)) { $this->data = $this->Category->read(null, $id); } $highscores = $this->Category->Highscore->find('list'); $this->set(compact('highscores')); } // Kategorie löschen function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Ungültige Kategorie Id', true)); $this->redirect(array('action'=>'index')); } if ($this->Category->delete($id)) { $this->Session->setFlash(__('Kategorie wurde gelöscht.', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Kategorie wurden nicht gelöscht.', true)); $this->redirect(array('action' => 'index')); } // Kategorien auswählen function choosecategories() { //Session zu Beginn des neuen Spieles leeren $this->Session->destroy(); //Kategorien auslesen if(empty($this->data)){ $this->set('categories', $this->Category->find('all')); }else{ $categories = array(); foreach ($this->data['Category'] as $key => $cat): if($cat == 1){ array_push($categories, $key); } endforeach; //Sessions setzen if(count($categories) > 0){ $this->Session->write('categories', $categories); $this->Session->write('startTime', date('Y-m-d H:i:s')); $this->Session->write('joker', true); $this->Session->write('points', 0);
PLEASE HELP ME! Warning (2): Cannot modify header information - headers already sent by cake php
failure: Warning (2): Cannot modify header information - headers already sent by (output started at /var/customers/webs/usr05/mkn151/app/controllers/ categories_controller.php:1) [CORE/cake/libs/controller/controller.php my controller: Auth->allow('choosecategories'); } // Liste der Kategorien function index() { $this->Category->recursive = 0; $this->set('categories', $this->paginate()); } // Detailansicht function view($id = null) { if (!$id) { $this->Session->setFlash(__('Ungültige Kategorie', true)); $this->redirect(array('action' => 'index')); } $this->set('category', $this->Category->read(null, $id)); } // Kategorie hinzufügen function add() { if (!empty($this->data)) { $this->Category->create(); if ($this->Category->save($this->data)) { $this->Session->setFlash(__('Kategorie wurde gespeichert.', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('Kategorie konnte nicht gespeichert werden. Versuchen Sie es nochmal.', true)); } } $highscores = $this->Category->Highscore->find('list'); $this->set(compact('highscores')); } // Kategorie bearbeiten function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Ungültige Kategorie', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Category->save($this->data)) { $this->Session->setFlash(__('Kategorie wurde gespeichert.', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('Kategorie konnte nicht gespeichert werden. Versuchen Sie es nochmal.', true)); } } if (empty($this->data)) { $this->data = $this->Category->read(null, $id); } $highscores = $this->Category->Highscore->find('list'); $this->set(compact('highscores')); } // Kategorie löschen function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Ungültige Kategorie Id', true)); $this->redirect(array('action'=>'index')); } if ($this->Category->delete($id)) { $this->Session->setFlash(__('Kategorie wurde gelöscht.', true)); $this->redirect(array('action'=>'index')); } $this->Session->setFlash(__('Kategorie wurden nicht gelöscht.', true)); $this->redirect(array('action' => 'index')); } // Kategorien auswählen function choosecategories() { //Session zu Beginn des neuen Spieles leeren $this->Session->destroy(); //Kategorien auslesen if(empty($this->data)){ $this->set('categories', $this->Category->find('all')); }else{ $categories = array(); foreach ($this->data['Category'] as $key => $cat): if($cat == 1){ array_push($categories, $key); } endforeach; //Sessions setzen if(count($categories) > 0){ $this->Session->write('categories', $categories); $this->Session->write('startTime', date('Y-m-d H:i:s')); $this->Session->write('joker', true); $this->Session->write('points', 0);
Re: Cannot modify header information
On Feb 12, 2011, at 10:08, tubiz wrote: > PLease presently i am testing my cakephp application online but when i > tried to visit my admin page at testserver.tunsicash.co.cc/admin i am > getting this error Cannot modify header information - headers already > sent by (output started at /home/tunsicas/public_html/testserver/app/ > models/behaviors/increment > > Please you can visit the link and check as well would like to know how > i can overcome this problem. Thanks. In fact the full error message your server provided is: output started at /home/tunsicas/public_html/testserver/app/models/behaviors/increment.php:105 So, check line 105 of the file increment.php and see why it's outputting something there, and make it stop doing that. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cannot modify header information
Which version of cake are you using ? If 1.2.* go to controller.php and delete empty line at the end as well as any other space or hidden characters you might have. Even if you are using some other version check for this. At 99.999 times, this error means you have some empty line or hidden character at the end of your file (behind php?>). The best way to do this is to download notepad ++ and open files in it because it has option to view hidden characters as well. Hope this helps, all the best Milos Vucinic On Feb 12, 11:08 am, tubiz wrote: > PLease presently i am testing my cakephp application online but when i > tried to visit my admin page at testserver.tunsicash.co.cc/admin i am > getting this error Cannot modify header information - headers already > sent by (output started at /home/tunsicas/public_html/testserver/app/ > models/behaviors/increment > > Please you can visit the link and check as well would like to know how > i can overcome this problem. Thanks. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Cannot modify header information
PLease presently i am testing my cakephp application online but when i tried to visit my admin page at testserver.tunsicash.co.cc/admin i am getting this error Cannot modify header information - headers already sent by (output started at /home/tunsicas/public_html/testserver/app/ models/behaviors/increment Please you can visit the link and check as well would like to know how i can overcome this problem. Thanks. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
RE: Warning (2): Cannot modify header information - headers already sent by
THE PROBLEM IS THAT U A PRINTINT SOMETHING IN THE ACTION WHERE YOU A REDIRECTO TO OTHER ACTION, MAYBE YOU A PRINTING AN ARRAY O AN ALERT WITH JAVASCRIPT, WHEN U WANT TO REDIRECT TO OTHER ACTION U CAN NOT PRINTING ANYTHING, I HAVE TASTED IT From: vrh2...@gmail.com Date: Tue, 17 Aug 2010 17:10:51 +0530 Subject: Re: Warning (2): Cannot modify header information - headers already sent by To: cake-php@googlegroups.com Comment all print and echo in your script. Kind Regards Vikas.R.Hanagodimath On Tue, Aug 17, 2010 at 04:47, milos wrote: I have just descovered something very important. My controller was working just fine with all redirect etc. After I changed the controller file to utf8 and whenever I had a redirect or session command it gave me information already send by my controller file. It is because I change it to utf8. I changed it back to ansi and it was all ok. It is very hard to see this error because part of controller does work. Probably when notepad++ changed my file to ut8 it added some chars which are not readable to us, but are to the server. Check this when you get an error View this message in context: Re: Warning (2): Cannot modify header information - headers already sent by Sent from the CakePHP mailing list archive at Nabble.com. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Warning (2): Cannot modify header information - headers already sent by
Comment all print and echo in your script. Kind Regards Vikas.R.Hanagodimath On Tue, Aug 17, 2010 at 04:47, milos wrote: > I have just descovered something very important. My controller was working > just fine with all redirect etc. After I changed the controller file to utf8 > and whenever I had a redirect or session command it gave me information > already send by my controller file. It is because I change it to utf8. I > changed it back to ansi and it was all ok. It is very hard to see this error > because part of controller does work. Probably when notepad++ changed my > file to ut8 it added some chars which are not readable to us, but are to the > server. Check this when you get an error > -- > View this message in context: Re: Warning (2): Cannot modify header > information - headers already sent > by<http://cakephp.1045679.n5.nabble.com/Warning-2-Cannot-modify-header-information-headers-already-sent-by-tp1318933p2637476.html> > Sent from the CakePHP mailing list > archive<http://cakephp.1045679.n5.nabble.com/>at Nabble.com. > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Warning (2): Cannot modify header information - headers already sent by
I have just descovered something very important. My controller was working just fine with all redirect etc. After I changed the controller file to utf8 and whenever I had a redirect or session command it gave me information already send by my controller file. It is because I change it to utf8. I changed it back to ansi and it was all ok. It is very hard to see this error because part of controller does work. Probably when notepad++ changed my file to ut8 it added some chars which are not readable to us, but are to the server. Check this when you get an error -- View this message in context: http://cakephp.1045679.n5.nabble.com/Warning-2-Cannot-modify-header-information-headers-already-sent-by-tp1318933p2637476.html Sent from the CakePHP mailing list archive at Nabble.com. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Simple Acl controlled Application Tutorial & Cannot modify header information
I've just began to cook cakePHP. I am following Simple Acl controlled Application Tutorial. It's so frustrating that I'm having this error and don't know how to trace it. Right after creating app_controller.php, I started getting this error on add group page. I finnished the steps anyway. The group was created though. I tried to create a user: AclNode::node() - Couldn't find Aro node identified by... P.S: I double checked whitespaces in all the files I create or modified twice. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\admitizer\cake\libs\object.php:3)
Did you check object.php itself? On line 3 there should be comments only. On Oct 6, 2:00 pm, lokesh sharma wrote: > Cannot modify header information - headers already sent by (output > started at C:\xampp\htdocs\admitizer\cake\libs\object.php:3) > > There is no white space after ?> in model , controller and view then > why I'm getting this error --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\admitizer\cake\libs\object.php:3)
Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\admitizer\cake\libs\object.php:3) There is no white space after ?> in model , controller and view then why I'm getting this error --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information - headers already sent by
don't use ?> to end a php file. just leave it out and you will solve 90% of these errors. On Jul 28, 12:36 pm, Delberto wrote: > Problem solved. Seems there was a space in the webroot/index.php Quite > frustrating. > > On Jul 28, 12:44 pm, Delberto wrote: > > > Hello, > > > I am having a problem with my application. I have it running fine on > > my local development machine. Yet when I put it on the server I get > > this error "Cannot modify header information -headersalreadysent > > by". I have checked the controllers and models for spaces before > and after ?> but I cannot find any. > > > I am using Wamp on my local machine and the remote server is Linux > > with PHP5 on it. > > > Any ideas would be appreciated as I have been nearly a day trying to > > figure this out. > > > Cheers, > > Derek --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information
salve seu model e controller com encoding ANSI On 20 jul, 15:54, "Dave Maharaj :: WidePixels.com" wrote: > I have debug = 2 and I get > Cannot modify header information > > turn debug to 0 and it works the way i want. Doing a redirect after login to > redirect a user to appropriate area. > No white space after closing ?> > $this->Auth->autoRedirect = false; > > Ideas why this may be happeining? > > Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information - headers already sent by
Problem solved. Seems there was a space in the webroot/index.php Quite frustrating. On Jul 28, 12:44 pm, Delberto wrote: > Hello, > > I am having a problem with my application. I have it running fine on > my local development machine. Yet when I put it on the server I get > this error "Cannot modify header information -headersalreadysent > by". I have checked the controllers and models for spaces before and after ?> but I cannot find any. > > I am using Wamp on my local machine and the remote server is Linux > with PHP5 on it. > > Any ideas would be appreciated as I have been nearly a day trying to > figure this out. > > Cheers, > Derek --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cannot modify header information - headers already sent by
Hello, I am having a problem with my application. I have it running fine on my local development machine. Yet when I put it on the server I get this error "Cannot modify header information - headers already sent by". I have checked the controllers and models for spaces before but I cannot find any. I am using Wamp on my local machine and the remote server is Linux with PHP5 on it. Any ideas would be appreciated as I have been nearly a day trying to figure this out. Cheers, Derek --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information
Check whether you have mad an debug or echo statement in your code On Tue, Jul 21, 2009 at 1:32 AM, Dave Maharaj :: WidePixels.com < d...@widepixels.com> wrote: > Ok, > > thanks for the tip. Will check it out. > > Dave > > -- > *From:* Pablo Viojo [mailto:pvi...@gmail.com] > *Sent:* July-20-09 5:07 PM > > *To:* cake-php@googlegroups.com > *Subject:* Re: Cannot modify header information > > Now what? > Try looking at /cake/basics.php:108 ... I found it belongs to function > debug(), so maybe you're using debug(...) previously? > > Take a look at your code. > > Saludos, > > Pablo Viojo > pvi...@gmail.com > http://pviojo.net > (#340 y creciendo!) > > > Ayudar nos hace felices! > http://needish.com - http://helperman.org > > > > On Mon, Jul 20, 2009 at 3:24 PM, Dave Maharaj :: WidePixels.com < > d...@widepixels.com> wrote: > >> >> Yes. >> >> Cannot modify header information - headers already sent by (output started >> at /cake/basics.php:108) [CORE/cake/libs/controller/controller.php, line >> 640] >> >> Now what? >> >> >> >> >> From: Pablo Viojo [mailto:pvi...@gmail.com] >> Sent: July-20-09 4:39 PM >> To: cake-php@googlegroups.com >> Subject: Re: Cannot modify header information >> >> >> Normally that error comes with something like: >> >> Warning (2): Cannot modify header information - headers already sent by >> (output started at file:line) >> >> Regards, >> >> Pablo Viojo >> pvi...@gmail.com >> http://pviojo.net >> (#340 y creciendo!) >> >> ---- >> Ayudar nos hace felices! >> http://needish.com - http://helperman.org >> >> >> >> >> On Mon, Jul 20, 2009 at 2:54 PM, Dave Maharaj :: WidePixels.com >> wrote: >> >> >> >>I have debug = 2 and I get >>Cannot modify header information >> >>turn debug to 0 and it works the way i want. Doing a redirect after >> login to >>redirect a user to appropriate area. >>No white space after closing ?> >>$this->Auth->autoRedirect = false; >> >>Ideas why this may be happeining? >> >>Dave >> >> >> >> >> >> >> >> >> >> >> >> >> > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Cannot modify header information
Ok, thanks for the tip. Will check it out. Dave _ From: Pablo Viojo [mailto:pvi...@gmail.com] Sent: July-20-09 5:07 PM To: cake-php@googlegroups.com Subject: Re: Cannot modify header information Now what? Try looking at /cake/basics.php:108 ... I found it belongs to function debug(), so maybe you're using debug(...) previously? Take a look at your code. Saludos, Pablo Viojo pvi...@gmail.com http://pviojo.net (#340 y creciendo!) Ayudar nos hace felices! http://needish.com - http://helperman.org On Mon, Jul 20, 2009 at 3:24 PM, Dave Maharaj :: WidePixels.com wrote: Yes..... Cannot modify header information - headers already sent by (output started at /cake/basics.php:108) [CORE/cake/libs/controller/controller.php, line 640] Now what? From: Pablo Viojo [mailto:pvi...@gmail.com] Sent: July-20-09 4:39 PM To: cake-php@googlegroups.com Subject: Re: Cannot modify header information Normally that error comes with something like: Warning (2): Cannot modify header information - headers already sent by (output started at file:line) Regards, Pablo Viojo pvi...@gmail.com http://pviojo.net (#340 y creciendo!) Ayudar nos hace felices! http://needish.com - http://helperman.org On Mon, Jul 20, 2009 at 2:54 PM, Dave Maharaj :: WidePixels.com wrote: I have debug = 2 and I get Cannot modify header information turn debug to 0 and it works the way i want. Doing a redirect after login to redirect a user to appropriate area. No white space after closing ?> $this->Auth->autoRedirect = false; Ideas why this may be happeining? Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information
Now what? Try looking at /cake/basics.php:108 ... I found it belongs to function debug(), so maybe you're using debug(...) previously? Take a look at your code. Saludos, Pablo Viojo pvi...@gmail.com http://pviojo.net (#340 y creciendo!) Ayudar nos hace felices! http://needish.com - http://helperman.org On Mon, Jul 20, 2009 at 3:24 PM, Dave Maharaj :: WidePixels.com < d...@widepixels.com> wrote: > > Yes. > > Cannot modify header information - headers already sent by (output started > at /cake/basics.php:108) [CORE/cake/libs/controller/controller.php, line > 640] > > Now what? > > > > > From: Pablo Viojo [mailto:pvi...@gmail.com] > Sent: July-20-09 4:39 PM > To: cake-php@googlegroups.com > Subject: Re: Cannot modify header information > > > Normally that error comes with something like: > > Warning (2): Cannot modify header information - headers already sent by > (output started at file:line) > > Regards, > > Pablo Viojo > pvi...@gmail.com > http://pviojo.net > (#340 y creciendo!) > > > Ayudar nos hace felices! > http://needish.com - http://helperman.org > > > > > On Mon, Jul 20, 2009 at 2:54 PM, Dave Maharaj :: WidePixels.com > wrote: > > > >I have debug = 2 and I get >Cannot modify header information > >turn debug to 0 and it works the way i want. Doing a redirect after > login to >redirect a user to appropriate area. >No white space after closing ?> >$this->Auth->autoRedirect = false; > >Ideas why this may be happeining? > >Dave > > > > > > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Cannot modify header information
Yes. Cannot modify header information - headers already sent by (output started at /cake/basics.php:108) [CORE/cake/libs/controller/controller.php, line 640] Now what? From: Pablo Viojo [mailto:pvi...@gmail.com] Sent: July-20-09 4:39 PM To: cake-php@googlegroups.com Subject: Re: Cannot modify header information Normally that error comes with something like: Warning (2): Cannot modify header information - headers already sent by (output started at file:line) Regards, Pablo Viojo pvi...@gmail.com http://pviojo.net (#340 y creciendo!) Ayudar nos hace felices! http://needish.com - http://helperman.org On Mon, Jul 20, 2009 at 2:54 PM, Dave Maharaj :: WidePixels.com wrote: I have debug = 2 and I get Cannot modify header information turn debug to 0 and it works the way i want. Doing a redirect after login to redirect a user to appropriate area. No white space after closing ?> $this->Auth->autoRedirect = false; Ideas why this may be happeining? Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information
Normally that error comes with something like: Warning (2): Cannot modify header information - headers already sent by (output started at file:line) Regards, Pablo Viojo pvi...@gmail.com http://pviojo.net (#340 y creciendo!) Ayudar nos hace felices! http://needish.com - http://helperman.org On Mon, Jul 20, 2009 at 2:54 PM, Dave Maharaj :: WidePixels.com < d...@widepixels.com> wrote: > > I have debug = 2 and I get > Cannot modify header information > > turn debug to 0 and it works the way i want. Doing a redirect after login > to > redirect a user to appropriate area. > No white space after closing ?> > $this->Auth->autoRedirect = false; > > Ideas why this may be happeining? > > Dave > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cannot modify header information
I have debug = 2 and I get Cannot modify header information turn debug to 0 and it works the way i want. Doing a redirect after login to redirect a user to appropriate area. No white space after closing ?> $this->Auth->autoRedirect = false; Ideas why this may be happeining? Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Warning (2): Cannot modify header information - headers already sent by
thanks will search for the white spaces.. cheers B On May 18, 2:04 am, paulos nikolo wrote: > Check for whitespaces in app_controller and the other controllers.This was > caused from copy-paste. > Think i may helped! > > Cheers > > 2009/5/18 Braydenstyles > > > > > Warning (2): Cannot modify header information - headers already sent > > by (output started at /Users/braydenstyles/Sites/app/ > > app_controller.php:112) [CORE/cake/libs/controller/controller.php, > > line 587] > > > Code | Context > > $status = "Location:http://localhost/beta_users/login"; > > > header - [internal], line ?? > > Controller::header() - CORE/cake/libs/controller/controller.php, line > > 587 > > Controller::redirect() - CORE/cake/libs/controller/controller.php, > > line 568 > > AppController::checkAuth() - APP/app_controller.php, line 269 > > AppController::beforeFilter() - APP/app_controller.php, line 141 > > UsersController::beforeFilter() - APP/controllers/ > > users_controller.php, line 49 > > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 228 > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213 > > Object::requestAction() - CORE/cake/libs/object.php, line 102 > > include - APP/views/layouts/default.ctp, line 246 > > View::_render() - CORE/cake/libs/view/view.php, line 654 > > View::renderLayout() - CORE/cake/libs/view/view.php, line 451 > > View::render() - CORE/cake/libs/view/view.php, line 384 > > Controller::render() - CORE/cake/libs/controller/controller.php, line > > 744 > > ErrorHandler::__outputMessage() - CORE/cake/libs/error.php, line 377 > > ErrorHandler::missingController() - CORE/cake/libs/error.php, line 176 > > Object::dispatchMethod() - CORE/cake/libs/object.php, line 119 > > ErrorHandler::__construct() - CORE/cake/libs/error.php, line 120 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Warning (2): Cannot modify header information - headers already sent by
Check for whitespaces in app_controller and the other controllers.This was caused from copy-paste. Think i may helped! Cheers 2009/5/18 Braydenstyles > > Warning (2): Cannot modify header information - headers already sent > by (output started at /Users/braydenstyles/Sites/app/ > app_controller.php:112) [CORE/cake/libs/controller/controller.php, > line 587] > > Code | Context > $status = "Location: http://localhost/beta_users/login"; > > header - [internal], line ?? > Controller::header() - CORE/cake/libs/controller/controller.php, line > 587 > Controller::redirect() - CORE/cake/libs/controller/controller.php, > line 568 > AppController::checkAuth() - APP/app_controller.php, line 269 > AppController::beforeFilter() - APP/app_controller.php, line 141 > UsersController::beforeFilter() - APP/controllers/ > users_controller.php, line 49 > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 228 > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213 > Object::requestAction() - CORE/cake/libs/object.php, line 102 > include - APP/views/layouts/default.ctp, line 246 > View::_render() - CORE/cake/libs/view/view.php, line 654 > View::renderLayout() - CORE/cake/libs/view/view.php, line 451 > View::render() - CORE/cake/libs/view/view.php, line 384 > Controller::render() - CORE/cake/libs/controller/controller.php, line > 744 > ErrorHandler::__outputMessage() - CORE/cake/libs/error.php, line 377 > ErrorHandler::missingController() - CORE/cake/libs/error.php, line 176 > Object::dispatchMethod() - CORE/cake/libs/object.php, line 119 > ErrorHandler::__construct() - CORE/cake/libs/error.php, line 120 > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Warning (2): Cannot modify header information - headers already sent by
Warning (2): Cannot modify header information - headers already sent by (output started at /Users/braydenstyles/Sites/app/ app_controller.php:112) [CORE/cake/libs/controller/controller.php, line 587] Code | Context $status = "Location: http://localhost/beta_users/login"; header - [internal], line ?? Controller::header() - CORE/cake/libs/controller/controller.php, line 587 Controller::redirect() - CORE/cake/libs/controller/controller.php, line 568 AppController::checkAuth() - APP/app_controller.php, line 269 AppController::beforeFilter() - APP/app_controller.php, line 141 UsersController::beforeFilter() - APP/controllers/ users_controller.php, line 49 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 228 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213 Object::requestAction() - CORE/cake/libs/object.php, line 102 include - APP/views/layouts/default.ctp, line 246 View::_render() - CORE/cake/libs/view/view.php, line 654 View::renderLayout() - CORE/cake/libs/view/view.php, line 451 View::render() - CORE/cake/libs/view/view.php, line 384 Controller::render() - CORE/cake/libs/controller/controller.php, line 744 ErrorHandler::__outputMessage() - CORE/cake/libs/error.php, line 377 ErrorHandler::missingController() - CORE/cake/libs/error.php, line 176 Object::dispatchMethod() - CORE/cake/libs/object.php, line 119 ErrorHandler::__construct() - CORE/cake/libs/error.php, line 120 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information - headers already sent by
Ok, I got you. The extra whitespace was before the opening wrote: > On Feb 3, 5:46 pm, gkc wrote: > > > > > Ok, I removed the php close tag from all the models and controllers > > but that didnt work. > > > Here is the full error message I am getting: > > > ============= > > Warning (2): Cannot modify header information - headers already sent > > by (output started at /home/user/public_html/sub/index.php:2) [CORE/ > > cake/libs/controller/controller.php, line 615] > > > Code | Context > > > header - [internal], line ?? > > Controller::header() - CORE/cake/libs/controller/controller.php, line > > 615 > > Controller::redirect() - CORE/cake/libs/controller/controller.php, > > line 596 > > AppController::checkAdminSession() - APP/app_controller.php, line 40 > > SalesController::beforeFilter() - APP/controllers/ > > sales_controller.php, line 17 > > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226 > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 211 > > [main] - CORE/public_html/sub/index.php, line 92 > > = > > > Any ideas? > > read the message instead of blindly guessing? > > output started at /home/user/public_html/sub/index.php:2 > > there is only 1 reason for the error message that file on that line is > sending output. Remove the echo/remove the whitespace, etc. > > AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information - headers already sent by
On Feb 3, 5:46 pm, gkc wrote: > Ok, I removed the php close tag from all the models and controllers > but that didnt work. > > Here is the full error message I am getting: > > ===== > Warning (2): Cannot modify header information - headers already sent > by (output started at /home/user/public_html/sub/index.php:2) [CORE/ > cake/libs/controller/controller.php, line 615] > > Code | Context > > header - [internal], line ?? > Controller::header() - CORE/cake/libs/controller/controller.php, line > 615 > Controller::redirect() - CORE/cake/libs/controller/controller.php, > line 596 > AppController::checkAdminSession() - APP/app_controller.php, line 40 > SalesController::beforeFilter() - APP/controllers/ > sales_controller.php, line 17 > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226 > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 211 > [main] - CORE/public_html/sub/index.php, line 92 > = > > Any ideas? read the message instead of blindly guessing? output started at /home/user/public_html/sub/index.php:2 there is only 1 reason for the error message that file on that line is sending output. Remove the echo/remove the whitespace, etc. AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information - headers already sent by
Ok, I removed the php close tag from all the models and controllers but that didnt work. Here is the full error message I am getting: = Warning (2): Cannot modify header information - headers already sent by (output started at /home/user/public_html/sub/index.php:2) [CORE/ cake/libs/controller/controller.php, line 615] Code | Context header - [internal], line ?? Controller::header() - CORE/cake/libs/controller/controller.php, line 615 Controller::redirect() - CORE/cake/libs/controller/controller.php, line 596 AppController::checkAdminSession() - APP/app_controller.php, line 40 SalesController::beforeFilter() - APP/controllers/ sales_controller.php, line 17 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 226 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 211 [main] - CORE/public_html/sub/index.php, line 92 = Any ideas? On Feb 3, 7:54 am, AD7six wrote: > On Feb 3, 7:45 am, gkc wrote: > > > > > I have researched this problem and have already removed any blank > > space after the closing php tag. > > > Here is the controller code: > > > function beforeFilter() { > > if(isset($this->params['admin'])) { > > $this->checkAdminSession(); > > $allowed = array('Sales','Admin'); > > $role = $this->readSession('role'); > > if(!in_array($role,$allowed)) { > > $this->roleRedirect(); > > } else { > > $this->layout = $role; > > } > > } > > } > > > Here is the appcontroller code: > > > function checkAdminSession() { > > if (!$this->Session->check('User')) { > > $this -> redirect('/users/login', null, true); > > exit(); > > } > > } > > > function readSession($val) { > > if ($this->Session->check('User')) { > > return $this->Session->read('User.' . $val); > > } > > } > > function roleRedirect() { > > switch($this->readSession('role')) { > > case 'Admin': > > $this->redirect('/admin/users/' .'' , null, > > true); > > exit(); > > break; > > case 'User': > > $this->redirect('/admin/users/', null, > > true); > > exit(); > > break; > > case 'Sales': > > $this->redirect('/admin/sales/', null, > > true); > > exit(); > > break; > > } > > } > > > I should also mention that the webroot folder is in a subdirectory of > > the public_html (/home/user/public_html/sub/)and I have the cake and > > app directories in the root (/home/user/) with the webroots index.php > > properly edited to reflect the various directory paths. > > > If I comment out the beforeFilter in the controller everything is > > fine, but if I leave it in then I get the header information error. > > > Again, I have already removed all the extra whitespace from the end of > > all models, controllers, and views. > > > Any help would be greatl appreciated. > > Try reading the error message. It tells you the file and line that you > should then focus your efforts on. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information - headers already sent by
On Feb 3, 7:45 am, gkc wrote: > I have researched this problem and have already removed any blank > space after the closing php tag. > > Here is the controller code: > > function beforeFilter() { > if(isset($this->params['admin'])) { > $this->checkAdminSession(); > $allowed = array('Sales','Admin'); > $role = $this->readSession('role'); > if(!in_array($role,$allowed)) { > $this->roleRedirect(); > } else { > $this->layout = $role; > } > } > } > > Here is the appcontroller code: > > function checkAdminSession() { > if (!$this->Session->check('User')) { > $this -> redirect('/users/login', null, true); > exit(); > } > } > > function readSession($val) { > if ($this->Session->check('User')) { > return $this->Session->read('User.' . $val); > } > } > function roleRedirect() { > switch($this->readSession('role')) { > case 'Admin': > $this->redirect('/admin/users/' .'' , null, > true); > exit(); > break; > case 'User': > $this->redirect('/admin/users/', null, true); > exit(); > break; > case 'Sales': > $this->redirect('/admin/sales/', null, true); > exit(); > break; > } > } > > I should also mention that the webroot folder is in a subdirectory of > the public_html (/home/user/public_html/sub/)and I have the cake and > app directories in the root (/home/user/) with the webroots index.php > properly edited to reflect the various directory paths. > > If I comment out the beforeFilter in the controller everything is > fine, but if I leave it in then I get the header information error. > > Again, I have already removed all the extra whitespace from the end of > all models, controllers, and views. > > Any help would be greatl appreciated. Try reading the error message. It tells you the file and line that you should then focus your efforts on. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot modify header information - headers already sent by
On Tue, Feb 3, 2009 at 3:45 AM, gkc wrote: > (..) > Again, I have already removed all the extra whitespace from the end of > all models, controllers, and views. I don't analyze your code. But you made the correct action removing extra spaces like that's the primarily cause of this problem. Anyway, wich text editor you are using? Some editors allway include an extra line at the end of text. Be sure that's not your case. If the problem persists, try do not end your models and controllers with the php close tag ( ?> ). Best regards. -- MARCELO DE F. ANDRADE (aka "eleKtron") Belem, PA, Amazonia, Brazil Linux User #221105 [...@pará ~]# links http://pa.slackwarebrasil.org/ For Libby's backstory be told on Lost http://www.petitiononline.com/libby423/petition.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cannot modify header information - headers already sent by
I have researched this problem and have already removed any blank space after the closing php tag. Here is the controller code: function beforeFilter() { if(isset($this->params['admin'])) { $this->checkAdminSession(); $allowed = array('Sales','Admin'); $role = $this->readSession('role'); if(!in_array($role,$allowed)) { $this->roleRedirect(); } else { $this->layout = $role; } } } Here is the appcontroller code: function checkAdminSession() { if (!$this->Session->check('User')) { $this -> redirect('/users/login', null, true); exit(); } } function readSession($val) { if ($this->Session->check('User')) { return $this->Session->read('User.' . $val); } } function roleRedirect() { switch($this->readSession('role')) { case 'Admin': $this->redirect('/admin/users/' .'' , null, true); exit(); break; case 'User': $this->redirect('/admin/users/', null, true); exit(); break; case 'Sales': $this->redirect('/admin/sales/', null, true); exit(); break; } } I should also mention that the webroot folder is in a subdirectory of the public_html (/home/user/public_html/sub/)and I have the cake and app directories in the root (/home/user/) with the webroots index.php properly edited to reflect the various directory paths. If I comment out the beforeFilter in the controller everything is fine, but if I leave it in then I get the header information error. Again, I have already removed all the extra whitespace from the end of all models, controllers, and views. Any help would be greatl appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP - Warning - Cannot modify header information - headers already sent by
Thanks Marcus Now its working. On Oct 16, 4:05 pm, Marcus Silva <[EMAIL PROTECTED]> wrote: > Try removing any hidden character you may have after the php closing > tag (?>). > > Example: > > ?>remove anything after the tag > > Hope it helps > > Cheers > > Marcus > > On Oct 16, 11:31 am, imu <[EMAIL PROTECTED]> wrote: > > > > > > controller file is messages_controller.php > > > > > > class MessagesController extends AppController{ > > var $name = 'Messages'; > > >var $helpers = array ( > > 'Html', > > 'Form', > > 'Time' > > ); > > > function index($id = null ){ > > if (!$id) { > > $this->Session->setFlash('Invalid Topic'); > > $this->redirect(array ( > > 'action' => 'index' > > ), null, true); > > } > > $this->Message->recursive = 1; > > > $messages = $this->Message->find('all', > > array( 'conditions' => array( 'topic_id' => $id ),'order' => > > 'Message.id DESC') ); > > $this->set('topic_id',$id); > > $this->set('messages',$messages); > > } > > > function add($id = null) { > > if (!empty ($this->data)) { > > $this->Message->create(); > > if ($this->Message->save($this->data)) { > > > $this->Session->setFlash('The message has been > > added'); > > $this->redirect(array ( > > 'action' => 'index' > > ), null, true); > >} else { > > $this->Session->setFlash('message posting > > failed. Try again.'); > > } > > } > > $users = $this->Message->User->find('list'); > > $this->set('topic_id',$id); > > $this->set('users',$users); > > } > > > } > > ?> > > > - > > > My view file is messages folders in views as add.ctp > > > - > > > create('Message',array( 'url' => 'add/'. > > $topic_id ));?> > > > > New topic > > > echo $form->input('message_text'); > > echo $form->input('user_id'); > > echo $form->hidden('topic_id',array( 'value' => $topic_id)); > > ?> > > > > end('post a message');?> > > > > echo $html->link('Go back', array('action'=>'index')); > > ?> > > > - > > > When I fill up the add form and submit. > > The data gets inserted into the messages table without any hiccups. > > > But I get an error during redirection back to the index page like this > > > > > > Warning (2): Cannot modify header information - headers already sent > > by (output started at /opt/lampp/htdocs/cake/message_board/app/ > > controllers/messages_controller.php:115) [CORE/cake/libs/controller/ > > controller.php, line 587] > > > Code | Context > > > $status = "Location:http://localhost/cake/message_board/messages"; > > > header - [internal], line ?? > > Controller::header() - CORE/cake/libs/controller/controller.php, line > > 587 > > Controller::redirect(
Re: CakePHP - Warning - Cannot modify header information - headers already sent by
Try removing any hidden character you may have after the php closing tag (?>). Example: ?>remove anything after the tag Hope it helps Cheers Marcus On Oct 16, 11:31 am, imu <[EMAIL PROTECTED]> wrote: > > > controller file is messages_controller.php > > > class MessagesController extends AppController{ > var $name = 'Messages'; > >var $helpers = array ( > 'Html', > 'Form', > 'Time' > ); > > function index($id = null ){ > if (!$id) { > $this->Session->setFlash('Invalid Topic'); > $this->redirect(array ( > 'action' => 'index' > ), null, true); > } > $this->Message->recursive = 1; > > $messages = $this->Message->find('all', > array( 'conditions' => array( 'topic_id' => $id ),'order' => > 'Message.id DESC') ); > $this->set('topic_id',$id); > $this->set('messages',$messages); > } > > function add($id = null) { > if (!empty ($this->data)) { > $this->Message->create(); > if ($this->Message->save($this->data)) { > > $this->Session->setFlash('The message has been > added'); > $this->redirect(array ( > 'action' => 'index' > ), null, true); >} else { > $this->Session->setFlash('message posting > failed. Try again.'); > } > } > $users = $this->Message->User->find('list'); > $this->set('topic_id',$id); > $this->set('users',$users); > } > > } > ?> > > - > > My view file is messages folders in views as add.ctp > > - > > create('Message',array( 'url' => 'add/'. > $topic_id ));?> > > New topic > echo $form->input('message_text'); > echo $form->input('user_id'); > echo $form->hidden('topic_id',array( 'value' => $topic_id)); > ?> > > end('post a message');?> > >echo $html->link('Go back', array('action'=>'index')); > ?> > > - > > When I fill up the add form and submit. > The data gets inserted into the messages table without any hiccups. > > But I get an error during redirection back to the index page like this > > > > Warning (2): Cannot modify header information - headers already sent > by (output started at /opt/lampp/htdocs/cake/message_board/app/ > controllers/messages_controller.php:115) [CORE/cake/libs/controller/ > controller.php, line 587] > > Code | Context > > $status = "Location:http://localhost/cake/message_board/messages"; > > header - [internal], line ?? > Controller::header() - CORE/cake/libs/controller/controller.php, line > 587 > Controller::redirect() - CORE/cake/libs/controller/controller.php, > line 568 > MessagesController::add() - APP/controllers/messages_controller.php, > line 54 > Object::dispatchMethod() - CORE/cake/libs/object.php, line 116 > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 259 > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213 > [main] - APP/webroot/index.php, line 90 > > --- > The redirection to the index page fails. >
CakePHP - Warning - Cannot modify header information - headers already sent by
controller file is messages_controller.php Session->setFlash('Invalid Topic'); $this->redirect(array ( 'action' => 'index' ), null, true); } $this->Message->recursive = 1; $messages = $this->Message->find('all', array( 'conditions' => array( 'topic_id' => $id ),'order' => 'Message.id DESC') ); $this->set('topic_id',$id); $this->set('messages',$messages); } function add($id = null) { if (!empty ($this->data)) { $this->Message->create(); if ($this->Message->save($this->data)) { $this->Session->setFlash('The message has been added'); $this->redirect(array ( 'action' => 'index' ), null, true); } else { $this->Session->setFlash('message posting failed. Try again.'); } } $users = $this->Message->User->find('list'); $this->set('topic_id',$id); $this->set('users',$users); } } ?> - My view file is messages folders in views as add.ctp - create('Message',array( 'url' => 'add/'. $topic_id ));?> New topic input('message_text'); echo $form->input('user_id'); echo $form->hidden('topic_id',array( 'value' => $topic_id)); ?> end('post a message');?> link('Go back', array('action'=>'index')); ?> ----------------- When I fill up the add form and submit. The data gets inserted into the messages table without any hiccups. But I get an error during redirection back to the index page like this Warning (2): Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/cake/message_board/app/ controllers/messages_controller.php:115) [CORE/cake/libs/controller/ controller.php, line 587] Code | Context $status = "Location: http://localhost/cake/message_board/messages"; header - [internal], line ?? Controller::header() - CORE/cake/libs/controller/controller.php, line 587 Controller::redirect() - CORE/cake/libs/controller/controller.php, line 568 MessagesController::add() - APP/controllers/messages_controller.php, line 54 Object::dispatchMethod() - CORE/cake/libs/object.php, line 116 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 259 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213 [main] - APP/webroot/index.php, line 90 --- The redirection to the index page fails. The parameters supplied in the form in add.ctp was as I expected "messages/add/1" which you can see the below code --- New topic --- Please, help me out with this problem?? Thank you Imranullah Mohammed --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: "redirect" and "Cannot modify header information"
Hi, Thank you for your help : I found the error. It was a presence of "space" was after the "?>" That sends a char and create an error On Apr 15, 7:08 pm, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote: > On Tue, Apr 15, 2008 at 12:59 PM, [EMAIL PROTECTED] < > > > > [EMAIL PROTECTED]> wrote: > > > [snip] > > > 2) The execution of this code on Unix server with "PHP version 5.2.5, > > System HP-UX frl4 B.11.11 U 9000/800 " generate the following error: > > > Warning (2): Cannot modify header information - headers already sent > > by (output started at /opt/hpws/apache/htdocs/cake/app/ > > app_controller.php:75) [CORE/cake/libs/controller/controller.php, line > > 546] > > > header - [internal], line ?? > > Controller::redirect() - CORE/cake/libs/controller/controller.php, > > line 546 > > PlansController::add() - APP/controllers/plans_controller.php, line > > 165 > > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 268 > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 240 > > [main] - APP/webroot/index.php, line 84 > > > I do not really manage to understand why I have this error; somebody > > can help me on this subject? > > Hi, > > I had a similar issue to this recently. I had pasted some code from a page > into a app/models/ file and it kept sending a blank character/line which > meant headers were already sent out (you can verify this by using something > like curl to look at the HTTP headers; you'll find you'll receive a 200 OK > instead of a "moved" status message like 301). Try backing up your > app_controller.php and starting with a fresh new one. Start to copy code > back until it breaks the redirect. Just an idea. > > - Gonzalo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: "redirect" and "Cannot modify header information"
On Tue, Apr 15, 2008 at 12:59 PM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > [snip] > > 2) The execution of this code on Unix server with "PHP version 5.2.5, > System HP-UX frl4 B.11.11 U 9000/800 " generate the following error: > > Warning (2): Cannot modify header information - headers already sent > by (output started at /opt/hpws/apache/htdocs/cake/app/ > app_controller.php:75) [CORE/cake/libs/controller/controller.php, line > 546] > > header - [internal], line ?? > Controller::redirect() - CORE/cake/libs/controller/controller.php, > line 546 > PlansController::add() - APP/controllers/plans_controller.php, line > 165 > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 268 > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 240 > [main] - APP/webroot/index.php, line 84 > > I do not really manage to understand why I have this error; somebody > can help me on this subject? > Hi, I had a similar issue to this recently. I had pasted some code from a page into a app/models/ file and it kept sending a blank character/line which meant headers were already sent out (you can verify this by using something like curl to look at the HTTP headers; you'll find you'll receive a 200 OK instead of a "moved" status message like 301). Try backing up your app_controller.php and starting with a fresh new one. Start to copy code back until it breaks the redirect. Just an idea. - Gonzalo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
"redirect" and "Cannot modify header information"
Hello, I try to make a redirection towards an address in my controller: Code of the controller: --- function add() { $modelClass = $this->modelClass; if (!empty($this->data)) { $this->$modelClass->create(); $this->data['Plan']['description'] = $this->html2text($this- >data['Plan']['description']); $this->$modelClass->save($this->data["Plan"]); $this->redirect('/'.$this->viewPath.'/index'); } } 1) The execution of this code on my PC with EasyPhp 2.0 works correctly 2) The execution of this code on Unix server with "PHP version 5.2.5, System HP-UX frl4 B.11.11 U 9000/800 " generate the following error: Warning (2): Cannot modify header information - headers already sent by (output started at /opt/hpws/apache/htdocs/cake/app/ app_controller.php:75) [CORE/cake/libs/controller/controller.php, line 546] header - [internal], line ?? Controller::redirect() - CORE/cake/libs/controller/controller.php, line 546 PlansController::add() - APP/controllers/plans_controller.php, line 165 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 268 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 240 [main] - APP/webroot/index.php, line 84 I do not really manage to understand why I have this error; somebody can help me on this subject? Thank you Frédéric --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Why I get this: Warning: Cannot modify header information - headers already sent by (output started at /var/www/cake/app/models/user.php:13) in /var/www/cake/cake/libs/controller/controller.php on
Oh I found the answer with Mike's help. Should be rewritten to: Please log in. formTag('/users/login') ?> Username: inputTag('User/username', array()) ?> Password: passwordTag('User/password', array()) ?> submitTag('login') ?> link('register', '/users/register') ?> Helpful to those who try to follow IBM's #2 tutorial. On Oct 4, 6:45 pm, val <[EMAIL PROTECTED]> wrote: > Thank you! Solved the problem! > > Another question from the code above- > > http://localhost/users/login > > gives this: > > Parse error: syntax error, unexpected ')', expecting '(' in /var/www/ > cake/app/views/users/login.thtml on line 11. > > The login.thtml was copied from IBM tutorial. > > I guessed that $html->anything should be changed to $html->anythingTag > but this was a wrong guess. > > On Oct 4, 5:33 pm, José Lorenzo <[EMAIL PROTECTED]> wrote: > > > You have a whitespace at the end of the file. Erase it. > > > On Oct 4, 11:01 am, val <[EMAIL PROTECTED]> wrote: > > > > Instead redirecting, i get this.. Any Ideas? > > > > login.thml: > > > > > if ($error) > > > { > > > e('Invalid Login.');} > > > > ?> > > > > > > Please log in. > > > > > > > form('/users/login') ?> > > > Username: > > > input('User/username', array) ?> > > > Password: > > > password('User/password', array) ?> > > > submit('login') ?> > > > > > > > link('register', '/users/register') ?> > > > > users_controller.php: > > > > > class UsersController extends AppController > > > { > > > function register() > > > { > > > $this->set('username_error', 'Username must be between 6 and 40 > > > characters.'); > > > if (!empty($this->data)) > > > { > > > if ($this->User->validates($this->data)) > > > { > > >if ($this->User->findByUsername($this->data['User'] > > > ['username'])) > > >{ > > > $this->User->invalidate('username'); > > > $this->set('username_error', 'User already exists.'); > > >} else { > > > $this->data['User']['password'] = > > > md5($this->data['User']['password']); > > > > $this->User->save($this->data); > > > $this->Session->write('user', $this->data['User'] > > > ['username']); > > > $this->redirect('/users/index'); > > > } > > > } else { > > > $this->validateErrors($this->User); > > > } > > > } > > > } > > > function knownusers() > > > { > > > $this->set('knownusers', $this->User->findAll(null, array('id', > > > 'username', > > > 'first_name', 'last_name', 'last_login'), 'id DESC')); > > > } > > > function login() > > > { > > > $this->set('error', false); > > > if ($this->data) > > > { > > > $results = $this->User->findByUsername($this->data['User'] > > > ['username']); > > > if ($results && $results['User']['password'] == > > > md5($this->data['User']['password'])) > > > { > > > $this->Session->write('user', $this->data['User'] > > > ['username']); > > > $this->Session->write('last_login', $results['User'] > > > ['last_login']); > > > $results['User']['last_login'] = date("Y-m-d H:i:s"); > > > $this->User->save($results); > > > $this->redirect('/users/index'); > > > } else { > > > $this->set('error', true); > > > } > > > } > > > } > > > function logout() > > > { > > > $this->Session->delete('user'); > > > $this->redirect('/users/login'); > > > } > > > function index() > > > { > > > $username = $this->Session->read('user'); > > > if ($username) > > > { > > > $results = $this->User->findByUsername($username); > > > $this->set('User', $results['User']); > > > $this->set('last_login', $this->Session->read('last_login')); > > > } else { > > > $this->redirect('/users/login'); > > > } > > > }} > > > > ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Why I get this: Warning: Cannot modify header information - headers already sent by (output started at /var/www/cake/app/models/user.php:13) in /var/www/cake/cake/libs/controller/controller.php on
Thank you! Solved the problem! Another question from the code above- http://localhost/users/login gives this: Parse error: syntax error, unexpected ')', expecting '(' in /var/www/ cake/app/views/users/login.thtml on line 11. The login.thtml was copied from IBM tutorial. I guessed that $html->anything should be changed to $html->anythingTag but this was a wrong guess. On Oct 4, 5:33 pm, José Lorenzo <[EMAIL PROTECTED]> wrote: > You have a whitespace at the end of the file. Erase it. > > On Oct 4, 11:01 am, val <[EMAIL PROTECTED]> wrote: > > > Instead redirecting, i get this.. Any Ideas? > > > login.thml: > > > if ($error) > > { > > e('Invalid Login.');} > > > ?> > > > > Please log in. > > > > > form('/users/login') ?> > > Username: > > input('User/username', array) ?> > > Password: > > password('User/password', array) ?> > > submit('login') ?> > > > > > link('register', '/users/register') ?> > > > users_controller.php: > > > class UsersController extends AppController > > { > > function register() > > { > > $this->set('username_error', 'Username must be between 6 and 40 > > characters.'); > > if (!empty($this->data)) > > { > > if ($this->User->validates($this->data)) > > { > >if ($this->User->findByUsername($this->data['User'] > > ['username'])) > >{ > > $this->User->invalidate('username'); > > $this->set('username_error', 'User already exists.'); > >} else { > > $this->data['User']['password'] = > > md5($this->data['User']['password']); > > > $this->User->save($this->data); > > $this->Session->write('user', $this->data['User'] > > ['username']); > > $this->redirect('/users/index'); > > } > > } else { > > $this->validateErrors($this->User); > > } > > } > > } > > function knownusers() > > { > > $this->set('knownusers', $this->User->findAll(null, array('id', > > 'username', > > 'first_name', 'last_name', 'last_login'), 'id DESC')); > > } > > function login() > > { > > $this->set('error', false); > > if ($this->data) > > { > > $results = $this->User->findByUsername($this->data['User'] > > ['username']); > > if ($results && $results['User']['password'] == > > md5($this->data['User']['password'])) > > { > > $this->Session->write('user', $this->data['User'] > > ['username']); > > $this->Session->write('last_login', $results['User'] > > ['last_login']); > > $results['User']['last_login'] = date("Y-m-d H:i:s"); > > $this->User->save($results); > > $this->redirect('/users/index'); > > } else { > > $this->set('error', true); > > } > > } > > } > > function logout() > > { > > $this->Session->delete('user'); > > $this->redirect('/users/login'); > > } > > function index() > > { > > $username = $this->Session->read('user'); > > if ($username) > > { > > $results = $this->User->findByUsername($username); > > $this->set('User', $results['User']); > > $this->set('last_login', $this->Session->read('last_login')); > > } else { > > $this->redirect('/users/login'); > > } > > }} > > > ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Why I get this: Warning: Cannot modify header information - headers already sent by (output started at /var/www/cake/app/models/user.php:13) in /var/www/cake/cake/libs/controller/controller.php on
You have a whitespace at the end of the file. Erase it. On Oct 4, 11:01 am, val <[EMAIL PROTECTED]> wrote: > Instead redirecting, i get this.. Any Ideas? > > login.thml: > if ($error) > { > e('Invalid Login.');} > > ?> > > Please log in. > > > form('/users/login') ?> > Username: > input('User/username', array) ?> > Password: > password('User/password', array) ?> > submit('login') ?> > > > link('register', '/users/register') ?> > > users_controller.php: > class UsersController extends AppController > { > function register() > { > $this->set('username_error', 'Username must be between 6 and 40 > characters.'); > if (!empty($this->data)) > { > if ($this->User->validates($this->data)) > { >if ($this->User->findByUsername($this->data['User'] > ['username'])) >{ > $this->User->invalidate('username'); > $this->set('username_error', 'User already exists.'); >} else { > $this->data['User']['password'] = > md5($this->data['User']['password']); > > $this->User->save($this->data); > $this->Session->write('user', $this->data['User'] > ['username']); > $this->redirect('/users/index'); > } > } else { > $this->validateErrors($this->User); > } > } > } > function knownusers() > { > $this->set('knownusers', $this->User->findAll(null, array('id', > 'username', > 'first_name', 'last_name', 'last_login'), 'id DESC')); > } > function login() > { > $this->set('error', false); > if ($this->data) > { > $results = $this->User->findByUsername($this->data['User'] > ['username']); > if ($results && $results['User']['password'] == > md5($this->data['User']['password'])) > { > $this->Session->write('user', $this->data['User'] > ['username']); > $this->Session->write('last_login', $results['User'] > ['last_login']); > $results['User']['last_login'] = date("Y-m-d H:i:s"); > $this->User->save($results); > $this->redirect('/users/index'); > } else { > $this->set('error', true); > } > } > } > function logout() > { > $this->Session->delete('user'); > $this->redirect('/users/login'); > } > function index() > { > $username = $this->Session->read('user'); > if ($username) > { > $results = $this->User->findByUsername($username); > $this->set('User', $results['User']); > $this->set('last_login', $this->Session->read('last_login')); > } else { > $this->redirect('/users/login'); > } > }} > > ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Why I get this: Warning: Cannot modify header information - headers already sent by (output started at /var/www/cake/app/models/user.php:13) in /var/www/cake/cake/libs/controller/controller.php on
You have a whitespace at the en of the file. Erase it... On Oct 4, 11:01 am, val <[EMAIL PROTECTED]> wrote: > Instead redirecting, i get this.. Any Ideas? > > login.thml: > if ($error) > { > e('Invalid Login.');} > > ?> > > Please log in. > > > form('/users/login') ?> > Username: > input('User/username', array) ?> > Password: > password('User/password', array) ?> > submit('login') ?> > > > link('register', '/users/register') ?> > > users_controller.php: > class UsersController extends AppController > { > function register() > { > $this->set('username_error', 'Username must be between 6 and 40 > characters.'); > if (!empty($this->data)) > { > if ($this->User->validates($this->data)) > { >if ($this->User->findByUsername($this->data['User'] > ['username'])) >{ > $this->User->invalidate('username'); > $this->set('username_error', 'User already exists.'); >} else { > $this->data['User']['password'] = > md5($this->data['User']['password']); > > $this->User->save($this->data); > $this->Session->write('user', $this->data['User'] > ['username']); > $this->redirect('/users/index'); > } > } else { > $this->validateErrors($this->User); > } > } > } > function knownusers() > { > $this->set('knownusers', $this->User->findAll(null, array('id', > 'username', > 'first_name', 'last_name', 'last_login'), 'id DESC')); > } > function login() > { > $this->set('error', false); > if ($this->data) > { > $results = $this->User->findByUsername($this->data['User'] > ['username']); > if ($results && $results['User']['password'] == > md5($this->data['User']['password'])) > { > $this->Session->write('user', $this->data['User'] > ['username']); > $this->Session->write('last_login', $results['User'] > ['last_login']); > $results['User']['last_login'] = date("Y-m-d H:i:s"); > $this->User->save($results); > $this->redirect('/users/index'); > } else { > $this->set('error', true); > } > } > } > function logout() > { > $this->Session->delete('user'); > $this->redirect('/users/login'); > } > function index() > { > $username = $this->Session->read('user'); > if ($username) > { > $results = $this->User->findByUsername($username); > $this->set('User', $results['User']); > $this->set('last_login', $this->Session->read('last_login')); > } else { > $this->redirect('/users/login'); > } > }} > > ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Why I get this: Warning: Cannot modify header information - headers already sent by (output started at /var/www/cake/app/models/user.php:13) in /var/www/cake/cake/libs/controller/controller.php on lin
Instead redirecting, i get this.. Any Ideas? login.thml: Please log in. form('/users/login') ?> Username: input('User/username', array) ?> Password: password('User/password', array) ?> submit('login') ?> link('register', '/users/register') ?> users_controller.php: set('username_error', 'Username must be between 6 and 40 characters.'); if (!empty($this->data)) { if ($this->User->validates($this->data)) { if ($this->User->findByUsername($this->data['User'] ['username'])) { $this->User->invalidate('username'); $this->set('username_error', 'User already exists.'); } else { $this->data['User']['password'] = md5($this- >data['User']['password']); $this->User->save($this->data); $this->Session->write('user', $this->data['User'] ['username']); $this->redirect('/users/index'); } } else { $this->validateErrors($this->User); } } } function knownusers() { $this->set('knownusers', $this->User->findAll(null, array('id', 'username', 'first_name', 'last_name', 'last_login'), 'id DESC')); } function login() { $this->set('error', false); if ($this->data) { $results = $this->User->findByUsername($this->data['User'] ['username']); if ($results && $results['User']['password'] == md5($this->data['User']['password'])) { $this->Session->write('user', $this->data['User'] ['username']); $this->Session->write('last_login', $results['User'] ['last_login']); $results['User']['last_login'] = date("Y-m-d H:i:s"); $this->User->save($results); $this->redirect('/users/index'); } else { $this->set('error', true); } } } function logout() { $this->Session->delete('user'); $this->redirect('/users/login'); } function index() { $username = $this->Session->read('user'); if ($username) { $results = $this->User->findByUsername($username); $this->set('User', $results['User']); $this->set('last_login', $this->Session->read('last_login')); } else { $this->redirect('/users/login'); } } } ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---