标签:
登录页面
<body> <form action="loginchuli.php" method="post"> <div>用户名:<input type="text" name="uid" /></div> <div>密码:<input type="text" name="pwd" /></div> <input type="submit" value="登录" /> </form> </body> </html>
登录处理页面
<?php session_start(); $uid = $_POST["uid"]; $pwd = $_POST["pwd"]; include("../DBDA.php"); $db = new DBDA(); $sql = "select count(*) from Users where Uid=‘{$uid}‘ and Pwd = ‘{$pwd}‘"; $z = $db->StrQuery($sql); if($z == 1) { $_SESSION["uid"] = $uid; header("location:main.php"); } else { header("location:login.php"); }
主页面
<head>
<?php
session_start();
if(empty($_SESSION["uid"]))
{
header("location:login.php");
exit;
}
$uid = $_SESSION["uid"];
include("../DBDA.php");
$db = new DBDA();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
#menu
{
width:100%;
height:30px;
}
.z
{
width:100px;
height:30px;
float:left;
}
</style>
</head>
<body>
<br />
<br />
<center><h1>主页面</h1></center>
<br />
<div id="menu">
<div class=‘z‘><a href="xinjian.php">新建流程</a></div>
<div class="z"><a href="faqi.php">发起流程</a></div>
<div class="z"><a href="shenhe.php">审核流程</a></div>
</div>
</body>
</html>
新建流程页面
<script src="../jquery-1.11.2.min.js"></script> </head> <body> <?php session_start(); include("../DBDA.php"); $db = new DBDA(); $attr = array(); if(!empty($_SESSION["jiedian"])) { $attr = $_SESSION["jiedian"]; } ?> <h1>新建流程</h1> <div> 请选择节点人员: <?php $sry = "select * from Users"; $ary = $db->Query($sry); foreach($ary as $v) { echo "<input name=‘ry‘ class=‘ry‘ type=‘radio‘ value=‘{$v[0]}‘ /> {$v[2]}"; } ?> </div> <br /> <div> <input type="button" value="添加节点" id="tjjd" /> </div> <br /> <div> <?php foreach($attr as $k=>$v) { $sname = "select Name from Users where Uid=‘{$v}‘"; $name = $db->StrQuery($sname); echo "<div>{$k}--{$name}--<input type=‘button‘ value=‘删除‘ bs=‘{$k}‘ class=‘sc‘ /></div>"; } ?> </div> <br /> <div> 请输入流程名称: <input type="text" id="mc" /> </div> <br /> <div> <input type="button" value="添加" id="add" /> </div> <a href="main.php">返回</a> </body> <script type="text/javascript"> $(document).ready(function(e) { //设置默认选中第一项 $(".ry").eq(0).prop("checked",true); //添加节点按钮点击事件 $("#tjjd").click(function(){ var rd = $(".ry"); //取选中的用户名 var uid = ""; for(var i=0;i<rd.length;i++) { if(rd.eq(i).prop("checked")) { uid = rd.eq(i).val(); } } $.ajax({ url:"tjjd.php", data:{uid:uid}, type:"POST", dataType:"TEXT", success: function(data){ window.location = "xinjian.php"; } }); }) //删除节点按钮事件 $(".sc").click(function(){ var id = $(this).attr("bs"); $.ajax({ url:"scjd.php", data:{id:id}, type:"POST", dataType:"TEXT", success: function(data){ window.location = "xinjian.php"; } }); }) //添加流程按钮 $("#add").click(function(){ var name = $("#mc").val(); $.ajax({ url:"tjlc.php", data:{name:name}, type:"POST", dataType:"TEXT", success: function(data){ if(data.trim()=="OK") { alert("添加成功"); } else { alert("添加失败!"); } } }); }) }); </script> </html>
添加节点页面
<?php session_start(); $uid = $_POST["uid"]; if(empty($_SESSION["jiedian"])) { $attr = array($uid); $_SESSION["jiedian"] = $attr; } else { $attr = $_SESSION["jiedian"]; array_push($attr,$uid); $_SESSION["jiedian"] = $attr; }
删除节点页面
<?php session_start(); $id = $_POST["id"]; $attr = $_SESSION["jiedian"]; unset($attr[$id]); $attr = array_values($attr); $_SESSION["jiedian"] = $attr;
添加流程页面
<?php session_start(); include("../DBDA.php"); $db = new DBDA(); $attr = array(); if(!empty($_SESSION["jiedian"])) { $attr = $_SESSION["jiedian"]; } $name = $_POST["name"]; //向流程表添加数据 $code = date("YmdHis"); $slc = "insert into LiuCheng values(‘{$code}‘,‘{$name}‘)"; //判断是否执行成功的变量 $isok = true; if($db->Query($slc,0)) { foreach($attr as $k=>$v) { //向流程对应节点表添加数据 $sfl = "insert into FlowPath values(‘‘,‘{$code}‘,‘{$v}‘,{$k})"; $isok = $isok && $db->Query($sfl,0); } } if($isok) { echo "OK"; } else { echo "NO"; }
发起流程页面
<script src="../jquery-1.11.2.min.js"></script> </head> <body> <?php include("../DBDA.php"); $db = new DBDA(); ?> <h1>发起流程</h1> <div> 请选择流程: <select id="lc"> <?php $sql = "select * from LiuCheng"; $attr = $db->Query($sql); foreach($attr as $v) { echo "<option value=‘{$v[0]}‘>{$v[1]}</option>"; } ?> </select> </div> <br /> <div> 请输入内容: <textarea style="width:300px; height:200px" id="nr"> </textarea> </div> <br /> <div> <input type="button" value="发起" id="fq" /> </div> <a href="main.php">返回</a> </body> <script type="text/javascript"> $(document).ready(function(e) { $("#fq").click(function(){ var code = $("#lc").val(); var nr = $("#nr").val(); $.ajax({ url:"fqcl.php", data:{code:code,nr:nr}, type:"POST", dataType:"TEXT", success: function(data){ if(data.trim()=="OK") { alert("发起成功"); } else { alert("发起失败!"); } } }); }) }); </script> </html>
发起处理页面
<?php
session_start();
include("../DBDA.php");
$db = new DBDA();
$code = $_POST["code"];
$nr = $_POST["nr"];
$uid = $_SESSION["uid"];
$rq = date("Y-m-d H:i:s");
$sql = "insert into UserFlow values(‘‘,‘{$code}‘,‘{$uid}‘,‘{$nr}‘,false,‘{$rq}‘,0)";
if($db->Query($sql,0))
{
echo "OK";
}
else
{
echo "NO";
}
标签:
原文地址:http://www.cnblogs.com/kevin2016/p/5559463.html