Here is a quick thing to help you fetch clean data from GET POST COOKIE and REQUEST input variables. Of course, you need to rely on something like mysql_real_escape_string before writing this into a database. But a common function like this for the entire Web App will keep the data safe from slashes and helps you code without bothering whether magic_quotes_gpc is ON or OFF.
/**
* Use this function to safely retreive data from GET POST COOKIE and REQUEST super globals
*
* @param String $_key Name of the POST element to be retrieved
* @return String Clean value without any slashes even if magic_quotes_gpc is enabled.
*/
function getFromGpc($_key, $_source='p')
{
$_source = strtolower($_source);
if( $_source == 'p' ):
if( get_magic_quotes_gpc() ) {
return stripslashes($_POST[$_key]);
} else {
return ($_POST[$_key]);
}
elseif( $_source == 'g' ):
if( get_magic_quotes_gpc() ) {
return stripslashes($_GET[$_key]);
} else {
return ($_GET[$_key]);
}
elseif( $_source == 'c' ):
if( get_magic_quotes_gpc() ) {
return stripslashes($_COOKIE[$_key]);
} else {
return ($_COOKIE[$_key]);
}
elseif( $_source == 'r' ):
if( get_magic_quotes_gpc() ) {
return stripslashes($_REQUEST[$_key]);
} else {
return ($_REQUEST[$_key]);
}
else:
if( get_magic_quotes_gpc() ) {
return stripslashes($_REQUEST[$_key]);
} else {
return ($_REQUEST[$_key]);
}
endif;
}
I found these plugins to be very useful. Not sure if there is a new version of it. Worth trying.
tablesorter:
1) http://tablesorter.com/docs/
2) http://tablesorter.com/docs/example-pager.html
New to CodeIgniter and looking for a example that helps you learn how a Model is written? or how form_valdiation library is used? and how to integrate SWFUpload?
Here is a nice example:
doxentral
Useful links:
CodeIgniter
ColorBox jQuery Plugin
Session class does not support a change of session ID (Facebook and Flash problem)
SWFUpload
WoW! Google Chrome now has <a href=”https://chrome.google.com/extensions?hl=en-US”>extensions</a> and bookmark sync. New area for developers to play.
Just tried a few recent/popular extensions. They are superb. The Evernote Web Clipper, Dictionary, FireBug and Calendar extensions are worth trying…That’s not all, you can now sync your Bookmarks with Google Docs!!
Here is an example to allow File Uploads upto 2 GB. You may also have to consider Max Execution Time.
PHP4:
<IfModule mod_php4.c>
php_value upload_max_filesize 2G
php_value post_max_size 2G
</IfModule>
PHP5:
<IfModule mod_php5.c>
php_value upload_max_filesize 2G
php_value post_max_size 2G
</IfModule>
Finally, figured out how to find those hiding unread messages in my GMail Inbox or other folders. aah! A quick relief. Always hated going down the pages and finding the mails in some 20th or 40th page.
You can just use “is:unread in:inbox” to search all unread mails in the Inbox. Without quotes though!
Finally, found two new Libraries that makes a PHP programmer’s life easy. Tested both and they seem to work pretty fine for simple requirements like PDF receipt generation or news letter download or e-Ticket/e-Cert generation.
FPDF (PHP4 and PHP5)
dompdf (PHP5 Only)
Happy PDFing!!
Posted in PHP
|
Tagged dompdf, FPDF, HTML to PDF
|
You ever got this error on your WorldPay Installation?
“Cannot find an available route for the purchase. This may be caused by merchant configuration or remote systems failures”
Then, you might be trying to charge something really less than 1.0 USD/EUR/GBP! Yes, that’s what I was doing too! None of the forums had an answer and had to spend 48 hours to find out reason and get it to work. Dear Google: Index this fast!
Here are two good sites I came across. Like them both for their brilliant look and speed.
http://www.webappers.com/
http://my.lovelycharts.com/
Hi All,
Thanks and GoodBye 2008
Thanks for giving us stable PHP5 builds and MySQL builds! The time has really turned well for OpenSource, especially for LAMP stack. We wish to do a lot of useful, productive work using LAMP in the new year! Here is a blog dedicated to that!!
Wishing all the readers
A Happy and Prosperous New Year 2009
Posted in General
|
Tagged New Year
|