Fast way to setup a form with PHPMailer and Ajax

This article has been written before more than 24months, information might old.

PHPMailer is a popular library for sending emails as the project of the title suggest. In the GitHub, readme file has a nice example of a basic setup, but today I’ll give you a similar simple example using jQuery, Swal( Sweet alert ).

So first this is the PHP script that should respond to an ajax request ( I named the filename smail.php):

// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

//Load composer's autoloader
require 'vendor/autoload.php';

function isValidEmail($email){ 
    return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;

	$name = htmlspecialchars($_POST["name"]);
	$email = htmlspecialchars($_POST["email"]);
	$msg =  htmlspecialchars($_POST["message"]);
	$recap = htmlspecialchars($_POST["g-recaptcha-response"]);
	$gcapSecret = 'YOUR RECAPTCHA2 SECRET';

if( !empty($name ) &&
	!empty( $email) &&
	!empty( $msg  )
    if( empty( $recap ) )  exit( json_encode(['send'=>'error', 'msg'=>'Please complete the captcha.' ]));
	if(!isValidEmail($email))  exit( json_encode(['send'=>'error', 'msg'=>'Invalid Email.' ]));
	$obj = json_decode($response);
	if($obj->success != true) exit( json_encode(['send'=>'error', 'msg'=>'Google ReCaptcha V2 not passed.' ]));
	$mail = new 

PHP 7.0.24 Curl Bug on Windows

This article has been written before more than 24months, information might old.

As you probably know running PHP on Windows is a bad idea as you can get in a plethora of problems even for a simple development setup but, when you want to test a quick script or you just want to write maybe a solution to an algorithmic problem found on some type of programmer improvement site that accepts solutions in PHP you can use of course some prebuild windows binaries from
Anyway, the main gist of this mini-post is that, I found a recurring bug with CURL library, the bug has been reported before and it consists in the fact that the library will not load(even if you set up correctly php.ini) you and no starting error will be generated so you will inside a PHP script that uses CURLthe following error:
Call to undefined function curl_init()
In my case, I was updating from version 7.0.9 to 7.0.24, so the quick and dirty solution is just to replace the php_curl.dll from your extension folder with one …

Jeremy Corbyn Worst thing that happend to Britain [ Satire ]

This article has been written before more than 24months, information might old.

About some days ago I wrote a sarcastic comment on a youtube clip that was biased from my point of view, and I didn’t do that just cause I think it was biased, cause as I previously imply, objectivity is troublesome to achieve, especially when considering the present polarized society.

The main reason that angered me, wasn’t the biased, it was the way that the clip was made, with many scenes taken out of context, and almost no argument to back a smearing narrative.

So I enabled my sarcastic mode and wrote a pretty darn subjective satiric comment, moreover due to its length, I thought why not to make an article out of it, here it is:

I am sure that Corbyn wants to annihilate all those super genius rich people that care so much about this world, and I know that from the enormous public outcry, let’s all hope that they don’t extenuate to death from all the whining.

Is it only me that wakes up in

Immortal Redneck Review

This article has been written before more than 24months, information might old.

This game is a fast paced first person shooter, that will require you to have a pretty durable mouse as you will find that you need a huge amount of fast clicks in order to play this game. I played it about two days and took me an approximated time of about 7-8 hours total(both days) in order to complete it. It is incredible but after this time I had a muscle soreness for my index finger(mostly) and a little bit for my middle finger of the firing hand. And I said that is incredible as I didn’t have any muscle soreness for any finger in a period that easily surpasses 10 years.

Some popular old games that in my view happen to be similar are Serious Sam, Quick and maybe Alien Arena. With that said you may imagine that when I wrote fast paced, I actually meant “godlike” speed of movement. And that for me is a very attractive feature as it allows you to dodge in …

Ionic 2 overwrite back button function my way

This article has been written before more than 24months, information might old.

I guess that most of APP developers would not prefer a crude exit of their APP when back button was pressed, and as you may already know using ionic you can register a callback on the back button pressed event. That is pretty straight forward, but what comes in the registered callback is most a matter of preference, but nevertheless, this method that I lately used works on the newest 3.1.1 Ionic version.
I will explain in just in 2 phrases, what is the expected behaviour:
The first thing that it will do it will look if there is an overlay view/component active like a Modal, Toast, Alert and if there is it will dismiss that component.
Then it will check if a menu is opened, if it is it will close it, then it will check if the keyboard is opened, and close it in case previous was true, and lastly it will check if you can go back taking into account the current page, and if …