Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Monday, March 05, 2012

Useful links for integrating Twitter with PHP.

Useful links for XML Parsing using jQuery/PHP.

Friday, August 21, 2009

Constructors

Constructors are functions in a class that are automatically called when you create a new instance of a class with new. A function becomes a constructor, when it has the same name as the class. If a class has no constructor, the constructor of the base class will be called, if it exists.

Monday, August 17, 2009

Caching your pages with PhP

In the modern days, most of the sites are database driven. That means that your site is actually an application which retrieves data from a DBMS ( database managment system, eg MySQL) , parses the data and shows the result to the user. Most of these data are usually don't change frequently or don't change at all, and the reason that we use the database is that we can easilly update the site and the content.

A problem that this process creates is the server overhead. Every time we execute a query in the database, the instance of our script will call the DBMS, and then the DBMS will send the results of the query. This is time consuming, and especcially for sites with heavy traffic is a real big problem.

How to Create an RSS Feed for Your Site in PHP

Most blogging platforms come with built-in support for RSS feeds. Why? It’s a great way for users to keep up to date on your new content. Instead of loading up a dozen favorite sites, they can look at one feed reader and then decide what to pursue further.

So what if you don’t use a blogging platform or CMS that creates a feed for you? You can create one yourself in PHP. It’s pretty simple.

PHP and AJAX - Make a Password Strength Bar that Updates in Real-time

This tutorial will show you how to make a very simple feature which will help your users make more secure passwords, in registration forms. After the user types their password, this script will make a request to a PHP page, which will check the password for lowercase letters, uppercase letters, numbers and symbols. Without reloading the page, a bar displaying the strength of the password will be shown to the user.

Facebook like multi Toggle Comment Box with jQuery and PHP.

Implement Facebook like toggle comment box for every updated wall. Here is a simple example which contains of very simple jQuery and PHP code.

Thursday, August 06, 2009

MySQL Commands

This article has a list of handy MySQL commands that we use time and time again. At the bottom are statements, clauses, and functions we can use in MySQL. Below that are PHP and Perl API functions we can use to interface with MySQL. To use those PHP need to build with MySQL functionality. To use MySQL with Perl the Perl modules DBI and DBD::mysql must be configured.

Monday, August 03, 2009

Building an IP-to-Country Mapping Application with PHP

Table of Contents:

1. Building an IP-to-Country Mapping Application with PHP
2. Start building an IP-to-country PHP application
3. Transferring the data of the IP-to-country database to the MySQL table
4. Importing records of the IP-to-country database to the MySQL table

Building a Database-Driven Application with the Code Igniter PHP Framework

This article explains the below.

1. Introducing the Code Igniter PHP framework
2. Retrieving user-related data from a MySQL table
3. Defining a controller class
4. Outputting user-related data with Code Igniter

Creating and Parsing JSON data with PHP

This article describes about what is JSON and how we can handle it via PHP. Although, JSON stands JavaScript Object Notation, it is used by many other technologies like PHP and Java for data interchange format over the Internet.

Monday, July 27, 2009

PHP Tutorial on Classes, Inheritance, Polymorphism, Magic Methods & Exceptions

This page will consist of various articles and tutorials on PHP, e.g.: PHP5 Tutorial, PHP Examples, PHP Class, etc. Read on to find out.

Image watermark with PHP

To prevent quality images being stolen, we can use PHP to watermark web-images in popular formats like GIF/PNG/JPEG. We print a transparent gif-image on a jpeg-photo in this tutorial. For best results use gif than png, because some png formats require extra functions to print a transparent image. We can convert this script to a batch-watermarker easily to watermark photo albums/galleries with multiple pictures by putting code in a loop or create a function.

Steps:

1.Load both images
2.Get size of both images
3.Copy watermark to main image
4.Print image to screen

How to Implement Text to Speech in PHP

Festival, application allows us to convert Text to Speech(WAV) format. In this article we will learn on how we can convert text to speech from PHP applications.

Facebook like Autosuggestion with jQuery, Ajax and PHP.

This article shows how to implement Autosuggestion search with jquery...

MySql Prepared Statement in PHP

Prepared Statements are always better than normal statements as it prevent SQL Injection etc. This article will discuss on how we can make Prepared Statement Call to MySql Database Call using MySqli Extension of PHP.

Getting Started with Drizzle and PHP

When It Rains, It Drizzles
Unless you've been completely out of touch with the open source world, you'll have heard of Drizzle, a new database server that's derived from MySQL. The Drizzle project aims to build a "smaller, lighter, faster" version of MySQL that offers similar stability and ease of use, but strips out certain features from the core system in order to improve performance and scalability.

Now, while Drizzle is still relatively new, it is quickly gaining attention among open source developers who are interested in experimenting with it, contributing to it, and using it in their projects. And that's where this article comes in. Over the next few pages, I'll guide you through the process of getting started with Drizzle, showing you how to compile and install it, set up a Drizzle database, and connect to it using PHP. Let's get started!

Thursday, July 16, 2009

PHP performance tips

1. Profile your code to pinpoint bottlenecks
2. Upgrade your version of PHP
3. Use caching
4. Use output buffering
5. Don't copy variables for no reason
6. Avoid doing SQL queries within a loop
7. Use single-quotes for long strings
8. Use switch/case instead of if/else

Wednesday, July 01, 2009

10 Useful PHP Tips

1. Use an SQL Injection Cheat Sheet
2. Know the Difference Between Comparison Operators
3. Shortcut the else
4. Drop Those Brackets
5. Favor str_replace() Over ereg_replace() and preg_replace()
6. Use Ternary Operators
7. Memcached
8. Use a Framework
9. Use the Suppression Operator Correctly
10. Use isset() Instead of strlen()

PHP File Upload Security Ideas

When you allow users to upload files to your website, you are putting yourself at a security risk. While nobody is ever completely safe, here are some precautions you can incorporate to make your site safer.

1.Check the referrer: Check to make sure that the information being sent to your script is from your website and not an outside source. While this information can be faked, it's still a good idea to check.

2.Restrict file types: You can check the mime-type and file extension and only allow certain types to be uploaded.

3.Rename files: You can rename the files that are uploaded. In doing so, check for double-barreld extensions like yourfile.php.gif and eliminate extensions you don't allow, or remove the file completely.

4.Change permissions: Change the permissions on the upload folder so that files within it are not executable. Your FTP program probably allows you to chmod right from it.

5.Login and Moderate: Making your users login might deter some deviant behavior. You can also take the time to moderate all file uploads before allowing them to become live on the web.