You should use PDO
if you can help it, mysql_*
functions are officially deprecated. Learn about prepared statements instead, and use PDO or MySQLi. Check out this comparison and if you choose PDO, here is a good tutorial.
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
/** | |
* Datetime conversion methods. Convert server datetime to UTC and convert UTC to server datetime. | |
* @author https://gist.github.com/dirte/ | |
* @version 1.0.1 | |
* @category DateTime | |
*/ | |
/** | |
* datetimeConvertServerToUTC | |
* |
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
/** | |
* Credit card validation regular expressions | |
*/ | |
# American Express | |
/^3[47]/ | |
# Visa | |
/^4/ |
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
/** | |
* Credit card verification luhn checksum method | |
*/ | |
function validateLuhnChecksum(cardNumber) { | |
if (cardNumber == 0) { return false; } | |
var sum = 0; | |
var mul = 1; | |
for (var x = cardNumber.length; x > 0 ; x--) { | |
var tproduct = parseInt(cardNumber.charAt(x - 1), 10) * mul; | |
if (tproduct >= 10) { |
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
syntax on | |
set background=dark " easy on the eyes | |
set ruler " show the line number on the bar | |
set more " use more prompt | |
set autoread " watch for file changes | |
set number " line numbers | |
set hidden | |
set noautowrite " don't automagically write on :next | |
set lazyredraw " don't redraw when don't have to | |
set showmode |
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
/** | |
* getPassphraseHash | |
* | |
* Gets hash of provided plaintext passphrase using crypt | |
* | |
* @author https://gist.github.com/dirte | |
* @var string $rounds If supported, the number of rounds to loop the hash which increases security | |
* @var string $algo Crypt algorithm | |
* @var string $salt Uniqid with more entropy | |
* @var string $cryptSalt Salt to use in crypt |
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
/** | |
* authenticatePassphrase | |
* | |
* Authenticate user provided passphrase against previously stored passphrase hash | |
* | |
* @author https://gist.github.com/dirte | |
* @access public | |
* @param string $frmPassphrase | |
* @param string $dbPassphrase | |
* @return boolean |
- Use an indent of 4 spaces, with no tabs
- Line length of 75-85 characters
- Control statements should have one space between the control keyword and opening parenthesis.
- Example: if (condition) {
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
# Logs | |
*.log | |
*_log | |
# Backups | |
*.bak | |
*.7z | |
*.bz2 | |
*.gz | |
*.tar |
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 | |
clear | |
clear | |
echo '#' | |
echo '# CentOS 6.x LAMP Server Provisioning Script' | |
echo '#' | |
echo '# This script will guide you through the initial server provisioning for a standard CentOS 6.x LAMP server.' | |
echo '# The basic provisioning tasks to be ran immediately after provisioning are fully automated with user prompts.' | |
echo '# The rest of the script is for copy/paste reference to pick/choose as desired.' | |
echo '#' |
OlderNewer