Put this within server { ... } block of your vhost
location ~ "^(.*)/your_uploads_folder/(.*)$" {
if (!-e $request_filename) {
return 302 http://yourlivesite.com$request_uri;
}
}
| <?php | |
| # RegEx For Eval Removal: \s+(eval\(base64.*?\))\); | |
| exit; | |
| function back_to_for_slash($str) { | |
| return str_replace('\\', '/', $str); | |
| } | |
| $current_dir = back_to_for_slash(dirname(__FILE__) . '/public_html'); | |
| $directory = $current_dir; |
| #!/bin/bash | |
| # | |
| # This script configures WordPress file permissions based on recommendations | |
| # from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
| # | |
| # Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
| # | |
| WP_OWNER=www-data # <-- wordpress owner | |
| WP_GROUP=www-data # <-- wordpress group | |
| WP_ROOT=$1 # <-- wordpress root directory |
| <?php | |
| /* | |
| * dl-file.php | |
| * | |
| * Protect uploaded files with login. | |
| * | |
| * @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in | |
| * | |
| * @author hakre <http://hakre.wordpress.com/> | |
| * @license GPL-3.0+ |
| <?php | |
| if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { | |
| // run Backend only code here | |
| } else { | |
| // Frontend code here, this will include the ajax calls | |
| } |
| jQuery("#textbox_id").on("keypress", function(e){ | |
| var currentChar = parseInt(String.fromCharCode(e.keyCode), 10); | |
| if(!isNaN(currentChar)){ | |
| var nextValue = elem.val() + currentChar; //It's a string concatenation, not an addition | |
| if(parseInt(nextValue, 10) <= 20) return true; | |
| } | |
| return false; | |
| }); |
| $csv = array_map("str_getcsv", file("file1.csv",FILE_SKIP_EMPTY_LINES)); | |
| $keys = array_shift($csv); | |
| foreach ($csv as $i=>$row) { | |
| $csv[$i] = array_combine($keys, $row); | |
| } |
| <?php | |
| $match_date = \DateTime::createFromFormat("Y-m-d H:i:s", $date_1); | |
| $match_date->setTime( 0, 0, 0 ); // reset time part, to prevent partial comparison | |
| $today = new \DateTime(); // This object represents current date/time | |
| $today->setTime( 0, 0, 0 ); // reset time part, to prevent partial comparison | |
| $diff = $today->diff( $match_date ); | |
| $diffDays = (integer)$diff->format( "%R%a" ); // Extract days count in interval |
| /** | |
| * This function will connect wp_mail to your authenticated | |
| * SMTP server. This improves reliability of wp_mail, and | |
| * avoids many potential problems. | |
| * | |
| * Author: Chad Butler | |
| * Author URI: http://butlerblog.com | |
| * | |
| * For more information and instructions, see: | |
| * http://b.utler.co/Y3 |
| $fileName = 'Billing-Summary.csv'; | |
| header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); | |
| header('Content-Description: File Transfer'); | |
| header("Content-type: text/csv"); | |
| header("Content-Disposition: attachment; filename={$fileName}"); | |
| header("Expires: 0"); | |
| header("Pragma: public"); | |
| $fh = @fopen( 'php://output', 'w' ); |