close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Members AREA Solution wanted

Thread began 11/08/2012 12:22 pm by Cologne | Last modified 11/08/2012 2:10 pm by Jason Byrnes | 642 views | 9 replies |

Cologne

Members AREA Solution wanted

Hi there,

I want to set up a members area, with, DB. Everything works fine.
The problem is, if I store other things like images in other tables that a related to the member ID its not safe.
I need to make sure, that the member only delete/edit his own images.
So I got a table members and a table images.
The relation is the member ID (stored in the session during login).
But, the problem is the image ID.
this is the critical thing. Cause I need to transmit it via the URL. ?imageID=6
So, anyone can change the imageID and delete random images from other ussers.
How can I fix that?

Cheers,
Denis

Sign in to reply to this post

Jason ByrnesWebAssist

in the mages table, you should have a column that relates the image to the user using the users ID

so theres the imageID primary key column and the imageUserID column.

in the recordset that returns the image, add another where clause to compare the imageUserID column to the UserID session that gets set. this way, it doesn't matter if they change the Image id in the URL variable, it wont return anything unless the image belongs to them.

Sign in to reply to this post

Cologne

Hi Jason,
i know, that that will work, but how do I add an other WHERE in the DA behavior?
Thats what I often ask to implement in an DA update.
Cause, I dont know where to put it. And at least I cant re-Edit the DELETE or UPDATE via the Server behavior again :-(

So, where to put the extra code?

And please, put it on the update list :-)

Cheers,
Denis

Sign in to reply to this post

Jason ByrnesWebAssist

it does not need to be included in the delete or update behavior.

the page that populates the delete or update pages uses a recordset to populate the page with the record to be deleted or updated.

this recordset should have the extra where condition to compare the session variable.

use a show if behavior to hide the delete or update form if the recordset is empty.

this way the delete cannot happen if it is for an image that does not belong to them

Sign in to reply to this post

Cologne

Ah, this is something I never thought about.

So, the URL is ?imageID=4

I create a recordset that searches the image via imageID=urlImageID AND userID=sessionUserID LIMIT 1

Should I SELECT the ID?

And this recordset ID I will use in the DELETE or UPDATE behavior?

Sign in to reply to this post

Jason ByrnesWebAssist

the select on the update page should return all columns that may be updated, on the delete page only needs the ID

Sign in to reply to this post

Cologne

So I can put it in the fields of the update form, right?

Sign in to reply to this post

Jason ByrnesWebAssist

or just use SELECT *

Sign in to reply to this post

Cologne

but this is only to have something to pre fill the fields right?

jason, i gonna try this. I allways used HASH from userID and imageID, check it on the edit page, ahh, that was horror!

I try your suggestion!
Denis

Sign in to reply to this post

Jason ByrnesWebAssist

  but this is only to have something to pre fill the fields right?  



yes, that is correct.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...