Sunday, August 11, 2019

Prevent / Defend Against XSS Attack in PHP

Include funtion e. This will escape malicious js stuff.

function e($value)
{
    return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);
}

Call function e to the input you need to display. For example

<input type="text" value="<?=e($_GET['q']??'')?>">

Tuesday, August 6, 2019

Create symlink folder

For example we have our folder in /etc/nginx/sites-enabled/example.com
And to make virtual symlink folder here /etc/nginx/sites-available we run this

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/