PHP

09
Apr
2011
admin

Managing Cron Jobs with PHP

Background – An Overview of the Crontab

Let’s face it, having the ability to schedule tasks to run in the background is just great! From backing up an SQL database, fetching / sending emails to running clean up tasks, analyzing performance, or even grabbing RSS feeds, cron jobs are fantastic!

Although the syntax of scheduling a new job may seem daunting at first glance, it’s actually relatively simple to understand once you break it down. A cron job will always have five columns each of which represent a chronological ‘operator’ followed by the full path and command to execute:

  1. * * * * * home/path/to/command/the_command.sh  

Each of the chronological columns has a specific relevance to the schedule of the task. They are as follows:

  • Minutes represents the minutes of a given hour, 0-59 respectively.
  • Hours represents the hours of a given day, 0-23 respectively.
  • Days represents the days of a given month, 1-31 respectively.
  • Months represents the months of a given year, 1-12 respectively.
  • Day of the Week represents the day of the week, Sunday through Saturday, numerically, as 0-6 respectively.
  1. Minutes [0-59]  
  2. |   Hours [0-23]  
  3. |   |   Days [1-31]  
  4. |   |   |   Months [1-12]  
  5. |   |   |   |   Days of the Week [Numeric, 0-6]  
  6. |   |   |   |   |  
  7. *   *   *   *   * home/path/to/command/the_command.sh  

So, for example, if one wanted to schedule a task for 12am on the first day of every month it would look something like this:

  1. 0 0 1 * * home/path/to/command/the_command.sh  

If we wanted to schedule a task to run every Saturday at 8:30am we’d write it as follows:

  1. 30 8 * * 6 home/path/to/command/the_command.sh  
02
Mar
2010
admin

Simple Math Question Captcha Component

I don’t like CAPTCHAs. I don’t know anyone who does.The downfalls of CAPTCHAs are many - hard to read, annoying, impossible for those with vision difficulties - and the benefits are slim. So, I came up with an alternative: a plain text math question to ask the user. This component generates a random equation and registers the answer as a session variable. The programmer can then check the form submitter’s answer against the session-registered answer using the validation function provided in the component.

02
Mar
2010
admin
07
Jan
2010
admin

Upgrading From Drupal 5 To Drupal 6

Before you get started I recommend that you take a look at Greg's upgrade video at http://www.masteringdrupal.com/screencast/upgrading-to-drupal-6. I watched it and it definitely helped with the process.

The upgrade process took me two hours. If you are using Drupal for a single user blog site, and are making minimum use of CCK and Views then I think that you should be able to execute the upgrade in the same amount of time it took me. If you're running a community site with a lot of content, a few custom content types with associated views then you're probably looking at three to four hours.

Tags: 
19
Dec
2009
admin

installing WAMP Server (Apache, PHP, MySQL, and phpMyAdmin)

WampServer is a Windows web development environment. It allows you to create web applications with Apache, PHP and the MySQL database. It also comes with PHPMyAdmin to easily manage your databases.

WampServer installs automatically (installer), and its usage is very intuitive. You will be able to tune your server without even touching the setting files.

 

19
Dec
2009
admin

XAMPP ইনস্টলেশন শর্টকার্ট ও শুরু (উইন্ডোজ)

উইন্ডোজ পরিবেশে ম্যানুয়ালি সবকিছু সেটাপ শিখতে গিয়ে যেসকল নবীন ডেভেলপাররা হোচট খেয়েছেন তাদের জন্য খুব আনন্দের খবর হচ্ছে কোন রকম ঝামেলা ছাড়াই উইন্ডোজ পরিবেশে ওয়েব ডেভেলপ করার পরিবেশ তৈরি করা সম্ভব। এর জন্য খুব জনপ্রিয় দু’টি প্যাকেজ (XAMPP, WAMP) আছে যাতে Apache, PHP, MySQL সহ আরো বেশ কিছু প্রয়োজনীয় টুল একত্রে কনফিগার করে দেয়া থাকে। এদের যেকোন একটি সংগ্রহ করে সাধারণ যেকোন সফটওয়্যারের মত সেটাপ করে নিলেই ওয়েব ডেভেলপ করার প্রয়োজনীয় পরিবেশ তৈরি হয়ে যাবে। XAMPP এবং WAMP নামের এই প্যাকেগুলো থেকে আমরা অধিক জনপ্রিয় XAMPP-কে বেছে নিচ্ছি। চলুন খুব সংক্ষেপে এটি সংগ্রহ, ইনস্টলেশন ও সাধারণ ব্যবহারবিধি জেনে নেই-

Tags: 
17
Aug
2009
admin

Disable PHP's Bad Features

