Posted by Mohammad Sajjad Hossain on August 26th, 2008
PHP is a very flexible language. But sometimes this flexibility creates security flaws because of improper use of it. I had just read an article “Top 7 PHP Security Blunders” by Pax Dickinson. It shows top 7 mistakes or flaws that may break site security.
“Security is a process, not a product, and adopting a sound approach to security during the process of application development will allow you to produce tighter, more robust code.” - Pax Dickinson
In this article the author has shown how PHP application be infected and how to protect it. He has described the followings with reference to different articles:
- Unvalidated Input Errors
- Access Control Flaws
- Session ID Protection
- Cross Site Scripting (XSS) Flaws
- SQL Injection Vulnerabilities
- Error Reporting
- Data Handling Errors
- Configuring PHP For Security
I found this article knowledgeable. Hope you will like it. You may read it from here http://www.sitepoint.com/article/php-security-blunders.
I want to conclude with lines from this article…
“…there are many things to be aware of when programming secure PHP applications, though this is true with any language, and any server platform. PHP is no less secure than many other common development languages. The most important thing is to develop a proper security mindset and to know your tools well…”
Posted in PHP | No Comments »
Posted by Mohammad Sajjad Hossain on July 15th, 2008
This class can be used to create email account and mail forwarders using PHP, without logging to cPanel. It is an extension of script made by www.zubrag.com. You can access the original link from here http://www.zubrag.com/scripts/cpanel-create-email-account.php. And it is also a modified version of the class “cpmail” which was coded by Md. Zakir Hossain (Raju), http://www.rajuru.xenexbd.com.
How to configure:
- Download the zipped file.
- Unzip the file. This file contains the class file and an example file.
- Open the class file and change these variables -
- $currentTheme - Your cPanel theme
- $userName - Your cPanel user name
- $password - Your cPanel password
- $domain - Your cPanel domain
- $cPanelPort - Your cPanel port [optional]
- Include the class in the file where you want to use it.
Example:
// include the class file
include('class.cpmailmanager.php');
// create an instanse of the class
$cp = new CPMailManager();
// create an email account
$cp->createEmail(’sadat’, ’sadat123′, 10);
if($cp->status) //account created successfully
{
echo ‘Mail created successfully’;
}
else
{
echo $cp->message;
}
// create mail forwarder
$cp->createForwarder(’sadat’, ‘msh134@gmail.com’);
echo ‘<br />’ . $cp->message;
// delete mail forwarder
$cp->deleteForwarder(’sadat’, ‘msh134@gmail.com’);
echo ‘<br />’ . $cp->message;
// delete email account
$cp->deleteEmail(’sadat’);
echo ‘<br />’ . $cp->message;

Posted in DOMPDF, Miscellaneous, My Works, PHP | No Comments »
Posted by Mohammad Sajjad Hossain on June 28th, 2008
For some days I was thinking to update my site to latest version of WordPress. But I was not sure how much time will take to complete the task and what complexity I will have to face.
Today is my holiday and I am a little bit free today. So, I decided to upgrade my WordPress setup. Taking a deep breath I started reading the “Upgrading WordPress - Three Step Upgrade“ guide. Followed the instruction carefully and within half an hour I was able to upgrade it successfully. I found this process very easy and less time consuming.
Thanks WordPress!
Posted in Miscellaneous | 1 Comment »
Posted by Mohammad Sajjad Hossain on June 21st, 2008
I have modified the plugin for DOMPDF which is found in CodeIgniter forum. I have added the paper size and orientation parameters. Here is the code to share with you.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function pdf_create($html, $filename, $stream=true, $papersize = 'letter', $orientation = 'portrait')
{
require_once("dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper($papersize, $orientation);
$dompdf->render();
if ($stream)
{
$options['Attachment'] = 1;
$options['Accept-Ranges'] = 0;
$options['compress'] = 1;
$dompdf->stream($filename.”.pdf”, $options);
}
else
{
write_file(”$filename.pdf”, $dompdf->output());
}
}
?>
Posted in CodeIgniter, DOMPDF, PHP | 10 Comments »
Posted by Mohammad Sajjad Hossain on June 21st, 2008
I was implementing PDF generation in one of projects which is built with CodeIgniter. I searched for PDF support for CodeIgniter and found help on CI forum. I followed the instruction given there and used DOMPDF. The result was satisfactory though I faced an issue. I was happy, but the problem was with the PDFLib. Its not free and our client would not buy it. I thought that DOMPDF will not work without the help of PDFLib. Soon I loss my happiness and started looking for an alternate solution. Then our team decided to use HTML2FPDF. But the result was not satisfactory. We had to rewrite our html files. It was lacking lots of HTML support. I was not happy with the output. So I started googling again for a PDF library. While searching I came accross a library called HTML2PS/HTML2PDF. But, it seemed to me complex. I again started searching for any solution which will help me use DOMPDF in my project without PDFLib. At last I got the solution from DOMPDF site ;).
“…Edit dompdf_config.inc.php to fit your installation. If you leave the DOMPDF_PDF_BACKEND setting at ‘auto’ dompdf will use PDFLib if it is installed, otherwise it will use the bundled R&OS CPDF class…”
I was very much happy to read this. I might have missed this while installing DOMPDF for the first time. Thanks DOMPDF for a nice interface and output. Really DOMPDF made our coding not just easy, but saved our times :).
Posted in DOMPDF, PHP | No Comments »