static public function mysql_aes_encrypt($val, $ky)
    {

        if (empty($ky) && empty($val)) return null;

        $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
        for ($a = 0; $a < strlen($ky); $a++) {
            $key[$a % 16] = chr(ord($key[$a % 16]) ^ ord($ky[$a]));
        }
        $mode = MCRYPT_MODE_ECB;
        $enc  = MCRYPT_RIJNDAEL_128;
        $val  = str_pad($val, (16 * (floor(strlen($val) / 16) + (strlen($val) % 16 == 0 ? 2 : 1))), chr(16 - (strlen($val) % 16)));

        return mcrypt_encrypt($enc, $key, $val, $mode, mcrypt_create_iv(mcrypt_get_iv_size($enc, $mode), MCRYPT_DEV_URANDOM));
    }
static public function mysql_aes_encrypt($val, $ky)
    {

        if (empty($ky) && empty($val)) return null;

        $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
        for ($a = 0; $a < strlen($ky); $a++) {
            $key[$a % 16] = chr(ord($key[$a % 16]) ^ ord($ky[$a]));
        }
        $mode = MCRYPT_MODE_ECB;
        $enc  = MCRYPT_RIJNDAEL_128;
        $val  = str_pad($val, (16 * (floor(strlen($val) / 16) + (strlen($val) % 16 == 0 ? 2 : 1))), chr(16 - (strlen($val) % 16)));

        return mcrypt_encrypt($enc, $key, $val, $mode, mcrypt_create_iv(mcrypt_get_iv_size($enc, $mode), MCRYPT_DEV_URANDOM));
    }
static public function mysql_aes_encrypt ( $ val , $ ky ) { if ( empty ( $ ky ) && empty ( $ val ) ) return null ; $ key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ; for ( $ a = 0 ; $ a < strlen ( $ ky ) ; $ a ++ ) { $ key [ $ a % 16 ] = chr ( ord ( $ key [ $ a % 16 ] ) ^ ord ( $ ky [ $ a ] ) ) ; } $ mode = MCRYPT_MODE_ECB ; $ enc = MCRYPT_RIJNDAEL_128 ; $ val = str_pad ( $ val , ( 16 * ( floor ( strlen ( $ val ) / 16 ) + ( strlen ( $ val ) % 16 == 0 ? 2 : 1 ) ) ) , chr ( 16 - ( strlen ( $ val ) % 16 ) ) ) ; return mcrypt_encrypt ( $ enc , $ key , $ val , $ mode , mcrypt_create_iv ( mcrypt_get_iv_size ( $ enc , $ mode ) , MCRYPT_DEV_URANDOM ) ) ; }
aes mysql encryption

@param string $val
@param string $ky

@return null|string
aes mysql encryption