Jump to content

Chrisj

Members
  • Posts

    551
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Chrisj

  1. I have added this to .htaccess:

    RewriteCond %{REQUEST_URI} \.(mp4)$ [NC]
    RewriteRule ^ validate.php?request_url=%{REQUEST_URI} [L]


    and added a validate.php file, containing this:

    <?php
    $v = $_GET['video'] ?? null;
    
    if(file_exists($v)) {
        unlink($v);
        header('Content-type: application/mp4');
        header('Content-Disposition: inline; filename=video.mp4');
        readfile("./mytestvideo.mp4");
    } else
       http_response_code(404);


    to the root directory. And then searched and played a video, but still see the unmasked url/path to the video, instead of this type of url/path:

    http://mymp4.com?validate.php?video=40f677a45113eb829e345d278b8d1d31

    as I was hoping for.

    I'm sure I must have something incomplete.

    Any additional guidance you'd like to share is much appreciated.

    Much thanks again

  2. Many thanks again for your posting/reply.  I have added this code to an .htaccess file:

    RewriteEngine OnRewriteCond %{REQUEST_URI} \.(mp4)$ [NC]
    RewriteRule ^ validate.php?request_url=%{REQUEST_URI} [L]

    I have added this php file:

    <?php
    $v = $_GET['video'] ?? null;
    
    if(file_exists($v)) {
        unlink($v);
        header('Content-type: application/mp4');
        header('Content-Disposition: inline; filename=video.mp4');    
        readfile("./mytestvideoo.mp4");    
    } else
       http_response_code(404);

    named validate.php to the main directory.

    I just don't know what to do with this:

    //Generate the link
    
    $normalText = "this is just your average string with words and stuff";
    
    $hashedText = md5($normalText);
    
    fopen($hashedTest, 'w');
    
    echo "<a href='validate.php?video={$hashedText}'>Link to the video</a>

    should I put it in a .txt file and add it to my main directory? If so, named what?

    That's just what I'm not clear on before I test all this.

    I look forward to your comments/anything you'd like to share.

  3. Thanks for your reply.

    Which one would work best for my request: " Is there a way to block or scramble the video's url from being available to be copied? If not, is there a way to have that url be available only if the potential viewer is 'logged-in' to the web site? Or some type of authentication based on checking for a user's PHP temp session file before allowing access from the video's url?"

  4. How about something like this:

    RewriteEngine OnRewriteCond %{REQUEST_URI} \.(mp4)$ [NC]
    RewriteRule ^ validate.php?request_url=%{REQUEST_URI} [L]
    # To disable or prevent the directory access/listing
    Options -Indexes

    with this validate.php?:

    <?phpsession_start();
    if (!isset($_SESSION['login'])) {
    header ('Location: index.php');
    exit();
    } else {
    // Get server document root
    $document_root = $_SERVER['DOCUMENT_ROOT'];
    // Get request URL from .htaccess
    $request_url = $_GET['request_url'];
    // Get file name only
    $filename = basename($request_url);
    // Set headers
    header('Content-type: application/mp4');
    header('Content-Disposition: inline; filename='.$filename);
    // Output file content
    @readfile($document_root.$request_url);
    }

    I look forward to any additional guidance/comments/suggestions

     

  5. When I play a video (that is blocked from being downloaded as a file from a php web script player that I'm using) I can see the url address of the file from my PC in dev tools > networking > media, Is there a way to block or scramble the video's url from being available to be copied? If not, is there a way to have that url be available only if the potential viewer is 'logged-in' to the web site? Or some type of authentication based on checking for a user's PHP temp session file before allowing access from the video's url?

  6. The html5 player works successfully on my web page, but I’m wondering if there is a way to limit the video replays. Here’s the code:

    <video id="my-video1" controls autoplay style="width:100%; height:100%;" poster="{{THUMBNAIL}}" disablePictureInPicture controlsList="nodownload"> <?php if (!empty($pt->video_1080)) { ?> <source src="{{VIDEO_LOCATION_1080}}" type="{{VIDEO_TYPE}}" data-quality="1080p"> <?php } ?> <?php if (!empty($pt->video_720)) { ?> <source src="{{VIDEO_LOCATION_720}}" type="{{VIDEO_TYPE}}" data-quality="720p"> <?php } ?> <?php if (!empty($pt->video_480)) { ?> <source src="{{VIDEO_LOCATION_480}}" type="{{VIDEO_TYPE}}" data-quality="480p"> <?php } ?> <?php if (!empty($pt->video_360)) { ?> <source src="{{VIDEO_LOCATION_360}}" type="{{VIDEO_TYPE}}" data-quality="360p"> <?php } ?> <?php if (!empty($pt->video_240)) { ?> <source src="{{VIDEO_LOCATION_240}}" type="{{VIDEO_TYPE}}" data-quality="240p"> <?php } ?> Your browser does not support HTML5 video. </video>

     

    I look forward to any replies/assistance

     

  7. Hello McGyver,

    I have re-read your great advice (thank you again), regarding the "two tables". I  am trying to understand more clearly what you've advised, and trying to improve what is already there (rather than re-create everything). Would it be possible that you could message me so I might be able to ask you some more specifics directly?

    Thanks again for your kind posting replies. I look forward to your positive response.

    Many thanks again

     

  8. Great help. Thanks for all the replies, and for your last clue. The html table now successfully displays the ID, PAYER_NAME, AMOUNT, etc. of the transactions pertaining to the logged-in User’s videos.

    I am wondering, however, if instead of the html table showing, in the Payer_Name column, the payers’ id, if it could display that payer’s ‘username’ instead?

    The only place ‘username’ is stored is in the ‘users’ db table.

    Any clues, as to how that might be possible, are appreciated.

  9. Much thanks for reply/help and example.

    I tried this without success:

    WHERE upv.time_date AND upv.user_id_uploaded = user_id ORDER BY upv.time_date DESC");

     

    in 'u_paid_videos ' db table  the 'user_id_uploaded' column represents the owner (uploader) of the video and 'user_id" is owner/uploader from  the 'videos' db table, which would be, I think should be the logged-in user seeing this page.

    apparently I am not getting the correct <user id of record> or <id of current user>, or something else is incorrect. (in 'users' db table the user id column is simply 'id').

    any additional assistance is appreciated

  10. Thanks for your reply.

    I appears that this now successfully reflects the correct PAYER NAME, in the html table, after this query was changed to this:

    $get_videos = $db->rawQuery("SELECT DISTINCT(v.id), v.*, upv.id_user as id_user, upv.earned_amount as earned_amount, upv.time_date as time_date FROM u_paid_videos AS upv LEFT JOIN " . T_VIDEOS . " AS v ON (upv.id_video = v.id) WHERE upv.time_date ORDER BY upv.id DESC");

    So, for each transaction; ID, PAYER_NAME, VIDEO_NAME, AMOUNT,  CURRENCY and TIME now displays correctly in the html table.

    The full page shows the earned amount for the User and his purchase balance, and now thanks to this latest query modification the page also displays the correct data in an html table at the bottom of the page. However, it should just display the ID, PAYER_NAME, AMOUNT, etc. of the transactions pertaining to this User's videos, but it displays all transactions. In fact, all Users now see all transactions, not just those transactions pertaining to their own videos.

    So, I'm looking for some assistance with getting the code to just display the transaction data only pertaining to a Users' own videos.

    Any guidance is appreciated.

  11. Thanks for the replies.

    I have made progress where all columns of the html table populate correctly, except for the PAYER_NAME column:

    $ads_list1 = '';
    
    $pt->videos      = $get_videos;
    
    $get_videos = $db->rawQuery("SELECT DISTINCT(v.id), v.*, upv.earned_amount as earned_amount, upv.id_user as id_user, upv.time_date as time_date FROM u_paid_videos AS upv LEFT JOIN " . T_VIDEOS . " AS v ON (upv.id_video = v.id) WHERE upv.id_user = {$user->id} AND upv.time_date ORDER BY upv.id DESC");
    
    $pt->videos      = $get_videos;
    
    if (!empty($get_videos)) {
    $len = count($get_videos);
    foreach ($get_videos as $key => $video) {
    $video = PT_GetVideoByID($video, 0, 0, 0);
    $pt->last_video = false; if ($key == $len - 1) { $pt->last_video = true;
    
    }
            $ads_list1 .= PT_LoadPage('transactions/list',array(
                'ID' => $video->id,
                            'PAYER_NAME' => $user->id,
    			'VIDEO_NAME' =>  $video->title,
    			'AMOUNT' => $video->earned_amount,
    			"CURRENCY" => $currency,
    			'TIME' => date("Y-m-d h:i A (T)", strtotime($video->time_date))
            ));
        }
    }

    I'd like the PAYER_NAME data to come from the db table: 'u_paid_videos' > 'id_user' column.

    Any ideas, suggestions are appreciated 

  12. Thanks for your reply/help.
    Now the displayed result is much improved, thanks.

    However, ultimately, I'm trying to display data in that table when a purchase takes place.

    I have added/copied this code to that page:

    " " " " " "
    
    $ads_list1 = '';
    
    $get_videos = $db->rawQuery("SELECT DISTINCT(v.id), v.* FROM u_paid_videos AS upv LEFT JOIN " . T_VIDEOS . " AS v ON (upv.id_video = v.id) WHERE upv.id_user = {$user->id} ORDER BY upv.id");
    
    
    if (!empty($get_videos)) {
        $len = count($get_videos);
        foreach ($get_videos as $key => $video) {
            $video = PT_GetVideoByID($video, 0, 0, 0);
            $pt->last_video = false;
            if ($key == $len - 1) {
                $pt->last_video = true;
            }
            $ads_list1 .= PT_LoadPage('transactions/list',array(
                'ID' => $video->id,
    			'PAID_USER' => $user->id,
    			'VIDEO_NAME' =>  $video->title,
    			'AMOUNT' => $tr->earned_amount,
    			"CURRENCY" => $currency,
    			"TIME" => $tr->time_date
            ));
        }
    }
    
    $total_earn = $total_earn + $total_ads;
    
    $pt->array = implode(', ', $array);
    $pt->ads_array = implode(', ', $ads_array);
    $pt->page_url_ = $pt->config->site_url.'/transactions';
    $pt->title       = $lang->earnings . ' | ' . $pt->config->title;
    $pt->page        = "transactions";
    $pt->description = $pt->config->description;
    $pt->keyword     = @$pt->config->keyword;
    $pt->currency    = $currency;
    $pt->content     = PT_LoadPage('transactions/content',array(
    	'CURRENCY'   => $currency,
    	'ADS_LIST'   => $ads_list1,
    	'TOTAL_EARN' => $total_earn,
    	'TODAY_EARN' => $today_earn,
    	'MONTH_EARN' => $month_earn
    ));

    and it populates the html table, but appears to repeat that same thing in the 'time' column and the Payer Name displayed is incorrect. The Payer Name should come from the 'u_paid_videos' table column named 'id_user'.

    Any additional assistance will be appreciated  (and help getting the table to display in ID order).

    thanks

     

    table1.png

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.