Monday, December 4, 2017

Encrypt JavaScript and jquery using php

Now we have a problem that we want to encrypt javasctript and jquery.

I create a code for encryption of JavaScript or jquery using php.


Have a look On git repo:-
https://github.com/ankitgarg306/javascriptencrypt

Sunday, October 29, 2017

Remove Bitnami Info Page for AWS Cloud

Command for removing 

sudo /opt/bitnami/apps/APPNAME/bnconfig --disable_banner 1


AppName:- your application name (wordpress, joomla, oodeo)

Restart the web server

If apache

sudo /opt/bitnami/ctlscript.sh restart apache

In nginx

sudo /opt/bitnami/ctlscript.sh restart nginx

=---------------------------------------------------------------------------------------

Sometimes error comes "command not found "


Sometimes on this path 

bnconfig preset as bnconfig.disabled

Then first rename the bnconfig file using command

sudo mv /opt/bitnami/apps/APPNAME/bnconfig.disbaled /opt/bitnami/apps/APPNAME/bnconfig

then run command 

sudo /opt/bitnami/apps/APPNAME/bnconfig --disable_banner 1

Again revert the file name
sudo mv /opt/bitnami/apps/APPNAME/bnconfig /opt/bitnami/apps/APPNAME/bnconfig.disbaled

and Restart the web server

Thursday, October 26, 2017

How to use JSON in PHP 4 or PHP 5.1.x

Download JSON Class

<?php
    // Future-friendly json_encode
    if( !function_exists('json_encode') ) {
        function json_encode($data) {
            $json = new Services_JSON();
            return( $json->encode($data) );
        }
    }
    // Future-friendly json_decode
    if( !function_exists('json_decode') ) {
        function json_decode($data) {
            $json = new Services_JSON();
            return( $json->decode($data) );
        }
    }
    ?>

Monday, October 9, 2017

format numbers with 00 prefixes in php?

Prob:-
 Is there any function to have numbers with 5 digit as
 00001, or
 00123… 
this number should be not random but have to increase the value of a previous field.


Ans:-

$n2 = str_pad($n + 1, 5, 0, STR_PAD_LEFT);

Use str_pad() by adding 0s (third parameter) to the left (fourth parameter) of the old number $n incremented by 1 (first parameter) until the length is 5 (second parameter).