Code Sharing Repository Public source code sharing repository http://devcodepro.com Highlight String Example - Code Sharing Repository '; echo ' '; highlight_string($string); echo ' '; ?> http://devcodepro.com/view/75/62/Highlight-String-Example http://devcodepro.com/view/75/62/Highlight-String-Example Sun, 20 Jan 2019 20:37:34 GMT Sending HTML Email With Image - Code Sharing Repository Email With Image Sending HTML Email With Image ' . $message . ' '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'From:... http://devcodepro.com/view/74/62/Sending-HTML-Email-With-Image http://devcodepro.com/view/74/62/Sending-HTML-Email-With-Image Sun, 20 Jan 2019 19:48:04 GMT Display and log errors - Code Sharing Repository error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('log_errors', TRUE); ini_set('error_log', 'php.log'); http://devcodepro.com/view/73/1/Display-and-log-errors http://devcodepro.com/view/73/1/Display-and-log-errors Sat, 8 Dec 2018 17:48:50 GMT ADOdb - Check if MySQL query executed successfully - Code Sharing Repository Prepare('DELETE FROM mytable WHERE id = ' . $DB->qstr($id) . ''); if ($DB->Execute($sql) === false) { print $DB->ErrorMsg(); } if ($DB->affected_rows() !== 0) { //true } ?> http://devcodepro.com/view/70/1/ADOdb-Check-if-MySQL-query-executed-successfully http://devcodepro.com/view/70/1/ADOdb-Check-if-MySQL-query-executed-successfully Tue, 29 May 2018 16:20:25 GMT ADOdb count number of records - Code Sharing Repository $recordSet = $conn->Execute('SELECT * FROM mytable where published = '.$conn->qstr('1').' or published = '.$conn->qstr('2').' order by id DESC'); $counter = $recordSet->recordCount(); echo $counter; http://devcodepro.com/view/66/1/ADOdb-count-number-of-records http://devcodepro.com/view/66/1/ADOdb-count-number-of-records Sun, 8 Apr 2018 04:14:33 GMT How to get clean file / image name with extension from the URL in PHP? - Code Sharing Repository $reg = '/(?<=jpg|png|gif|jpeg).*/'; $url = 'https://example.com/2012/12/zoe.jpg?w=600&#038;h=400&#038;crop=1,"; "=""'; $rep = ''; $result = preg_replace($reg, $rep, $url); $cleanfile = basename($result); echo $cleanfile; http://devcodepro.com/view/58/14/How-to-get-clean-file-image-name-with-extension-from-the-URL-in-PHP- http://devcodepro.com/view/58/14/How-to-get-clean-file-image-name-with-extension-from-the-URL-in-PHP- Mon, 4 Dec 2017 17:57:17 GMT Avoid spam points - Message only has text/html MIME parts - Code Sharing Repository "."\r\n"; $header .= "Organization: My Company Name \r\n"; $header .= "Content-Type: multipart/alternative;boundary=" . $uid . "\r\n"; $body = "This is a MIME encoded message."; $body .= "\r\n\r\n--" . $uid . "\r\n";... http://devcodepro.com/view/56/1/Avoid-spam-points-Message-only-has-text-html-MIME-parts http://devcodepro.com/view/56/1/Avoid-spam-points-Message-only-has-text-html-MIME-parts Tue, 14 Nov 2017 04:52:05 GMT Convert HTML to plain text in PHP - Code Sharing Repository ]*>| )/si' => "", '/\r/si' => "", '/\n/si' => "", '/&nbsp;/si' => " ", '/&middot;/si' => " ", '/ ]*alt=\"([^>"]+)\"[^>]*>/si'... http://devcodepro.com/view/54/13/Convert-HTML-to-plain-text-in-PHP http://devcodepro.com/view/54/13/Convert-HTML-to-plain-text-in-PHP Sat, 30 Sep 2017 01:28:06 GMT Log and display all errors, warnings and notices - Code Sharing Repository ini_set('display_errors', 1); ini_set('display_startup_errors', 1); ini_set("error_log", "myerrors.log"); error_reporting(E_ALL); http://devcodepro.com/view/53/13/Log-and-display-all-errors-warnings-and-notices http://devcodepro.com/view/53/13/Log-and-display-all-errors-warnings-and-notices Sat, 16 Sep 2017 16:52:35 GMT Smarty display multiple template pages with single php page - Code Sharing Repository Contact $smarty->display('header.php'); $page = (isset($_GET['page']))?$_GET['page']:''; switch($page) { case 'contact': $smarty->display('contact.php'); break; case 'termsofuse':... http://devcodepro.com/view/44/8/Smarty-display-multiple-template-pages-with-single-php-page http://devcodepro.com/view/44/8/Smarty-display-multiple-template-pages-with-single-php-page Wed, 26 Jul 2017 13:03:20 GMT Random image in Smarty file - Code Sharing Repository //php file $smarty->assign('random', array( 'photo1.jpg', 'photo2.jpg', 'photo3.jpg', 'photo4.jpg' )); //template file {literal} .myImageDiv { background:... http://devcodepro.com/view/36/1/Random-image-in-Smarty-file http://devcodepro.com/view/36/1/Random-image-in-Smarty-file Thu, 25 May 2017 13:29:47 GMT HTML Purifier Posting Arrays - Code Sharing Repository $getdata = $_POST['getdata']; /** * myFilter() * * @return */ function myFilter($value) { global $purifier; $value = $purifier->purify($value); return $value; } $getdata = array_map("myFilter",$getdata); print_r($getdata); http://devcodepro.com/view/32/8/HTML-Purifier-Posting-Arrays http://devcodepro.com/view/32/8/HTML-Purifier-Posting-Arrays Thu, 16 Mar 2017 05:51:45 GMT Get YouTube Video ID and clean URL with PHP - Code Sharing Repository Real Url: \\2\\3\\4\\5\\6 We don\'t need this part: \\6 Clean Url: https://www.youtube.com/v/\\5 Another Clean Url: https://www.youtube.com/watch?v=\\5 Video ID: \\5 Watch Video ', $url); echo $youtube; ?> http://devcodepro.com/view/31/8/Get-YouTube-Video-ID-and-clean-URL-with-PHP http://devcodepro.com/view/31/8/Get-YouTube-Video-ID-and-clean-URL-with-PHP Sun, 5 Mar 2017 13:51:18 GMT Get a domain name IP address - Code Sharing Repository "> DomainName: http://devcodepro.com/view/30/8/Get-a-domain-name-IP-address http://devcodepro.com/view/30/8/Get-a-domain-name-IP-address Tue, 28 Feb 2017 09:40:06 GMT Upload favicon from external website - Code Sharing Repository http://devcodepro.com/view/29/2/Upload-favicon-from-external-website http://devcodepro.com/view/29/2/Upload-favicon-from-external-website Tue, 21 Feb 2017 02:06:26 GMT PHP replace bad words - Code Sharing Repository http://devcodepro.com/view/28/8/PHP-replace-bad-words http://devcodepro.com/view/28/8/PHP-replace-bad-words Fri, 10 Feb 2017 00:15:34 GMT Smarty section start loop - Code Sharing Repository //First Result {section name="articles" loop=1 start=0} {$articles[articles].title} {/section} //First and Second Result {section name="articles" loop=2 start=0} {$articles[articles].title} {/section} //Second Result {section name="articles" loop=2... http://devcodepro.com/view/27/8/Smarty-section-start-loop http://devcodepro.com/view/27/8/Smarty-section-start-loop Fri, 10 Feb 2017 00:02:07 GMT esoTalk-BBCode plugin with Color Tag - Code Sharing Repository =======plugin.php======= "BBCode","description" => "Formats BBCode within posts, allowing users to style their text.","version" => ESOTALK_VERSION,"author" => "esoTalk Team","authorEmail" =>... http://devcodepro.com/view/26/8/esoTalk-BBCode-plugin-with-Color-Tag http://devcodepro.com/view/26/8/esoTalk-BBCode-plugin-with-Color-Tag Sat, 21 Jan 2017 05:41:42 GMT PHP StopForumSpam integration example - Code Sharing Repository //stopforumspam.php appears == 'yes') { echo "Sorry, your registration could not be processed."; $emailto = "Email: ".$email." - IP: ".$ipse."r"; $file = "banlog.log"; @$fh = fopen($file,'a');... http://devcodepro.com/view/24/8/PHP-StopForumSpam--integration-example http://devcodepro.com/view/24/8/PHP-StopForumSpam--integration-example Mon, 16 Jan 2017 02:18:41 GMT reCAPTCHA v.2.0. Example Form - Code Sharing Repository //submit.php body{background-color:#fff;font-family:tahoma,serif;font-size:15px;color:#555;font-weight:900;width:40%;overflow:hidden;margin:50px auto 0} .info{padding:15px;text-align:center;background:#6C89B5;color:#fff;margin:0 5px}... http://devcodepro.com/view/23/8/reCAPTCHA-v-2-0-Example-Form http://devcodepro.com/view/23/8/reCAPTCHA-v-2-0-Example-Form Mon, 9 Jan 2017 02:50:09 GMT