The previous blog post is a new process, which is a follow-up to process management: initiating and approving processes
I. Three tables needed to initiate the process and audit process
Two. Write code
1. Use Ajax to make a login page, use the session to get the user name:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">2. Login Interface Processing page dlchuli.php
<?phpsession_start (); Require ". /dbda.class.php "; $db = new Dbda (); Create new object//pass over value $uid = $_post["UID"]; $pwd = $_post["pwd"];//query statement $sql = "Select pwd from users where uid= ' {$uid} ' and pwd= ' {$ PWD} ';//execute statement $attr = $db->query ($sql, 1); if (!empty ($pwd) &&!empty ($attr) && $attr [0][0]== $pwd) { $_session["UID"] = $uid;//session Receive user value echo "OK";} else{ echo "NO";}
3. Main Page main.php
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
4. Initiation Process Page faqi.php
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
5. Initiating Process processing page fqchuli.php
<?phpsession_start (); Require ". /dbda.class.php "; $db = new Dbda (); $code =$_post[" LC "]; $nr =$_post[" nr "]; $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); Header (" Location:main.php ");
Click "Initiate" and the data will be added to the database.
6. Process Review Page shenhe.php
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 7. Write the Audit processing page tongguo.php (*)
<?php$ids = $_get["code"];require ". /dbda.class.php "; $db = new Dbda ();//Let the process go down, each audit through one, corresponding towhere field to add 1$sql =" Update userflow set towhere = towhere+1 where IDs = ' {$ids} '; $db->query ($sql);//Determine if the process is over $sql = "SELECT Max (orders) from Flowpath where code= (select code from Userflow w Here ids= ' {$ids} '), $maxsx = $db->strquery ($sql), $sql = "Select Towhere from Userflow where ids= ' {$ids} '"; $towhere = $d B->strquery ($sql), if ($towhere > $maxsx) {//If it is finished, modify the state; the corresponding isOK field is changed to 1 (here 1 means end, 0 means not closed) $sql = "Update Userflow Set isOK = 1 where ids= ' {$ids} ' "; $db->query ($sql);} Header ("location:shenhe.php");
When this step is written, clicking "Pass" will become "passed";
Zhangsan is the first approver to review from Zhangsan.
Niuniu is the last approver to end the show 1
END
php-Process Management (initiation process and audit process)