If someone types in the address, or follows a bookmark (happens all the time as user bookmarks the login page), there is no referer as they have not clicked on a link from another page.
Try: http://book.cakephp.org/view/1270/loginRedirect (which by the way says the referer is only populated from links to pages within your site) HTH, Paul @phpMagpie On Aug 29, 11:18 pm, driz <talk2d...@gmail.com> wrote: > When a user tries to access a protected action they are automatically > taken to the login form which then sets the previous page in a session > called Auth.Redirect and on successful login sends the user back to > that session value. > > However if I put a check to see the referrer it will NOT show the > previous URL! > > This causes a problem in my app as I do a check in the code to see if > a user has come direct to the login page (typed it in the address bar) > or has come from another page within the app. > > e.g. > > $referer = env('HTTP_REFERER'); > > if(empty($referer) > { > 'user has typed the url manually or clicked a link from an > external website'; > > } > > The issue is that when a user is taken to the login form by the auth > component it will leave the referer empty! But this is wrong as the > referer WAS the last page! > > a) is this a bug in CakePHP? Why isn't it being classed as a refer? > > b) how do I get around this? > > Cheers -- 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