Register Globals (register_globals):
Whether or not to register the EGPCS (Environment, GET, POST, Cookie, Server) variables as global variables.
We cannot disable register_globals from the script side (using ini_set, like we normally might), but we can use an .htaccess files to do this. Some hosts also allow you to have a php.ini file on the server.

Disabling with .htaccess
php_flag register_globals 0

Disabling with php.ini
register_globals = Off
 

05
Aug
2009
admin

Develope Bangla Unicode based Web Application using PHP-MySQL

1 .Make the database and Tables with CHARACTER utf8 and collation_connection =’utf8_general_ci’
2 . Must add following two lines just after selecting the database, i.e mysql_select_db() function:
mysql_query(’SET CHARACTER SET utf8′);
mysql_query(”SET SESSION collation_connection =’utf8_general_ci’”);
4 . Set the META-TAG as “Content-Type: text/html; charset=UTF-8″

19
May
2009
admin

Awesome Event of "phpXperts Yahoo Group" is "PHP Seminar 2009: Current Development Trends" at Brac University Seminar Hall

পূর্বের ঘোষণা অনুযায়ী ৯ মে অনুষ্ঠিত হওয়ার কথা থাকলেও শেষ পর্যন্ত ১৬ মে অনুষ্ঠিত হয় পিএইচপি এক্সপার্টস্ ইয়াহূ গ্রুপের সেমিনার - PHP Seminar 2009: Current Development Trends. সেমিনার শুরু হওয়ার কথা ৩টা ১০মিনিটে ব্রাক ইউনির্ভাসিটির সেমিনার হলে হলেও কয়েক মিনিট দেরিতে হাসিন হায়দার অনুষ্ঠান শুরু করেন। এই সেমিনারে প্রায় ১৬০‍‍‌‌-১৭০ জন উপস্থিত হয়, যারা হল বাংলাদেশের পিএইচপি এক্সপার্ট ও বিগিনার । কিভাবে পিএইচপি প্রোগ্রামার হিসাবে নিজেকে গড়ে তুলতে হবে এটাই মূল বিষয়। এই সেমিনারে যেসব বিষয়ে আলোচনা করা হয়েছে তার অধিকাংশই ব্যবহার করি অথবা জানি । তারপরেও, এইরকম সফল ও সুন্দর সেমিনার আয়োজন করায় আয়োজকদের জানায় আন্তরিক অভিনন্দন।
Tags: 
07
May
2009
admin

Data Filtering in PHP

Data Filtering extension filters data by either validating or sanitizing it. This is especially useful when the data source contains unknown (or foreign) data, like user supplied input. For example, this data may come from an HTML form.
There are two main types of filtering: validation and sanitization.
Validation is used to validate or check if the data meets certain qualifications. For example, passing in FILTER_VALIDATE_EMAIL will determine if the data is a valid email address, but will not change the data itself.
Sanitization will sanitize the data, so it may alter it by removing undesired characters. For example, passing in FILTER_SANITIZE_EMAIL will remove characters that are inappropriate for an email address to contain. That said, it does not validate the data.
Tags: 
20
Apr
2009
admin

Dynamic Date Time Dropdown List

The menu is generated using PHP and all values default to current values for year, month, day, and hour. These values can be set along with the name and id of each element.

Tags: 
25
Jan
2009
admin

Cheat Sheets Collection of PHP, MySQL, Javascript, CSS, JQuery, HTML

PHP Cheat Sheet

The PHP cheat sheet is a one-page reference sheet, listing date format arguments, regular expression syntax and common functions and designed to make life a bit easier. A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size PHP cheat sheet.

1.      PHP cheat sheet -1 or PHP Cheat Sheet (V1)

25
Jan
2009
admin

Learn PHP from Scratch

PHP stands for Hypertext Preprocessor. While other languages, like Javascript, function on the client-side, your PHP code will execute on the server level. It works seamlessly with our HTML. Furthermore, your PHP can be embedded within your HTML and vice versa. The important thing to remember is that, no matter how complicated your PHP is, it will ultimately be output as simple HTML.

07
Jan
2009
admin

Customize a PHP configuration file at Runtime

You can change your php.ini file configuration at runtime using PHP scripts. Customize such settings as whether global variables are turned on, the default directory to upload files to when writing upload scripts, and the maximum allowed size for uploaded files.

PHP Options and Information functions enable you to get a lot of information about PHP itself, e.g. runtime configuration, loaded extensions, version and much more. You'll also find functions to set options for your running PHP.

21
Dec
2008
admin

PHP Coding Standard

"A coding standards document tells developers how they must write their code. Instead of each developer coding in their own preferred style, they will write all code to the standards outlined in the document. This makes sure that a large project is coded in a consistent style — parts are not written differently by different programmers.

Tags: 

Pages

Subscribe to RSS - PHP