diff options
author | Naglfar <naglfar@tilde.institute> | 2021-01-08 23:07:56 +0100 |
---|---|---|
committer | Naglfar <naglfar@tilde.institute> | 2021-01-08 23:07:56 +0100 |
commit | b3999a235201891805ad9477d5e31cfcd88fe180 (patch) | |
tree | 3526ae7a373a42fdb331219c92c27ce173adcad1 | |
parent | 954e914a4f100348c4cd7fdaef7d2ae7a10d4392 (diff) | |
download | MightyWVMS-b3999a235201891805ad9477d5e31cfcd88fe180.tar.gz |
Add video views counter
-rw-r--r-- | index.php | 3 | ||||
-rw-r--r-- | php/rd-procedures.php (renamed from php/vm-procedures.php) | 3 | ||||
-rw-r--r-- | php/wd-procedures.php | 7 |
3 files changed, 9 insertions, 4 deletions
diff --git a/index.php b/index.php index e5d86bf..cc1ab1e 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,8 @@ require 'php/definitions.php'; # Variables and constants definition # Interact with variables in the execution environment require 'php/ws-procedures.php'; # website specific -require 'php/vm-procedures.php'; # video management +require 'php/rd-procedures.php'; #video management (Read data) +require 'php/wd-procedures.php'; #video management (Write/update data) ?> <!DOCTYPE html> <html lang="<?php echo $mdata[3] ?>"> diff --git a/php/vm-procedures.php b/php/rd-procedures.php index 23e861c..27fd11e 100644 --- a/php/vm-procedures.php +++ b/php/rd-procedures.php @@ -11,8 +11,5 @@ if(!empty($vdata[1])) $vid = $i; $vdata = file($dpath.$mdata[3].'/'.$vid, FILE_IGNORE_NEW_LINES); -$vdata[1] = date('M j, Y', $vdata[1]); -$vdata[] = file_get_contents($dpath.$mdata[3].'/'.$cpath.$vid); - $cindex = file($dpath.$mdata[3].'/'.$channel, FILE_IGNORE_NEW_LINES); ?> diff --git a/php/wd-procedures.php b/php/wd-procedures.php new file mode 100644 index 0000000..1b8d02d --- /dev/null +++ b/php/wd-procedures.php @@ -0,0 +1,7 @@ +<?php +$vdata[0]+=1; +file_put_contents($dpath.$mdata[3].'/'.$vid, implode(PHP_EOL, $vdata)); + +$vdata[1] = date('M j, Y', $vdata[1]); +$vdata[] = file_get_contents($dpath.$mdata[3].'/'.$cpath.$vid); +?> |