Implement auto login in PHP

One of the basic component for every PHP application is the user account system. User can login , logout and register. This post talks about auto login. The user can select "remember me" or "auto login", so after the user login successfully, when the user come back at any later time in a specific period, the user auto login.

Store session data in MongoDB with PHP

MongoDB is scalable document oriented database. This make it a good choice to store of the session information of the users. With MongoDB, your application can grow as the users grows, for example, a Social Network Site.

A special cookie with a name "SID" is used to identify the current session. To start a session , first check the cookie, if there is a cookie named with "SID", then load the session data from MongoDB, if not, create a new session and insert a record that contains session data into database.

A special cookie with a name "SID" is used to identify the current session. To start a session , first check the cookie, if .

Regular expression non-capture in PHP

The non-capture parentheses is a confusing regular expression element. The non-capture operator has a special notation (?:).

Here is an example in PHP:

Advance query in MongoDB with PHP

In last post we demonstrate the basic CRUD in MongoDB. Lets get some advanced query technique.

MongoDB support chained calling, you can filter result by chaining, to select the first 3 recoreds:

CRUD in Mongodb with PHP

and the php extension on windows. Lets do some CRUD operation in PHP script. [Select collection ... In last post we introduced how to install mongodb ... ] => this is content [category] => database ) As you can see Mongodb use an unique id to identify ... ('5188bebf7ab2ad7422000000'); $one = $collection->findone(array('_id' => $id)); print_r($one); The $set tells Mongodb

PHP install PEAR and mongodb on windows

Install PEAR is very easy, just download and run

Then you can install mongodb like this:

PHP tutorial : How to output category tree

A very common situation in web development is the category tree, in its nature , its just a recursive traversal of a tree data structure. This post will demonstrate the method of generating a tree while traversing the data strucute.

Step 1. Create a database table to store the category data:

PHP example: How to get extension of a file name

A typical file name in windows is like "file.txt". How to get the extension name with php script?

If you think its too many lines:

Upload files to FTP server with php script recursively

PHP has built in networking api to access all kinds of services. Here is a script you can type in a command line window to upload a folder and all its sub directories to a FTP server. Sometimes it will be very handy with a command to do this kind of job.

Using php record visitor information

Its very useful to record the site visitor information like ip address, search keywords, visit url...

Today I will write a simple php script to achieve that. First we need a database table to store the information. Here is the table:

Previous Page 1 ... 3 4 5 Next Page