September 14, 2012

Cross Domain Form Posted – PHP Security Fix

Cross Domain Form Posted – PHP Security Fix We the developers mostly rely on the ready made frameworks now a days and ignoring the common sense security fixes. Everybody knows that when a spammer will attack to your site so he will not do such a hectic activity that he will come to your form […]

September 7, 2012

What does mean by internal server error?

What does mean by internal server error? error due to the reasons which are directly associated to your OS or Hardware constraints it can be some permissions issue memory limit issue version(s) related issue anything which is required to run your script properly but directly to your server on which your website is hosted

August 29, 2012

SyntaxError: unterminated string literal – PHP/XHTML String

SyntaxError: unterminated string literal – PHP/XHTML String <?php $string = addslashes(preg_replace(“/[\r\n]+/”,’ ‘,(preg_replace(‘/\s\s+/’, ‘ ‘, include(“xhtml_page.php”)))); ?> Note: New lines in string will be removed and the string will be a valid string instead of unterminated string in javascript. <script type=”text/javascript” language=”javascript”>var js_str = ‘<?php echo $string; ?>’;</script>

August 16, 2012

onKeypress enter return false;

onKeypress enter return false; function checkEnter(e){ var key; if (window.event) key = window.event.keyCode; else if (e) key = e.which; var ret = ((key) != 13); return ret; }

August 15, 2012

JavaScript Replace All Function

JavaScript Replace All Function function replaceSubstring(inSource, inToReplace, inReplaceWith) { return inSource.replace(new RegExp(inToReplace, ‘g’),inReplaceWith); }

August 8, 2012

Current Week No. PHP Function

Current Week No. PHP Function if(!function_exists(‘current_week_no’)) { function current_week_no() { $current_date = date(‘Y-m-d’); $date_part = explode(‘-‘, $current_date); $date_part[2] = ’01’; $start_of_month = implode(‘-‘, $date_part); $day_for_first = date(‘N’, strtotime($start_of_month)); $day_for_month = date(‘j’, strtotime($current_date)); $current_month_current_week = floor(($day_for_first + $day_for_month – 1) / 7) + 1; $last_month = (date(‘m’)-1); $week_limit_of_last_month = $last_month*4; $return = $week_limit_of_last_month+$current_month_current_week; return $return; } […]

August 1, 2012

Database caching can be a reason of data redundancy

Database caching can be a reason of data redundancy Database caching brings the convenience of result set already fetched and stored in files. I am sharing a situation which i faced twice but still i sometimes forget to avoid. The thing is to validate a record in database that either it exists or not? If […]

Database caching and sql injection prevention

Database caching and sql injection prevention Most probably this term “database caching” will be new for the beginners or the developers who are not using such php frameworks which provide this facility. I am talking about one of those which is codeigniter. Database caching in fact caches those queries which fetch the records from database […]