The realization of session in php3,4

Source: Internet
Author: User
Tags contains copy include modify mysql php3 file variable mysql database
Implementation of session in session php3,4
In PhP3 there is no session of this stuff, but we need, how to do? Don't worry, a lot of people do this for you, the most famous one is Phplib. You can go abroad.
Download, you can also go to most of the domestic PHP site downloads. The first thing we have to do is get phplib and php3 together to make it work. In order to achieve this function, we need to first install Phplib.
Follow me, it's easy (the following methods are passed on the win2000+php3.0.16+apache1.3.12+phplib7.2c+mysql3.23.21 for Win32)
Phplib most basic functions include user authentication, session management, permissions, and database abstraction.
How to use Phplib to implement the session function?
First, you will phplib untie, there is a directory called "PHP", this directory copy to the Apache installation directory. The following take the author's machine as an example:
My Apache is installed in the D:apache directory, I copy the "PHP" directory above to D:apache and copy the files and directories under the pages directory under Phplib to
D:apachehtdocs, note that the directory itself is not.
The Phplib class library needs to be initialized according to the system, you can modify the Local.inc file, which contains some basic parameters, you can modify it according to the actual situation of your machine.
Change a procedure in the D:apachephpprepend.php3 file as follows:

if (!isset ($_phplib) or!is_array ($_phplib)) {
$_phplib["Libdir"] = "d:/apache/php/"; Here instead you put phplib the path of the PHP directory
}

The D:apachephplocal.inc file is then changed as follows:

Class Db_example extends Db_sql {
var $Host = "localhost";//your MySQL database host name
var $Database = "Test";//Database name
var $User = "root";//Database user name
var $Password = "";//Database user password
}

The final step is to perform the Create_database.mysql file in the stuff directory in the unpacked Phplib directory, generating the initial table.
Let's explain how phplib works, every page that uses phplib must first be able to find the library files required to run Phplib, we can set auto_prepend in Php3.ini
Variable to support, the Phplib distribution package contains a prepend.php3 file, the Auto_prepend designated as "D:/apache/php/prepend.php3" (quoted), the pages will automatically contain Phplib class library, we can also
Add the Phplib Class Library directory to the include variable so that you can find the files, of course, the most benzene way is to specify the Phplib absolute path, which is not a good idea, portability is too bad!
In the second step, each page that uses phplib, you must first invoke the Page_open function for initialization. This will tell Phplib that you will use state saving now or in the future.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.