Programming

How to create a random password in PHP

Fadıl

I am trying to generate a random password in PHP.

If you ever have the need to create a random password or username you can use something like this.

function randomPassword($length) { 
  $possible = '0123456789!@#$%^&*()_+' . 
              'abcdefghijklmnopqrstuvwxyz' . 
              'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . 
  $str = ""; 
  while (strlen($str) < $length) { 
     $str .= substr($possible, (rand() % strlen($possible)), 1); 
  } 
  return($str); 
}

How to Improved Caching with PHP

Fadıl

Introduction

In the last Code Gallery Spotlight, we examined a PHP class that performed very simple data caching. This time around we are going to explore the same topic, but we will add new functionality in order to increase efficiency and reduce the chance of errors. The class we will be examining this time around uses file locking and employs some better coding techniques than the last class we used.
If you missed the last, you can find it at https://techsoftcenter.com/caching-variables-with-php/

How to Displaying an RSS feed with PHP

Fadıl

Introduction

Whether you are retrieving information from a database or grabbing news headlines from another site, properly used caching can help reduce the run time of your PHP scripts and load on your server. Aside from the speed considerations, caching can also add dependability. By caching results from your database queries, you can still use the results in the event your database goes down.

Today we will look at a class designed to do caching, but first, let’s determine when we should use caching.

Displaying an RSS feed with PHP

Fadıl

Introduction

RDF Site Summary documents, or RSS, are an easy way to syndicate content onto your web site. More and more web sites are offering RSS feeds of their content that you can use to add substance to your own site.

RSS is an XML format that was designed by Netscape. Since their inception, RSS documents have gained wide popularity and are used by many major news portals and other web sites.

A Simple Web Search Engine

Fadıl

Every user expects a search engine on any Web site they visit. Unfortunately, search engines are extremely complex to develop. They require massive amounts of resources and time to implement. Today I’ll show you how to use a MySQL (or any SQL database) to create your own basic search engine.

Note: Today’s Code Gallery Spotlight requires that an SQL-compliant database be installed (such as MySQL). If a SQL database is not available, you can download one from<http://www.mysql.com/>.