Jump to content

Chrisj

Members
  • Posts

    551
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Chrisj

  1. Much thanks again for your reply.

    Upon completion of a live transaction, I see this in 'Webserver SSL transfer log':

     - - [04/May/2023:17:25:53 -0400] "GET /aj/wallet/get_paid?status=success&amount=1.00&token=6H326569M0899450A&PayerID=ZVLJWCX8ST4TS HTTP/2.0" 302 - "https://www.paypal.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"

    Does this provide any clues?

    I look forward to any additional guidance...

  2. Hi, thanks for your reply.

    I don't see any related transaction in video_transactions table.

    I don't see anything clearly in server logs.

    However, in the paypal.com API Event logs I see, under API Calls, from an attempt today: http status 201, and under debug ID I see Request, and I see Response.

    Request shows:

    {
      "application_context": {
        "cancel_url": "https://websitename.com/aj/wallet/get_paid?status=false",
        "return_url": "https://websitename.com/aj/wallet/get_paid?status=success&amount=2",
        "shipping_preference": "NO_SHIPPING"
      },
      "intent": "CAPTURE",
      "purchase_units": [
        {
          "amount": {
            "breakdown": {
              "item_total": {
                "currency_code": "USD",
                "value": "2"
              }
            },
            "currency_code": "USD",
            "value": "2"
          },
          "items": [
            {
              "description": "Pay For item",
              "name": "Wallet Replenishment",
              "quantity": "1",
              "unit_amount": {
                "currency_code": "USD",
                "value": "2"
              }
            }
          ]
        }
      ]
    }

    And Response shows:

    {
      "id": "8CV39571RF9321610",
      "links": [
        {
          "href": "https://api.paypal.com/v2/checkout/orders/8CV39571RF9321610",
          "method": "GET",
          "rel": "self"
        },
        {
          "href": "https://www.paypal.com/checkoutnow?token=8CV39571RF9321610",
          "method": "GET",
          "rel": "approve"
        },
        {
          "href": "https://api.paypal.com/v2/checkout/orders/8CV39571RF9321610",
          "method": "PATCH",
          "rel": "update"
        },
        {
          "href": "https://api.paypal.com/v2/checkout/orders/8CV39571RF9321610/capture",
          "method": "POST",
          "rel": "capture"
        }
      ],
      "status": "CREATED"
    }

    Does this provide any clues?

    I look forward to any additional guidance...

     

     

     

     

  3. Many thanks for your reply.

    I've looked many places I do not see any notification of a transaction.

    Paypal merchant support said they believe the "integration that caused the payment capture call not to be invoked after the customer approved the payment".

    Here is the paypal_cofig.php file, maybe this could provide a clue?

    $url = "https://api-m.sandbox.paypal.com";
    if ($pt->config->paypal_mode == 'live') {
        $url = "https://api-m.paypal.com";
    }
    
    $pt->paypal_access_token = null;
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $url . '/v1/oauth2/token');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
    curl_setopt($ch, CURLOPT_USERPWD, $pt->config->paypal_id . ':' . $pt->config->paypal_secret);
    
    $headers = array();
    $headers[] = 'Content-Type: application/x-www-form-urlencoded';
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    $result = curl_exec($ch);
    curl_close($ch);
    $result = json_decode($result);
    if (!empty($result->access_token)) {
      $pt->paypal_access_token = $result->access_token;
    }

    I look forward to any guidance

  4. I am using a web video script that has Paypal integrated. Upon attempting a live transaction to test, the process proceeds to Paypal, shows the transaction amount and returns to the web site successfully, 
    however, no amount is added to the website and no amount is deducted from the paypal user account. I see no errors at paypal or on the website.
    After communicating with Paypal Merchant Support they said: "You do need to work with your developer and request them to find out why the capture request would not be invoked after the order is created and approved and fix it accordingly".
    However, the developer is unavailable, so I am attempting to find/fix the issue.
    Can you tell me if you see anything that might cause an issue with the code below? Or any clues I might look into?
    I look forward to any suggestions.

     

    <?php
    if (IS_LOGGED == false && $first != 'success_fortumo' && $first != 'success_aamarpay' && $first != 'cashfree_paid' && $first != 'iyzipay_paid' && $first != 'success_yoomoney') {
        $data = array(
            'status' => 400,
            'error' => 'Not logged in'
        );
        echo json_encode($data);
        exit();
    }
    
    require 'assets/includes/paypal_config.php';
    
    $payment_currency = $pt->config->payment_currency;
    $paypal_currency = $pt->config->paypal_currency;
    
    if ($first == 'replenish') {
    	$data    = array('status' => 400);
    	$request = (!empty($_POST['amount']) && is_numeric($_POST['amount']));
    	if ($request === true) {
    		$price = PT_Secure($_POST['amount']);
    
    		$ch = curl_init();
    
    	    curl_setopt($ch, CURLOPT_URL, $url . '/v2/checkout/orders');
    	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    	    curl_setopt($ch, CURLOPT_POST, 1);
    	    curl_setopt($ch, CURLOPT_POSTFIELDS, '{
    	      "intent": "CAPTURE",
    	      "purchase_units": [
    	            {
    	                "items": [
    	                    {
    	                        "name": "Wallet Replenishment",
    	                        "description":  "Pay For ' . $pt->config->name.'",
    	                        "quantity": "1",
    	                        "unit_amount": {
    	                            "currency_code": "'.$pt->config->paypal_currency.'",
    	                            "value": "'.$price.'"
    	                        }
    	                    }
    	                ],
    	                "amount": {
    	                    "currency_code": "'.$pt->config->paypal_currency.'",
    	                    "value": "'.$price.'",
    	                    "breakdown": {
    	                        "item_total": {
    	                            "currency_code": "'.$pt->config->paypal_currency.'",
    	                            "value": "'.$price.'"
    	                        }
    	                    }
    	                }
    	            }
    	        ],
    	        "application_context":{
    	            "shipping_preference":"NO_SHIPPING",
    	            "return_url": "'.PT_Link("aj/wallet/get_paid?status=success&amount=").$price.'",
    	            "cancel_url": "'.PT_Link("aj/wallet/get_paid?status=false").'"
    	        }
    	    }');
    
    	    $headers = array();
    	    $headers[] = 'Content-Type: application/json';
    	    $headers[] = 'Authorization: Bearer '.$pt->paypal_access_token;
    	    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    	    $result = curl_exec($ch);
    	    if (curl_errno($ch)) {
    	        echo 'Error:' . curl_error($ch);
    	    }
    	    curl_close($ch);
    	    $result = json_decode($result);
    	    if (!empty($result) && !empty($result->links) && !empty($result->links[1]) && !empty($result->links[1]->href)) {
    	        $data = array(
    		        'status' => 200,
    		        'type' => 'SUCCESS',
    		        'url' => $result->links[1]->href
    		    );
    	    }
    	    elseif(!empty($result->message)){
    	        $data = array(
    	            'type' => 'ERROR',
    	            'details' => $result->message
    	        );
    	    }
    	    echo json_encode($data);
    	    exit();
    	}
    }
    
    if ($first == 'get_paid') {
    	$data['status'] = 500;
    	if (!empty($_GET['amount']) && is_numeric($_GET['amount']) && !empty($_GET['token'])) {
    
    		$amount = (int)PT_Secure($_GET['amount']);
    		$token = PT_Secure($_GET['token']);
    
    		include_once('assets/includes/paypal.php');
    
    		$ch = curl_init();
    
    		curl_setopt($ch, CURLOPT_URL, $url . '/v2/checkout/orders/'.$token.'/capture');
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    		curl_setopt($ch, CURLOPT_POST, 1);
    
    		$headers = array();
    		$headers[] = 'Content-Type: application/json';
    		$headers[] = 'Authorization: Bearer '.$pt->paypal_access_token;
    		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    		$result = curl_exec($ch);
    		if (curl_errno($ch)) {
    		    header("Location: " . PT_Link('wallet'));
    			exit();
    		}
    		curl_close($ch);
    		if (!empty($result)) {
    		    $result = json_decode($result);
    		    if (!empty($result->status) && $result->status == 'COMPLETED') {
    
    
    		    	$update  = array('wallet' => ($user->wallet_or += $amount));
    				$db->where('id',$user->id)->update(T_USERS,$update);
    				$payment_data         = array(
    		    		'user_id' => $user->id,
    		    		'paid_id'  => $user->id,
    		    		'admin_com'    => 0,
    		    		'currency'    => $pt->config->paypal_currency,
    		    		'time'  => time(),
    		    		'amount' => $amount,
    		    		'type' => 'ad'
    		    	);
    				$db->insert(T_VIDEOS_TRSNS,$payment_data);
    
    
    				$_SESSION['upgraded'] = true;
    				$url     = PT_Link('wallet');
    				if (!empty($_COOKIE['redirect_page'])) {
    		            $redirect_page = preg_replace('/on[^<>=]+=[^<>]*/m', '', $_COOKIE['redirect_page']);
    		            $url = preg_replace('/\((.*?)\)/m', '', $redirect_page);
    		        }
    
    		    	header("Location: $url");
    		    	exit();
    		    }
    		}
    	}
    	header("Location: " . PT_Link('wallet'));
    	exit();
    }
    
    
    ...

     

  5. Thanks for the replies.

    Sorry for my lack of info. The php ffmpeg_submit.php file is for it's accompanying html ffmpeg.html form-submitting file.

    Whatever I enter into the Error will display successfully on the html page upon the 'if' conditions being met.

    I'd prefer it not being an Error message, but it's the only thing that will display, as I test and try to determine how to display a message there, rather than an error.

    if (empty($error) && $_POST['set_p_v'] == 0 && $wallet >=1) {
    echo "Hello";
    $error = "Whatever I enter here gets displayed upon these if conditions being met";
    $db->rawQuery("UPDATE ".T_USERS." SET `wallet` = `wallet` - 0.50 WHERE $wallet = $user->wallet");
    }

    So, it would seem that the code is working successfully, because when the if conditions are met the error message is displayed successfully.

    So, my question is, how do I instead modify it so that, if conditions are met display the echo message, or is there another way to have the php display a message onto the html page?

    I look forward to your reply.

     

     

     

     

  6. Thanks for your suggestions, this is where I'm at now, upon selecting the Submit button it successfully displays the pop-up alert. But "yes submit" doesn't upload the file:

                  $('#submit-btn').on('click',function(e){
                        e.preventDefault();
                       var form = $('.pt_upld_page_frm');
                        swal.fire({
                            title: "Are you sure?",
                            type: "warning",
                            showCancelButton: true,
                            confirmButtonColor: "#DD6B55",
                            confirmButtonText: "Yes, submit it!",
                            closeOnConfirm: false
                            }).then((result) => {
                           if (result.isConfirmed) { $('.pt_upld_page_frm').submit(); }
    });
    });

    The code, farther down in the file, that successfully Submits I've copied and tried to add to the Alert, like so:

     $('#submit-btn').on('click',function(e){
    e.preventDefault();
       var form = $('.pt_upld_page_frm');
     swal.fire({
    title: "Are you sure?",
     type: "warning",
      showCancelButton: true,
    confirmButtonColor: "#DD6B55",
     confirmButtonText: "Yes, submit it!",
    closeOnConfirm: false
     }).then((result) => {
     if (result.isConfirmed) { 
       $('.upload-form').ajaxForm({
          url: '{{LINK aj/ffmpeg-submit}}?hash=' + $('.main_session').val(),
        beforeSend: function() {
           $('#submit-btn').attr('disabled', true);
           $('#submit-btn').val("{{LANG please_wait}}");
    },
     success: function(data) {
             if (data.status == 200) {
    window.location.href = '{{LINK home}}';
    }
    })
    });

    This successfully Submits the uploaded file, but doesn't display the Alert.
    My goal is to display the Alert anf have the "Yes, submit it" to actually Submit the chosen uploaded file.
    Any additional guidance is appreciated.

  7. Thanks again.

     

    Regarding "don't submit the form when they click the first button. Make that trigger the popup, then have the popup's button submit the form";

    so, are you saying I need to  integrate this:

    
             Swal.fire({
    	        title: '<strong>HTML <u>example</u></strong>',
    	        icon: 'info',
    	        html:
    	          'You can use <b>bold text</b>, ' +
    	          '<a href="//sweetalert2.github.io">links</a> ' +
    	          'and other HTML tags',
    	        showCloseButton: true,
    	        showCancelButton: true,
    	        focusConfirm: false,
    	        confirmButtonText: '<i class="fa fa-thumbs-up"></i> Great!',
    	        confirmButtonAriaLabel: 'Thumbs up, great!',
    	        cancelButtonText: '<i class="fa fa-thumbs-down"></i> Cancel',
    	        cancelButtonAriaLabel: 'Thumbs down'
    	      })

    into this?:

     

      $('#submit-btn').attr('disabled', true);

     

    And regarding this "block submitting the form based on whether the popup is visible: if not then cancel the submit and instead show the popup", do you mean something like this?:

     

     beforeSend: function() {
    
             Swal.fire({
    	        title: '<strong>HTML <u>example</u></strong>',
    	        icon: 'info',
    	        html:
    	          'You can use <b>bold text</b>, ' +
    	          '<a href="//sweetalert2.github.io">links</a> ' +
    	          'and other HTML tags',
    	        showCloseButton: true,
    	        showCancelButton: true,
    	        focusConfirm: false,
    	        confirmButtonText: '<i class="fa fa-thumbs-up"></i> Great!',
    	        confirmButtonAriaLabel: 'Thumbs up, great!',
    	        cancelButtonText: '<i class="fa fa-thumbs-down"></i> Cancel',
    	        cancelButtonAriaLabel: 'Thumbs down'
    	      })
    
              if ($Swal.fire.is(':visible')) {
    	        return true
    	      }
    
    	      $Swal.fire.show()
    	      return false
    	    }
    	  })
    
                  $('#submit-btn').attr('disabled', true);
            $('#submit-btn').val("{{LANG please_wait}}");
    },

    which, as you know, didn't work...

    I look forward to any additional assistance

     

     

     

  8. Thanks again for your kind reply.

    Not sure what is meant by 'first button', but this code was tried without success (which means I was unable to select a file to upload); so I commented out the lines that were added and I can now proceed again with uploading a file, but still no message displaying beyond a 1 second appearance.

     

       $('#upload-form form').ajaxForm({
      url: '{{LINK aj/ffmpeg-submit}}?hash=' + $('.main_session').val(),
      beforeSend: function() {
        $('#submit-btn').attr('disabled', true);
        $('#submit-btn').val("{{LANG please_wait}}");
    //const result = await swal.fire({
    Swal.fire({ title: '<strong>HTML <u>example</u></strong>', icon: 'info', html:
     'You can use <b>bold text</b>, ' +
     'and other HTML tags',
      showCloseButton: true,
      showCancelButton: true,
      focusConfirm: false,
          confirmButtonText: '<i class="fa fa-thumbs-up"></i> Great!',
      confirmButtonAriaLabel: 'Thumbs up, great!',
      cancelButtonText: '<i class="fa fa-thumbs-down"></i> Cancel',
      cancelButtonAriaLabel: 'Thumbs down'
     })
    //  if (result.isConfirmed)
     //});
     },

    any additional guidance is appreciated

  9. Thanks for all the previous help.

    I’m trying to add some JS to this successfully working submit Form:

     

      $('#upload-form form').ajaxForm({
    url: '{{LINK aj/ffmpeg-submit}}?hash=' + $('.main_session').val(),
    beforeSend: function() {
    $('#submit-btn').attr('disabled', true);
    $('#submit-btn').val("{{LANG please_wait}}");
    }, success: function(data) {
    if (data.status == 200) {
    window.location.href = data.link;
    }

     

    to get a message to display before the Form submits, I tested:

     

    etc.....
    
    beforeSend: function() {
    $('#submit-btn').attr('disabled', true);
    $('#submit-btn').val("{{LANG please_wait}}");
    
    
    Swal.fire({
    title: '<strong>HTML <u>example</u></strong>',
      icon: 'info',
    html:
    'You can use <b>bold text</b>, ' +
    '<a href="//sweetalert2.github.io">links</a> ' +
    'and other HTML tags',
     showCloseButton: true,
     showCancelButton: true,
    focusConfirm: false,
     confirmButtonText:
     '<i class="fa fa-thumbs-up"></i> Great!',
     confirmButtonAriaLabel: 'Thumbs up, great!',
     cancelButtonText:
     '<i class="fa fa-thumbs-down"></i>',
      cancelButtonAriaLabel: 'Thumbs down'
    })
     },
      

    (from SweetAlert).

    The alert displays successfully, but only for about 1 second.

    How can I delay or pause the beforeSend to give the Form submitter time to read the displayed message?

    I look forward to any assistance...

     

  10. This works successfully:

    $wallet = $user->wallet;
    $upwallet = ($sell_video == 0 && $wallet >= 1 ? 0.5 : 0);
    $db->rawQuery("UPDATE ".T_USERS." SET `wallet` = `wallet`- '".$upwallet."' WHERE `id` = '".$video->user_id."'");

    I'd like guidance with adding after that code:
    When the sell_video amount is 0 and the wallet amount = 0.5, change/update the sell_video to X.


    Any assistance is welcomed.

  11. Any ideas/suggestions as to why this may not be succeeding? 

    $up_user = $db->where('id', $video->user_id)->getOne(T_USERS);
    
    $uploader_wallet = $up_user->$user->wallet;
    
    $upwallet = ($sell_video == 0 && $uploader_wallet >= 1 ? .5 : 0);
    $db->rawQuery("UPDATE ".T_USERS." SET `wallet` = `wallet`-'".$upwallet."' WHERE `id` = '".$video->user_id."'");

    Success would be deducting .5 from the uploader's wallet account, when it has 1 or more, and when the sell price is zero.

    (The sell_price is located in the db video table and the wallet is located in the db users table.) 
    I have tried echoing, but saw no display.

    I look forward to any helpful suggestions/guidance

  12. Thanks for all the previous help. The web script that I’m modifying has a Search Form that successfully appears when a particular type of page displays:

     

    <?php if (preg_match('#/?sub__(\d)+\b#',$_SERVER['REQUEST_URI'],$matches)) {
    echo "<form action='#' method='POST' id='sub_id'>
    <input name='search_sub'>
    <input type='submit' value='search' />
    <input type='hidden' value='{$matches[1]}'> </form>";
    } ?>

    I wanted to enhance the Form’s appearance and tested this HTML Search Form (which slides the text-enter-field across the page upon selecting the magnify glass icon) seperately successfully:

    <div id="sb-search" class="sb-search " >
        <form>
            <input class="sb-search-input " onkeyup="buttonUp();" placeholder="Enter your search term..." onblur="monkey();" type="search" value="" name="search" id="search">
            <input class="sb-search-submit" type="submit"  value="">
            <span class="sb-icon-search"><i class="fa fa-search"></i></span>
        </form>
    </div>

    the HTML Search Form has this corresponding js:

    function buttonUp(){
             var valux = $('.sb-search-input').val();
                valux = $.trim(valux).length;
                if(valux !== 0){
                    $('.sb-search-submit').css('z-index','99');
                } else{
                    $('.sb-search-input').val('');
                    $('.sb-search-submit').css('z-index','-999');
                }
        }
    
        $(document).ready(function(){
            var submitIcon = $('.sb-icon-search');
            var submitInput = $('.sb-search-input');
            var searchBox = $('.sb-search');
            var isOpen = false;
    
            $(document).mouseup(function(){
                if(isOpen == true){
                submitInput.val('');
                $('.sb-search-submit').css('z-index','-999');
                submitIcon.click();
                }
            });
    
            submitIcon.mouseup(function(){
                return false;
            });
    
            searchBox.mouseup(function(){
                return false;
            });
    
            submitIcon.click(function(){
                if(isOpen == false){
                    searchBox.addClass('sb-search-open');
                    isOpen = true;
                } else {
                    searchBox.removeClass('sb-search-open');
                    isOpen = false;
                }
        });
    });

    I’ve combined the two Search form codes successfully like so:

     

    <?php
    if (preg_match('#/?sub__(\d)+\b#',$_SERVER['REQUEST_URI'],$matches)) {
    echo "<form action='#' method='POST' id='sub_id'>
    <input class='sb-search-input ' onkeyup='buttonUp();' placeholder='Enter your search term...' onblur='monkey();' type='search' value='' name='search_sub' id='search'>
    <!--<input name='search_sub'>-->
    <input class='sb-search-submit' type='submit' value=''>
    <span class='sb-icon-search'><i class='fa fa-search'></i></span>
    <!--<input type='submit' value='search' />-->
    <input type='hidden' value='{$matches[1]}'>
    </form>";
    }
    ?>

     

    however, now the search Form does not slide the text-enter-field across the page, it is just already 'open' when the page displays.

    I’m looking for help with getting the text-enter-field to slide across the page upon selecting the magnify glass icon again, instead of it being 'open' (when the page displays).

    If that makes sense I look forward to any assistance.

     

     

     

     

     

     

     

     

     

     

     

     

  13. Many thanks again.

    I have corrected the LIKE and retried without success.

    Regarding "the subcategory value in your search would be the same one that was selected to get you to that page",
    when the web script filters results to a category, the url, for example, looks like this:

    ....com/videos/category/1?page_id=1

    and from there when a subcategory is selected, for example, the url looks like this:

    ....com/videos/category/1/sub__536

    so, I tried this:

    AND sub_category LIKE '%$subid%'

     

    Otherwise, it would be great to have it so it's something like: AND sub_category LIKE "the name of the currently displayed page's subcategory"  or 
    AND sub_category LIKE "the currently displayed pages's subcategory id"

    I look forward to any additional clarification/guidance

  14. Thanks for all the previous help.
    The web video script that I'm modifying successfully filters videos into categories and subcategories. I've added this Search Form which appears on subcategory html results pages:

     

    <?php
    if (preg_match('#/?sub__(\d)+\b#',$_SERVER['REQUEST_URI'],$matches)) {
    echo "<form action='#' method='GET' id='subcategory'>
    <input id='search' name='keywords' type='text' placeholder='Search--SubCategory'> <input type='submit' value='Search' />
    <input type='hidden' id='subid' name='sub_category_id' value='{$matches[1]}'>
    </form>";
    }
    ?>

    I've also added the following code to the same html file in an attempt to get the Search Form to have the functionality of searching just within the currently displayed subcategory page(s) results, for title, description and tags(keywords), and display those results:

    <?php
    if (!empty($_POST['search_value'])) {
    $search_value = PT_Secure($_POST['subid']);
    $search_result = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE (title '%$search_value%' OR tags '%$search_value%' OR description '%$search_value%') AND sub_category = '%$search_value%' ");
    if (!empty($search_result)) {
    $html = '';
    foreach ($search_result as $key => $search) {
    $search = PT_GetVideoByID($search, 0, 0, 0);
    $html .= "
    <div class='search-result'><a href='$search->url'>$search->sub_category</a></div>";
    }
    $data = array('status' => 200, 'html' => $html);
    }
    }
    ?>

     

    but no success yet. The T_VIDEOS (videos table) looks like this (attached).

    I need help with a where clause to limit the video data selected to the requested sub category id and display it.

    [https://pasteboard.co/6lSH6CKAfFUV.png](https://)

    Or, maybe there's a way to have it so it's something like where sub_category = "the name of subcategory" ?

    Any guidance with this is appreciated

     

  15. Thanks for your reply.
    I'm trying to get help to determine if the php file outputs the subcategory.

    And then I'll be looking for guidance to ultimately have a search form appear on the page when it's  a subcategory page.

    I had tried echo-ing the Form onto the sub-category page by adding to the php file ( https://pastebin.com/zgbELKJf ) this:

    $injectForm = "";
    
     - - -etc.- - -
    
    $injectForm = "<form action=\"content.php\" method=\"GET\" id=\"sub-search\">
    <input id=\"search\" name=\"keywords\" type=\"text\" placeholder=\"Type here\">
    <input type=\"submit\" value=\"Search\" />
    </form>";

    and added this to the html page:

    <?php
    echo $injectForm;
    ?>

    but no success with displaying the Search Form onto a subcategory page

     

  16. The web video script that I'm trying to modify, successfully filters videos by category and by sub-category. The file code here shows sub-category related code: https://pastebin.com/zgbELKJf on lines 149 and 215 I am trying to display a search form when sub-category page appears, so I first need to determine if this code is the file that outputs the subcategory pages. (as a first step in being able to search the sub-category page by keyword).  If this provides a clue, when I remove these lines:

    $pt->show_sub = false;
    $pt->sub_categories_array = array();
    foreach ($pt->sub_categories as $cat_key => $subs) {
        $pt->sub_categories_array["'".$cat_key."'"] = '<option value="">'.$lang->all.'</option>';
        foreach ($subs as $sub_key => $sub_value) {
            $pt->sub_categories_array["'".$cat_key."'"] .= '<option value="'.array_keys($sub_value)[0].'" '.((!empty($_GET['sub_id']) && $_GET['sub_id'] == array_keys($sub_value)[0]) ? "selected" : "") .'>'.$sub_value[array_keys($sub_value)[0]].'</option>';
       }
    
        if (!empty($_GET['id']) && $_GET['id'] == $cat_key) {
            $pt->show_sub = true;
    if($pt->show_sub) {
    
    }
    }

    it eliminates the drop-down list to choose a subcategory, so there’s no way to display subcategory pages without that code.

    And on the html page file there is also this code:

    <?php if ($pt->page == 'category' && $pt->show_sub == true) { ?>
    <script type="text/javascript">
    $(document).on('change', '#category_id', function(event) {
    	event.preventDefault();
    	id = $(this).val();
    	$('#sub_category_id').html(sub_categories_array["'"+id+"'"]);
    });
    $(document).on('change','#sub_categories_', function(event) {
    	window.location.href = site_url+'/videos/category/<?php echo($_GET['id']) ?>/'+$('#sub_categories_').val();
    });
    </script>

     

    Any additional assistance is welcomed

     

  17. When I enter my log-in credentials and submit, in my site's web script, I see this:
    This page isn’t working...... is currently unable to handle this request.
    HTTP ERROR 500
    So, I look at dev tools > Console I see:

    crbug/1173575, non-JS module files deprecated.
    (index):7288

    and when I expand the 7288 I see:

    "No resource with given URL found"

    but if I refresh, I'm logged in.

    Any ideas on how to solve this error is appreciated.

  18. I'm using this code, but I only see a black screen when viewing via iPhone:

     

    <link href="https://vjs.zencdn.net/7.11.4/video-js.css" rel="stylesheet" />
    <script src="https://vjs.zencdn.net/7.11.4/video.min.js"></script>
    <video id="js-video" autoplay muted class="video-js vjs-default-skin" playsinline></video>
    <button id="display" onclick="display()">Display Camera</button>

    And when I select 'Display Camera' and agree to "access camera & mic" no camera view displays.

     let blobs = [];
            let stream, mediaRecorder, blob;
            let video = document.getElementById("video");
            var displaying = false;
            var recording = false;
            async function display() {
                stream = await navigator.mediaDevices.getUserMedia({
                    audio: true,
                    video: true,
                });
                video.srcObject = stream;
                displaying = true;
                playsinline = true;
            }

     

    Any help to show camera view and not black screen is appreciated

  19. This upload code is used for uploading a video file from html page, after recording via html5 screen <video></video>, however, ther file doesn't arrive in the uploads/ folder:

     

    <?php
    foreach (array('video', 'audio') as $type) {
        if (isset($_FILES["${type}-blob"])) {
    
            $fileName = $_POST["${type}-filename"];
            $uploadDirectory = 'uploads/' .rand(5,500).$fileName;
    
            if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $uploadDirectory)) {
                echo (" problem moving uploaded file");
            }
        }
    }

    when uploaded from iPhone. So, I don't know how to see errors on iPhone. Folder permission is 755. php.ini max file size is 2024M,

    any ideas/solutions are appreciated.

     

     

  20. Thanks for your reply. I don't know the answer. Maybe you can help me, I probably have the code incorrect.

    Here's the corresponding javascript that it's working with save1.php (the code I posted above):

    <video id="video" autoplay="true" controls muted playsInline></video>
    
    <script>
    function supportsRecording(mimeType) {
      if (!window.MediaRecorder) {
        return false;
      }
      if (!MediaRecorder.isTypeSupported) {
        return mimeType.startsWith("audio/mp4") || mimeType.startsWith("video/mp4");
      }
      return MediaRecorder.isTypeSupported(mimeType);
    }
    
    var video = document.querySelector("video");
    let params = { audio: true, video: { facingMode: { exact: "environment" } } };
    
    //if (navigator.mediaDevices.getUserMedia) {
     // navigator.mediaDevices.getUserMedia({ video: true })
       // .then(function (stream) {
       //   video.srcObject = stream;
       // })
       // .catch(function (err0r) {
      //    console.log("Something went wrong!");
      //  });
    //}
    
    let blobs = [];
    let stream, mediaRecorder, blob;
    
    async function startRecording() {
      stream = await navigator.mediaDevices.getUserMedia({
        audio: true,
        video: true,
      });
    
      mediaRecorder = new MediaRecorder(stream);
      mediaRecorder.ondataavailable = (event) => {
        // Let's append blobs for now, we could also upload them to the network.
        if (event.data) {
          blobs.push(event.data);
        }
      };
      mediaRecorder.onstop = doPreview;
      // Let's receive 1 second blobs
      mediaRecorder.start(1000);
    }
    
    function endRecording() {
      // Let's stop capture and recording
      mediaRecorder.stop();
      stream.getTracks().forEach((track) => track.stop());
    }
    
    function doPreview() {
      if (!blobs.length) {
        return;
      }
      // Let's concatenate blobs to preview the recorded content
      blob = new Blob(blobs, { type: mediaRecorder.mimeType });
      video.src = URL.createObjectURL(
        blob,
      );
    }
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
          function uploadFile() {
    	  // create FormData
    	  var fileType = 'video'; // or "audio"
    	  var fileName = 'ABCXYZ.webm';
    	  var formData = new FormData();
    	  var request = new XMLHttpRequest;
    
    	  formData.append(fileType + '-filename', fileName);
    	  formData.append(fileType + '-blob', blob);
    	  request.open("POST", "/save1.php");
    	  request.onreadystatechange = function() {
    	  if(request.readyState==4) {
    	  alert(request.responseText);
    	  }
    	  }
    	  request.send(formData);
    }
    </script>
    
    
    
    
    
    
    
    
    
    
    
    
    

     

     

     

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