This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$salt ='whatever_you_want' | |
function simple_encrypt($text) | |
{ | |
return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $salt, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)))); | |
} | |
function simple_decrypt($text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Very simple way to get the number of seconds from Jan 1, 0001 or any other date | |
* the normal date/time functions only work from 1 Jan 1970 | |
* Requires PHP 5.3 or above | |
* Start: must be in YYYY-MM-DD format | |
* End: must be in YYYY-MM-DD format | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* To get the largest key in an array | |
*/ | |
$array = array( 0 => 'first', 1=> 'second', /* ... */ 99 => 'nth' ); | |
$max_key = max( array_keys( $array ) ); // 99 | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function addDeal($form) | |
{ | |
$location =""; | |
foreach($form->getElement('location_id')->getValue() as $key=>$value) | |
{ | |
if($key==0) | |
{ | |
$location = $value ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install this plugin http://wordpress.org/extend/plugins/ps-disable-auto-formatting/ | |
It will disable the way WP auto formats your html in the page content editor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MUSER="MYSQL_USER" | |
MPASS="MYSQL_PASSWORD" | |
MDB="MYSQL_DB" | |
FILE="/path/to/sql/to/import.sql" | |
# Detect paths | |
MYSQL=$(which mysql) | |
AWK=$(which awk) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#include/class/cron.php | |
class cron { | |
public $start_date; | |
public $domain_id; | |
public function insert() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthType Basic | |
AuthName "Auth Required" | |
AuthUserFile /path/to/.htpasswd | |
Require valid-user | |
# allow public access to the following resources | |
SetEnvIf Request_URI "(path/to/directory/)$" allow | |
SetEnvIf Request_URI "(path/to/file\.phpt)$" allow | |
SetEnvIf Request_URI "(util)$" allow | |
Order allow,deny | |
Allow from env=allow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Simple PHP function to generate a random apha-numeric code with only readable characters | |
*/ | |
function randomCode($length=4) { | |
/* Only select from letters and numbers that are readable - no 0 or O etc..*/ | |
$characters = "23456789ABCDEFHJKLMNPRTVWXYZ"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Original CSS | |
* - which caused this issue in Chrome on Windows -> http://minus.com/mbbbT3JZrH | |
*/ | |
.showCompletedButton { | |
padding: 8px 10px; | |
width: 118px; | |
} | |