Hey thanks for the help... yeah I did learn a while ago that pages
doesn't work... I tried it at the beginning of this project, was just
using that as an example.
Okay, I'm sorry a bit of a n00b here. This is what I had before I
came here, and have actually tried several variations:
function edit($id = null, $secretid = null) {
if (!$id && empty($this->data)) {
$this->flash(__('Invalid Application', true),
array('action'=>'index'));
if(!$secretid && empty($this->data)) {
$this->flash(__('Invalid Secret Identification
Code', true),
array('action'=>'index'));
}
}
if (!empty($this->data)) {
if ($this->Application->save($this->data)) {
$this->flash(__('The Application has been
saved.', true),
array('action'=>'index'));
} else {
}
}
if (empty($this->data)) {
$this->data = $this->Application->read(null, $id);
}
}
----------------------------------------------------------------------
That doesn't work, but seems closer to me than my other alternative
which just created new pages every time instead up updating them which
was:
function email($id = null, $secretid = null) {
if (!$id && empty($this->data)) {
$this->flash(__('Invalid Application', true),
array('action'=>'index'));
}
if(!$secretid && empty($this->data)) {
$this->flash(__('Invalid Secret Identification Code',
true),
array('action'=>'index'));
}
if (!empty($this->data)) {
if ($this->Application->save($this->data)) {
$this->flash(__('The Application has been
saved.', true),
array('action'=>'index'));
} else {
}
}
if (empty($this->data)) {
$this->data = $this->Application->read(null, $id);
}
}
----------------------------------
That really fails to do anything productive unfortunately. From how
you have things worded it almost seems like I should be checking the
$secretid in the view or somewhere else. I just don't really get how
to verify the secretid... and it's driving me nuts. I'm not sure what
switching is... but may be what I need. A redirect might work as
well.
On Oct 15, 6:26 am, hydra12 <[EMAIL PROTECTED]> wrote:
> Assuming that you have a controller called contents (pages is already
> taken by Cake) and a view action that lets you view a given page, you
> could try something like this:
>
> http://www.testsite.com/contents/view/1/secretid/
>
> In your controller, you could have this:
>
> function edit($id=null, $secretid=null)
>
> Now when someone goes to a page, you check first for the id to make
> sure the id exists (standard procedure). If the id exists, read that
> record from the database. Now check that record's secretid against
> $secretid from the url. If they don't match, or if none was supplied
> (ie. it gets assigned to null if they don't put one in the url),
> render a view page. If they do match, show an edit page (you could do
> this through switching, or you could redirect to an edit page).
>
> I hope that helps!
> hydra12
>
> On Oct 15, 5:23 am, Cody Sortore <[EMAIL PROTECTED]> wrote:
>
> > Okay, with the particular site I'm building I did a poll and received
> > 80% feedback to make the site without a user log in system. The
> > problem is that I want to allow the creator editing access still.
> > People make mistakes, or may need to delete spam comments
> > occasionally.
>
> > What I was thinking was to have a place when creating their page they
> > put in a "secret id" that then goes into the database and what I want
> > to do is so that the only way to access the edit page is to have that
> > secret id in the url for example:
>
> >http://www.testsite.com/pages/secretid/edit/1/
>
> > I want to set it up so that the only way to edit the page would be to
> > have the secret id in place... I can't figure it out at all though. I
> > did consider making it so that instead of the page number it just used
> > the secret id, but that would be a bad idea because if two people had
> > the same secret id which would it pull up? And if I checked for
> > unique id's it would have to be pretty long so that everyone could
> > have something different.
>
> > Any help or pointing in the right direction would be greatly
> > appreciated! Thanks in advance for the help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---