close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Restricting media file play count.

Thread began 5/19/2010 12:55 pm by fdotmedia | Last modified 5/20/2010 4:23 pm by Jason Byrnes | 954 views | 3 replies |


Restricting media file play count.

I've run the wizard and added the session details - works perfectly...

I have a question that maybe someone can help with...

I have three pages - login.php, home.php and player.php... The login page is self explanatory and after the individual is logged in we return the following session variables:


On the home page I'm returning a recordset loop filtered by the EID to display the product title, product link, plays available and total plays purchased... The recordset returns all the data correctly and even loads the flash file correctly... But when I istitute a simple math equation, e.g. PLAYS > TOTAL, it behaves correctly for an exceeded plays and behaves incorrectly for a non exceeded plays - meaning both redirect to the expired.php page.

The first question is - Does SecurityAssist (or Webassist to a greater extent) have something that can do a better job with the following equation?

$ePlays = $row_eVideo['ePlays'];
$ePlayed = $row_eVideo['ePlayed'];

if ($ePlayed > $ePlays) {
header('Location: expired.php');


The second question is - Is there a way to add +1 to a table on a page load versus an update form? An example would be adding 1 to 4 in ePlayed to equal 5... I would like the player.php page to add a 1 to the total 'ePlayed' for that EID...

I know I'm asking a lot - but - I'm kinda stuck!


Sign in to reply to this post

Jason ByrnesWebAssist

the first question is what is the value in both of those columns?

second question, what is the default value for those columns?

in your database you should make sure that the default value for both of those columns is 0. if it is NULL any math equation attempted will always fail.

NULL is the absence of a value.

NULL cannot be less then 1 or 2 because NULL does not exist.

as for updateing the value on page load, you can use the Before Page load trigger in the update record server behavior to accomplish this.

Sign in to reply to this post


Thanks @Jason for the reply...

I changed the code to the following

$updateSQL = sprintf("UPDATE eVideo SET eVideo.ePlayed = %s +1 WHERE eVideo.eid = %s",

on Form submit add's the +1 to the db... It works perfectly now for ONE record returned - if there are multiple records, however, with one exceeding the ePlayed the other not exceeding ePlayed, the code defaults to the exceeded redirect.

As an example - I have page 1 and page 2... instead of having a form submit on page 1 I can have the same form on page 2 and set it "before page loads"?

If so I think I've solved one of my MANY problems...


Sign in to reply to this post

Jason ByrnesWebAssist

If you are using the data assist update record server behavior, one of the available triggers will be before page load.

Sign in to reply to this post

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





Ease of use


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