How to create cron job using PHP?

This is the best explanation with code in PHP I have found so far: http://code.tutsplus.com/tutorials/managing-cron-jobs-with-php–net-19428 In short: Although the syntax of scheduling a new job may seem daunting at first glance, it’s actually relatively simple to understand once you break it down. A cron job will always have five columns each of which represent a … Read more

Are PDO prepared statements sufficient to prevent SQL injection?

The short answer is NO, PDO prepares will not defend you from all possible SQL-Injection attacks. For certain obscure edge-cases. I’m adapting this answer to talk about PDO… The long answer isn’t so easy. It’s based off an attack demonstrated here. The Attack So, let’s start off by showing the attack… In certain circumstances, that will return more than … Read more

PHP convert XML to JSON

I figured it out. json_encode handles objects differently than strings. I cast the object to a string and it works now.

Laravel 5.2 Storage::makeDirectory($dir) is not creating directory

Well… I figured out what was going on. File::exists(public_path() . “/video/$user”) is looking for this: /home/ubuntu/workspace/site/public/video/N And Storage::makeDirectory(public_path() . “/video/$user”) is creating a directory in: /home/ubuntu/workspace/site/storage/app/public/video/N So I can go to site/config/filesystems.php and change the routes for app and app/public ; you can check them by using the helper storage_path(‘app’).But, instead, I decided to save the videos in the storage/app/public/video and storage/app/public/thumbnails, and I am getting some package’s … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)