close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Best Fix Found for Random Deletions in "Classes" Database?

Thread begun 2/03/2022 6:43 am by yogastudents362523 | Last modified 2/03/2022 8:59 am by Ray Borduin | 120 views | 1 replies |

yogastudents362523

Best Fix Found for Random Deletions in "Classes" Database?

Hi,

Random and completely unasked for delections have been occurring in my "Classes" database.
I would like to know if I have correctly analysed and handled the situation.

I first filter on SecurityAssist_ID to create a "View" page of all classes per each Presenter.

I then drill down to details per each specified class on an "Edit" Page using:

edit_class.php?ClassID=<?php echo($rsGetClassInfo->getColumnVal("ClassID")); ?>

This (of course) gives me a:
$_GET['ClassID'],
to go with that
'ClassID=xxxx'.

But if a Presenter merely looks at the page then backs out (doing nothing), the record was deleted.
I decided that this was probably because nothing or null was somehow being used as an unauthorized value for an update.

I then noticed MySQL's coding for the Update begins with:
if (true) {
blah blah blah;
}

I therefore amended this to:

<?php
if (isset($_POST["ClassLength"])) {
blah blah blah
}
(with there being a different such page for every class attribute, that Post being linked to the ClassID from the GET).

It may be a coincidence, but there has not been a repeat since. So unless I am mistaken, amending that "if" clause cured the problem.

Does this mean I must in the future amend all such "if (true)" MySQLi update queries that involve a ?ClassID = xxxx appended to the URL?

This is surely such a common scenario that it seems strange it should be so?
But if it is so, then I am sure my above code fragment is primitive in the extreme.
Could you please suggest what more auspicious expression I should be using?

Thank you,
KAB

Sign in to reply to this post

Ray BorduinWebAssist

The IF statement is the trigger that causes the action to take place. In every application it could be different. Without looking at your code in context I really couldn't determine if or why you should be using one trigger over the other.

In general if (true) means to run every time the page loads. If it is an insert or update, usually it will refer to the form button and a $_POST value so that it only runs when the form is filled out and doesn't run twice (once when the page loads and another time when the form is submitted)

Sign in to reply to this post
Did this help? Tips are appreciated...

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