Sunday, 20 June 2021

Angular - Ionic. Enlarge Photo Viewer

 


https://stackblitz.com/edit/angular-bkosu5?file=src%2Fapp%2Fapp.component.css


https://morioh.com/p/6bd2fa8478c4

Wednesday, 16 June 2021

PHP-JWT


Note that, by default, Apache will not pass the HTTP_AUTHORIZATION header to PHP. The reason behind this is:

The basic authorization header is only secure if your connection is done over HTTPS, since otherwise the credentials are sent in encoded plain text (not encrypted) over the network which is a huge security issue.

I fully appreciate the logic of this decision. However, to avoid a lot of confusion, add the following to your Apache configuration. Then the code will function as expected. If you’re using NGINX, the code should function as expected:

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.+)$
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


https://www.sitepoint.com/php-authorization-jwt-json-web-tokens/ 

Sunday, 13 June 2021

Format Date ( ) JS Functionalities

 https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date

Thursday, 10 June 2021

Install Chocolatey and Update node.js

 https://docs.chocolatey.org/en-us/choco/setup

choco install python
choco upgrade chocolatey

Wednesday, 2 June 2021

Session (Native Php)

Maybe depending on PHP settings, but if return values are not the above, then go for this:
_DISABLED = 0
_NONE = 1
_ACTIVE = 2



Universal function for checking session status.

start session

<?php
/**
* @return bool
*/

function is_session_started()
{
    if ( 
php_sapi_name() !== 'cli' ) {
        if ( 
version_compare(phpversion(), '5.4.0''>=') ) {
            return 
session_status() === PHP_SESSION_ACTIVE TRUE FALSE;
        } else {
            return 
session_id() === '' FALSE TRUE;
        }
    }
    return 
FALSE;
}

// Example
if ( is_session_started() === FALSE session_start();
?>


Unset

<?php
// remove all session variables
session_unset();


Destroy

// destroy the session
session_destroy();
?>


Notes

As a shorthand you can use
@session_start()
with the @ at the beginning to suppress the
PHP notice "A session had already been started - ignoring session_start()"

As stated in the manual for session_start(), a second call will do no harm,
it will be simply ignored. But you need the @, if you don't want to get the notice.

Put Cookie in prestashop 1.5 and 1.6

 Today I will show you how can you simple set and get your custom cookie variable.

It is useful when you want to keep locally on user’s PC some settings.

Setting cookie

$this->context->cookie->__set('your_cookie_name', 'your cookie value');
$this->context->cookie->write();

Getting cookie

$this->context->cookie->__get('your_cookie_name');

Check if cookie exists

$this->context->cookie->__isset('your_cookie_name');

Deleting cookie

$this->context->cookie->__unset('your_cookie_name');

Final words

Remember – if you don’t have access to $this->context, you can replace it with Context::getContext().

That’s all – as simple as that!


Reference Tutorial

https://prestacraft.com/tutorials/

Put Cookie in prestashop 1.5 and 1.6