Z
Z
ZaraMc2015-03-21 10:23:55
PHP
ZaraMc, 2015-03-21 10:23:55

To encode in base64 (using js), do I need to include php?

Hello!
On the site, through F12, I looked at the source code_kinogo.net/5428-iskatel-vody-2015.html, the following is written there:

<div class="box visible" style="display: block; background: rgb(0, 0, 0); ">
   	/*Зашифрованный код плеера UPPOD*/		
            <script type="text/javascript"><span id="selection_index24" class="selection_index"></span>document.write(Base64.decode('PG9iamVjdCBjbGFzcz0idXBwb2Rfc3R5bGVfdmlkZW8iIGlkPSJmaWxtczU0MjgiIHVpZD0iZmlsbXM1NDI4IiB0eXBlPSJhcHBsaWNhdGlvbi94LXNob2Nrd2F2ZS1mbGFzaCIgZGF0YT0iL3RlbXBsYXRlcy9raW5vZ28vcGxheWVyL3BsYXllci5zd2YiICB3aWR0aD0iNjQwIiBoZWlnaHQ9IjQwOCI+Cgk8cGFyYW0gbmFtZT0iYmdjb2xvciIgdmFsdWU9IiMwMDAwMDAiIC8+Cgk8cGFyYW0gbmFtZT0id21vZGUiIHZhbHVlPSJ0cmFuc3BhcmVudCI+Cgk8cGFyYW0gbmFtZT0iYWxsb3dGdWxsU2NyZWVuIiB2YWx1ZT0idHJ1ZSIgLz48cGFyYW0gbmFtZT0iYWxsb3dTY3JpcHRBY2Nlc3MiIHZhbHVlPSJhbHdheXMiIC8+Cgk8cGFyYW0gbmFtZT0ibW92aWUiIHZhbHVlPSIvdGVtcGxhdGVzL2tpbm9nby9wbGF5ZXIvcGxheWVyLnN3ZiIgLz4KPHBhcmFtIG5hbWU9ImZsYXNodmFycyIgdmFsdWU9InZhc3RfcHJlcm9sbD1odHRwOi8va2lub2dvLm5ldC9lbmdpbmUvbW9kdWxlcy92aWRlby5waHAmYW1wO2NvbW1lbnQ90JjRgdC60LDRgtC10LvRjCDQstC+0LTRiyAoMjAxNSkmYW1wO3N0PWh0dHA6Ly9raW5vZ28ubmV0L3RlbXBsYXRlcy9raW5vZ28vcGxheWVyL2ZpbG1zX25lbS50eHQmYW1wO2ZpbGU9MmlvYjNnUkx2YWJNMFFFTXRnVE0wYWs4Mk5tPTJ4bUxrYXNCMDV3YnYxdWpPUW9qdFF0YnRRdGxrajloVVF0MXRqQU5reG9oa2o5NXlnNDR0Z0dIdmFrNzBkejF2dFEzTmFoV3ROSjczYU1oR2R3OHZma0xraVpNdGpBV3lTbTUwaVVyJmFtcDtwb3N0ZXI9aHR0cDovL2tpbm9nby5uZXQvdGVtcGxhdGVzL2tpbm9nby91cHBvZC9wcmV2aWV3LmpwZyIgLz4KPC9vYmplY3Q+'));</script>
      
  /*Плеер UPPOD который шифруется.*/		
      <object class="uppod_style_video" id="films5428" uid="films5428" type="application/x-shockwave-flash" data="/templates/kinogo/player/player.swf" width="640" height="408">
      <param name="bgcolor" value="#000000">
      <param name="wmode" value="transparent">
      <param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always">
      <param name="movie" value="/templates/kinogo/player/player.swf">
      <param name="flashvars" value="vast_preroll=http://kinogo.net/engine/modules/video.php&amp;comment=Искатель воды (2015)&amp;st=http://kinogo.net/templates/kinogo/player/films_nem.txt&amp;file=2iob3gRLvabM0QEMtgTM0ak82Nm=2xmLkasB05wbv1ujOQojtQtbtQtlkj9hUQt1tjANkxohkj95yg44tgGHvak70dz1vtQ3NahWtNJ73aMhGdw8vfkLkiZMtjAWySm50iUr&amp;poster=http://kinogo.net/templates/kinogo/uppod/preview.jpg">
      </object>
</div>

If you look through CRTL + U, then we see only the encrypted code.
I have a question, in order to encrypt links on your site in the same way, do you need to connect PHP? To base64 automatically encrypted in each page - the code from the player.
That is, on a personal site, as well as on a movie, there are video materials on each page that need to be encrypted.
The encoder code is located at the link _kinogo.net/templates/kinogo/js/nocopy.js_below.
var Base64 = {
   _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
    decode : function (input) {
      var output = "";
      var chr1, chr2, chr3;
      var enc1, enc2, enc3, enc4;
      var i = 0;
     input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
     while (i < input.length) {
      enc1 = this._keyStr.indexOf(input.charAt(i++));
       enc2 = this._keyStr.indexOf(input.charAt(i++));
       enc3 = this._keyStr.indexOf(input.charAt(i++));
       enc4 = this._keyStr.indexOf(input.charAt(i++));
      chr1 = (enc1 << 2) | (enc2 >> 4);
        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
        chr3 = ((enc3 & 3) << 6) | enc4;
       output = output + String.fromCharCode(chr1);
       if( enc3 != 64 ){
          output = output + String.fromCharCode(chr2);
        }
        if( enc4 != 64 ) {
          output = output + String.fromCharCode(chr3);
        }
   }
   output = Base64._utf8_decode(output);
     return output;
   },
    _utf8_decode : function (utftext) {
      var string = "";
      var i = 0;
      var c = c1 = c2 = 0;
      while( i < utftext.length ){
       c = utftext.charCodeAt(i);
      if (c < 128) {
         string += String.fromCharCode(c);
         i++;
       }else if( (c > 191) && (c < 224) ) {
         c2 = utftext.charCodeAt(i+1);
          string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
          i += 2;
        }else {
          c2 = utftext.charCodeAt(i+1);
          c3 = utftext.charCodeAt(i+2);
          string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
          i += 3;
        }
     }
     return string;
    }
 }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2015-03-21
@FanatPHP

base64 has nothing to do with encryption.
What for?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question