function makeClickableLinks($s, $blank = false) {
return preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1"'.(($blank===true) ? ' target="_blank"' : '').'>$1</a>', $s); }
function makeClickableLinks($s, $blank = false) {
return preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1"'.(($blank===true) ? ' target="_blank"' : '').'>$1</a>', $s); }
$(document).on( eventName, selector, function(){} );
(function ($) { $.each(['show', 'hide'], function (i, ev) { var el = $.fn[ev]; $.fn[ev] = function () { this.trigger(ev); el.apply(this, arguments); }; }); })(jQuery);
$(function () { $('div').on('hide', function () { alert('div hidden'); }); });
$key = 'password to (en/de)crypt'; $string = ' string to be encrypted '; // note the spaces
To Encrypt:$iv = mcrypt_create_iv( mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM ); $encrypted = base64_encode( $iv . mcrypt_encrypt( MCRYPT_RIJNDAEL_256, hash('sha256', $key, true), $string, MCRYPT_MODE_CBC, $iv ) );
To Decrypt:$data = base64_decode($encrypted); $iv = substr($data, 0, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC)); $decrypted = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, hash('sha256', $key, true), substr($data, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC)), MCRYPT_MODE_CBC, $iv ), "\0" );
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #!/bin/sh #this is the prefix before the filename and can be anything you want fileprefix='mysql_backup_'; #this is your mysql user - best to create a new mysql user called backup that has access to all databases myuser='backup'; #your mysql password mypass='s0mething$ecure123'; #the backup directory that you should put at the root, not public_html #chmod 644 the backup folder and leave the trailing slash backupdir='/home/{typically your main cpanel account here without brackets}/backup/'; #more emails can be added by using a , to separate emailto='test@test.com'; #subject of the email emailsubject='mysql backup'; #body of the email emailbody='mysql db backup attached'; #shouldn't need to change below this date=`date '+%Y-%m-%d'`; file=$fileprefix$date.gz; mysqldump -u$myuser -p$mypass --all-databases | gzip > $backupdir$file; find $backupdir -name "$fileprefix*" -mtime +7 -type f -exec rm -rf {} ; echo $emailbody | mutt -s "$emailsubject" -a $backupdir$file "$emailto"; |
PHP Fatal error: Call to a member function find() on a non-objectJei dirbdami su simple_html_dom susiduriate su tokia klaida, naudokite tikrinimą:
$html = file_get_html( $url ); |
if ( $html && is_object ( $html ) && isset( $html ->nodes)){ |
foreach ( $html ->find( 'img' ) as $img ){ |
//kodas... |
} |
} |