Design management staff table
67.255.255.255
A byte: . 8 bits:
00000000——————11111111
An IPv4 address of an unsigned integer, can be converted into each other:
TABLE statement:
Insert a few test data :
shop34-6- verify the legitimacy of administrators
Function : administrator verification
Controller - action
Back/AdminController->checkAction();
model
To operate admin table, model AdminModel
Application/back/Model/AdminModel.class.php
Test :
Do not forget to modify the data server information, is used by the project! ( Increasing the configuration file)
View - Templates
Do not need
shop34-7- Jump
Case realized Jump
Package that can complete the jump method, if necessary, can call!
The controller 's function!
This feature should be all the controller operation is shared, and therefore, should be the basis of the controller is defined in :
Controller.class.php
Realization :
Analysis, parameters:
$ url, target URL address
$ info, tips information
$ wait, wait time
For the info and wait to increase the default parameters, can be done, can be done immediately, you may also be prompted to complete the jump!
Code implementation:
Project use:
Back/AdminController->checkAction()
Test :
Create a background Home Action!
Application/back/controller/ManageController.class.php
indexAction();
shop34-8-session login authentication
Browser login authentication analysis
In accessing the home page to the background (the background all functions), you should first determine whether the current browser whether logged in, do realize the function! If you do not sign in, go to the login page .
How to determine the current browser user is logged on ?
Administrators legitimate -> in the login status
Login logo:
A data.
How to store the data it ?
[ Unreasonable of ] test:
Variables :
分配(back/AdminController->checkAction())
Verify ( Back / ManageController-> the indexAction () )
Summary : No , because:
Data of the life cycle of problems, for PHP , all data ( variables, constants) of the maximum life cycle, a cycle script (once to the server browser makes a request , the server requests referred PHP processing , PHP finished processing to the server, The server responds to the browser , is a script period )
Visible : store login sign, you need to cross-script period can store data in a form (persistent storage of data of mechanisms)
[ Unreasonable of ] test:
file:
No , the reason is:
In the server-side management of files (database) is not case-browser, any browser are common!
Visible : Log storage flag, you need to be distinguished browser, and multiple requests within the browser cycle can be permanently stored in a data storage mechanism!
More storage mechanism , that is, the session technology !
S ession complete the login state storage
distribution:
Back/AdminController->checkAction();
Judge :
Back/ManageController->indexAction()
shop34-9-SESSION storage
Project in the session storage
To the framework code base extension tools roles appear projects!
Increase the appropriate directory constants:
Index.php
The use of object-oriented programming ideas to complete:
Tools .
Requirements :
Increasing the session storage tools (complete its automatic loading)
Storage operation tool by the process of acting as an object class.
In the instance of the object class of the tool, complete the setup session processor and open session .
Increasing the session storage tools (complete its automatic loading)
Storage operation serving as an object by the process tools
Requires the use of a unified project DAO database operations are completed.
In the instance of the object class of the tool, complete the setup session processor and open session .
A complete construction methods:
Use :
Create a session table:
Project , the original session_start (), a new SessionDB can !
shop34-10- frame class
Frame type (frame initialization class)
The original into the mouth of file functions , on the completion of the class, entry documents become simple, lightweight!
The entry file in the respective functions , the frame type of each method, complete:
To simplify, using pure static class. ( See the success of energy collection)
At this time, entry file: