This file contains hidden or 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 | |
// Email Submit | |
if ( isset($_POST['email']) && isset($_POST['name']) && isset($_POST['text']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) { | |
// detect & prevent header injections | |
$test = "/(content-type|bcc:|cc:|to:)/i"; | |
foreach ( $_POST as $key => $val ) { | |
if ( preg_match( $test, $val ) ) { | |
exit; | |
} |
This file contains hidden or 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
UPDATE `wp_options` SET option_value = replace(option_value, 'CURRENT_URL', 'NEW_URL') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE `wp_posts` SET guid = REPLACE (guid, 'CURRENT_URL', 'NEW_URL'); | |
UPDATE `wp_posts` SET post_content = REPLACE (post_content, 'CURRENT_URL', 'NEW_URL'); | |
UPDATE `wp_postmeta` SET meta_value = REPLACE (meta_value, 'CURRENT_URL','NEW_URL'); |
This file contains hidden or 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
// Extend jQuery addClass function to accept callback function | |
var oAddClass = $.fn.addClass; | |
$.fn.addClass = function () { | |
for (var i in arguments) { | |
var arg = arguments[i]; | |
if ( !! (arg && arg.constructor && arg.call && arg.apply)) { | |
arg(); | |
delete arg; | |
} | |
} |
This file contains hidden or 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 | |
namespace VerbalExpressions\PHPVerbalExpressions; | |
/** | |
* Verbal Expressions v0.1 (https://github.com/jehna/VerbalExpressions) ported in PHP | |
* @author Mihai Ionut Vilcu ([email protected]) | |
* 22.July.2013 | |
*/ | |
class VerbalExpressions |
This file contains hidden or 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 | |
error_reporting(E_ALL); | |
ini_set('display_errors', '1'); | |
function fgetcsv_PHP() | |
{ | |
/* | |
* See if we can open a file named fgetcsv.csv in |
This file contains hidden or 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 | |
/** | |
* @author Tom Gabrysiak | |
* @version 1.0 | |
* | |
* Compares 2 random generated numbers to see if they are equal | |
* | |
* Class needs to be initialized before chaining other methods | |
* | |
* Example: |
This file contains hidden or 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 | |
/** | |
* @author Tom Gabrysiak | |
* @version 1.2 | |
* PDO Wrapper Class | |
* | |
* Example Usage: | |
* | |
* CONNECT: | |
* $db = new DB("mysql:host=localhost;dbname=db", "dbuser", "dbpass"); |
This file contains hidden or 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 | |
header("Content-Type: text/plain"); | |
$dataIn = (object)array( | |
"string" => "value 1", | |
"array" => array(1,2,3), | |
"assoc" => array("cow"=>"moo","dog"=>"woof"), | |
"object" => (object)array("cat"=>"miao","pig"=>"oink"), | |
); |
This file contains hidden or 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
mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < backup/data.sql |
This file contains hidden or 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
mysqldump -h DBHOST -u DBUSER -pDBPASS --single-transaction DBNAME > data.sql |