close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Showing id in url is a risk for me and my members

Thread began 2/08/2011 11:45 am by Paul | Last modified 3/20/2015 11:10 am by Jason Byrnes | 4035 views | 12 replies |

PaulBeta Tester

Showing id in url is a risk for me and my members

Hi,

I have used the SA wizard to create users login accounts.
I've also used the DA wizard to build a members log where logged in members can create, post and edit logs.

Returning members login and are redirected to a dashboard which is populated with only their logs and account details.

Each log shown has its own edit button so the member can select it and the id is passed to the update.php where they can edit and save.

And so my problem...

Unfortunately, members could change the record id in the url and potentially access other members logs, thus; ../update.php?id=1 or 2 or 3 or 3 etc.. and edit the detail.

How can I prevent members from doing this?

Advice welcome.
Thanks, Paul.

Sign in to reply to this post

Jason ByrnesWebAssist

The login page created by security assist will store the users ID in a session variable.

instead of passing the ID through the GET, use the ID that is store in the session.

double check the Security assist authenticate user behavior for the name of the session variable that is created.

Then edit the data Assist recordsets and the insert and update behaviors to use the ID Session instead of the ID URL Variable.

Sign in to reply to this post

PaulBeta Tester

Hi Jason,

Thank you for your reply.

I think I may not have explained my scenario to well, or possibly i have failed to understand your response.

I've got the user login side sorted. i'm using the ID in the login session to ensure members can only see their logs etc.

My concern is around the editing of these logs that the users create.
May I suggest you visit the site and try it for yourself;

registration.php

After you receive a confirmation email, login and update a log.
Youll see the url id i'm concerned about. if you change it to 1, 2 or 3 they will return other members logs.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, i understand this.

to work around the issue modify the recordsets so that they use the ID session instead of the id querystring.


if you modify the recordsets to use the session instead of the querysting for filtering the data that is displayed, then users cannot modify other users records.

Sign in to reply to this post

PaulBeta Tester

Are you referring to the 'Update Record' recordset in my update.php file?

Sign in to reply to this post

Jason ByrnesWebAssist

i am referring to any recordset on the insert, update or delete page that is currently set to filter on the ID url variable.

you simply need to edit the recordset to use the ID Session variable instead of the ID querysting variable.


The Update Record is a server behavior, not a recordset. though you should probably update that as well to use the session instead of the query sting.

Sign in to reply to this post

PaulBeta Tester

Resolved, Thanks J

Sign in to reply to this post

Mags

I have the same problem and have tried the solution above, however it's returning an empty recordset. My recordset is as follows:

<?php
$ParamClientID_WADAclients = "-1";
if (isset($_GET['ClientID'])) {
$ParamClientID_WADAclients = $_GET['ClientID'];
}

$ParamAccountantID_WADAclients = "-1";
if (isset($_SESSION['AccountantID'])) {
$ParamAccountantID_WADAclients = $_SESSION['AccountantID'];
}
mysql_select_db($database_new_greenroom, $new_greenroom);
$query_WADAclients = sprintf("SELECT AccountantID, ClientID, ClientName, StagingDate FROM clients WHERE ClientID = %s AND AccountantID = %s", GetSQLValueString($ParamClientID_WADAclients, "int"),GetSQLValueString($ParamAccountantID_WADAclients, "int"));
$WADAclients = mysql_query($query_WADAclients, $new_greenroom) or die(mysql_error());
$row_WADAclients = mysql_fetch_assoc($WADAclients);
$totalRows_WADAclients = mysql_num_rows($WADAclients);
?>

Any idea what might be wrong?

Sign in to reply to this post

Jason ByrnesWebAssist

try starting the session at line 1:

<?php @session_start(); ?>



if the problem persists, add the following code to write the session content and the SQL query in the page body:

<?php
echo("SQL: ".$query_WADAclients."<br />");
echo("<pre>");
var_dump($_SESSION);
echo("</pre>");
?>



report back the session contents and the SQL query.

Sign in to reply to this post

Mags

Hi Jason

Still the same problem. Here's the session content (see PM):

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...