PHP process management, comparable to small programs and php process management
This process management starts from the user login interface, and then submits the application. The page is reviewed and approved step by step. This is actually quite simple, but it is only required in some logic aspects.
Think about it.
The login page will not be mentioned more. If you want to save the session, we can create a fake login page and only store the uid in the session.
Weilogin: fake logon page
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
On the create process page, select a node person, initiate a process, and perform other operations.
Xinjian. php
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Each of their methods is referenced on a page, using the switch method,
Chuli. php
<? Phpsession_start (); include (".. /fengzhuang/DBDA. class. php "); $ db = new DBDA (); $ type = $ _ POST [" type "]; switch ($ type) {case 0: $ uid = $ _ POST ["uid"]; if (empty ($ _ SESSION ["user"]) {$ arr = array ($ uid ); $ _ SESSION ["user"] = $ arr;} else {$ arr = $ _ SESSION ["user"]; array_push ($ arr, $ uid ); $ _ SESSION ["user"] = $ arr;} break; case 1: $ key = $ _ POST ["key"]; $ arr = $ _ SESSION ["user"]; unset ($ arr [$ key]); // Delete $ arr = array_values ($ arr ); // re-index $ _ SESSION ["user"] = $ arr; break; case 2: $ name =$ _ POST ["name"]; $ code = time (); // Add process $ SQL = "insert into liucheng values ('{$ code}', '{$ name}')"; $ db-> Query ($ SQL, 0); // Add a process node $ arr =$ _ SESSION ["user"]; foreach ($ arr as $ k => $ v) // obtain the index {$ SQL = "insert into flowpath values ('', '{$ code}', '{$ v}', '{$ k }')"; $ db-> Query ($ SQL, 0);} break; case 3: // user-initiated process $ code = $ _ POST ["code"]; $ nr = $ _ POST ["content"]; $ uid = $ _ SESSION ["uid"]; $ time = date ("Y-m-d H: I: s "); $ SQL =" insert into userflow values ('', '{$ code}', '{$ uid}', '{$ nr}', 0, '{$ time}', 0) "; $ db-> Query ($ SQL, 0); break ;}
Then, initiate the process,
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Next is the review page. You need to determine the owner of the process, the process code, the Process Code, and the order of the personnel in the process. Shenhe. php
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Finally, we will pass the processing... tongguo. php
<? Php
Session_start ();
Include ("../fengzhuang/DBDA. class. php ");
$ Db = new DBDA ();
// Process down
$ Code = $ _ GET ["code"];
$ SQL = "update userflow set towhere = towhere + 1 where ids = '{$ code }'";
$ Db-> Query ($ SQL, 0 );
// Determine whether the process is complete
$ SQL = "select * from userflow where ids = '{$ code }'";
$ Arr = $ db-> Query ($ SQL );
$ Lcdh = $ arr [0] [1]; // Process Code
$ Tw = $ arr [0] [6]; // Where is the process going?
$ SQL = "select count (*) from flowpath where code = '{$ lcdh }'";
$ Count = $ db-> StrQuery ($ SQL); // number of nodes in the process
If ($ tw> = $ count)
{
$ SQL = "update userflow set isok = 1 where ids = '{$ code }'";
$ Db-> Query ($ SQL, 0 );
}
Header ("location: shenhe. php ");