PHP

Laravel 5 and simple Forms workaround

Here is a simple example of using laravel 5 powerful forms to deliver a secure and fast result!
To make our lives easier we need to install the HTML package!

In file /compojer.json we add:
"require": {
"laravel/framework": "5.0.*",
"laravelcollective/html": "~5.0"
},

Next add the service provider and aliases.
In /config/app.php we update the following:

'providers' => [
'Illuminate\Html\HtmlServiceProvider',
],

'aliases' => [
'Form'=> 'Illuminate\Html\FormFacade',
'HTML'=> 'Illuminate\Html\HtmlFacade',
],

More

Laravel 5 TIPS For Beginners!

Here are some tips you might find handy when you think you have done everything according to the tutorials!

In formrequests to authorise access only for registered/signed users we add

use Auth;
public function authorize()
{
if ( !Auth::check() )
return false;
return true;
}

More

JQuery Calendar and PHP: Handling Inserts

1) Getting Current Time in Javascript

The ISO 8601 date format can be utilized to convert the date on the browser side to a format that include timestamp information. Quoting from here:

Note that the “T” appears literally in the string, to indicate the beginning of the time element. Times are expressed in UTC (Coordinated Universal Time), with a special UTC designator (“Z”). Used in ATOM RSS feeds.

function fnISO() {
// Only works in Firefox using ECMAScript 5
var now = new Date().toISOString();
alert(now);
}

Result: 2009-08-06T23:36:31.390Z

More

Encrypt in VB.NET and Decrypt in PHP 4 Using Phpseclib0.3.0

Originally I had found code from: Encrypt in VB.NET and Decrypt in PHP and Vice Versa .

Everything worked well, until I realized that the specific webserver I was writing code for ran PHP 4…No mcrypt_decrypt.

Hence I discovered PHPSecLib has the Rijndael algorithm implemented as PHP code.
Following please find code to check if mcrypt exists and react differently (where $line is the encrypted text):


if(function_exists('mcrypt_decrypt'))
$dec = decryptRJ256($ky, $iv, $line);
else
$dec = decryptRJ256_PHPSECLIB($ky, $iv, $line);

More