PelaPHPtutorials.com http://www.pelaphptutorials.com/rss http://www.pelaphptutorials.com Last Tutorials Articles en-en contact@pelaphptutorials.com Copyright 2017 http://www.pelaphptutorials.com/ Instalation of Apache server on windows http://www.pelaphptutorials.com/article/instalation-of-apache-server-on-windows.html http://www.pelaphptutorials.com/article/instalation-of-apache-server-on-windows.html Apache is one of the most spreaded web servers in the world, who is working on 56% from the web servers. Tue, 31 Jan 2012 22:12:13 +0000 Manipulating of given values http://www.pelaphptutorials.com/article/manipulating-of-given-values.html http://www.pelaphptutorials.com/article/manipulating-of-given-values.html The HTML script in the example above is giving to the client to put two numbers and after that to choose matematic operation, which will be provided. When the script will be put on server, theese values are sending on PHP scrip for processing, and the name of the PHP script is matematic.php. Thu, 03 Mar 2011 12:13:25 +0000 PHP online registrations for cars http://www.pelaphptutorials.com/article/php-online-registrations-for-cars.html http://www.pelaphptutorials.com/article/php-online-registrations-for-cars.html This is small not so confusing php script for online registration for cars. Sat, 26 Feb 2011 12:58:42 +0000 PHP Simple example of using get and post http://www.pelaphptutorials.com/article/php-simple-example-of-using-get-and-post.html http://www.pelaphptutorials.com/article/php-simple-example-of-using-get-and-post.html In this tutorial we are going to talk about the difference of POST and GET method and show you with simple examples how you can use them for sending data from forms. First of lets start with the GET method. The GET method is primarily used for passing along data that you would need on other pages through the URL, and it’s considered a less secured way then the POST method. Sun, 20 Feb 2011 23:31:55 +0000 CodeIgniter Cart library doesnt support cyrillic characters in the product name http://www.pelaphptutorials.com/article/codeigniter-cart-library-doesnt-support-cyrillic-characters-in-the-product-name.html http://www.pelaphptutorials.com/article/codeigniter-cart-library-doesnt-support-cyrillic-characters-in-the-product-name.html Web Developer is happy people no they don't. Why? When you start some new project u must become Lawyer, Doctor, priest etc.. to understand other cultures, their customs, alphabets religious prohibitions, whether written from left to right or vice versa, which encoding they use and similar trifles. And after that your starting with your technical "highly technological problems" Developing one project for Cyrillic alphabet region i had problem with Codeignatier Cart library because by default CI Cart Library support only Latin charters . Bright side of the coin is that someone before me already had the same problem Sat, 22 Jan 2011 06:18:06 +0000 PHP Fatal Error Fix: Can’t use method return value in write context http://www.pelaphptutorials.com/article/php-fatal-error-fix-can-rsquo-t-use-method-return-value-in-write-context.html http://www.pelaphptutorials.com/article/php-fatal-error-fix-can-rsquo-t-use-method-return-value-in-write-context.html PHP Fatal Error Fix: Can’t use method return value in write context. Very nice error in very bad moment but very very logical error. When i got this error in my code i was confused Sun, 09 Jan 2011 03:18:41 +0000 Matching variables and DB columns http://www.pelaphptutorials.com/article/matching-variables-and-db-columns.html http://www.pelaphptutorials.com/article/matching-variables-and-db-columns.html One frequent use for PHP objects in database-driven systems is as a wrapper around the entire database API. The theory is that the wrapper insulates the code from the specific database system, which will make it trivial to swap in a different RDBMS when the technical needs change. (We’ve never seen it work out quite this way in practice, but . . . don’t get us started.) Another use that is almost as common (and that your authors like better) is to have object instances correspond to database result rows. Fri, 07 Jan 2011 06:10:14 +0000 Sleeping and waking up in PHP http://www.pelaphptutorials.com/article/Sleeping-and-waking-up-in-PHP.html http://www.pelaphptutorials.com/article/Sleeping-and-waking-up-in-PHP.html PHP provides a hook mechanism so that objects can specify what should happen just before serialization and just after unserialization. The special member function __sleep() (that’s two underscores before the word sleep), if defined in an object that is being serialized, will be called automatically at serialization time. It is also required to return an array of the names of variables whose values are to be serialized. Tue, 30 Nov 2010 23:11:32 +0000 Serialization of data in PHP http://www.pelaphptutorials.com/article/serialization-of-data-in-PHP.html http://www.pelaphptutorials.com/article/serialization-of-data-in-PHP.html Serialization of data means converting it into a string of bytes in such a way that you can produce the original data again from the string (via a process known, unsurprisingly, as unserialization). After you have the ability to serialize/unserialize, you can store your serialized string pretty much anywhere (a system file, a database, and so on) and recreate a copy of the data again when needed. Sun, 28 Nov 2010 00:00:00 +0000 Do Web-Scripting Languages Really Need OOP? http://www.pelaphptutorials.com/article/DoWeb-Scripting-Languages-Really-Need-OOP.html http://www.pelaphptutorials.com/article/DoWeb-Scripting-Languages-Really-Need-OOP.html The object-oriented revolution has not been without controversy. Although many programmers embraced OOP quickly, others preferred the procedural approach they were used to and wondered aloud if the extra machinery needed to support OOP wasn’t more trouble than it was worth. Still, there’s no doubt that the revolution has largely succeeded. Thu, 25 Nov 2010 00:00:00 +0000 Simulating method overloading http://www.pelaphptutorials.com/article/Simulating-method-overloading.html http://www.pelaphptutorials.com/article/Simulating-method-overloading.html One neat trick offered by some OOP languages (and not offered by PHP) is automatic overloading of member functions. Thu, 25 Nov 2010 00:00:00 +0000 Data Protection in PHP http://www.pelaphptutorials.com/article/data-protection-in-php.html http://www.pelaphptutorials.com/article/data-protection-in-php.html The reason to use classes is that they provide data protection; that is, classes prevent a programmer from making logic errors in dealing with complex data structures. Fri, 12 Nov 2010 00:00:00 +0000 PHP Login script http://www.pelaphptutorials.com/article/php-login-script.html http://www.pelaphptutorials.com/article/php-login-script.html This is a sophisticated PHP Login script. In this Login script we are going to create one database table called members. Than we create php file called main_login.php that would be the form where to put your information. Wed, 10 Nov 2010 00:00:00 +0000 PHP practical example using sessions with private content login system http://www.pelaphptutorials.com/article/PHP-practical-example-using-sessions-with-private-content-using-login-system.html http://www.pelaphptutorials.com/article/PHP-practical-example-using-sessions-with-private-content-using-login-system.html A few days ago the students of Faculty of Informatics in some place got a exam One of the tasks was to make a 3 pages. page3.php is private and should login with username and password. The structure of the task is.. Tue, 09 Nov 2010 20:32:04 +0000 How To Choose A Successful Freelancer Nickname? http://www.pelaphptutorials.com/article/how-to-Choose-A-Successful-Freelancer-Nickname.html http://www.pelaphptutorials.com/article/how-to-Choose-A-Successful-Freelancer-Nickname.html Searching the internet I found a pretty good text for the importance of the nickname in the online freelance jobs. I want to share with you hope it will help for future projects. In order to get yourself known on freelancing markets, what you need is a seller profile. It is best that your profile is as complete as possible, because it will act as a recommendation card for all the buyers that will show interest in you, from the moment you place a bid on one of their projects. Fri, 05 Nov 2010 23:03:55 +0000 Sending upload file with email notify http://www.pelaphptutorials.com/article/sending-upload-file-with-email-notify.html http://www.pelaphptutorials.com/article/sending-upload-file-with-email-notify.html Sending email notify with stored content wants a good knowledge of email formats. On the first place in the basic stuff is "Content-type": needs to declare the content as "multipart/mixed". Tue, 26 Oct 2010 23:00:00 +0000 PHP upload form http://www.pelaphptutorials.com/article/php-upload-file.html http://www.pelaphptutorials.com/article/php-upload-file.html Hello everyone, this is a simple PHP form for uploading files. We are going to show you how to create form for upload files. Wed, 20 Oct 2010 23:00:00 +0000 Using curl to Query Remote Servers http://www.pelaphptutorials.com/article/using-curl-to-query-remote-servers.html http://www.pelaphptutorials.com/article/using-curl-to-query-remote-servers.html curl is the client URL function library. PHP supports it through libcurl. To enable support for libcurl when installing PHP add --with-curl=[location of curl libraries] to the configure statement before compiling. Tue, 05 Oct 2010 00:00:00 +0000 0.mk shorten url service api Codeigniter library how to? http://www.pelaphptutorials.com/article/short-url-0-mk-service-api-class.html http://www.pelaphptutorials.com/article/short-url-0-mk-service-api-class.html For developing a php project I've needed web service for making shorter url addresses Main conditions for selection of such a service were: speed of service have api easy implementation of the api and very short domain Thu, 23 Sep 2010 02:19:38 +0000 chop() - string function http://www.pelaphptutorials.com/article/chop-strin-function.html http://www.pelaphptutorials.com/article/chop-strin-function.html The chop() function will remove a white space or other predefined character from the right end of a string. Mon, 06 Sep 2010 00:00:00 +0000 base64_encode http://www.pelaphptutorials.com/article/base64-encode.html http://www.pelaphptutorials.com/article/base64-encode.html Encodes the given data with base64. Sun, 05 Sep 2010 00:00:00 +0000 base64_decode http://www.pelaphptutorials.com/article/base64-decode.html http://www.pelaphptutorials.com/article/base64-decode.html base64_decode — Decodes data encoded with MIME base64 Sun, 05 Sep 2010 00:00:00 +0000 MySQL Deleting Anonymous Accounts security tip http://www.pelaphptutorials.com/article/mysql-deleting-anonymous-accounts-security-tip-one.html http://www.pelaphptutorials.com/article/mysql-deleting-anonymous-accounts-security-tip-one.html When you install MySQL on Windows, it automatically creates some accounts for you. On Linux, this happens when you run the mysql_install_db script. Two of these accounts are anonymous; they represent the account you get when you don't specify a username. One has a host value of localhost and the other % (any other host, so effectively any remote connection). These accounts have no passwords set by default. You can probably already see where we're going with this, but we strongly recommend that you delete these accounts. Sat, 04 Sep 2010 15:28:28 +0000 MySQL compiling and Linking for Speed http://www.pelaphptutorials.com/article/mysql-compiling-and-linking-for-speed.html http://www.pelaphptutorials.com/article/mysql-compiling-and-linking-for-speed.html You may be able to get a performance improvement from your server by downloading the source version and compiling it yourself. Specifically, if you have a Pentium-based machine and run Linux, you will be able to get a significant performance increase by compiling MySQL with the pgcc compiler, which optimizes for Pentium only. Sat, 04 Sep 2010 11:43:39 +0000 addslashes() String Function http://www.pelaphptutorials.com/article/addslashes-string-function.html http://www.pelaphptutorials.com/article/addslashes-string-function.html addslashes() is usually used to prepare a string for storage in a database or some kind of delimited format such as comma-separated values (CSV). The function places a single backslash in front of any backslashes (\), quotes (" or '') or null (\0) bytes in the string argument. Thu, 02 Sep 2010 00:00:00 +0000 String Functions http://www.pelaphptutorials.com/article/function-strings.html http://www.pelaphptutorials.com/article/function-strings.html This section contains functions that work with strings. Wed, 01 Sep 2010 00:36:00 +0000 Variable Functions http://www.pelaphptutorials.com/article/variables-functions.html http://www.pelaphptutorials.com/article/variables-functions.html This section contains functions that work with variables. Sun, 29 Aug 2010 13:49:00 +0000 Making a String Uppercase, Lowercase, or Capitalized http://www.pelaphptutorials.com/article/making-a-atring-uppercase-lowercase-or-capitalized.html http://www.pelaphptutorials.com/article/making-a-atring-uppercase-lowercase-or-capitalized.html One occasional problem with PHP is that MySQL supports case-insensitive character fields, but strings in PHP are case sensitive. In a query, MySQL makes no distinction between the words Ferrett, FERRETT, and FerReTt, but as strings in PHP, they have nothing in common. So in PHP you may need to change the case of characters in a string before you compare or print them. Sat, 28 Aug 2010 23:39:17 +0000 Generating Random Passwords http://www.pelaphptutorials.com/article/generating-random-passwords.html http://www.pelaphptutorials.com/article/generating-random-passwords.html Random (but difficult-to-guess) strings are important in user security. For example, if someone loses a password and you're using MD5 hashes, you won't be able to, nor should you want to, look it up. Instead, you should generate a secure random password and send that to the user. Another application for random number generation is creating activation links in order to access your site's services. Here is a function that creates a password: Sat, 28 Aug 2010 14:50:40 +0000 How to prevent hotlnik images from your site http://www.pelaphptutorials.com/article/how-to-prevent-hotlnik-images-from-your-site.html http://www.pelaphptutorials.com/article/how-to-prevent-hotlnik-images-from-your-site.html This is an example of how to protect the site direct links to your images from another site. For example a web master can set the site with high traffic and loads directly from your server. What can lead to high load on your server. The result is more costs and greater bandwidth occupation on your server. Sat, 28 Aug 2010 13:12:08 +0000 MySQL Creating Indexes http://www.pelaphptutorials.com/article/mysql-creating-indexes.html http://www.pelaphptutorials.com/article/mysql-creating-indexes.html Usually, you create all the indexes you need when you are creating tables. Any column declared as PRIMARY KEY, KEY, UNIQUE, or INDEX will be indexed. Sometimes you will find that you are running many queries based on an unindexed column, and in this situation, you can add an index using the CREATE INDEX statement. Interestingly enough, the CREATE INDEX statement is mapped to an ALTER TABLE statement before being executed. The ALTER TABLE statement can be used for this and many other purposes. Fri, 27 Aug 2010 13:18:35 +0000 MySQL Using TRUNCATE http://www.pelaphptutorials.com/article/mysql-using-truncate.html http://www.pelaphptutorials.com/article/mysql-using-truncate.html The TRUNCATE statement allows us to delete all the rows from a table. TRUNCATE is faster than a DELETE statement because it works by dropping the table and re-creating it empty. One thing to bear in mind is that TRUNCATE is not transaction safe. Thu, 26 Aug 2010 17:07:28 +0000 Compressing MyISAM Tables http://www.pelaphptutorials.com/article/compressing-myisam-tables.html http://www.pelaphptutorials.com/article/compressing-myisam-tables.html Although tables become static or dynamic without your specific request (but in response to your design decisions), tables are not automatically compressed. To compress a table, you need to use the command-line program myisampack. (There is a version of this for pure ISAM tables, should you be using them, which is called pack_isam.) Thu, 26 Aug 2010 16:00:07 +0000 MyISAM Tables http://www.pelaphptutorials.com/article/myisam-tables.html http://www.pelaphptutorials.com/article/myisam-tables.html Many people use MySQL for years without discovering that it offers different table types. These people are using MyISAM tables because this has been the default in all recent versions. MyISAM tables offer very fast but not transaction-safe storage. They provide high performance in most situations, even if the designer makes mistakes, and in the hands of a skilled administrator, they can handle massive and/or busy databases. Thu, 26 Aug 2010 15:10:35 +0000 Open Blog http://www.pelaphptutorials.com/article/open-blog-platform.html http://www.pelaphptutorials.com/article/open-blog-platform.html Open blog is a free and open source blogging platform built using the CodeIgniter PHP framework and released under the GPL v3 license. It provides users with a very powerful yet easy to use interface which makes blogging simple and enjoyable. They keep source base well factored so the developers can easier continue refining the development version, add their own modules and features, fix possible bugs, and most importantly, do their job. Wed, 25 Aug 2010 15:59:18 +0000 Edirectory fix catergory listing bug http://www.pelaphptutorials.com/article/e-directory-fix-catergory-listing-bug.html http://www.pelaphptutorials.com/article/e-directory-fix-catergory-listing-bug.html Maybe you have noted that when a listing is approved, you can not change the category of listing because category three is not showing. How to fix it: Mon, 09 Aug 2010 13:53:29 +0000 Displaying Time Left To a Date http://www.pelaphptutorials.com/article/displaying-time-left-to-a-date.html http://www.pelaphptutorials.com/article/displaying-time-left-to-a-date.html A PHP function to display the time between now and a future date supplied as Unix time, in human readable format, using two blocks of time periods (year, month, week, day, hour or minute.) Wed, 16 Jun 2010 00:00:00 +0000 PHP Detecting the Host Platform http://www.pelaphptutorials.com/article/php-detecting-the-host-platform.html http://www.pelaphptutorials.com/article/php-detecting-the-host-platform.html Detecting the Host Platform. Because different types of systems have different sets of host commands available, if you are writing a script that could potentially be executed on different platforms, it's useful to detect what kind of web server is being used. Tue, 09 Feb 2010 13:28:20 +0000 Why programmers are not paid in proportion to their productivity http://www.pelaphptutorials.com/article/why-programmers-are-not-paid-in-proportion-to-their-productivity.html http://www.pelaphptutorials.com/article/why-programmers-are-not-paid-in-proportion-to-their-productivity.html The most productive programmers are orders of magnitude more productive than average programmers. But salaries usually fall within a fairly small range in any company. Even across the entire profession, salaries don't vary that much. If some programmers are 10x more productive than others, why aren't they paid 10x as much? Fri, 25 Dec 2009 04:04:45 +0000 PHP Foundation Classes http://www.pelaphptutorials.com/article/php-foundation-classes.html http://www.pelaphptutorials.com/article/php-foundation-classes.html PHP Foundation Classes PFC is a subset of PEAR packages, and these classes have a strict set of entrance criteria: Quality Packages must be in a stable state. Generality Packages should not be excessively specific to any particular type of environment. Interoperability Packages should work well with other packages and in different environments, and they should have a standardized API. Compatibility Packages must be designed to be backward compatible when new features are added. At the present time, only the PEAR installer is shipped with PHP. However, at a later date, certain classes may be included as standard. The PFC would be those classes. Mon, 07 Dec 2009 18:33:54 +0000 PEAR Coding Standards http://www.pelaphptutorials.com/article/pear-coding-standards.html http://www.pelaphptutorials.com/article/pear-coding-standards.html The PCS documents were created because many different teams are developing open-source packages that might be of use to the PHP community. Mon, 07 Dec 2009 18:30:40 +0000 Using PEAR http://www.pelaphptutorials.com/article/using-pear.html http://www.pelaphptutorials.com/article/using-pear.html In the following sections you will learn how to use PEAR to find and install packages on a system, and you'll learn how to submit your own projects for consideration as PEAR packages. Mon, 07 Dec 2009 18:23:58 +0000 Filesystem Security http://www.pelaphptutorials.com/article/filesystem-security.html http://www.pelaphptutorials.com/article/filesystem-security.html Safe Mode restricts filesystem access only to files owned by the script owner, and you can use the open_basedir directive to specify the directory in which a file must reside. If you specify a directory, PHP will refuse any attempt to access a file that is not in that directory or its subdirectory tree. The open_basedir directive works independently of Safe Mode. Mon, 07 Dec 2009 15:46:08 +0000 PHP Safe Mode http://www.pelaphptutorials.com/article/php-safe-mode.html http://www.pelaphptutorials.com/article/php-safe-mode.html PHP's Safe Mode attempts to provide a degree of basic security in a shared environment, where multiple user accounts exist on a PHP-enabled web server. When a web server is running PHP in Safe Mode, some functions are disabled completely, and others are available with limited functionality. Mon, 07 Dec 2009 15:11:15 +0000 PHP Forcing a User to Use SSL-Encrypted Pages http://www.pelaphptutorials.com/article/php-forcing-a-user-to-use-ssl-encrypted-pages.html http://www.pelaphptutorials.com/article/php-forcing-a-user-to-use-ssl-encrypted-pages.html When handling credit card information, you want to guarantee that all card information always goes through an SSL (Secure Socket Layer) connection. Sun, 06 Dec 2009 18:12:13 +0000 PHP Checking to See If a Users Browser Accepts Cookies http://www.pelaphptutorials.com/article/php-checking-to-see-if-a-users-browser-accepts-cookies.html http://www.pelaphptutorials.com/article/php-checking-to-see-if-a-users-browser-accepts-cookies.html To see if a browser accepts cookies, you must check in two distinct steps, in two distinct web requests. The client's browser must make two requests because the browser sets a cookie only when it gets a response from the first request. You can serve both requests with one script, but you have to be careful not to put the browser in an infinite loop. The idea is to check for the cookie, and if the cookie is not set, you must try to set it and reload the page. But you want to reload only once, so you also have to tell the script that it is doing a reload to prevent it from loading yet again if the cookie is not set. Sun, 06 Dec 2009 15:09:04 +0000 Creating a Screen Scraper http://www.pelaphptutorials.com/article/creating-a-screen-scraper.html http://www.pelaphptutorials.com/article/creating-a-screen-scraper.html A screen scraper program accesses a web page and picks through the HTML for interesting or useful data. Here's a very simple one that extracts all hyperlinks from a page and then categorizes them. This scraper includes a lot of regular expressions, so let's take it one step at a time. Sun, 06 Dec 2009 08:56:38 +0000 A Shopping Cart Class http://www.pelaphptutorials.com/article/a-shopping-cart-class.html http://www.pelaphptutorials.com/article/a-shopping-cart-class.html First, we need to define the properties and behavior of a shopping cartclass. This shopping cart will be kept fairly simple for demonstration purposes,but will certainly be sufficient for use and expansion. Tue, 01 Dec 2009 23:59:42 +0000 ISPConfig http://www.pelaphptutorials.com/article/ispconfig.html http://www.pelaphptutorials.com/article/ispconfig.html ISPConfig is an open source hosting control panel for Linux. ISPConfig is licensed under BSD license. Mon, 30 Nov 2009 01:51:32 +0000 Extracting a Substring Using substr http://www.pelaphptutorials.com/article/extracting-a-substring-using-substr.html http://www.pelaphptutorials.com/article/extracting-a-substring-using-substr.html The substr() function returns a part of a string. You provide a string and the position of the first character to be extracted (keep in mind that the first character has the index 0). From this character on, the rest of the string is returned. If you only want to return a part of it, provide the length in the third parameter. The preceding code shows substr() in action and extracts Prep from PHP: Hypertext Preprocessor. Sun, 29 Nov 2009 17:06:25 +0000 Black Boxing in PHP http://www.pelaphptutorials.com/article/black-boxing-in-php.html http://www.pelaphptutorials.com/article/black-boxing-in-php.html Classes are most useful for black boxing concepts. Black boxing involves hiding the inner workings of a concept and only requiring the programmer to think about the higher-level results he is trying to produce. Fri, 27 Nov 2009 21:23:33 +0000 FireFox web development plugins http://www.pelaphptutorials.com/article/firefox-web-development-plugins.html http://www.pelaphptutorials.com/article/firefox-web-development-plugins.html I want to share with you web development plugins for Mozilla Firefox. I will be short :) The most common plug-ins for Web Develop, in my view are: 1. Firebug - many things can be made by editing CSS directly to the clatter of traffic and speed of execution of the page 2. Web Developer - allows the exclusion of Cache, Java, JavaScript, visually showing the image sizes, shapes and many many things. 3. MeasureIt - Allows you to directly measure the tip izgeneriranata page size of an element (terribly convenient for cutting design:)) 4. ColorZilla - Color Picker Yee all know what: P Wed, 25 Nov 2009 04:34:12 +0000 Coppermine php photo gallery http://www.pelaphptutorials.com/article/coppermine-php-photo-gallery.html http://www.pelaphptutorials.com/article/coppermine-php-photo-gallery.html Coppermine is an easily set-up, fast, feature-rich photo gallery script with mySQL database, user management, private galleries, automatic thumbnail creation, ecard feature and a template system for easy customization to match the rest of a site. Thu, 12 Nov 2009 05:41:32 +0000 Creating a bank_account Class http://www.pelaphptutorials.com/article/creating-a-bank-account-class.html http://www.pelaphptutorials.com/article/creating-a-bank-account-class.html To demonstrate the use of a class, let's create one to model a bank account. Fri, 06 Nov 2009 00:54:00 +0000 Function parameters in PHP http://www.pelaphptutorials.com/article/function-parameters-in-php.html http://www.pelaphptutorials.com/article/function-parameters-in-php.html A function is used to give a complex task a shorter form by naming it; Tue, 27 Oct 2009 23:23:15 +0000 Flash red moving Cube in PHP http://www.pelaphptutorials.com/article/flash-red-moving-cube-in-php.html http://www.pelaphptutorials.com/article/flash-red-moving-cube-in-php.html This is a simple SWF code made in php programing languge. When you write this program you will see red cube. Mon, 19 Oct 2009 01:08:39 +0000 The foreach Statement http://www.pelaphptutorials.com/article/the-foreach-statement.html http://www.pelaphptutorials.com/article/the-foreach-statement.html The foreach statement is similar to for in that it is basically a specializedform of the while loop. Foreach, however, unlike for, is to be used witharrays.Like for, foreach automatically performs a step for every repetition of the loop: It assigns the next value of an array to a temporary variable (similarto a counter).For example, foreach could be used to sum all of the numbers in an array.The syntax for the foreach loop is as follows Tue, 13 Oct 2009 19:29:18 +0000 The for statement in PHP http://www.pelaphptutorials.com/article/the-for-statement-in-php.html http://www.pelaphptutorials.com/article/the-for-statement-in-php.html The for statement is used to create loops involving numbers. It is composedof three parts: an initialization statement, a condition, and a repetitionstatement. These three parts have important purposes within the for loop. To find the sum of the integers from Tue, 13 Oct 2009 02:35:36 +0000 Placing a File s Contents into a Variable http://www.pelaphptutorials.com/article/placing-a-file-s-contents-into-a-variable.html http://www.pelaphptutorials.com/article/placing-a-file-s-contents-into-a-variable.html Let's say that you want to put all of the content of a text file into a variable so that you can access it later. This is a good introduction to file access, because it shows all of the basic steps. Here's how you would place the contents of file.txt into the $file_data variable: Wed, 07 Oct 2009 01:58:55 +0000 Using while with a Counter http://www.pelaphptutorials.com/article/using-while-with-a-counter.html http://www.pelaphptutorials.com/article/using-while-with-a-counter.html A counter is used to associate a number with each execution of a loop. Mostof the time, this number simply increments from 0 or 1 to higher valuesuntil the loop finishes. Tue, 06 Oct 2009 01:45:01 +0000 A Feedback Form http://www.pelaphptutorials.com/article/a-feedback-form.html http://www.pelaphptutorials.com/article/a-feedback-form.html The feedback program you want to create will have three main tasks, as follows: Display a form.Display a verification page to let the user review what hes about tosubmit. Send the forms contents to the Webmaster and display a thank you page. Mon, 05 Oct 2009 02:59:54 +0000 The while Statement http://www.pelaphptutorials.com/article/the-while-statement.html http://www.pelaphptutorials.com/article/the-while-statement.html For example, to use while to echo all of the values in $HTTP_POST_VARS, youcan create a program like this: Thu, 01 Oct 2009 20:46:53 +0000 To find the length of a string http://www.pelaphptutorials.com/article/to-find-the-length-of-a-string.html http://www.pelaphptutorials.com/article/to-find-the-length-of-a-string.html You may find that sometimes you need the length of a string. Thu, 01 Oct 2009 01:20:04 +0000 How many visitors browsing the site at the moment? http://www.pelaphptutorials.com/article/how-many-visitors-browsing-the-site-at-the-moment.html http://www.pelaphptutorials.com/article/how-many-visitors-browsing-the-site-at-the-moment.html In this tutorial will show you how to make a class that will show how many users browsing the site at the moment. First, how work this class and its function. For his realization normally need a Apache server, PHP, MySQL and desire to do that. The principle of work / performance is very simple: Check whether the user is registered in the database. If a record is entered. If you subscribed to update the access time. Checking other records if the access time and now time. If the difference is greater than the given limit to remove all records with a limit expired. Wed, 30 Sep 2009 15:50:33 +0000 The String Concatenation Operator http://www.pelaphptutorials.com/article/the-string-concatenation-operator.html http://www.pelaphptutorials.com/article/the-string-concatenation-operator.html The following program asks the user for his first and last names, then prints his full name in two different formats: Wed, 30 Sep 2009 02:02:15 +0000 Compound operators in PHP http://www.pelaphptutorials.com/article/compound-operators-in-php.html http://www.pelaphptutorials.com/article/compound-operators-in-php.html Compound operators are pretty straightforward. Here is a example to help demonstrate their use. Tue, 29 Sep 2009 02:33:49 +0000 New member to sign up http://www.pelaphptutorials.com/article/new-member-to-sign-up.html http://www.pelaphptutorials.com/article/new-member-to-sign-up.html The following example program allows a new member to sign up; upon submittingthe form, a new record is created for him in the database. Fri, 25 Sep 2009 01:09:26 +0000 Using foreach to print a list of array http://www.pelaphptutorials.com/article/using-foreach-to-print-a-list-of-array.html http://www.pelaphptutorials.com/article/using-foreach-to-print-a-list-of-array.html The first example involves using foreach to print a list of array elementsalong with their numeric index. Thu, 24 Sep 2009 20:43:06 +0000 Installing Smarty http://www.pelaphptutorials.com/article/installing-smarty.html http://www.pelaphptutorials.com/article/installing-smarty.html Follow these steps to install Smarty on your server. Create a directory on your server within the web root named smarty to store the core Smarty files. Go to smarty home page and download the latest version of Smarty. Thu, 24 Sep 2009 16:18:19 +0000 Templating Your Site with Smarty http://www.pelaphptutorials.com/article/templating-your-site-with-smarty.html http://www.pelaphptutorials.com/article/templating-your-site-with-smarty.html Most sites have a consistent look and feel. Although the dynamic content in the middle of the page may change, there's usually a header, a navigation bar on the side, and maybe an advertisement or two. There are simple ways to achieve this, from custom header-printing functions to include files. Depending on the size of your site, these solutions may work fine, but the larger and more complicated your content becomes, the more tedious making changes can get. Thu, 24 Sep 2009 15:24:28 +0000 Working with Directories in PHP http://www.pelaphptutorials.com/article/working-with-directories-in-php.html http://www.pelaphptutorials.com/article/working-with-directories-in-php.html PHP offers a very powerful set of directory-manipulation functions. Wed, 23 Sep 2009 00:41:26 +0000 Modifying arrays in PHP http://www.pelaphptutorials.com/article/modifying-arrays-in-php.html http://www.pelaphptutorials.com/article/modifying-arrays-in-php.html Arrays can be changed at any time in the script, just as variables can. Thu, 17 Sep 2009 19:32:51 +0000 The grade_event Table http://www.pelaphptutorials.com/article/the-grade-event-table.html http://www.pelaphptutorials.com/article/the-grade-event-table.html The grade_event table has this definition: Wed, 16 Sep 2009 02:21:38 +0000 Cross-Site Scripting http://www.pelaphptutorials.com/article/cross-site-scripting.html http://www.pelaphptutorials.com/article/cross-site-scripting.html Cross-site scripting (XSS) is one of the most common and best known kinds of attacks.The simplicity of this attack and the number of vulnerable applications inexistence make it very attractive tomalicious users. Mon, 14 Sep 2009 23:36:52 +0000 Spoofed Forms http://www.pelaphptutorials.com/article/spoofed-forms.html http://www.pelaphptutorials.com/article/spoofed-forms.html A common method used by attackers is a spoofed form submission. There are variousways to spoof forms, the easiest of which is to simply copy a target form andexecute it from a different location. Fri, 11 Sep 2009 01:34:33 +0000 XPath Queries http://www.pelaphptutorials.com/article/xpath-queries.html http://www.pelaphptutorials.com/article/xpath-queries.html The XML Path Language (XPath) is a W3C standardized language that is used to accessand search XML documents. Thu, 10 Sep 2009 17:56:00 +0000 Parsing XML Documents in PHP http://www.pelaphptutorials.com/article/parsing-xml-documents-in-php.html http://www.pelaphptutorials.com/article/parsing-xml-documents-in-php.html All XML parsing is done by SimpleXML internally using the DOM parsing model.There are no special calls or tricks you need to perform to parse a document. Theonly restraint is that the XML document must be well-formed, or SimpleXML willemit warnings and fail to parse it. Also, while the W3C has published a recommendedspecification for XML1.1, SimpleXML supports only version 1.0 documents. Thu, 10 Sep 2009 17:40:55 +0000 PHP Checking to See If a File Exists http://www.pelaphptutorials.com/article/php-checking-to-see-if-a-file-exists.html http://www.pelaphptutorials.com/article/php-checking-to-see-if-a-file-exists.html fopen() generates error messages if you're trying to open a file that doesn't exist, as do other functions such as unlink(), when you attempt to delete a nonexistent file. Mon, 31 Aug 2009 05:34:24 +0000 Automatically Hyperlinking URLs http://www.pelaphptutorials.com/article/automatically-hyperlinking-urls.html http://www.pelaphptutorials.com/article/automatically-hyperlinking-urls.html Most forum and blog software automatically convert URLs in posts and comments into hyperlinked text. You could probably think of a simple way to implement this feature in your own site by matching http:// and then using a backreference to add an anchor tag around it. However, what if someone is actually using an anchor tag? Then you'd get a real mess! Thu, 27 Aug 2009 14:52:35 +0000 PHP Web Crawler http://www.pelaphptutorials.com/article/php-web-crawler.html http://www.pelaphptutorials.com/article/php-web-crawler.html Web Crawler Hi, this is indicative of a bot script which indexes a Web site. Uses PHP and JavaScript (AJAX framework - mootools [version 1.2 +]). Tue, 25 Aug 2009 14:28:17 +0000 Streams and Network Programming in PHP http://www.pelaphptutorials.com/article/streams-and-network-programming-in-php.html http://www.pelaphptutorials.com/article/streams-and-network-programming-in-php.html There are two types of streams. One group provides access to a certain type ofstream resource; the standard PHP distribution includes several built in examples ofthese: Tue, 25 Aug 2009 02:57:22 +0000 Validation form Enforcing Required Fields http://www.pelaphptutorials.com/article/validation-form-enforcing-required-fields.html http://www.pelaphptutorials.com/article/validation-form-enforcing-required-fields.html The most basic type of form validation is to enforce that a particular field must contain a value. In the case of a text input that is submitted with no value entered, the element in $_POST is still created, but it contains an empty value. Therefore, you cannot use isset to check whether a value was entered; you must check the actual value of the element, either by comparing it to an empty string or by using the following, more compact syntax with the Boolean NOT operator: Sat, 22 Aug 2009 16:17:20 +0000 Using date and time http://www.pelaphptutorials.com/article/using-date-and-time.html http://www.pelaphptutorials.com/article/using-date-and-time.html Fourteen-digit number from the type timestamp in Mysql date and time recorded in the following format the first four number presenting the year, and each paragraph numbers are next month, days, hours minutes and seconds. You may use the function substr () to see the part number, who represent the date and time. Fri, 21 Aug 2009 17:05:46 +0000 Filter Input in PHP http://www.pelaphptutorials.com/article/filter-input-in-php.html http://www.pelaphptutorials.com/article/filter-input-in-php.html Since all input is tainted and cannot be trusted, it is necessary to filter your input toensure that input received is input expected. To do this, use a whitelist approach, asdescribed earlier. As an example, consider the following HTML form: Fri, 21 Aug 2009 02:40:56 +0000 Filtering Iterators http://www.pelaphptutorials.com/article/filtering-iterators.html http://www.pelaphptutorials.com/article/filtering-iterators.html The FilterIterator class can be used to filter the items returned by an iteration: Tue, 18 Aug 2009 00:43:01 +0000 Replication Principles http://www.pelaphptutorials.com/article/replication-principles.html http://www.pelaphptutorials.com/article/replication-principles.html Replication can take various forms. The MySQL implementation is a directional master-slave relationship. One server is called the master. One or more other servers are called slaves to a particular master. The master controls what data is stored in the system while the slaves try to mirror that content. Sun, 16 Aug 2009 15:28:42 +0000 Replicating Your Database http://www.pelaphptutorials.com/article/replicating-your-database.html http://www.pelaphptutorials.com/article/replicating-your-database.html One of the advanced features included in MySQL is replication. Using this feature, you can have multiple servers storing the same data. You might do this for performance reasons, for reliability, or for ease of backups. Additionally, you might choose to make use of replication simply to spread your database load across multiple servers you already own, instead of one (new) large server. Sun, 16 Aug 2009 15:16:55 +0000 PHP Numeric Data Types http://www.pelaphptutorials.com/article/php-numeric-data-types.html http://www.pelaphptutorials.com/article/php-numeric-data-types.html PHP assigns a data type to each value and that the numeric data types are integer and double, for whole numbers. Fri, 14 Aug 2009 15:22:13 +0000 Understanding NULLs http://www.pelaphptutorials.com/article/understanding-nulls.html http://www.pelaphptutorials.com/article/understanding-nulls.html The value NULL is a data type all to itselfa value that actually has no value. It has no numeric value, but comparing to an integer value zero evaluates to true Fri, 14 Aug 2009 09:42:15 +0000 Date Formats http://www.pelaphptutorials.com/article/date-formats.html http://www.pelaphptutorials.com/article/date-formats.html PHP does not have a native date data type, so in order to store date values in a script, you must first decide on the best way to store these values. Thu, 13 Aug 2009 16:34:56 +0000 MySQL Architectural Terminology http://www.pelaphptutorials.com/article/mysql-architectural-terminology.html http://www.pelaphptutorials.com/article/mysql-architectural-terminology.html When you use MySQL, you're actually using at least two programs, because MySQL operatesusing a client/server architecture.The first program is the MySQL server, mysqld. Wed, 12 Aug 2009 01:41:49 +0000 Running PHP on the Command Line part I http://www.pelaphptutorials.com/article/running-php-on-the-command-line-part-i.html http://www.pelaphptutorials.com/article/running-php-on-the-command-line-part-i.html Although PHP was conceived as a tool for creating dynamic web pages, because the PHP language is very powerful, it has also become popular for writing command scripts and even desktop programs. Tue, 11 Aug 2009 15:23:40 +0000 PHP Redirection http://www.pelaphptutorials.com/article/php-redirection.html http://www.pelaphptutorials.com/article/php-redirection.html To redirect a user from the page they entered to a different web page you can use a simple PHP script. One reason you may want to do this is that the page they are trying to access no longer exists. If you use this method, thay can be easily transvered to the new page without having to click a link to continue. Good thing is that it works on all browsers. Tue, 11 Aug 2009 01:56:07 +0000 Truncate text when reach max chars allowed http://www.pelaphptutorials.com/article/truncate-text-when-reach-max-chars-allowed.html http://www.pelaphptutorials.com/article/truncate-text-when-reach-max-chars-allowed.html In this tutorial I will show you one simple method how to cut long texts. This method is really simple. Method parameters Sat, 08 Aug 2009 05:41:09 +0000 What is Lazy Loading in PHP http://www.pelaphptutorials.com/article/what-is-lazy-loading-in-php.html http://www.pelaphptutorials.com/article/what-is-lazy-loading-in-php.html In PHP 5, using instantiating an undefined class in astatic way would cause a critical error. This mean that you must include all of theclass files that you need, better than loading them as they were needed. So that you don`t forget one or come up with complicated file inclusion mechanismsto reduce and needless processing of external files.To autoload facility that makes it possibleto implement lazy loading, or loading of classes on-demand. Fri, 07 Aug 2009 04:56:36 +0000 Mootools http://www.pelaphptutorials.com/article/mootools.html http://www.pelaphptutorials.com/article/mootools.html MooTools is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer. It allows you to write powerful, flexible, and cross-browser code with its elegant, well documented, and coherent API. Tue, 04 Aug 2009 11:24:14 +0000 The Registry Pattern in PHP http://www.pelaphptutorials.com/article/the-registry-pattern-in-php.html http://www.pelaphptutorials.com/article/the-registry-pattern-in-php.html By taking the Singleton pattern a little further, we can implement the Registry pattern.This allows us to use any object as a Singleton without it being written specificallythat way. Wed, 29 Jul 2009 14:57:31 +0000 The Factory Pattern in PHP http://www.pelaphptutorials.com/article/the-factory-pattern-in-php.html http://www.pelaphptutorials.com/article/the-factory-pattern-in-php.html The Factory pattern is used in scenarios where you have a generic class (the factory)that provides the facilities for creating instances of one or more separate specializedclasses that handle the same task in different ways. Wed, 29 Jul 2009 14:42:56 +0000 The Singleton Pattern in PHP http://www.pelaphptutorials.com/article/the-singleton-pattern-in-php.html http://www.pelaphptutorials.com/article/the-singleton-pattern-in-php.html The Singleton is, probably, the simplest design pattern. Its goal is to provide accessto a single resource that is never duplicated, but that is made available to any portionof an application that requests it without the need to keep track of its existence. Wed, 29 Jul 2009 14:18:50 +0000 A simple PHP script http://www.pelaphptutorials.com/article/a-simple-php-script.html http://www.pelaphptutorials.com/article/a-simple-php-script.html If PHP provided only the capability of producing what is essentially static HTML bymeans of print statements, it wouldn't be very useful. PHP's power is that it generates dynamicpages: output that can vary from one invocation of a script to the next. Thu, 23 Jul 2009 14:39:39 +0000 The PHP API http://www.pelaphptutorials.com/article/the-php-api.html http://www.pelaphptutorials.com/article/the-php-api.html Like Perl, PHP is a scripting language. Unlike Perl, PHP is designed less as a general purposelanguage than as a language for writing Web applications.The PHP API is usedprimarily as a means of embedding executable scripts into Web pages. Wed, 22 Jul 2009 16:24:18 +0000 PHP Open-Realty http://www.pelaphptutorials.com/article/php-open-realty.html http://www.pelaphptutorials.com/article/php-open-realty.html Open-Realty is an open source web based real estate listing management application. It is intended to be both easy to setup and use. Written in PHP, Open-Realty is designed to be a fast and flexible tool for your real estate website. With a large open-source community working with this application, and solid management from Transparent Technologies, Inc. Open-Realty is the top choice for use on your website. Fri, 17 Jul 2009 16:47:59 +0000 PHP Reflection http://www.pelaphptutorials.com/article/php-reflection.html http://www.pelaphptutorials.com/article/php-reflection.html With PHP's new object model comes the Reflection API a collection of functions and objects that allows you to examine the contents of a script's code, such as functions and objects, at runtime. Mon, 13 Jul 2009 04:38:13 +0000 MySQL-Joins http://www.pelaphptutorials.com/article/mysql-joins.html http://www.pelaphptutorials.com/article/mysql-joins.html As the name implies, joins combine data from multiple tables to create a singlerecordset. Many applications use extremely complex joins to return recordsets ofdata spanning across many different tables. Some of these joins use subqueriesthat contain even more joins nested within them. Thu, 09 Jul 2009 15:13:51 +0000 MySQL Finding months with data http://www.pelaphptutorials.com/article/mysql-finding-months-with-data.html http://www.pelaphptutorials.com/article/mysql-finding-months-with-data.html I was started coding some small project blog. For project i needed one section archive Wed, 08 Jul 2009 00:48:41 +0000 PHP Throwing Exceptions http://www.pelaphptutorials.com/article/php-throwing-exceptions.html http://www.pelaphptutorials.com/article/php-throwing-exceptions.html Exceptions are usually created and thrown when an error occurs by using the throw construct: Mon, 06 Jul 2009 20:49:06 +0000 The Basic Exception Class in PHP http://www.pelaphptutorials.com/article/the-basic-exception-class-in-php.html http://www.pelaphptutorials.com/article/the-basic-exception-class-in-php.html As we mentioned in the previous paragraph, exceptions are objects that must bedirect or indirect (for example through inheritance) instances of the Exception baseclass. The latter is built into PHP itself, and is declared as follows: Sun, 05 Jul 2009 20:19:58 +0000 Interfaces http://www.pelaphptutorials.com/article/interfaces.html http://www.pelaphptutorials.com/article/interfaces.html Interfaces, are used to specify an API that a class must implement.This allows you to create a common contract4 that your classes must implement inorder to satisfy certain logical requirements for example, you could use interfacesto abstract the concept of database provider into a common API that could then beimplemented by a series of classes that interface to different DBMSs.Interfacemethods contain no body: Sun, 05 Jul 2009 02:56:07 +0000 Abstract Classes.php http://www.pelaphptutorials.com/article/abstract-classes-php.html http://www.pelaphptutorials.com/article/abstract-classes-php.html Yet another new feature added to PHP 5 is that of Interfaces and Abstract classes.These are both used to create a series of constraints on the base design of a group ofclasses. Thu, 02 Jul 2009 04:34:15 +0000 Class.php Constants http://www.pelaphptutorials.com/article/class-php-constants.html http://www.pelaphptutorials.com/article/class-php-constants.html Class constants work in the same way as regular constants, except they are scopedwithin a class. Class constants are public, and accessible from all scopes; for example,the following script will output Hello World: Thu, 02 Jul 2009 04:11:15 +0000 PHP Constants, Static Methods and Properties http://www.pelaphptutorials.com/article/php-constants-static-methods-and-properties.html http://www.pelaphptutorials.com/article/php-constants-static-methods-and-properties.html Along with PPP, PHP 5 also implements static methods and properties. Unlike regularmethodsand properties, their static counterparts exist and are accessible as partof a class itself, as opposed to existing only within the scope of one of its instances. Thu, 02 Jul 2009 03:45:27 +0000 PHP Declaring and Accessing Properties http://www.pelaphptutorials.com/article/php-declaring-and-accessing-properties.html http://www.pelaphptutorials.com/article/php-declaring-and-accessing-properties.html Properties are declared in PHP using one of the PPP operators, followed by theirname Thu, 02 Jul 2009 02:11:33 +0000 PHP Methods Visibility In Class http://www.pelaphptutorials.com/article/php-methods-visibility-in-class.html http://www.pelaphptutorials.com/article/php-methods-visibility-in-class.html PHP 5 adds the notion of object method and property visibility (often referred to as), which enables you to determine the scope from which each component ofyour class interfaces can be accessed.There are four levels of visibility: Tue, 30 Jun 2009 02:49:23 +0000 Constructors and Destructors http://www.pelaphptutorials.com/article/constructors-and-destructors.html http://www.pelaphptutorials.com/article/constructors-and-destructors.html PHP 5 introduces the concept of the unified constructor and, along with it, a newdestructor for objects. The constructor and destructor are special classmethods thatare called, as their names suggest, on object creation and destruction, respectively. Mon, 29 Jun 2009 04:52:17 +0000 Streams and Network Programming http://www.pelaphptutorials.com/article/streams-and-network-programming.html http://www.pelaphptutorials.com/article/streams-and-network-programming.html An often-forgotten feature of PHP is the streams layer. First introduced in PHP 4.3 byWez Furlong, the streams layer is most often used without even knowing that it exists:whenever you access a file using fopen(), file(), readfile(), include, require and amultitude of other functions, PHP uses the functionality provided by the streamslayer to do the actual dirty work. Fri, 19 Jun 2009 15:40:28 +0000 Declaring a Class and Instantiating an Object http://www.pelaphptutorials.com/article/declaring-a-class-and-instantiating-an-object.html http://www.pelaphptutorials.com/article/declaring-a-class-and-instantiating-an-object.html The basic declaration of a class is very simple.Once you have declared a class, you need to instantiate it in order to take advantageof the functionality it offers. Thu, 18 Jun 2009 23:54:48 +0000 Object Oriented Programming in PHP http://www.pelaphptutorials.com/article/object-oriented-programming-in-php.html http://www.pelaphptutorials.com/article/object-oriented-programming-in-php.html Object orientation is probably the area that has been subject to the most significantand far-reaching changes with the advent of PHP 5. Rather than making thingsincompatible with previous versions of the language, however, they enhance PHP meagre OOP offerings and make PHP 5 a fully functional object-oriented language plus, of course, they make your life easier. Thu, 18 Jun 2009 23:35:55 +0000 PHP Array Operations http://www.pelaphptutorials.com/article/php-array-operations.html http://www.pelaphptutorials.com/article/php-array-operations.html As we mentioned in the PHP Basics chapter, a number of operators behave differentlyif their operands are arrays. For example, the addition operator + can be usedto create the union of its two operands Thu, 18 Jun 2009 21:52:10 +0000 PHP Printing Arrays http://www.pelaphptutorials.com/article/php-printing-arrays.html http://www.pelaphptutorials.com/article/php-printing-arrays.html In the PHP Basics, we illustrated how the echo statement can be used to outputthe value of an expression including that of a single variable. While echo isextremely useful, it exhibits some limitations that curb its helpfulness in certain situations. Thu, 18 Jun 2009 21:34:42 +0000 Generic Formatting http://www.pelaphptutorials.com/article/generic-formatting.html http://www.pelaphptutorials.com/article/generic-formatting.html If you are not handling numbers or currency values, you can use the printf() family of functions to perform arbitrary formatting of a value. All the functions in this group performin an essentially identical way: they take an input string that specifiesthe output format and one or more values. The only difference is in the way they return their results: the printf() function simply writes it to the script's output,while other variants may return it (sprintf()), write it out to a file (fprintf()), and so on. Thu, 18 Jun 2009 02:44:32 +0000 Formatting Currency Values http://www.pelaphptutorials.com/article/formatting-currency-values.html http://www.pelaphptutorials.com/article/formatting-currency-values.html Currency formatting, unlike number formatting, is locale aware and will display thecorrect currency symbol (either international or national notations e.g.: USD or $, respectively) depending on how your locale is set. When using money_format(), we must specify the formatting rules we want to use by passing the function a specially-crafted string that consists of a percent symbol(%) followed by a set of flags that determine the minimumwidth of the resulting output, its integer and decimal precision and a conversion character that determines whether the currency value is formatted using the locale's national or international rules. Thu, 18 Jun 2009 02:02:48 +0000 Simple Search and Replace Operations http://www.pelaphptutorials.com/article/simple-search-and-replace-operations.html http://www.pelaphptutorials.com/article/simple-search-and-replace-operations.html Replacing portions of a string with a different substring is another very common task for PHP developers. Simple substitutions are performed using str_replace() (as wells its case-insensitive variation, str_ireplace()) and substr_replace(). Here's an example: Thu, 18 Jun 2009 01:16:23 +0000 Removing Data and Retrieving Data http://www.pelaphptutorials.com/article/removing-data-and-retrieving-data.html http://www.pelaphptutorials.com/article/removing-data-and-retrieving-data.html In a dynamic application, data never remains constant. It always changes and,sometimes, it becomes superfluous and needs to be deleted. SQL database enginesimplement the DELETE statement for this purpose:DELETE FROM book; Wed, 17 Jun 2009 03:47:54 +0000 Adding and Manipulating Data http://www.pelaphptutorials.com/article/adding-and-manipulating-data.html http://www.pelaphptutorials.com/article/adding-and-manipulating-data.html While most of the time you will be retrieving data from a database, being able toinsert it is essential to using it, later.This is done by means of the INSERT statement, which takes on two forms: Wed, 17 Jun 2009 03:08:38 +0000 Creating Indices and Relationships http://www.pelaphptutorials.com/article/creating-indices-and-relationships.html http://www.pelaphptutorials.com/article/creating-indices-and-relationships.html Indices can be created (as was the example with the primary key above) while youare creating a table; alternatively, you can create them separately at a later point intime: Tue, 16 Jun 2009 02:09:53 +0000 Creating Databases and Tables http://www.pelaphptutorials.com/article/creating-databases-and-tables.html http://www.pelaphptutorials.com/article/creating-databases-and-tables.html The creation of a new database is relatively simple: Tue, 16 Jun 2009 01:21:21 +0000 PHP Database Programming http://www.pelaphptutorials.com/article/php-database-programming.html http://www.pelaphptutorials.com/article/php-database-programming.html Most applications that you will work with or encounter will involve the use of somesort of data storage container. In some cases, you will need nothing more than filesfor this purpose, but often, that container is some sort of database engine. PHP providesaccess to a great number of different database systems, many of which are relationalin nature and can be interrogated using Structured Query Language (SQL). Tue, 16 Jun 2009 00:59:15 +0000 Accessing Session Data http://www.pelaphptutorials.com/article/accessing-session-data.html http://www.pelaphptutorials.com/article/accessing-session-data.html Once the session has been started, you can access its data in the $_SESSION superglobalarray: Mon, 15 Jun 2009 17:49:06 +0000 Development Environment layout using Linux, Apache, PHP, and Subversion http://www.pelaphptutorials.com/article/development-environment-layout-using-linux-apache-php-and-subversion.html http://www.pelaphptutorials.com/article/development-environment-layout-using-linux-apache-php-and-subversion.html Some of the most used questions we face lately are: Whats for dinner? Should we accept that friend request on Facebook for the friend of a friend of a friend that I knew 15 years ago? Whats the best development and test environment layouts for PHP using Apache as a web server with Subversion for version control for multiple developers? Mon, 15 Jun 2009 13:46:26 +0000 PHP Sessions http://www.pelaphptutorials.com/article/php-sessions.html http://www.pelaphptutorials.com/article/php-sessions.html HTTP is a stateless protocol; this means that the webserver does not know (or care)whether two requests comes from the same user; each request is instead handledwithout regard to the context in which it happens. Sessions are used to create a measureof state in between requests even when they occur at large time intervals fromeach other. Mon, 15 Jun 2009 13:12:26 +0000 Accessing Cookie Data http://www.pelaphptutorials.com/article/accessing-cookie-data.html http://www.pelaphptutorials.com/article/accessing-cookie-data.html Cookie data is usually sent to the server using a single request header. Mon, 15 Jun 2009 12:52:01 +0000 Cookies http://www.pelaphptutorials.com/article/cookies.html http://www.pelaphptutorials.com/article/cookies.html Cookies allow your applications to store a small amount of textual data (typically, 4-6kB) on a Web client. There are a number of possible uses for cookies, although their most common one ismaintaining session state (explained in the next section). Mon, 15 Jun 2009 03:26:32 +0000 PHP Security http://www.pelaphptutorials.com/article/php-security.html http://www.pelaphptutorials.com/article/php-security.html Ben Parker once advised his young nephew Peter, whose super-hero alter ego is Spider-man, that with great power comes great responsibility. So it is with security in PHP applications. PHP provides a rich toolset with immense power some have argued that it is perhaps too much power and this power, when used with careful attention to detail, allows for the creation of complex and robust applications. Mon, 15 Jun 2009 03:09:28 +0000 The ExtensibleMarkup Language (XML) http://www.pelaphptutorials.com/article/the-extensiblemarkup-language-xml.html http://www.pelaphptutorials.com/article/the-extensiblemarkup-language-xml.html XML is a subset of Standard Generalized Markup Language (SGML); its design goalis to be as powerful and flexible as SGML with less complexity. If you've ever workedwith Hypertext Markup Language (HTML), then you're familiar with an applicationof SGML. If you've ever worked with Extensible Hypertext Markup Language(XHTML), then you're familiar with an application of XML, since XHTML is a reformulationof HTML 4 as XML. Mon, 15 Jun 2009 02:48:39 +0000 Array Basics http://www.pelaphptutorials.com/article/array-basics.html http://www.pelaphptutorials.com/article/array-basics.html All arrays are ordered collections of items, called elements. Each element has a value,and is identified by a key that is unique to the array it belongs to. As we mentionedin the previous paragraph, keys can be either integer numbers or strings of arbitrarylength. Mon, 15 Jun 2009 01:56:03 +0000 Forms and URLs http://www.pelaphptutorials.com/article/forms-and-urls.html http://www.pelaphptutorials.com/article/forms-and-urls.html Most often, your script will interact with their clients using one of two HTTP methods:GET and POST. Froma technical perspective, the main difference between thesetwo methods is in the fact that the latter allows the client to send along a data payload,while the former only allows you to send data as part of the query string. Mon, 15 Jun 2009 01:36:23 +0000 How the World Wide Web works http://www.pelaphptutorials.com/article/how-the-world-wide-web-works.html http://www.pelaphptutorials.com/article/how-the-world-wide-web-works.html It's helpful to understand a little about how theWorld Wide Web (WWW) works. The Web is anetwork of computers that offer Web pages. Sun, 14 Jun 2009 19:09:58 +0000 Using PHP for system commands http://www.pelaphptutorials.com/article/using-php-for-system-commands.html http://www.pelaphptutorials.com/article/using-php-for-system-commands.html PHP can interact with your operating system to perform any task the operatingsystem can perform. You can execute an operating system command andreceive the output. For example, you can execute a dir or ls command (tolist the files in your directory) from PHP and receive the list of filenames thatthe dir/ls command produces. Sun, 14 Jun 2009 19:06:11 +0000 Using PHP with your file system http://www.pelaphptutorials.com/article/using-php-with-your-file-system.html http://www.pelaphptutorials.com/article/using-php-with-your-file-system.html PHP can interact with your file system the directories and files that are onyour local hard disk or on other computers accessible over a network. PHP canwrite into a file on your file system, creating the file if it doesn't exist, and canread the contents from files. Sun, 14 Jun 2009 19:03:51 +0000 Using PHP for Web applications http://www.pelaphptutorials.com/article/using-php-for-web-applications.html http://www.pelaphptutorials.com/article/using-php-for-web-applications.html In the beginning, Web pages were static they just presented documents.Users went to Web sites to read information. Documents were linked togetherso that users could easily find the information they sought, but the Web pagesdidn't change. Every user who arrived at a Web page saw the same thing. Sun, 14 Jun 2009 18:59:40 +0000 GET or POST http://www.pelaphptutorials.com/article/get-or-post.html http://www.pelaphptutorials.com/article/get-or-post.html PHP makes it very easy to handle data sent using either POST or GET. However, thisdoesn't mean that you should choose one or the other at random. Sun, 14 Jun 2009 18:38:45 +0000 When You Do not Know How Data Is Sent http://www.pelaphptutorials.com/article/when-you-do-not-know-how-data-is-sent.html http://www.pelaphptutorials.com/article/when-you-do-not-know-how-data-is-sent.html If you need to write a script that is supposed to work just as well with both GET andPOST requests, you can use the $_REQUEST superglobal array; the latter is filled in Sun, 14 Jun 2009 18:32:40 +0000 GET and URLs http://www.pelaphptutorials.com/article/get-and-urls.html http://www.pelaphptutorials.com/article/get-and-urls.html When a form is submitted using the GET method, its values are encoded directly inthe query string portion of the URL. For example, if you submit the form above byentering user in the List box and choosing to... Sun, 14 Jun 2009 12:06:16 +0000 Anatomy of a Web Page http://www.pelaphptutorials.com/article/anatomy-of-a-web-page.html http://www.pelaphptutorials.com/article/anatomy-of-a-web-page.html Anatomy of a Web Page... Most people think of a Web page as nothing more than a collection of HTML code. This is fine if you happen to be aWeb designer but, as a PHP developer, your knowledge must run much deeper if you want to take full advantage of what the Web has to offer Sun, 07 Jun 2009 10:44:48 +0000 Convert windows newlines to unix newlines http://www.pelaphptutorials.com/article/convert-windows-newlines-to-unix-newlines.html http://www.pelaphptutorials.com/article/convert-windows-newlines-to-unix-newlines.html This tutorial will show you how to convert windows system newlines in UNIX system newlines with PHP i hope will help you. Fri, 15 May 2009 22:31:01 +0000 Zend Studio for Eclipse open tpl files Smarty http://www.pelaphptutorials.com/article/zend-studio-for-eclipse-open-tpl-files-smarty.html http://www.pelaphptutorials.com/article/zend-studio-for-eclipse-open-tpl-files-smarty.html I am having problems opening *.tpl files for smarty template. Is this normal? If it isn't how would i go about getting smarty to work with zend studio for eclipse? Solution Add tpl to HTML content type on Zend Studio Form Eclipse The smarty deafult tempalte file type named "tpl" hasn't been supported by Zend Studio for Eclipse 6.1. So, you need to setup Tue, 21 Apr 2009 20:08:09 +0000 PHP Size of Array http://www.pelaphptutorials.com/article/php-size-of-array.html http://www.pelaphptutorials.com/article/php-size-of-array.html function sizeof() in PHP is variety of count(), and they both can using for counting numbers of overall elements in array. Argument must be writed with name. Next PHP script id creating empty array, after that is creating elements whit data using for cicle. every value of element is wrting on page with foreach function. At the end size of array is assume to variable and reasult is writing to page. Thu, 26 Mar 2009 00:21:39 +0000 What is PHP http://www.pelaphptutorials.com/article/what-is-php.html http://www.pelaphptutorials.com/article/what-is-php.html PHP is short variant of PHP: Hypertext Preprocessor. PHP is coming from instruments Personal Home Page, Developed in 1994 year from independent developer Rasmus Lerdof. Improvements that he has made for Tracking visitors on visited site is rised big interest for his work. He developed PHP to scripting machine with interpretation on Mon, 16 Mar 2009 05:38:49 +0000 How to delete-remove file with PHP http://www.pelaphptutorials.com/article/how-to-delete-remove-file-with-php.html http://www.pelaphptutorials.com/article/how-to-delete-remove-file-with-php.html PHP function unlink ()is delete file if the filename like argument is valid. Example In this exampleat beginning we have user function who try to delete file and write result message if file is deleted. Mon, 23 Feb 2009 19:02:12 +0000 PHP Installing GD http://www.pelaphptutorials.com/article/php-installing-gd.html http://www.pelaphptutorials.com/article/php-installing-gd.html Just in case you missed installing the GD library when you were setting up PHP, I'll quickly go over it again. I will also show you a great little chunk of code that you can use to load the library dynamically. To install GD on a Linux or UNIX installation you will Wed, 04 Feb 2009 09:14:13 +0000 PHP What Is GD? http://www.pelaphptutorials.com/article/php-what-is-gd.html http://www.pelaphptutorials.com/article/php-what-is-gd.html GD is a C graphics library that allows you to create and manipulate .jpegs, .pngs, and.wbmps. What's that you say? No support for .gifs? That is correct. There used to be a GD library out there at one time that supported the .gif file format, but since Unisys (the company that owns the patent on LWZ compression that .gifs use) changed their licensing agreements, GD has stopped supporting the .gif file format. This could change in the next Wed, 04 Feb 2009 09:03:12 +0000 PHP Getting Information About a Domain Name http://www.pelaphptutorials.com/article/php-getting-information-about-a-domain-name.html http://www.pelaphptutorials.com/article/php-getting-information-about-a-domain-name.html You want to look up contact information or other details about a domain name. Use PEAR's Net_Whois Sat, 24 Jan 2009 04:04:04 +0000 PHP Free Arcade Game Script http://www.pelaphptutorials.com/article/php-free-arcade-game-script.html http://www.pelaphptutorials.com/article/php-free-arcade-game-script.html Yes that's right you can download the best free arcade script on the net the software has many fantastic features, and all updates and support is free! Full administration panel is included, user accounts, links, categories, top users, comments, ajax ratings, statics, mostplayed, newest, search, game enabled code and many more features. Fri, 23 Jan 2009 00:08:21 +0000 PHP Crafty Syntax Live Help http://www.pelaphptutorials.com/article/php-crafty-syntax-live-help.html http://www.pelaphptutorials.com/article/php-crafty-syntax-live-help.html A multi-user, multi-operator, multi-department live Help support chat system that allows the operators of the websites to monitor their visitors as they are browsing the site and pro actively open a chat session with the visitor. Is in PHP and uses a Mysql based database . Other features include AUTO INVITE!, referrer tracking, page tracking, chat notification, user is typing message, multiple chat sessions, sound alert, leave a message if off line, push urls, quick responses, and multiple operators. runs on your server and is open source GPL. Fri, 23 Jan 2009 00:03:42 +0000 PHP Fusion Ticket http://www.pelaphptutorials.com/article/php-fusion-ticket.html http://www.pelaphptutorials.com/article/php-fusion-ticket.html The full box office solution. The ticket system can be used for disco's, theaters, parties, operas, school shows. We are a completely free open source box office solution which handles booking online ticket sales, box office and ticket takers. Fully customisable seating charts and PDF tickets, there isn't much you can't do with this software and even better were adding new features regularly! Fusion Ticket is based on the old phpMyTicket platform. This new version brings new light to the old project. Now with a new dev team, the script is fully PHP5 and MySQL5 compliant. Thu, 22 Jan 2009 23:55:02 +0000 Adsense and ads limiting and protection class http://www.pelaphptutorials.com/article/adsense-and-ads-limiting-and-protection-class.html http://www.pelaphptutorials.com/article/adsense-and-ads-limiting-and-protection-class.html This class can control how many times ads are shown to a user over 24hours. its good protection for spam bots and other repeat visitors who rack up massive amount of views on programs like adsense. Thu, 22 Jan 2009 23:47:51 +0000 PHPads http://www.pelaphptutorials.com/article/phpads.html http://www.pelaphptutorials.com/article/phpads.html PHPads is a simple php script that allows management of a banner ad rotations. There is an admin panel that allows the admin to add banners, and specify the length of ad campaign. There is also a way for the admin to see single stats outside the admin panel on any banner campaign (good for those wanting to sell banner ads and give their customers something to monitor their campaign's progress.) PHPads creates ad rotation code for admin to place on website. The script is simple to istall and involves no MySQL. Updated December 29. Thu, 22 Jan 2009 23:42:58 +0000 PHP Quick.Cart - freeware shopping car http://www.pelaphptutorials.com/article/php-quick-cart-freeware-shopping-car.html http://www.pelaphptutorials.com/article/php-quick-cart-freeware-shopping-car.html Quick.Cart is a freeware, small, simple and multilingual Shopping Cart. It offers plenty of options. Some features: very easy to setup and install, based on Flat Files, XHTML 1.1 compliant, WAI compliant, very easy to customize, good support via email and forums, WYSIWYG editor, SEO tools, no limit pages depth, no limit images per page, products and more. Available over 4 years, thousands pages using Quick.Cart. Mon, 19 Jan 2009 06:50:30 +0000 PHP Barcode http://www.pelaphptutorials.com/article/php-barcode.html http://www.pelaphptutorials.com/article/php-barcode.html You can generate barcode images on the fly with this PHP script. Use it on your web pages or save it to a file. It supports Code 39, Code 93, Standard 25, Interleaved 25, PostNet and Royal Mail 4-State. Control over almost all aspects of barcode style: width, height, wide to narrow ratio, label printing, image rotation, check digit. It's FREE ! Mon, 19 Jan 2009 06:45:11 +0000 PHP Validate Input http://www.pelaphptutorials.com/article/php-validate-input.html http://www.pelaphptutorials.com/article/php-validate-input.html In addition to escaping characters, another great to way to protect input is to validate it. With many applications, you actually already know what kind of data you are expecting on input. So the simplest way to protect yourself against attacks is to make sure your users can only enter the appropriate data. Mon, 19 Jan 2009 06:32:09 +0000 Watch for Cross Site Scripting (XSS) Attacks in User Input http://www.pelaphptutorials.com/article/watch-for-cross-site-scripting-xss-attacks-in-user-input.html http://www.pelaphptutorials.com/article/watch-for-cross-site-scripting-xss-attacks-in-user-input.html A web application usually accepts input from users and displays it in some way. This can, of course, be in a wide variety of forms including comments, threads or blog posts that are in the form of HTML code. When accepting input, allowing HTML can be a dangerous thing, because that allows for JavaScript to be executed in unintended ways. If even one hole is left open, JavasScript can be executed and cookies could be hijacked. This cookie data could then be used to fake a real account and give an illegal user access to the website's data. Mon, 19 Jan 2009 06:29:14 +0000 Use Proper Error Reporting http://www.pelaphptutorials.com/article/use-proper-error-reporting.html http://www.pelaphptutorials.com/article/use-proper-error-reporting.html During the development process, application error reporting is your best friend. Error reports can help you find spelling mistakes in your variables, detect incorrect function usage and much more. However, once the site goes live the same reporting that was an ally during development can turn traitor and tell your users much more about your site than you may want them to know (the software you run, your folder structure, etc). Once your site goes live, you should make sure to hide all error reporting. This can be done by invoking the following simple function at the top of your application file(s) Mon, 19 Jan 2009 06:26:00 +0000 PHP AdSense account monitor http://www.pelaphptutorials.com/article/php-adsense-account-monitor.html http://www.pelaphptutorials.com/article/php-adsense-account-monitor.html PHP AdSense account monitor class, can retrieve data from your AdSense account (impressions, clicks, ctr, ecpm, earnings). This class can retrieve (for now) only "AdSense for Content" data, for different periods of time (see class methods for more details). You can implement this PHP class in your own applications. Mon, 19 Jan 2009 02:43:21 +0000 MYSQL import Database from UTF-8 file http://www.pelaphptutorials.com/article/mysql-import-database-from-utf-8-file.html http://www.pelaphptutorials.com/article/mysql-import-database-from-utf-8-file.html We need to restore our backup we can do that with phpmyadmin, but there is big problem beacuse default upload file must be 2 mb . We have two soluotions to slove that problem. Sat, 17 Jan 2009 04:22:19 +0000 PHP How to Create a Flash Movie http://www.pelaphptutorials.com/article/php-how-to-create-a-flash-movie.html http://www.pelaphptutorials.com/article/php-how-to-create-a-flash-movie.html To create a new Flash movie you need to invoke an instance of the SWFMovie class. Take a look at the following line of code to see how to invoke the SWFMovie class: Sat, 17 Jan 2009 03:57:55 +0000 PHP and Ming http://www.pelaphptutorials.com/article/php-and-ming.html http://www.pelaphptutorials.com/article/php-and-ming.html What is Ming? Ming is a library that allows you to create your own dynamic SWF Flash movies. That's right; you can create on-the-fly Flash movies. Imagine the endless applications you could use this for. Dynamic tickers, an online chat application using aPHP engine... Sat, 17 Jan 2009 03:41:54 +0000 PHP Creating and processing forms with the help of arrays http://www.pelaphptutorials.com/article/php-creating-and-processing-forms-with-the-help-of-arrays.html http://www.pelaphptutorials.com/article/php-creating-and-processing-forms-with-the-help-of-arrays.html In the first class have clsForm file which contains two methods for each display format displayRegisterForm () which will be shown by default when the page is loaded... Wed, 14 Jan 2009 05:22:52 +0000 PHP Libchart http://www.pelaphptutorials.com/article/php-libchart.html http://www.pelaphptutorials.com/article/php-libchart.html Libchart is a chart creation PHP library that is easy to use. It can generate bar diagrams or pie charts. It is compatible with PHP4/5 (compiled with GD and FreeType) and has no other dependencies. Fri, 09 Jan 2009 17:33:44 +0000 PHP GD Bar Chart http://www.pelaphptutorials.com/article/php-gd-bar-chart.html http://www.pelaphptutorials.com/article/php-gd-bar-chart.html Create Bar chart with PHP and GD Its very easy i will show you in few steps You must have installed GD and enable it Fri, 09 Jan 2009 17:24:15 +0000 PHP RandomLib http://www.pelaphptutorials.com/article/php-randomlib.html http://www.pelaphptutorials.com/article/php-randomlib.html The class can be used to select one or a group of item(strings, objects, anything) from the entire collection of items. It include randomly select, randomly select unique. It also include function to randomly select weighted items and randomly select unique weighted items. Weighted items are items assigned a weight, so it can show up more frequently than ones with lower weight. This could be great on making sites need reward some user more than other, or PHP games. Fri, 09 Jan 2009 12:57:46 +0000 PHP Manipulating Strings, OO Style http://www.pelaphptutorials.com/article/php-manipulating-strings-oo-style.html http://www.pelaphptutorials.com/article/php-manipulating-strings-oo-style.html Whenever using php to output data on the web, it is common place to have to format it so that it is visually stimulating, or to add emphasis. Depending on your configuration,this may require echoing large amounts of html each time you output data. You may be using a templateengine, or a framework that allows view scripts, where the file is primarily html, but you put in place-holdersor echo the data wherever needed, this arguably is the easiest to debug, fastest to change, and the bestconfiguration.Sometimes, however, you may not have the ability to use templating engines, or a framework, and may have to rely onyour own functions for manipulating data for output. Having to echo html several times over and over again, to change simple things like color, or creating elements is a pain, and not friendly. Say you have an error message style, or a headerstyle, and everytime you use this data, you have to again and again echo html elements. This can lead to severalmistakes in html, and or php code.What you should always remember when thinking of your code, is DRY, or Don't Repeat Yourself. Wheneveryou find you are coding the same thing multiple times, it is time to step aside, think, and refactor. Wed, 24 Dec 2008 18:48:02 +0000 MYSQL convert windows1251 into UTF-8 enconding procedure http://www.pelaphptutorials.com/article/mysql-convert-windows1251-into-utf-8-enconding-procedure.html http://www.pelaphptutorials.com/article/mysql-convert-windows1251-into-utf-8-enconding-procedure.html We know that in MYSQL we can write procedures Here is one procudure for converting MYSQL data CP1251 encoding in UTF-8 encoding I hope this function will help you . Wed, 17 Dec 2008 18:45:45 +0000 SQL Protection of injecting in PHP applications II http://www.pelaphptutorials.com/article/sql-protection-of-injecting-in-php-applications-ii.html http://www.pelaphptutorials.com/article/sql-protection-of-injecting-in-php-applications-ii.html How to prevent SQL injection code? The first rule is: Never trust in the correctness of user data entered! It's easy to say a little more complicated to make. The easiest way to prevent SQL injections is to use the option of PHP "Magic Quotes" for the presentation of special characters (such as quotes, NULL, reverse slash, etc..) That are part of SQL syntax in the form of escape sequences . This option is provided as a means to prevent SQL injections, but not in all cases is effective and is unlikely to evolve into the next versions of PHP. The next examples do not guarantee 100 percent protection (if at all possible), but have a high degree of protection against SQL injections. First we need to do is to remove '\' of all input parameters that may have naslozheni of Magic Quotes: Fri, 12 Dec 2008 13:44:34 +0000 SQL Protection of injecting in PHP applications http://www.pelaphptutorials.com/article/sql-protection-of-injecting-in-php-applications.html http://www.pelaphptutorials.com/article/sql-protection-of-injecting-in-php-applications.html In these days all of us or very little affected by the development of information technology. Shopping, banking operations, even social contact ... Even if you do not want our personal data is kept in electronic form in a variety of databases... Fri, 12 Dec 2008 13:18:23 +0000 MYSQL Change Collation On All Tables And Columns In MySQL with Phoca Changing Collation Utility http://www.pelaphptutorials.com/article/mysql-change-collation-on-all-tables-and-columns-in-mysql-with-phoca-changing-collation-utility.html http://www.pelaphptutorials.com/article/mysql-change-collation-on-all-tables-and-columns-in-mysql-with-phoca-changing-collation-utility.html I was working with lot of databases collated in latin1_swedish_ci lately. I needed to convert the structure to utf8 collation, but it was very time-consuming to convert all the tables and all the columns manually. Thu, 11 Dec 2008 14:32:11 +0000 PHP Count files in dir http://www.pelaphptutorials.com/article/php-count-files-in-dir.html http://www.pelaphptutorials.com/article/php-count-files-in-dir.html How to count files in one directorium with php We know that in linux hiden files have dot (.filename) also we have to system dirs .(curent) ..(main dir) Wed, 10 Dec 2008 23:01:29 +0000 PUT access to incoming data from PHP http://www.pelaphptutorials.com/article/put-access-to-incoming-data-from-php.html http://www.pelaphptutorials.com/article/put-access-to-incoming-data-from-php.html Recently I started to write REST request. I started in the usual manner, php script writing, calls with GET, enabling variables using superglobalnata variable PHP - $_GET. I wrote the code to grips POST request and use variables to find in $_POST. Then I tried to npisha PUT request. PHP-no built-in way to do it over and I was a little confused how to reach it. It turns out that this can be read by flow coming to PHP, php: Wed, 10 Dec 2008 22:30:28 +0000 PHP GD How to center a text on an image using GD http://www.pelaphptutorials.com/article/php-gd-how-to-center-a-text-on-an-image-using-gd.html http://www.pelaphptutorials.com/article/php-gd-how-to-center-a-text-on-an-image-using-gd.html This is a snippet which centers a text on an image using the GD Library. First, we create the image using the ImageCreate() function. Here we set the width height. Wed, 10 Dec 2008 17:49:30 +0000 SQL Mass Mailer http://www.pelaphptutorials.com/article/sql-mass-mailer.html http://www.pelaphptutorials.com/article/sql-mass-mailer.html Send mass mail without slowing down your server. This easy to use program takes email addresses from your existing database and allows you to send full HTML emails to everyone. The script is designed to allow a steady flow of email without slowing down your server. Choose how many emails get sent over a given amount of time and watch a real time indication of the progress. Bulk mailing is easy and effective with Smart Mailer. The script is complete and ready to use, simply upload to your server and enter in your database information. Easily send out company newsletters and special offers from your company. Keep in touch with all of your members by filling out one simple email form, preview your email, and start sending. Thu, 04 Dec 2008 21:39:22 +0000 PHP How to Sort an Array http://www.pelaphptutorials.com/article/php-how-to-sort-an-array.html http://www.pelaphptutorials.com/article/php-how-to-sort-an-array.html It is often necessary to arrange the elements in an array in numerical order from highest to lowest values (descending order) or vice versa (ascending order). If the array contains string values, alphabetical order may be needed. Sorting a one-dimensional arrays is quite easy. Thu, 04 Dec 2008 04:50:17 +0000 How to Encrypt Passwords in the Database http://www.pelaphptutorials.com/article/how-to-encrypt-passwords-in-the-database.html http://www.pelaphptutorials.com/article/how-to-encrypt-passwords-in-the-database.html If you are developing a password-protected web site, you have to make a decision about how to store user password information securely. What is "secure," anyway? Realize that the data in your database is not safe. What if the password to the database is compromised? Then your entire user password database will be compromised as well. Even if you are quite certain of the security of your database, your users' passwords are still accessible to all administrators who work at the Web hosting company where your database is hosted. Scrambling the passwords using some home-brewed algorithm may add some obscurity but not true "security." Another approach would be to encrypt all passwords in your database using some industry-standard cipher, such as the Message-Digest Algorithm 5 (MD5). Thu, 04 Dec 2008 04:45:50 +0000 PHP Reporting and handling errors http://www.pelaphptutorials.com/article/php-reporting-and-handling-errors.html http://www.pelaphptutorials.com/article/php-reporting-and-handling-errors.html When developing a PHP project, whether it's a simple website or a much larger web application, it's always a good idea to take into account the potential appearance of errors in your PHP code. An error occurs whenever PHP tries to execute an instruction which either results in an impossible outcome, or otherwise prevents the script from executing in the manner intended by the programmer. Errors range from simple fatal errors, where program execution is halted at the point of the fault - usually a syntax error or a call to a function... Wed, 03 Dec 2008 16:08:35 +0000 PHP Syntax http://www.pelaphptutorials.com/article/php-syntax.html http://www.pelaphptutorials.com/article/php-syntax.html A PHP file is basically a text file containing all the required PHP code to run a specific program. PHP code can be written with the use of a simple text editor, like Windows Notepad, or the more useful Crimson Editor. Wed, 03 Dec 2008 15:53:48 +0000 VIM Editor http://www.pelaphptutorials.com/article/vim-editor.html http://www.pelaphptutorials.com/article/vim-editor.html Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems. Vim is often called a "programmer's editor," and so useful for programming that many consider it an entire IDE. It's not just for programmers, though. Vim is perfect for all kinds of text editing, from composing email to editing configuration files. Despite what the above comic suggests, Vim can be configured to work in a very simple (Notepad-like) way, called evim or Easy Vim. Wed, 03 Dec 2008 14:21:34 +0000 File System PHP Basics http://www.pelaphptutorials.com/article/file-system-php-basics.html http://www.pelaphptutorials.com/article/file-system-php-basics.html One of the most useful features of a server side language is its ability to interface with the file system on the server that hosts the website. This feature clearly distinguishes the language from a client side language such as JavaScript. Wed, 03 Dec 2008 01:48:08 +0000 MYSQL Install on Linux http://www.pelaphptutorials.com/article/mysql-install-on-linux.html http://www.pelaphptutorials.com/article/mysql-install-on-linux.html Depending on your Linux version and how recently you installed it, you will quite likely already have a version of MySQL on your system, but it is also very likely that you won't have the newest version. Tue, 02 Dec 2008 22:50:39 +0000 PHP Security Mistakes http://www.pelaphptutorials.com/article/php-security-mistakes.html http://www.pelaphptutorials.com/article/php-security-mistakes.html The purpose of this document is to inform PHP programmers of common security mistakes that can be overlooked in PHP scripts. While many of the following concepts may appear to be common sense, they are unfortunately not always common practice. After applying the following practices to your coding, you will be able to eliminate the vast majority of security holes that plague many scripts. Many of these security holes have been found in widely-used open source and commercial PHP scripts in the past. The most important concept to learn from this article is that you should never trust the user to input exactly what is expected. The way most PHP scripts are compromised is by entering unexpected data to exploit security holes inadvertantly left in the script. Tue, 02 Dec 2008 00:29:37 +0000 MODx CMS http://www.pelaphptutorials.com/article/modx-cms.html http://www.pelaphptutorials.com/article/modx-cms.html MODx is an open source Content Management System and Application Framework. Initially inspired by Etomite 0.6, MODx is an ongoing project written by Raymond Irving and a core team of contributors at the MODx Project. MODx is distributed under the GPL license and is now run by a professional team of developers from all over the world. Mon, 01 Dec 2008 23:14:42 +0000 Crimson Editor http://www.pelaphptutorials.com/article/crimson-editor.html http://www.pelaphptutorials.com/article/crimson-editor.html Crimson Editor is a professional source code editor for Windows. This program is not only fast in loading time, but also small in size (so small that it can be copied in one floppy disk). While it can serve as a good replacement for Notepad, it also offers many powerful features for programming languages such as HTML, C/C++, Perl and Java. Thu, 27 Nov 2008 01:00:27 +0000 XAMPP http://www.pelaphptutorials.com/article/xampp.html http://www.pelaphptutorials.com/article/xampp.html Many people know from their own experience that it's not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start. Mon, 24 Nov 2008 22:12:28 +0000 Joomla CMS http://www.pelaphptutorials.com/article/joomla-cms.html http://www.pelaphptutorials.com/article/joomla-cms.html What is Joomla? Joomla is an award-winning content management system (CMS), which enables you to build Web sites and powerful online applications. Many aspects, including its ease-of-use and extensibility, have made Joomla the most popular Web site software available. Best of all, Joomla is an open source solution that is freely available to everyone. Mon, 24 Nov 2008 21:21:40 +0000 Dynamic copyright year with php http://www.pelaphptutorials.com/article/dynamic-copyright-year-with-php.html http://www.pelaphptutorials.com/article/dynamic-copyright-year-with-php.html On the footer on web sites we see All rights reserved John Smith copyright 2000 - 2007 That is hard for editing on all your pages every year . With PHP we can do this process very simple. Mon, 24 Nov 2008 20:43:51 +0000 Wordpress http://www.pelaphptutorials.com/article/wordpress.html http://www.pelaphptutorials.com/article/wordpress.html WordPress started in 2003 with a single bit of code to enhance the typography of everyday writing and with fewer users than you can count on your fingers and toes. Since then it has grown to be the largest self-hosted blogging tool in the world, used on hundreds of thousands of sites and seen by tens of millions of people every day. Mon, 24 Nov 2008 20:35:54 +0000 Anti Spam Bot Email by ASCII http://www.pelaphptutorials.com/article/anti-spam-bot-email-by-ascii.html http://www.pelaphptutorials.com/article/anti-spam-bot-email-by-ascii.html This class can be used to encode e-mail addresses to avoid robots that crawl pages to harvest e-mail addresses. It takes an e-mail address and can generate two versions: one for displaying in Web pages and another to use in mailto: links. In both versions the @ character is replaced by alternative characters. In the mailto: link version the other characters are encoded using equivalent numeric HTML entities. Fri, 21 Nov 2008 22:58:50 +0000 PHP Binary search http://www.pelaphptutorials.com/article/php-binary-search.html http://www.pelaphptutorials.com/article/php-binary-search.html This class can be used to quickly search for sorted data in large files using the binary search algorithm. It can search for a given identifier in a file that has lines that contain only the identifier and a value separated by a tab character. The class uses the binary search algorithm to quickly narrow the search for a given identifier even when the files are very large. Fri, 21 Nov 2008 22:37:33 +0000 MailBee WebMail http://www.pelaphptutorials.com/article/mailbee-webmail.html http://www.pelaphptutorials.com/article/mailbee-webmail.html MailBee WebMail PHP is a web based mail client built as a set of PHP scripts. MailBee WebMail PHP allows users to access their local or remote e-mail accounts directly from web browser. MailBee WebMail PHP allows receiving and sending email messages via POP3 and SMTP protocols respectively through both local and remote mail servers. MailBee WebMail PHP is shipped as source code, what allows you to use it "as-is" or modify the scripts to suit your needs. Sun, 09 Nov 2008 23:55:36 +0000 Notepad++ http://www.pelaphptutorials.com/article/notepad.html http://www.pelaphptutorials.com/article/notepad.html Notepad++ is a generic source editor (it tries to be anyway) and Notepad replacement written in C++ with the win32 API. The aim of Notepad++ is to offer a slim and efficient binary with a totally customizable GUI. This project is under the GPL Licence (http://www.gnu.org/copyleft/gpl.html). Fri, 07 Nov 2008 18:56:33 +0000 Clearing Caches http://www.pelaphptutorials.com/article/clearing-caches.html http://www.pelaphptutorials.com/article/clearing-caches.html MySQL has a set of internal caches. These can be cleared using the FLUSH and RESET commands. For example, if we have updated user privileges by manually altering the grant tables, we can make sure that these changes roll through the system by executing a Fri, 31 Oct 2008 21:38:58 +0000 Setting the Root Password http://www.pelaphptutorials.com/article/setting-the-root-password.html http://www.pelaphptutorials.com/article/setting-the-root-password.html As you probably noticed when you logged in just now, you had to supply a username "root" but not a password. The initial installation of MySQL has no root password set. It's really important to set this password for obvious security reasons. Fri, 31 Oct 2008 20:55:27 +0000 Dynamically Creating Graphs and Charts with PHP and GDChart http://www.pelaphptutorials.com/article/dynamically-creating-graphs-and-charts-with-php-and-gdchart.html http://www.pelaphptutorials.com/article/dynamically-creating-graphs-and-charts-with-php-and-gdchart.html Friday Night Fever If you've been working with PHP for a while, you already know that the language makes dynamic image generation very simple: the GD extension and a few lines of PHP code are all you need to create a JPEG, GIF or PNG image from scratch. However, while this works remarkably well for simple tasks, it can become tedious and complicated if you need to generate more complex images, such as graphs and charts, at run-time. Tue, 23 Sep 2008 21:10:53 +0000 How to solve JFolder::create: Could not create directory http://www.pelaphptutorials.com/article/how-to-solve-jfolder-create-could-not-create-directory.html http://www.pelaphptutorials.com/article/how-to-solve-jfolder-create-could-not-create-directory.html One of most common headache when you deploying from local version joomla to production server is : JFolder::create: Could not create directory So from where is coming this problem? Thu, 01 Jan 1970 00:00:00 +0000