查看文件: add_signup.php
大小: 6.95 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { if(!empty($_FILES['file1']['name'])){ $_POST['sgact2']=$_FILES['file1']['name']; $dd='/www/bus104/signupdoc/'.$_POST['sgact2'];//.".docx"; $tempFile = $_FILES['file1']['tmp_name']; move_uploaded_file($tempFile, $_FILES['file1']['name'] ); } $_POST['sgdate']=$_POST['y1'].sprintf('%02d',$_POST['m1']).sprintf('%02d',$_POST['d1']); $_POST['sgdates']=$_POST['y2'].sprintf('%02d',$_POST['m2']).sprintf('%02d',$_POST['d2']); $_POST['sgdatee']=$_POST['y3'].sprintf('%02d',$_POST['m3']).sprintf('%02d',$_POST['d3']); $maxman=($_POST['sgman2']>15)?15:$_POST['sgman2']; $insertSQL = sprintf("INSERT INTO signup1 (sgname, sgdate, sgdates, sgdatee, sgaddr, sgact1, sgact2, sgman, sgman2, sgunit) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['sgname'], "text"), GetSQLValueString($_POST['sgdate'], "date"), GetSQLValueString($_POST['sgdates'], "date"), GetSQLValueString($_POST['sgdatee'], "date"), GetSQLValueString($_POST['sgaddr'], "text"), GetSQLValueString($_POST['doc'], "text"), GetSQLValueString($_POST['sgact2'], "text"), GetSQLValueString($_POST['sgman'], "int"), GetSQLValueString($maxman, "int"), GetSQLValueString($_POST['sgunit'], "text")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($insertSQL, $BE2) or die(mysql_error()); mysql_select_db($database_BE2, $BE2); $query_Rt2 = "SELECT sgid FROM signup1 WHERE 1 order by sgid desc limit 1 "; $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); $pid=$row_Rt2['sgid']; $updateSQL = sprintf("UPDATE adpage SET psigid=%s WHERE pid=%s", GetSQLValueString($pid, "int"), GetSQLValueString($_POST['setid'], "int")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); mysql_free_result($Rt2); $updateGoTo = $_POST['url'];//"main.php?act=list_signup"; header(sprintf("Location: %s", $updateGoTo)); } $colname_Rt2 = "-1"; if (isset($_GET['setid'])) { $colname_Rt2 = $_GET['setid']; } ?> <form action="" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="500" border="1" align="center"> <tr valign="baseline"> <td colspan="2" align="center" nowrap="nowrap">新增 活動</td> </tr> <tr valign="baseline"> <td width="110" align="right" nowrap="nowrap">活動名稱:</td> <td width="340"><input type="text" name="sgname" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">活動日期:</td> <td><input type="hidden" name="sgdate" value="" size="32" /><select id="y1" name="y1"> <? $year=date('Y',time()) ; ?> <? for($ax=$year;$ax<$year+2;$ax++){ ?> <option value="<? echo $ax;?>" ><? echo $ax;?></option> <? }?> </select> 年 <select id="m1" name="m1"> <? for($ax=1;$ax<13;$ax++){ ?> <option value="<? echo $ax;?>" ><? echo $ax;?></option> <? }?> </select> 月 <select id="d1" name="d1"> <? for($ax=1;$ax<32;$ax++){ ?> <option value="<? echo $ax;?>" ><? echo $ax;?></option> <? }?> </select> 日</td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">報名起始日期:</td> <td><input type="hidden" name="sgdates" value="" size="32" /><select id="y2" name="y2"> <? $year=date('Y',time()) ; ?> <? for($ax=$year;$ax<$year+2;$ax++){ ?> <option value="<? echo $ax;?>" ><? echo $ax;?></option> <? }?> </select> 年 <select id="m2" name="m2"> <? for($ax=1;$ax<13;$ax++){ ?> <option value="<? echo $ax;?>" ><? echo $ax;?></option> <? }?> </select> 月 <select id="d2" name="d2"> <? for($ax=1;$ax<32;$ax++){ ?> <option value="<? echo $ax;?>" ><? echo $ax;?></option> <? }?> </select> 日</td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">報名截止日期:</td> <td><input type="hidden" name="sgdatee" value="" size="32" /><select id="y3" name="y3"> <? $year=date('Y',time()) ; ?> <? for($ax=$year;$ax<$year+2;$ax++){ ?> <option value="<? echo $ax;?>" ><? echo $ax;?></option> <? }?> </select> 年 <select id="m3" name="m3"> <? for($ax=1;$ax<13;$ax++){ ?> <option value="<? echo $ax;?>" ><? echo $ax;?></option> <? }?> </select> 月 <select id="d3" name="d3"> <? for($ax=1;$ax<32;$ax++){ ?> <option value="<? echo $ax;?>" ><? echo $ax;?></option> <? }?> </select> 日</td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">活動地點:</td> <td><input type="text" name="sgaddr" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">活動辦法:</td> <td> <input name="file1" type="file" id="file1" /> <input name="sgact2" type="hidden" id="sgact2" value="<? echo sprintf("%04d%04d",rand(0,9999),rand(0,9999))?>" /> <input name="doc" type="hidden" id="doc" value="" size="32" /> <input name="setid" type="hidden" id="setid" value="<?= $colname_Rt2 ;?>" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">報名人數:</td> <td><input name="sgman" type="text" value="" size="6" maxlength="5" /> 0 表示不設限</td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">最大攜伴人數:</td> <td><input name="sgman2" id="sgman2" type="text" value="" size="6" maxlength="5" /> 0 表示無攜伴 /最多攜伴15人</td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">活動單位:</td> <td><input type="text" name="sgunit" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td><input type="submit" value="插入記錄" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> <input name="url" type="hidden" id="url" value="<? echo $_SERVER['HTTP_REFERER']?>" /> </form>
保存
取消
返回文件列表