Kevin Pirnie' Articles

Wow!  It's been a little while since I have had the time to post another article.   Well, here I am again, back at it.This time, I will show you an optimal way to keep your site secure utilizing a bit of nginx configuration.  You will need to do some work before implementing this, so please do not attempt to simply copy/paste this and expect it to work out of the box. # Default security headers add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"; # enable, cache, and preload subdomains add_header X-Frame-Options "SAMEORIGIN" always; # generally only allow SAMEORIGIN frame sources add_header X-Xss-Protection "1; mode=block"; # protect against Cross-Site Scripting add_header X-Content-Type-Options "nosniff" always; # no sniffing allowed! add_header Referrer-Policy "strict-origin"; # protect agains cross-linking add_header X-Download-Options "noopen"; #… Read More
Here is a little snippet for anyone who needs it. What it does?   Generates a random character string, stores it to a session variable (for verification), then renders a png image with a white background and random colors of the random characters. Change any variables you need.  And call is using a simple <img> tag. Here's the code: <? $string = ''; // String of characters to randomly render $chars = 'a,b,c,d,e,f,g,h,j,k,m,n,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,G,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z,1,2,3,4,5,6,7,8,9,$,%,&,*,@,#,~'; $ca = explode(',', $chars); // Shuffle up the array shuffle($ca); // Now make it a complete string, but only allow 8 characters foreach (array_slice($ca, 0, 8) as $ltr) { $string .= $ltr; } //Store the string in the session $_SESSION['SecImg'] = $string; //Set the browser header to render this as an image… Read More