This is featured post 1 title
Replace these every slider sentences with your featured post descriptions.Go to Blogger edit html and find these sentences.Now replace these with your own descriptions.This theme is Bloggerized by Lasantha - Premiumbloggertemplates.com.
This is featured post 2 title
Replace these every slider sentences with your featured post descriptions.Go to Blogger edit html and find these sentences.Now replace these with your own descriptions.This theme is Bloggerized by Lasantha - Premiumbloggertemplates.com.
This is featured post 3 title
Replace these every slider sentences with your featured post descriptions.Go to Blogger edit html and find these sentences.Now replace these with your own descriptions.This theme is Bloggerized by Lasantha - Premiumbloggertemplates.com.
2014年9月30日 星期二
2014年9月28日 星期日
清晨6:26
禹傑
<?php require_once('../Connections/allianz.php'); ?>
<?php
$varID = ""; if (isset($_GET["id"]) ){ $varID =$_GET["id"];}
//echo " id = " .$varID ."<br>";
$delete = "delete from abc01 where 1=1 and id=".$varID." "; // 準備 新增或修改或刪除的SQL語法
//echo "delete=" . $delete . "<br>";
//exit();
mysql_select_db($database_allianz, $allianz); // 連線資料庫
$Result1 = mysql_query($delete, $allianz) or die(mysql_error()); // 執行新增或修改或刪除的SQL語法
$SQLGoTo = "abc01_qry";//跳頁
header(sprintf("Location: %s", $SQLGoTo ));
?>
清晨5:59
禹傑
<?php require_once('../Connections/allianz.php'); ?>
<?php
// 檔案處理區 ( "../../../../upload/news")
function isUploadFile($tmpFileName, $newFileName){
$isUpload = false;
if ( copy($tmpFileName, $newFileName) ){ // 更改檔名前置動作
$isUpload = true;
}
unlink($tmpFileName); // 清除暫存檔案
return $isUpload;
}
// 取得檔名
function getDateTimeFileName( $Picname ){
$temp = explode(".",$Picname);
return date("ymdHis") . "." . $temp[1];
}
$varMM_form = ""; if (isset($_POST["mm_form"]) ){ $varMM_form=$_POST["mm_form"];}
//echo " mm_form =" . $varMM_form."<br>";
if( $varMM_form == "form1"){
// 上傳圖片的程式
// 1.接file型態圖片檔案的資料,放到暫存檔案上
// 2.拷貝暫存檔案到images\upload目錄下
// 3.刪除暫存檔案
$oldFileName = $_FILES["pic"]["name"]; //--讀取參數
$tmpFileName = $_FILES["pic"]["tmp_name"];
$fileType = $_FILES["pic"]["type"];
$fileSize = $_FILES["pic"]["size"];
//$newFileName = getDateTimeFileName($oldFileName);
//$newFileName = $oldFileName; // "a.txt"; // 以原檔名存
$newFileName=mb_convert_encoding($_FILES["pic"]["name"],"big5","utf8"); // 以原檔名存
//echo "原始=" . $_FILES["picname"]["name"]. "<Br>";
//echo "轉碼=" . $newFileName . "<Br>";
//exit();
$path = "../images/upload"; // images/upload/
if ( chdir($path) ){ // 是否有切換目錄成功
//echo "tmp=" . $tmpFileName . "<br>";
//echo "new=" . $newFileName . "<Br>";
if ( isUploadFile($tmpFileName, $newFileName) ){ // 上傳成功
$msg .= "檔名=" . $oldFileName . "\\n";
$msg .= "大小=". ceil($fileSize / 1024) . " KB\\n";
$msg .= "\\n 成功上傳了 <br>";
} else {
$msg.= "\\n 上傳失敗,有可能您上傳的檔案太大了,";
$msg.= "不合規定,如有任何問題,請洽系統設計服務人員";
}
} else {
$msg.= "上傳檔案到指定的目錄 失敗\\n";
}
$varName = ""; if (isset($_POST["name"]) ){ $varName =$_POST["name"];}
//echo " name = " .$varName ."<br>";
$varSex = ""; if (isset($_POST["sex"]) ){ $varSex =$_POST["sex"];}
$varAge = ""; if (isset($_POST["age"]) ){ $varAge =$_POST["age"];}
$varAbout = ""; if (isset($_POST["about"]) ){ $varAbout = implode(",", $_POST["about"]); }
$varFavor = ""; if (isset($_POST["favor"]) ){ $varFavor =$_POST["favor"];}
$varOther = ""; if (isset($_POST["other"]) ){ $varOther =$_POST["other"];}
mysql_select_db($database_allianz,$allianz); // ³s½u¸ꯆ®w
$insert = " insert into abc01 ( ";
$insert.= " name, sex, age, ";
$insert.= " favor, about, other, ";
$insert= substr($insert, 0, strlen($insert)-2);
$insert.= " ) value ( ";
$insert.= " '".$varName."', ";
$insert.= " '".$varSex."', ";
$insert.= " '".$varAge."', ";
$insert.= " '".$varFavor."', ";
$insert.= " '".$varAbout."', ";
$insert.= " '".$varOther."', ";
$insert = substr($insert, 0, strlen($insert)-2);
$insert.= ");";
//echo " insert = " . $insert . "<br>";
//exit();
$Recordset1=mysql_query($insert,$allianz) or die(mysql_error());// °�d¸yªk
header(sprintf("Location: %s", "abc01_qry.php" ));
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- <script src="../js/jquery-2.1.1.js"></script> -->
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="../js/jquery-ui-1.11.1.custom/jquery-ui.js"></script>
<link rel="stylesheet" href="../js/jquery-ui-1.11.1.custom/jquery-ui.structure.css">
<link rel="stylesheet" href="../js/jquery-ui-1.11.1.custom/jquery-ui.theme.css">
<script>
<!--
$(function(){
$('#form1').submit(function() {
var s = "";
if ( $("input[name='name']").val().length==0 ){
s += " 沒輸入名字 \n ";
}
if( $("input[type=radio]:checked").length==0 ){
s += " 沒輸入性別 \n ";
}
if ( $("age option:selected").val().length==0 ){
s += " 沒輸入年紀 \n ";
}
if( $("input[type=checkbox][name='favor']:checked").length==0 ){
s += " 沒輸入興趣 \n ";
}
if ( $("input[name='about']").val().length==0 ){
s += " 沒輸入關於 \n ";
}
if ( s.length >0 ){
alert(s);
return false;
}
});
});
-->
</script>
<style>
.nofind{
background-color:pink;
}
.eachrow{
background-color:#C1FFC1;
}
</style>
</head>
<body>
<form method="post" name="form1" id="form1" action="" >
<table border="1">
<tr>
<td colspan="2">新增</td>
</tr>
<tr>
<td>名字</td><td><input type="text" name="name" value=""></td>
</tr>
<tr>
<td>性別</td>
<td>
女生<input type="radio" id="sex" name="sex" value="0">
男生<input type="radio" id="sex" name="sex" value="1">
</td>
<td>年紀</td>
<td>
<select id="age" name="age">
<?php for($i=18;$i<=80;$i++){?>
<option value="<?php echo $i;?>"><?php echo $i;?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td>喜好</td>
<td colspan="3">
編號<input type="checkbox" id="favor" name="favor[]" value="0">
名字<input type="checkbox" id="favor" name="favor[]" value="1">
性別<input type="checkbox" id="favor" name="favor[]" value="2">
年紀<input type="checkbox" id="favor" name="favor[]" value="3">
</td>
</tr>
<tr>
<td>關於</td><td><textarea name="about" id="about" style="width:500px; hight:100; overflow:auto;"></textarea></td>
<td>其他</td><td><input type="text" id="other" name="other" value=""></td>
</tr>
<tr>
<td><input type="submit" value="新增"></td>
</tr>
</table>
<input type="hidden" name="mm_form" value="form1">
</form>
</body>
</html>
清晨5:56
禹傑
<?php require_once('../Connections/allianz.php'); ?>
<?php
$varMM_form = ""; if (isset($_POST["mm_form"]) ){ $varMM_form=$_POST["mm_form"];}
//echo " mm_form =" . $varMM_form."<br>";
$varID = ""; if (isset($_GET["id"]) ){ $varID =$_GET["id"];}
//echo " id = " .$varID ."<br>";
if( $varMM_form == "form1"){
$varName = ""; if (isset($_POST["name"]) ){ $varName =$_POST["name"];}
//echo " name = " .$varName ."<br>";
$varSex = ""; if (isset($_POST["sex"]) ){ $varSex =$_POST["sex"];}
$varAge = ""; if (isset($_POST["age"]) ){ $varAge =$_POST["age"];}
$varAbout = ""; if (isset($_POST["about"]) ){ $varAbout = implode(",", $_POST["about"]); }
$varFavor = ""; if (isset($_POST["favor"]) ){ $varFavor =$_POST["favor"];}
$varOther = ""; if (isset($_POST["other"]) ){ $varOther =$_POST["other"];}
mysql_select_db($database_allianz,$allianz); // ³s½u¸ꯆ®w
$update =" update abc01 set ";
$update.=" name= '".$varName."', ";
$update.=" sex= '".$varSex."', ";
$update.=" age= '".$varAge."', ";
$update.=" favor= '".$varFavor."', ";
$update.=" other= '".$varOther."', ";
$update= substr($update, 0, strlen($update)-2);
$update.= " where 1=1 ";
$update.=" and id= ".$varID." ";
echo " update = ". $update."<br>";
//exit();
$Recordset1 = mysql_query($update, $allianz) or die(mysql_error()); // 執行查詢語法
header(sprintf("Location: %s", "abc01_qry.php" ));
}
mysql_select_db($database_allianz, $allianz); // 連線資料庫
$sql = " select * from abc01 where 1=1 ";
if ( strlen($varID)>0 ){
$sql .= " and id= " . $varID . " ";
}
//echo " sql = " . $sql . "<br>";
//exit();
$Recordset1 = mysql_query($sql, $allianz) or die(mysql_error()); // 執行查詢語法
$row_Recordset1 = mysql_fetch_assoc($Recordset1); // 把查詢的結果帶到$row_Recordset1[]陣列中
$totalRow_Recordset1 = mysql_num_rows($Recordset1); // 把查詢後表格總共有幾列(幾筆資料)放到 $totalRows_Recordset1
//echo "totalRow_Recordset1 = " .$totalRow_Recordset1."<br>";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- <script src="../js/jquery-2.1.1.js"></script> -->
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="../js/jquery-ui-1.11.1.custom/jquery-ui.js"></script>
<link rel="stylesheet" href="../js/jquery-ui-1.11.1.custom/jquery-ui.structure.css">
<link rel="stylesheet" href="../js/jquery-ui-1.11.1.custom/jquery-ui.theme.css">
<script>
<!--
$(function(){
$('#form1').submit(function() {
var s = "";
if ( $("input[name='name']").val().length==0 ){
s += " 沒輸入名字 \n ";
}
if ( s.length >0 ){
alert(s);
return false;
}
});
});
-->
</script>
</head>
<body>
<?php if ($totalRow_Recordset1>0){ ?>
<form method="post" name="form1" id="form1" action="" >
<table border="1">
<tr>
<td colspan="2">修改</td>
</tr>
<tr>
<td>名字</td><td><input type="text" name="name" value="<?php echo $row_Recordset1["name"];?>"></td>
</tr>
<tr>
<td>性別</td>
<td>
女生<input type="radio" id="sex" name="sex" value="0" <?php if ( $row_Recordset1["sex"]=="0"){echo "checked=\"checked\""; }?>>
男生<input type="radio" id="sex" name="sex" value="1" <?php if ( $row_Recordset1["sex"]=="1"){echo "checked=\"checked\""; }?>>
</td>
<td>年紀</td>
<td>
<select id="age" name="age">
<?php for($i=18;$i<=80;$i++){?>
<option value="<?php echo $i;?>"><?php echo $row_Recordset1["age"];?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td>喜好</td>
<td colspan="3">
編號<input type="checkbox" id="favor" name="favor[]" value="0" <?php if ( strpos($row_Recordset1['favor'], "0")!== false ){ echo "checked=\"checked\""; } ?>>
名字<input type="checkbox" id="favor" name="favor[]" value="1" <?php if ( strpos($row_Recordset1['favor'], "1")!== false ){ echo "checked=\"checked\""; } ?>>
性別<input type="checkbox" id="favor" name="favor[]" value="2" <?php if ( strpos($row_Recordset1['favor'], "2")!== false ){ echo "checked=\"checked\""; } ?>>
年紀<input type="checkbox" id="favor" name="favor[]" value="3" <?php if ( strpos($row_Recordset1['favor'], "3")!== false ){ echo "checked=\"checked\""; } ?>>
</td>
</tr>
<tr>
<td>關於</td><td><textarea name="about" id="about" style="width:500px; hight:100; overflow:auto;"><?php echo $row_Recordset1["about"];?></textarea></td>
<td>其他</td><td><input type="text" id="other" name="other" value="<?php echo $row_Recordset1["other"];?>"></td>
</tr>
<tr>
<td><input type="submit" value="修改"></td>
</tr>
</table>
<input type="hidden" name="mm_form" value="form1">
<input type="hidden" name="id" value="<?php echo $row_Recordset1["id"];?>">
</form>
<?php } ?>
</body>
</html>
清晨5:41
禹傑
<?php require_once('../Connections/allianz.php'); ?>
<?php
$varID = ""; if (isset($_POST["id"]) ){ $varID =$_POST["id"];}
//echo " id = " .$varID ."<br>";
$varName = ""; if (isset($_POST["name"]) ){ $varName =$_POST["name"];}
//echo " name = " .$varName ."<br>";
$varSex = ""; if (isset($_POST["sex"]) ){ $varSex =$_POST["sex"];}
$varAge = ""; if (isset($_POST["age"]) ){ $varAge =$_POST["age"];}
$varFavor = ""; if (isset($_POST["favor"]) ){ $varFavor =implode(",", $_POST["favor"]);}
$varAbout = ""; if (isset($_POST["about"]) ){ $varAbout =$_POST["about"];}
$varOther = ""; if (isset($_POST["other"]) ){ $varOther =$_POST["other"];}
$varMM_form = ""; if (isset($_POST["mm_form"]) ){ $varMM_form =$_POST["mm_form"];}
// echo " mm_form = " .$varMM_form ."<br>";
mysql_select_db($database_allianz, $allianz); // 連線資料庫
$sql = " select * from abc01 where 1=1 ";
if ( strlen($varID)>0 ){
$sql .= " and id = " . $varID . " ";
}
if ( strlen($varName)>0 ){
$sql .= " and name like '%" . $varName . "%' ";
}
if ( strlen($varSex)>0 ){
$sql .= " and sex= " . $varSex . " ";
}
if ( strlen($varAge)>0 ){
$sql .= " and age= '" . $varAge . "' ";
}
if ( strlen($varFavor)>0 ){ // LOCATE('substring', 'mainstring')
// $_POST["favor"]
$sql .= " and ";
for($i=0; $i < count($_POST["favor"]); $i++){
$sql .= " favor like '%" . $_POST["favor"][$i] . "%' and ";
}
$sql = substr($sql, 0, strlen($sql)-5);
}
if ( strlen($varAbout)>0 ){
$sql .= " and about like '%" . $varAbout . "%'";
}
if ( strlen($varOther)>0 ){
$sql .= " and other like '%" . $varOther . "%' ";
}
//echo " sql = " . $sql . "<br>";
//exit();
$Recordset1 = mysql_query($sql, $allianz) or die(mysql_error()); // 執行查詢語法
$row_Recordset1 = mysql_fetch_assoc($Recordset1); // 把查詢的結果帶到$row_Recordset1[]陣列中
$totalRow_Recordset1 = mysql_num_rows($Recordset1); // 把查詢後表格總共有幾列(幾筆資料)放到 $totalRows_Recordset1
//echo "totalRow_Recordset1 = " .$totalRow_Recordset1."<br>";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
<!--
-->
</script>
<style>
.nofind{
background-color:pink;
}
.eachrow{
background-color:#C1FFC1;
}
</style>
</head>
<body>
<form method="post" name="form1" action="">
<table border="1">
<tr>
<td>編號</td><td><input type="text" id="id" name="id" value=""></td>
<td>名字</td><td><input type="text" id="name" name="name" value="<?php echo $_POST["name"];?>"></td>
</tr>
<tr>
<td>性別</td>
<td>
女生<input type="radio" id="sex" name="sex" value="0">
男生<input type="radio" id="sex" name="sex" value="1">
</td>
<td>年紀</td>
<td>
<select id="age" name="age">
<option value="">請選擇</option>
<?php for($i=18;$i<=80;$i++){?>
<option value="<?php echo $i;?>" <?php if ( $varAge ==strval($i) ){ echo "selected"; } ?>><?php echo $i;?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td>喜好</td>
<td colspan="3">
<?php echo $varFavor; ?>
<!-- strpos(整段要找的字串,要找的字); -->
編號<input type="checkbox" id="favor" name="favor[]" value="0" <?php if( strpos($varFavor,"0")!==false){ echo "checked";}?> >
名字<input type="checkbox" id="favor" name="favor[]" value="1" <?php if( strpos($varFavor,"1")!==false){ echo "checked";}?> >
性別<input type="checkbox" id="favor" name="favor[]" value="2" <?php if( strpos($varFavor,"2")!==false){ echo "checked";}?> >
年紀<input type="checkbox" id="favor" name="favor[]" value="3" <?php if( strpos($varFavor,"3")!==false){ echo "checked";}?> >
</td>
</tr>
<tr>
<td>關於</td><td><textarea id="about" name="about"><?php echo $varAbout;?></textarea></td>
<td>其他</td><td><input type="text" id="other" name="other" value="<?php echo $varOther;?>"></td>
</tr>
<tr>
<td colspan="4"><input type="submit" value="尋找"></td>
</tr>
</table>
<input type="hidden" name="mm_form" value="form1">
</form>
<input type="button" name="btn_ins" value="ins" onclick="location.href='abc01_ins.php';">
<table border="1">
<tr>
<td>ID</td>
<td>名字</td>
<td>性別</td>
<td>年紀</td>
<td>喜好</td>
<td>關於</td>
<td>圖片</td>
<td>其他</td>
</tr>
<?php if( $totalRow_Recordset1>0){ ?>
<?php do{ ?>
<tr class="eachrow">
<td><?php echo $row_Recordset1["id"];?></td>
<td><?php echo $row_Recordset1["name"];?></td>
<td><?php echo $row_Recordset1["sex"];?></td>
<td><?php echo $row_Recordset1["age"];?></td>
<td><?php echo $row_Recordset1["favor"];?></td>
<td><?php echo $row_Recordset1["about"];?></td>
<td><?php echo $row_Recordset1["pic"];?></td>
<td><?php echo $row_Recordset1["other"];?></td>
<td><input type="button" value="upd" onclick="location.href='abc01_upd.php?id=<?php echo $row_Recordset1["id"];?>';"></td><!--"<a href="abc01_upd.php?id=<?php echo $row_Recordset1["id"];?>">upd</a>-->
<td><input type="button" value="del" onclick="location.href='abc01_del.php?id=<?php echo $row_Recordset1["id"];?>';"></td><!--<a href="abc01_del.php?id=<?php echo $row_Recordset1["id"];?>">del</a>-->
</tr>
<?php } while($row_Recordset1 = mysql_fetch_assoc($Recordset1) ); ?>
<?php }else{ ?>
<tr>
<td colspan="4" class="nofind">無資料</td>
</tr>
<?php } ?>
</table>
</body>
</html>


