Jump to content

Chrisj

Members
  • Posts

    551
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Chrisj

  1. Ok, thanks again for your help.
    This has succeeded:

    $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2, overlay=180:180:enable=between(t\,5\,5+2),scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1';

    Yet, on the uploaded test videos, the first watermark in the upper left corner looks small and unsharp, but the 2nd watermark, that displays in the middle after 5 seconds, looks to be the correct size, and sharp.

    Any ideas on how to improve that will be welcomed.

  2. Thanks for your reply.

    Yes, I copied them because I'm trying to add the two same logos with the same code line, as an example showed in the documentation.

    So, my latest (unsuccessful) attempt is:

    $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.'-i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.'-filter_complex "overlay=10:10,scale=640:-2, overlay=10:10 'if(gte(t,15), -w+(t-2)*20, NAN)',scale=640:-2,"-vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1';

    any additional guidance is welcomed

  3. If I could find where to edit my previous message here, I would have changed it to say that, upon some more research I see that 10:10 puts the watermark 10 pixels from the top and 10 pixels from the right, correct? So, I added the code above and ran an upload, which appeared to upload, but nothing there when I try to play it.

    Any additional help is welcomed.

  4. Thanks again for your assistance.

    So, in my current original posted line of code, I don't see any coordinates. However, when it processes it places the logo in the top left corner, which is good.

    So, based on the linked documentation, I believe I've added a second instance of a logo showing up after 20 seconds. If I'm incorrect please let me know. 

    And any help I can get with adding coordinates to the center for the 2nd logo is appreciated.

    Here my current modification:

     $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' 
    -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.'(t,20)
    -filter_complex "overlay=10:10,scale=640:-2, overlay=10:10,scale=640:-2,"
    -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1';

     

  5. Much thanks for your reply. I did not write the posted code, but based on what you provided, would you say I would need to integrate this link example:

    overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0

    into this line of code in my posting?:

    $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1';

    if I'm correct with that, then I'd somehow replace/integrate this:

    "overlay=10:10,scale=640:-2"

    with this?:

    overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0

     

    because I'm not clear on what this means:

    "overlay=10:10,scale=640:-2",

    I don't know if it should stay in or be modified. Any additional guidance is appreciated

     

  6. The web video script that I'm using, and trying to modify, works successfully integrating a watermark in the upper left corner of the video file, (so that when it's downloaded, the watermark stays on the video). In the ffmpeg php file code below, the watermarking starts with this line

    $watermark_image_full_path = "watermark.png";

    at line 275 (out of 504 - about halfway).

    I am wondering if there might be a way to make the watermark also display briefly in another location on the video again, maybe halfway through, when playing it. 

     

    <?php
    if (IS_LOGGED == false || $pt->config->upload_system != 'on') {
        $data = array(
            'status' => 400,
            'error' => 'Not logged in'
        );
        echo json_encode($data);
        exit();
    } else if ($pt->config->ffmpeg_system != 'on') {
        $data = array(
            'status' => 402
        );
        echo json_encode($data);
        exit();
    } else {
        $getID3    = new getID3;
        $featured  = ($user->is_pro == 1) ? 1 : 0;
        $filesize  = 0;
        $error     = false;
    
    
    if (PT_IsAdmin() && !empty($_POST['is_movie']) && $_POST['is_movie'] == 1) {
        if (empty($_POST['movie_title']) || empty($_POST['movie_description']) || empty($_FILES["movie_thumbnail"]) || empty($_POST['stars']) || empty($_POST['producer']) || empty($_POST['country']) || empty($_POST['quality']) || empty($_POST['rating']) || !is_numeric($_POST['rating']) || $_POST['rating'] < 1 || $_POST['rating'] > 10 || empty($_POST['release']) || empty($_POST['category']) || !in_array($_POST['category'], array_keys($pt->movies_categories))) {
            $error = $lang->please_check_details;
        }
        // $cover = getimagesize($_FILES["movie_thumbnail"]["tmp_name"]);
        // if ($cover[0] > 400 || $cover[1] > 570) {
        //     $error = $lang->cover_size;
        // }
    }
    else{
        $request   = array();
        $request[] = (empty($_POST['title']) || empty($_POST['description']));
        $request[] = (empty($_POST['tags']) || empty($_POST['video-thumnail']));
        if (in_array(true, $request)) {
            $error = $lang->please_check_details;
        } else if (empty($_POST['video-location'])) {
            $error = $lang->video_not_found_please_try_again;
        } else if (($pt->config->sell_videos_system == 'on' && $pt->config->who_sell == 'pro_users' && $pt->user->is_pro) || ($pt->config->sell_videos_system == 'on' && $pt->config->who_sell == 'users') || ($pt->config->sell_videos_system == 'on' && $pt->user->admin)) {
            if (!empty($_POST['set_p_v']) || $_POST['set_p_v'] < 0) {
                if (!is_numeric($_POST['set_p_v']) || $_POST['set_p_v'] < 0 || (($pt->config->com_type == 0 && $_POST['set_p_v'] <= $pt->config->admin_com_sell_videos)) ) {
                    $error = $lang->video_price_error." ".($pt->config->com_type == 0 ? $pt->config->admin_com_sell_videos : 0);
                }
            }
        } else {
            $request   = array();
            $request[] = (!in_array($_POST['video-location'], $_SESSION['uploads']['videos']));
            $request[] = (!in_array($_POST['video-thumnail'], $_SESSION['ffempg_uploads']));
            $request[] = (!file_exists($_POST['video-location']));
            if (in_array(true, $request)) {
                $error = $lang->error_msg;
            }
        }
    }
        if (empty($error)) {
            $file = $duration_file     = $getID3->analyze($_POST['video-location']);
            $duration = '00:00';
            if (!empty($file['playtime_string'])) {
                $duration = PT_Secure($file['playtime_string']);
            }
            if (!empty($file['filesize'])) {
                $filesize = $file['filesize'];
            }
            $video_res = (!empty($file['video']['resolution_x'])) ? $file['video']['resolution_x'] : 0;
            $video_id        = PT_GenerateKey(15, 15);
            $check_for_video = $db->where('video_id', $video_id)->getValue(T_VIDEOS, 'count(*)');
            if ($check_for_video > 0) {
                $video_id = PT_GenerateKey(15, 15);
            }
            if (PT_IsAdmin() && !empty($_POST['is_movie']) && $_POST['is_movie'] == 1) {
                $thumbnail = 'upload/photos/thumbnail.jpg';
                if (!empty($_FILES['movie_thumbnail']['tmp_name'])) {
                    $file_info   = array(
                        'file' => $_FILES['movie_thumbnail']['tmp_name'],
                        'size' => $_FILES['movie_thumbnail']['size'],
                        'name' => $_FILES['movie_thumbnail']['name'],
                        'type' => $_FILES['movie_thumbnail']['type']
                    );
                    $file_upload = PT_ShareFile($file_info);
                    $thumbnail = PT_Secure($file_upload['filename'], 0);
                    // if (!empty($file_upload['filename'])) {
                    //     $thumbnail = PT_Secure($file_upload['filename'], 0);
                    //     $upload = PT_UploadToS3($thumbnail);
                    // }
                }
            }
            else{
                $thumbnail = PT_Secure($_POST['video-thumnail'], 0);
                if (file_exists($thumbnail)) {
                    $upload = PT_UploadToS3($thumbnail);
                }
            }
    
            $category_id = 0;
            $convert     = true;
            $thumbnail   = substr($thumbnail, strpos($thumbnail, "upload"), 120);
            // ******************************
            if (PT_IsAdmin() && !empty($_POST['is_movie']) && $_POST['is_movie'] == 1) {
    
                $link_regex = '/(http\:\/\/|https\:\/\/|www\.)([^\ ]+)/i';
                $i          = 0;
                preg_match_all($link_regex, PT_Secure($_POST['movie_description']), $matches);
                foreach ($matches[0] as $match) {
                    $match_url            = strip_tags($match);
                    $syntax               = '[a]' . urlencode($match_url) . '[/a]';
                    $_POST['movie_description'] = str_replace($match, $syntax, $_POST['movie_description']);
                }
                $data_insert = array(
                    'title' =>  PT_Secure($_POST['movie_title']),
                    'category_id' => PT_Secure($_POST['category']),
                    'stars' => PT_Secure($_POST['stars']),
                    'producer' => PT_Secure($_POST['producer']),
                    'country' => PT_Secure($_POST['country']),
                    'movie_release' => PT_Secure($_POST['release']),
                    'quality' => PT_Secure($_POST['quality']),
                    'duration' => $duration,
                    'description' => PT_Secure($_POST['movie_description']),
                    'rating' => PT_Secure($_POST['rating']),
                    'is_movie' => 1,
                    'video_id' => $video_id,
                    'converted' => '2',
                    'size' => $filesize,
                    'thumbnail' => $thumbnail,
                    'user_id' => $user->id,
                    'time' => time(),
                    'registered' => date('Y') . '/' . intval(date('m'))
                );
                if (!empty($_POST['buy_price']) && is_numeric($_POST['buy_price']) && $_POST['buy_price'] > 0) {
                    $data_insert['sell_video'] = PT_Secure($_POST['buy_price']);
                }
            }
            else{
                $link_regex = '/(http\:\/\/|https\:\/\/|www\.)([^\ ]+)/i';
                $i          = 0;
                preg_match_all($link_regex, PT_Secure($_POST['description']), $matches);
                foreach ($matches[0] as $match) {
                    $match_url            = strip_tags($match);
                    $syntax               = '[a]' . urlencode($match_url) . '[/a]';
                    $_POST['description'] = str_replace($match, $syntax, $_POST['description']);
                }
    
                if (!empty($_POST['category_id'])) {
                    if (in_array($_POST['category_id'], array_keys(get_object_vars($pt->categories)))) {
                        $category_id = PT_Secure($_POST['category_id']);
                    }
                }
                $video_privacy = 0;
                if (!empty($_POST['privacy'])) {
                    if (in_array($_POST['privacy'], array(0, 1, 2))) {
                        $video_privacy = PT_Secure($_POST['privacy']);
                    }
                }
                $age_restriction = 1;
                if (!empty($_POST['age_restriction'])) {
                    if (in_array($_POST['age_restriction'], array(1, 2))) {
                        $age_restriction = PT_Secure($_POST['age_restriction']);
                    }
                }
                $sub_category = 0;
    
                if (!empty($_POST['sub_category_id'])) {
                    $is_found = $db->where('type',PT_Secure($_POST['category_id']))->where('lang_key',PT_Secure($_POST['sub_category_id']))->getValue(T_LANGS,'COUNT(*)');
                    if ($is_found > 0) {
                        $sub_category = PT_Secure($_POST['sub_category_id']);
                    }
                }
    
                $continents_list = array();
                if (!empty($_POST['continents-list'])) {
    
                    foreach ($_POST['continents-list'] as $key => $value) {
                        if (in_array($value, $pt->continents)) {
                            $continents_list[] = $value;
                        }
                    }
                }
                $data_insert = array(
                    'video_id' => $video_id,
                    'user_id' => $user->id,
                    'title' => PT_Secure($_POST['title']),
                    'description' => PT_Secure($_POST['description']),
                    'tags' => PT_Secure($_POST['tags']),
                    'duration' => $duration,
                    'video_location' => '',
                    'category_id' => $category_id,
                    'thumbnail' => $thumbnail,
                    'time' => time(),
                    'registered' => date('Y') . '/' . intval(date('m')),
                    'featured' => $featured,
                    'converted' => '2',
                    'size' => $filesize,
                    'privacy' => $video_privacy,
                    'age_restriction' => $age_restriction,
                    'sub_category' => $sub_category,
                    'geo_blocking' => (!empty($continents_list) ? json_encode($continents_list) : '')
                );
                if (!empty($_POST['set_p_v']) && is_numeric($_POST['set_p_v']) && $_POST['set_p_v'] > 0) {
                    $data_insert['sell_video'] = PT_Secure($_POST['set_p_v']);
                }
                if ( ($pt->config->approve_videos == 'on' && !PT_IsAdmin()) || ($pt->config->auto_approve_ == 'no' && $pt->config->sell_videos_system == 'on' && !PT_IsAdmin() && !empty($data_insert['sell_video'])) ) {
                    $data_insert['approved'] = 0;
                }
            }
            // ******************************
            $insert      = $db->insert(T_VIDEOS, $data_insert);
    
            if ($insert) {
                $delete_files = array();
                if (!empty($_SESSION['ffempg_uploads'])) {
                    if (is_array($_SESSION['ffempg_uploads'])) {
                        foreach ($_SESSION['ffempg_uploads'] as $key => $file) {
                            if ($thumbnail != $file) {
                                $delete_files[] = $file;
                                unset($_SESSION['ffempg_uploads'][$key]);
                            }
                        }
                    }
                }
                if (!empty($delete_files)) {
                    foreach ($delete_files as $key => $file2) {
                        unlink($file2);
                    }
                }
                if (isset($_SESSION['ffempg_uploads'])) {
                    unset($_SESSION['ffempg_uploads']);
                }
                $data = array(
                    'status' => 200,
                    'video_id' => $video_id,
                    'link' => PT_Link("watch/$video_id")
                );
                ob_end_clean();
                header("Content-Encoding: none");
                header("Connection: close");
                ignore_user_abort();
                ob_start();
                header('Content-Type: application/json');
                echo json_encode($data);
                $size = ob_get_length();
                header("Content-Length: $size");
                ob_end_flush();
                flush();
                session_write_close();
                if (is_callable('fastcgi_finish_request')) {
                    fastcgi_finish_request();
                }
    
                if ($pt->config->queue_count > 0) {
                    $process_queue = $db->getValue(T_QUEUE,'video_id',$pt->config->queue_count);
                }
    
                if ( (count($process_queue) < $pt->config->queue_count  && !in_array($video_id, $process_queue)) ||  $pt->config->queue_count == 0) {
                    if ($pt->config->queue_count > 0) {
                        $db->insert(T_QUEUE, array('video_id' => $insert,
                                       'video_res' => $video_res,
                                       'processing' => 2));
                    }
    
                    $ffmpeg_b                   = $pt->config->ffmpeg_binary_file;
                    $filepath                   = explode('.', $_POST['video-location'])[0];
                    $time                       = time();
                    $full_dir                   = str_replace('ajax', '/', __DIR__);
    
                    $video_output_full_path_240 = $full_dir . $filepath . "_240p_converted.mp4";
                    $video_output_full_path_360 = $full_dir . $filepath . "_360p_converted.mp4";
                    $video_output_full_path_480 = $full_dir . $filepath . "_480p_converted.mp4";
                    $video_output_full_path_720 = $full_dir . $filepath . "_720p_converted.mp4";
                    $video_output_full_path_1080 = $full_dir . $filepath . "_1080p_converted.mp4";
                    $video_output_full_path_2048 = $full_dir . $filepath . "_2048p_converted.mp4";
                    $video_output_full_path_4096 = $full_dir . $filepath . "_4096p_converted.mp4";
    
                    $video_file_full_path       = $full_dir . $_POST['video-location'];
    
    
                    $watermark_image_full_path = "watermark.png";
    
    
                    // demo Video
                    $video_time = '';
                    $demo_video = '';
                    if ($pt->config->demo_video == 'on' && !empty($data_insert['sell_video'])) {
                        $have_demo = false;
                        if (!empty($duration_file['playtime_seconds']) && $duration_file['playtime_seconds'] > 0) {
                            $video_time = round((10 * round($duration_file['playtime_seconds'],0)) / 100,0);
                            $video_time = '-t '.$video_time.'  -async 1';
                            $have_demo = true;
                        }
                    }
    
    
    
    
                    // demo Video
    
                    //$shell     = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=426:-2 -crf 26 $video_output_full_path_240 2>&1");
    
                    $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1';
    				$shell     = shell_exec($ffmpegCommand);
    
    
    
    
                    $upload_s3 = PT_UploadToS3($filepath . "_240p_converted.mp4");
                    $db->where('id', $insert);
                    $db->update(T_VIDEOS, array(
                        'converted' => 1,
                        '240p' => 1,
                        'video_location' => $filepath . "_240p_converted.mp4"
                    ));
                    if ($pt->config->queue_count > 0) {
                        $db->where('video_id',$insert)->delete(T_QUEUE);
                    }
    
                    if ($video_res >= 3840) {
    
                        //$shell     = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=3840:-2 -crf 26 $video_output_full_path_4096 2>&1");
    
                    $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_4096.' 2>&1';
    				$shell     = shell_exec($ffmpegCommand);
    
    
    
                        $upload_s3 = PT_UploadToS3($filepath . "_4096p_converted.mp4");
                        $db->where('id', $insert);
                        $db->update(T_VIDEOS, array(
                            '4096p' => 1
                        ));
                        // demo Video
    
                        if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) {
                            $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()). "_video_4096p_demo.mp4";
                            $shell     = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=3840:-2 -crf 26 ".$full_dir . $demo_video." 2>&1");
                            $upload_s3 = PT_UploadToS3($demo_video);
                            $db->where('id', $insert);
                            $db->update(T_VIDEOS, array(
                                'demo' => $demo_video
                            ));
                        }
                        // demo Video
                    }
                    if ($video_res >= 2048) {
                        //$shell     = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=2048:-2 -crf 26 $video_output_full_path_2048 2>&1");
    
                        $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_2048.' 2>&1';
    					$shell     = shell_exec($ffmpegCommand);
    
    
                        $upload_s3 = PT_UploadToS3($filepath . "_2048p_converted.mp4");
                        $db->where('id', $insert);
                        $db->update(T_VIDEOS, array(
                            '2048p' => 1
                        ));
                        // demo Video
                        if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) {
                            $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_2048p_demo.mp4";
                            $shell     = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=2048:-2 -crf 26 ".$full_dir . $demo_video." 2>&1");
                            $upload_s3 = PT_UploadToS3($demo_video);
                            $db->where('id', $insert);
                            $db->update(T_VIDEOS, array(
                                'demo' => $demo_video
                            ));
                        }
                        // demo Video
                    }
                    if ($video_res >= 1920 || $video_res == 0) {
                        //$shell     = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=1920:-2 -crf 26 $video_output_full_path_1080 2>&1");
    
                    $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_1080.' 2>&1';
    				$shell     = shell_exec($ffmpegCommand);
    
    
                        $upload_s3 = PT_UploadToS3($filepath . "_1080p_converted.mp4");
                        $db->where('id', $insert);
                        $db->update(T_VIDEOS, array(
                            '1080p' => 1
                        ));
                        // demo Video
                        if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) {
                            $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_1080p_demo.mp4";
                            $shell     = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=1920:-2 -crf 26 ".$full_dir . $demo_video." 2>&1");
                            $upload_s3 = PT_UploadToS3($demo_video);
                            $db->where('id', $insert);
                            $db->update(T_VIDEOS, array(
                                'demo' => $demo_video
                            ));
                        }
                        // demo Video
                    }
                    if ($video_res >= 1280 || $video_res == 0) {
    
                       //$shell     = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=1280:-2 -crf 26 $video_output_full_path_720 2>&1");
    
                    $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_720.' 2>&1';
    				$shell     = shell_exec($ffmpegCommand);
    
                        $upload_s3 = PT_UploadToS3($filepath . "_720p_converted.mp4");
                        $db->where('id', $insert);
                        $db->update(T_VIDEOS, array(
                            '720p' => 1
                        ));
                        // demo Video
                        if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) {
                            $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_720p_demo.mp4";
                            $shell     = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=1280:-2 -crf 26 ".$full_dir . $demo_video." 2>&1");
                            $upload_s3 = PT_UploadToS3($demo_video);
                            $db->where('id', $insert);
                            $db->update(T_VIDEOS, array(
                                'demo' => $demo_video
                            ));
                        }
                        // demo Video
                    }
                    if ($video_res >= 854 || $video_res == 0) {
                        //$shell     = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=854:-2 -crf 26 $video_output_full_path_480 2>&1");
    
                        $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_480.' 2>&1';
    					$shell     = shell_exec($ffmpegCommand);
    
    
    
                        $upload_s3 = PT_UploadToS3($filepath . "_480p_converted.mp4");
                        $db->where('id', $insert);
                        $db->update(T_VIDEOS, array(
                            '480p' => 1
                        ));
                        // demo Video
                        if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) {
                            $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_480p_demo.mp4";
                            $shell     = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=854:-2 -crf 26 ".$full_dir . $demo_video." 2>&1");
                            $upload_s3 = PT_UploadToS3($demo_video);
                            $db->where('id', $insert);
                            $db->update(T_VIDEOS, array(
                                'demo' => $demo_video
                            ));
                        }
                        // demo Video
                    }
                    if ($video_res >= 640 || $video_res == 0) {
                       // $shell                      = shell_exec("$ffmpeg_b -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=640:-2 -crf 26 $video_output_full_path_360 2>&1");
    
                    $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_360.' 2>&1';
    				$shell     = shell_exec($ffmpegCommand);
    
    
    
                       $upload_s3                  = PT_UploadToS3($filepath . "_360p_converted.mp4");
                        $db->where('id', $insert);
                        $db->update(T_VIDEOS, array(
                            '360p' => 1,
                        ));
                        // demo Video
                        if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) {
                            $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_360p_demo.mp4";
                            $shell     = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=640:-2 -crf 26 ".$full_dir . $demo_video." 2>&1");
                            $upload_s3 = PT_UploadToS3($demo_video);
                            $db->where('id', $insert);
                            $db->update(T_VIDEOS, array(
                                'demo' => $demo_video
                            ));
                        }
                        // demo Video
                    }
    
                    // demo Video
                    if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) {
                        $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_240p_demo.mp4";
                        $shell     = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=426:-2 -crf 26 ".$full_dir . $demo_video." 2>&1");
                        $upload_s3 = PT_UploadToS3($demo_video);
                        $db->where('id', $insert);
                        $db->update(T_VIDEOS, array(
                            'demo' => $demo_video
                        ));
                    }
                    // demo Video
    
    
                    if (file_exists($_POST['video-location'])) {
                        unlink($_POST['video-location']);
                    }
    
    
                    pt_push_channel_notifiations($video_id);
                    $_SESSION['uploads'] = array();
                }
                else{
                    $db->insert(T_QUEUE, array('video_id' => $insert,
                                       'video_res' => $video_res,
                                       'processing' => 0));
                    $db->where('id', $insert);
                    $db->update(T_VIDEOS, array(
                        'video_location' => $_POST['video-location']
                    ));
                }
                exit();
            }
        } else {
            $data = array(
                'status' => 400,
                'message' => $error_icon . $error
            );
        }
    }
    

    Any guidance with this is appreciated

  7. I’m using this video web script where videos can be purchased to view.
    Upon testing the purchasing process I see: “‘Something went wrong. Please try again later!!’,”

    Any help or guidance on what to check or look at, or if you need me to provide more code to view, to resolve this issue in order to proceed with purchase test, will be appreciated:

    function PT_MultipleBuyVideo() {
        var checked = getSelectedVideos();
        if (!checked) { return false; }
    
        swal({
            title: "",
            type: "info",
            html:"Simply proceed to purchase " + countSelectedVideos() + " videos(s) at a total cost of " + countTotalCredits() +" credits",
            showCancelButton: true,
            cancelButtonText: "Close",
            customClass: 'sweetalert-lg',
            confirmButtonText:'Proceed'
        }).then(function(){
    
            $.ajax({
                url: PT_Ajax_Requests_File() + 'aj/buy-video',
                type: 'POST',
                dataType: 'json',
                data: {id:checked},
            }).done(function(data){
                if (data.status == 200) {
                    for (var i = 0; i < checked.length; i++) {
                        var button = $("button[data-action='multiple_select_button'][data-id='" + checked[i] + "']")
                        buttonMultipleSelectingStyle(button, 'purchased');
                    }
    
                    swal({
                        title: "Success",
                        type: "success",
                        html:"",
                        showCancelButton: true,
                        cancelButtonText: "Close",
                        customClass: 'sweetalert-lg',
                        confirmButtonText:'Go To Video(s)'
                    }).then(function(){
                        window.location.href='/paid-list';
                    });
    
                } else {
                    if (data.error_num == 1) {
                        return swal(
                            'Error!',
                            'Not enough money',
                            'error'
                        );
                      }
               }
            }).fail(function() {
                 swal(
                    'Error!',
                    'Something went wrong. Please try again later!!',
                    'error'
                );
            })
        });
    }
    
    function buttonMultipleBuy(command) {
        var button = $("button[data-action='multuple-buy-video']");
        if (command == 'hide') {
            button.hide();
        } else if (command == 'show') {
            button.show();
        }
    }
    

    any help with resolving the error, to move to "Success" message, is appreciated 

  8. Thanks for your reply.

    Yes, it should disable the Start Recording button (for 5 minutes) upon the upload completing.

    Any additional guidance with 'setting the cookie' and 'calling the function' and 'checking the cookie before letting the user click' would be appreciated.

  9. I'm trying to create a cookie where the visitor who uploads a webcam recording, from the webcam recording web page, can't record and upload until X amount of time has passed.

    I've searched around and have gotten this far:

    						document.cookie = "name=Recording_Time_Delay; expires=5 minutes; path=/";
    
    						 function create_cookie(Recording_Time_Delay, Start Disabled) {
    						 var date = new Date();
    						 date.setTime(date.getTime() + (minutes * 60 * 1000));
    						 var expires = date.toUTCString();
    						 document.cookie = name + '=' + value + ';' +
    						  'expires=' + expires + ';' ;
    						 }

    It will be added to the script shown here:

    Ultimately, I'd like someone not to be able to record/upload until 5 minutes has elapsed from the last upload.
    Currently, when a recording is uploaded the User is redirected to another page. 
    If they come right back from that redirect and record/upload again, I'd like that ability to be unavailable/delayed. 

    I would image the time out should start upon the initial recording being uploaded, where a 5 minute delay starts, and disables the Start Recording function (or button)?

    Does that sound right?

    And what am I missing in my cookie code attempt?

    Also, how do I tie in the disable Start Recording function/Button?

    Any guidance will be appreciated.

     

     

     

     

  10. The original web script that I'm using calculates daily earnings from video purchase transactions. I have added my own videos purchase transactions code into this web script successfully, and I'm trying to integrate my successfully working code part in with the original web script's page - that displays the daily earnings. Here is (part) of the original web script's code:

        $day_start = strtotime(date('M')." ".date('d').", ".date('Y')." 12:00am");
        $day_end = strtotime(date('M')." ".date('d').", ".date('Y')." 11:59pm");
        $this_day_ads_earn = $db->rawQuery("SELECT SUM(amount) AS sum FROM ".T_ADS_TRANS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end."  AND type = 'video' AND video_owner = ".$pt->user->id);
        $this_day_video_earn = $db->rawQuery("SELECT * FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id = ".$pt->user->id);
        $day_net = 0;
        foreach ($this_day_video_earn as $tr) {
            if ($tr->currency == "USD") {
                $day_net = $day_net + ($tr->amount - $tr->admin_com);
            }
            else if($tr->currency == "EUR"){
                $day_net = $day_net + ($tr->amount - $tr->admin_com);
            }
        }
        $today_earn = $this_day_ads_earn[0]->sum + $day_net ;

    The table they are using is T_VIDEOS_TRSNS, my modification stores video transactions in the table T_U_PAID_VIDEOS, and the earnings amount is stored in the 'earned_amount' column.

    I'd like to substitute my code in, so the purchase transaction from my mod shows on the original web script's already set up page. I look forward to, and appreciate, any suggestions, or requests for more info/code.

  11. Thanks for your reply.

    That worked successfully when I added it between style tags on the html page that launches the pop-up. Thanks.

    You said "button is `background-color: rgb(48, 133, 214)`, which is added as an inline style", just for my own education, where would I find that inline line of code. I see it when I 'inspect' the element. How can I find it?

  12. This js has a (Proceed) button, I'd like to change it's color, but I don't know where the current color is.

    It is in a pop-up box, and I don't see the styling on any page code, where it pops up from.

    When I right-click and select inspect I see this:

    <button type="button" class="swal2-confirm swal2-styled" aria-label="" style="background-color: rgb(48, 133, 214); border-left-color: rgb(48, 133, 214); border-right-color: rgb(48, 133, 214);">Proceed</button>

    How can I find that?

    Essentially, how can I style the "Proceed" button here:

    function PT_BuyVideo(video_id) {
        if (!video_id) {
            return false;
        }
    
        swal({
            title: "",
            type: "info",
            html:"Simply proceed to purchase",
            showCancelButton: true,
            cancelButtonText: "Close",
            customClass: 'sweetalert-lg',
            confirmButtonText:'Proceed'
        }).then(function(){

    any help is appreciated

     

  13. Thanks again for your reply.

    Yes, I've been reading. I've been given a lot of advice and tried many things without success (including what was provided here and elsewhere).
    But, some of the explanation I don't understand, like this sentence "use the new wallet and balance amounts in that existing single query, per the comment i added at that point, rather than to start adding more queries before the start of where the transaction/rollback logic starts". 

    Earlier in this thread I was told "Try reading your own code. Go through it line by line and check the value of each variable after each line executes". Based on that, as far as I can see, this should work, but shows 'not enough money:

     

    } else {
    
    //     4    +    4      >=    6
    if ($wallet + $balance >= $amount) {
    
    //   8  =               4    +    4
    $balance = (string)($balance + $wallet);
    
    //   2   =              8    -    6
    $balance = (string)($balance - $amount);
    $wallet= '0';
    
    $db->where('id', $user_id);
    $update_user_balance = $db->update(T_USERS, [
    'balance' => $balance
    ]);
    
    }
    }

     

    any additional guidance is appreciated

     

     

  14. Thanks for your reply. 

    This seems to work successfully, where a purchase uses the amount in ‘wallet’ first, and then uses the amount in ‘balance’ if there is not enough in ‘wallet’:

    however, if all videos cost 2 (or higher), and there is “1” left in the ‘wallet’, it will never get used. I am looking to see how I can make more like if ‘wallet’ is zero then deduct from ‘earnings’ (or wallet + balance = amount)…

    I have tried this revision without success:

    		// Check if user has enough wallet amount to purchase video
    		if($wallet >= $amount){
    
    			$wallet = (string)($wallet - $amount);
    			$db->where('id', $user_id);
    			$update_wallet = $db->update(T_USERS, [
    				'wallet' => $wallet
    			]);
    
    			} else {
    
    			if($wallet < $amount && $wallet + $balance >= $amount){
    
    			$wallet = (string)($wallet - $amount) + $balance = (string)($balance - $amount);
    
    							$db->where('id', $user_id);
    							$update_user_balance = $db->update(T_USERS, [
    								'balance' => $balance
    								]);
    							$db->where('id', $user_id);
    							$update_wallet = $db->update(T_USERS, [
    							'wallet' => $wallet
    							]);
    						}
    			}

    I’m trying to say this;
    if what’s in the ‘wallet’ is less than the amount AND $balance has more than or equal to the amount:

    if($wallet < $amount && $wallet + $balance >= $amount){

     

    then proceed to deduct whatever is left in 'wallet' to satisfy the amount + the rest of the amount from $balance:

    $wallet = (string)($wallet - $amount) + $balance = (string)($balance - $amount);

     

    but, apparently I need to say this better in code:
    “then proceed to deduct whatever is left in 'wallet' to satisfy the amount + the rest of the amount from $balance”

    any additional help is greatly appreciated.

     

  15. Thanks for your reply. Much appreciated.

    I have tried your suggestion without success.

    I see a pop-up dialog box  that displays: "Something went wrong. Please try again later!!" (from the script.js file):

     

    function PT_MultipleBuyVideo() {
        var checked = getSelectedVideos();
        if (!checked) { return false; }
    
        swal({
            title: "",
            type: "info",
            html:"Simply proceed to purchase " + countSelectedVideos() + " video(s) at a total cost of " + countTotalCredits() +" credits",
            showCancelButton: true,
            cancelButtonText: "Close",
            customClass: 'sweetalert-lg',
            confirmButtonText:'Proceed'
        }).then(function(){
    
            $.ajax({
                url: PT_Ajax_Requests_File() + 'aj/buy-video',
                type: 'POST',
                dataType: 'json',
                data: {id:checked},
            }).done(function(data){
                if (data.status == 200) {
                    for (var i = 0; i < checked.length; i++) {
                        var button = $("button[data-action='multiple_select_button'][data-id='" + checked[i] + "']")
                        buttonMultipleSelectingStyle(button, 'purchased');
                    }
    
                    swal({
                        title: "Success",
                        type: "success",
                        html:"",
                        showCancelButton: true,
                        cancelButtonText: "Close",
                        customClass: 'sweetalert-lg',
                        confirmButtonText:'Go To Video(s)'
                    }).then(function(){
                        window.location.href='/paid-list';
                    });
    
                } else {
                    if (data.error_num == 1) {
                        swal(
                            'Error!',
                            'Not enough money(test)',
                            'error'
                        );
                    } else {
                        swal(
                            'Error!',
                            'Something went wrong. Please try again later!',
                            'error'
                        );
                    }
                }
            }).fail(function() {
                swal(
                    'Error!',
                    'Something went wrong. Please try again later!!',
                    'error'
                );
            })
        });
    }

    The only thing that shows 'not enough money' from 'wallet' or "success' (when there is enough) is this:

    		if($wallet + $balance >= $amount) {
    		$wallet = (string)($wallet - $amount);
    		 //}elseif    $wallet = 0; {
    		$balance = ($balance - $amount);
    
    		$db->startTransaction();

    Any other ideas will be appreciated

     

     

  16. So, I just tried this without success:
     

    Code:
    	if ($wallet >= $amount) {
    		$wallet = (string)($wallet - $amount);
    		} elseif ($wallet + $balance >= $amount) {
    		$balance = (string)($balance - $amount);
    		$db->startTransaction();
    
    etc....

    By ‘without success’, I mean that the same message appears as if just the ‘wallet’ doesn’t have enough “Not Enough Money” - when I test - by having 3 in ‘wallet’ and 3 in earnings (equals a total of 6) but try to purchase something that costs 5.

    Any suggestion, guess or guidance will be appreciated.

  17.  

    In my account 'wallet' I have 3, and in 'balance' I have 3, which equals a total of 6. I tried to purchase a total of 5, with this code added: 

    if($wallet >= $amout) {
       // take money first from wallet
    } elseif ($wallet + $balance >= $amout) {
       // take money first from wallet and/or balance
    } else {
    		echo json_encode([
    			'status' => 400,
    			'error_num' => 1,
    			'error' => 'Not enough money'
    		]);
    
    } else {

    I saw 
    "Something went wrong. Please try again later!!"

     

    any additional help is appreciated

  18. Thanks for your reply.

    I appreciate your time you've taken to explain. It all makes sense.
    It is  a lot for me to implement, although I'm working on it.

    However, the first step for me, I believe, would be to get help with adding in these things you've commented, please, before I start improving my tables.:
    // it is here that you would include the balance amount
    // you would calculate new wallet and balance amounts
    // you would include the new 'balance' too

    any guidance, examples of what's needed there, will be greatly helpful.

  19. Thank you for your helpful reply. Much appreciated.

    I've replaced my original file with your commented code. Much thanks for helping clarify what is going on there, and for the small changes that you made to the (now improved) code.

    I am still looking for a solution where the script first checks the “wallet” amount, and if empty will then check the “balance” amount, and use a required amount from the balance, and if both are empty, then the “not enough money” appears. This was suggested, but I failed at integrating it into the code:

    if($wallet->balance() + $balance->balance() >= $amount) {
        $walletAmount = min($amount, $wallet->balance();
        $balanceAmount = ($walletAmount < $amount) ? $amount - $walletAmount : 0;
        // could then create deduct() methods to extract funds
        $wallet->deduct($walletAmount);
        $balance->deduct($balanceAmount);
    }
    else {
        // handle not enough money here
    }

    any guidance with that would be very helpful.

    In regard to an 'account' table, thanks for that great advice. The script currently does have u_paid_videos table, as you can see at: // add data to paid table. Would expanding this table to include more be satisfactory? I've attached a picture of it's structure (all though time_date just shows NULL ).

    Any additional comments/direction/advice is welcomed.

    u_paid.png

  20. I am using a php web video script which allows Users to purchase videos successfully. The purchases are made from the amount available in the Users’ “wallet” (the User can also earn compensation, which gets added to his “balance”.). When there’s not enough available in the “wallet” for the purchase, the script checks and displays a message “not enough money”. I’d like help adding the ability where the script first checks the “wallet” amount, and if empty will then check the “balance” amount, and use a required amount from the balance, and if both are empty, then the “not enough money” appears. Here’s the portion of the code that I believe needs the modification:

    // get cost video
        $db->where('name', 'video_play_price');
        $db_cost = $db->getOne('config');
        $video_cost = (float)$db_cost->value;
    
        $count_video = count($id_array);
        $user_id = $user->id;
        $wallet = (float)str_replace(',', '', $user->wallet);
    
    
    	$amout = 0;
    	foreach ($id_array as $id) {
                $video_id = (int)PT_Secure($id);
    
                // get video data
                $video = $db->where('id', $id)->getOne(T_VIDEOS);
    			$amout += $video->video_play_price?$video->video_play_price:$video_cost;
    	}
    
    //   $amout = $video_cost * $count_video;
    
        $charge = ( $video_cost *0.50 );
    
    
    
        if ($wallet >= $amout) {
    
            //$new_wallet = (string)($wallet - $amout);
            $wallet = (string)($wallet - $amout);
    
            $db->startTransaction();
    
            $inserted_records = 0;
            foreach ($id_array as $id) {
                $video_id = (int)PT_Secure($id);
    
    
    		// $uploader_amount = $video_cost - $charge; //100 - 20% = 80
    
                // get video data
                $video = $db->where('id', $id)->getOne(T_VIDEOS);
    
    
    
    			$video_cost_new = $video->video_play_price?$video->video_play_price:$video_cost;
    
    			$uploader_amount = ( $video_cost_new *0.50 );
                // add data to paid table
                $insert_buy = $db->insert('u_paid_videos', [
                    'id_user' => $user_id,
                    'id_video' => $video_id,
                    'session_key' => $_SESSION['session_key'],
                    'video_play_price' => (string)$video_cost,
                    'video_title' => $video->title,
                    'user_id_uploaded' => $video->user_id,
                ]);
    
                if ($insert_buy) { $inserted_records++; }
                //add wallet users' video
            $userwallet = $db->where('id', $video->user_id)->getOne(T_USERS);
    
    
            //$videouserwallet = $userwallet->balance+$video_cost;
            $videouserwallet = $userwallet->balance+$uploader_amount;
            $db->where('id', $video->user_id);
            $update_balance = $db->update(T_USERS, [
              // 'wallet' => $videouserwallet,
                'balance' => number_format($videouserwallet, 1, '.', ''),
            ]);
            }
    
    
            $db->where('id', $user_id);
            //$update_wallet = $db->update(T_USERS, [
            $update_wallet = $db->update(T_USERS, [
                'wallet' => $wallet,
            ]);
    
    
            if (($inserted_records == $count_video) && $update_wallet) {
                $db->commit();
    
                echo json_encode([
                    'status' => 200
                ]);
                exit();
            } else {
                $db->rollback();
    
                echo json_encode([
                    'status' => 400,
                    'error' => 'Buy process error'
                ]);
                exit();
            }
    
        } else {
    
            echo json_encode([
                'status' => 400,
                'error_num' => 1,
                'error' => 'Not enough money'
            ]);
            exit();
    
        }
    
    } else {
    
        echo json_encode([
            'status' => 400,
            'error' => 'Bad Request, Invalid or missing parameter'
        ]);
        exit();

     

  21. I'm using an upload script (I did not write it) that works successfully.

     

    I'm trying to add the function where you 'must check box to agree to terms' prior to uploading a file.

     

    I've added lines 67 thru 75, and lines 88 thru 92, but it is missing something, because, whether the box is checked or not, a file can still be uploaded.

     

    Any guidance will be appreciated.

    <?php
    session_start();
    require_once 'phps3integration_lib.php';
    $message = "";
    if (@$_POST['submit'] != "") {
    $allowed_ext = array("gif", "jpeg", "jpg", "png", "pdf", "doc", "docs", "zip", "mov", "MOV", "flv", "mp4", "3gp", "3GP");
    $extension = end(explode(".", $_FILES["file"]["name"]));
    if (($_FILES["file"]["size"] < 10485760000) && in_array($extension, $allowed_ext)) {
    if ($_FILES["file"]["error"] > 0) {
    //$message.="There is some error in upload, see: " . $_FILES["file"]["error"] . "<br>";//Enable this to see actual error
    $message.="There is some error in upload. Please try after some time.";
    } else {
    $uploaddir = '../Upload/';
    $uploadfile = $uploaddir . basename($_FILES['file']['name']);
    $uploaded_file = false;
    if(move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile))
    {
    $uploaded_file = $_FILES['file']['name'];
    }
    if ($uploaded_file != FALSE) {
    $user_name = @$_POST['user_name'] != "" ? @$_POST['user_name'] : "Anonymous";
    $form_data = array(
    'file' => $uploaded_file,
    'user_name' => $user_name,
    'type' => 'file'
    );
    mysql_query("INSERT INTO `phps3files` (`id`, `file`, `user_name`, `type`) VALUES (NULL, '" . $uploaded_file . "', '" . $user_name . "', 'file')") or die(mysql_error());
    $message.= "File Successfully Uploaded";
    } else {
    $message.="There is some error in upload. Please try after some time.";
    }
    }
    } else {
    $message.= "Invalid file, Please upload a gif/jpeg/jpg/png/pdf/doc/docs/zip/mov/flv/mp4/3gp file of maximum size 25 MB.";
    }
    }
    ?>
    
    <?php
    require_once 'header.php';
    ?>
    <head>
    
    <script>
    var ids = ['input', 'message', 'button'];
    var obj = {};
    
    ids.forEach(function (v) {
        obj[v] = document.getElementById(v);
    });
    
    obj.input.style.display = 'none';
    obj.button.style.display = 'block';
    
    obj.input.addEventListener('change', function () {
        obj.message.innerText = this.value;
        obj.message.style.display = 'block';
    });
    
    obj.button.addEventListener('click', function (e) {
        e.preventDefault();
    
        obj.input.click();
    });
    </script>
    
    <script type="text/javascript">
    function validate()
    {
    if(false == document.getElementById("agree").checked)
    {
    alert("If you agree with the terms, check the Agree check box");
    }
    }
    </script>
    
    </head>
    <html>
    <fieldset>
    <form action="" method="post" enctype="multipart/form-data">
    
    <div class="control-group">
    <label for="file" class="control-label"><font size="6" color="#454545"><b>Choose a file to upload:</b></font></label><br /><br />
    <input id="input" name="file" type="file" /></input>
    <button id="button"><font size="3" color="#454545">Click To<br /> Select File</font></button>
    <div id="message"><font size="3" color="#454545">No File Chosen</font></div>
    </div>
    <div>
    <input type="checkbox" name="agree" id="agree" value="agree" /> <label for='agree'>
    <a href="../Terms1.php" target="_blank"><span style="color: #454545; font-size: 10px">By uploading a file here, you agree to these <u>Upload Terms/Agreement</u></a></span>
    </label>
    </div>
    <div class="control-group">
    <div class='controls'>
    <label class="myLabel1">
    <input type="submit" name="submit" value="Submit" class="btn" style="opacity: 0">
    </label><
    </div>
    </form>
    </fieldset>
    
    <script>
    var ids = ['input', 'message', 'button'];
    var obj = {};
    
    ids.forEach(function (v) {
        obj[v] = document.getElementById(v);
    });
    
    obj.input.style.display = 'none';
    obj.button.style.display = 'inline-block';
    
    obj.input.addEventListener('change', function () {
        var filename = this.value.replace(/^.*[\\\/]/, '');
    		obj.message.innerHTML  = filename;
        obj.message.style.display = 'inline-block';
    });
    
    obj.button.addEventListener('click', function (e) {
        e.preventDefault();
    
        obj.input.click();
    });
    
    </script>
    <?php
    if ($message != "" || @$_SESSION['message'] != "") {
        ?>
        <div class="alert alert-success">
        <?php echo $message; ?>
        <?php
        echo @$_SESSION['message'];
        @$_SESSION['message'] = '';
        ?>
        </div>
        <?php
    }
    ?>
    <div>
    </div>
    
    <?php require_once 'footer.php'; ?>
    
    
    
×
×
  • 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.