<?php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> <title>admin_product_add</title> <style type="text/css"> <!-- .style2 {color: #999999} --> </style> </head> <body> <? //include('head.php');?> <table width="782" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="124" height="60"> </td> <td width="100" align="center" background="../images/button1.jpg"><a href="admin_login.php">หน้าหลัก</a></td> <td width="100" align="center" background="../images/button1.jpg"><p><a href="admin_product_add.php">เพิ่มแสตมป์</a></p></td> <td width="100" align="center" background="../images/button2.jpg"><p><a href="admin_special.php">แสตมป์พิเศษ</a></p></td> <td width="100" align="center" background="../images/button1.jpg"><p><a href="admin_product_search.php">ค้นหา</a></p></td> <td width="100" align="center" background="../images/button1.jpg"><p>ออกจากระบบ</p></td> <td width="158"> </td> </tr> </table> <br /> <form action=" admin_special2.php " method="post" enctype="multipart/form-data"> <table width="450" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" align="center">เพิ่มแสตมป์</td> </tr> <tr> <td align="center">ชื่อแสตมป์</td> <td><input name="n_stamp" type="text" id="n_stamp" /></td> </tr> <tr> <td align="center">ชื่อเทศกาล/ วันสำคัญ </td> <td><label> <select name="special"> <option>วันขึ้นปีใหม่</option> <option>วันวาเลนไทน์</option> <option>วันแม่แห่งชาติ</option> <option>วันพ่อแห่งชาติ</option> </select> </label></td> </tr> <tr> <td width="224" align="center">ปีที่ผลิต</td> <td width="350"><label> <input name="year" type="text" id="year" maxlength="4" /> <span class="style2">*พ.ศ. เท่านั้น</span> </label></td> </tr> <tr> <td height="37" align="center">รายละเอียด</td> <td> <textarea name="detail" id="detail"></textarea> </td></tr> <tr> <td align="center">จำนวนชุด</td> <td><input name="quality" type="text" id="quality" /> <span class="style2"> *ตัวเลขเท่านั้น</span></td> </tr> <tr> <td align="center">ราคา</td> <td><label> <input name="price" type="text" id="price" /> บาท </label></td> </tr> <tr> <td align="center">รูปภาพ</td> <td><label> <input type="file" name="file" id="file" /> </label></td> </tr> <tr> <td colspan="2"><center><input type="submit" name="Submit2" value="ยืนยัน" /></center></td> </tr> </table> </form> <br /> </body> <? include'../under.php';?> </html> ?>
<?php <? //include('head.php');?> <? include('../connect_db.php');?> <? echo $_POST[n_stamp]; // ทดลองเรียกค่าจากฟอร์มมา เพื่อเช็คว่าได้รับข้อมูลมาแล้ว echo $_POST[special]; echo $_POST[year]; echo $_POST[detail]; echo $_POST[price]; echo $_POST[file]; echo $_POST[quality];?> <? //ตรวจสอบ upload file if (($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/pjpeg") && ($_FILES["file"]["size"] < 2000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { move_uploaded_file($_FILES["file"]["tmp_name"],"../images/stamp/".$_POST[pic].".jpg"); } } else { ?> <? }?> <style type="text/css"> <!-- .style2 {color: #999999} --> </style> <table width="782" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="124" height="60"> </td> <td width="100" align="center" background="../images/button1.jpg"><a href="admin_login.php">หน้าหลัก</a></td> <td width="100" align="center" background="../images/button1.jpg"><p>เพิ่มแสตมป์</p></td> <td width="100" align="center" background="../images/button2.jpg"><p><a href="admin_special.php">แสตมป์พิเศษ</a></p></td> <td width="100" align="center" background="../images/button1.jpg"><p><a href="admin_product_search.php">ค้นหา</a></p></td> <td width="100" align="center" background="../images/button1.jpg"><p>ออกจากระบบ</p></td> <td width="158"> </td> </tr> </table> <br /> <form action="confirm_stamp_db.php" method="post" enctype="multipart/form-data"> <table width="450" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" align="center">ตรวจสอบความถูกต้องในการเพิ่มแสตมป์พิเศษ</td> </tr> <tr> <td align="center">ชื่อแสตมป์</td> <td><input name="n_stamp" type="text" id="n_stamp" value="<? echo $_POST[n_stamp];?>"/></td> </tr> <tr> <td align="center">ชื่อเทศกาล/ วันสำคัญ </td> <td><label> <? $special=array("วันขึ้นปีใหม่","วันวาเลนไทน์","วันแม่แห่งชาติ","วันพ่อแห่งชาติ"); ?> <select name="special" id="sec" value="<? echo $_POST[special];?>"> <? foreach($special as $x){?> <option value=<? echo $x;?>><? echo $x; ?> </option> <? }?> </select> </label></td> </tr> <tr> <td width="138" align="center">ปีที่ผลิต</td> <td width="356"><label> <input name="year" type="text" id="year" maxlength="4" value="<? echo $_POST[year];?>"/> <span class="style2">*พ.ศ. เท่านั้น</span> </label></td> </tr> <tr> <td height="37" align="center">รายละเอียด</td> <td><textarea name="detail" id="detail"><? echo $_POST[detail];?> </textarea> </td> </tr> <tr> <td align="center">จำนวนชุด</td> <td><input name="quality" type="text" id="quality" value="<? echo $_POST[quality];?>" /> </td> </tr> <tr> <td align="center">ราคา</td> <td><label> <input name="price" type="text" id="price" value="<? echo $_POST[price];?>" /> บาท </label></td> </tr> <tr> <td align="center">รูปภาพ</td> <td><label> <img src="../Images/stamp/<? echo $_POST[id].'.jpg';?>" width="165" height="123" /> <br /> <br /> <input type="file" name="file" /> <br /> <span class="style2"> *หากต้องการเปลี่ยนรูปภาพ<br /> ให้ทำการเลือกไฟล์ใหม่ครับ<br /> ไฟล์รูปภาพสกุล .jpg เท่านั้น </span> </label></td> </tr> <tr> <td colspan="2"><center> <input type="submit" name="Submit2" value="ยืนยัน" /> </center></td> </tr> </table> </form> <? if($_POST[n_stamp]==''){ ?> <script> alert("กรุณากรอกชื่อแสตมป์ด้วยครับ"); history.back(); </script> <? }else{ if($_POST[year]==''){ ?> <script> alert("กรุณากรอกปีที่ผลิตของแสตมป์ด้วยครับ"); history.back(); </script> <? }else{ if(!(ereg("[0-9]",$_POST[year]))){ // ตรวจสอบค่า ให้เป็นตัวเลขอย่างเดียว ?> <script> alert("กรุณากรอกปี พ.ศ. เฉพาะตัวเลขด้วยครับ"); history.back(); </script> <? }else{ $year=strlen($_POST[year]); if ($year<4){ ?> <script> alert("กรุณากรอกปี พ.ศ. อย่างน้อย 4 ตัวด้วยครับ"); history.back(); </script> <? }else{ if($_POST[detail]==''){ ?> <script> alert("กรุณากรอกข้อมูลแสตมป์ด้วยครับ"); history.back(); </script> <? }else{ if($_POST[quality]==''){ ?> <script> alert("กรุณากรอกข้อมูลจำนวนชุดแสตมป์ด้วยครับ"); history.back(); </script> <? }else{ if(!(ereg("[0-9]",$_POST[quality]))){ // ตรวจสอบค่า ให้เป็นตัวเลขอย่างเดียว ?> <script> alert("กรุณากรอกจำนวนชุดเฉพาะตัวเลขด้วยครับ"); history.back(); </script> <? }else{ if($_POST[price]==''){ ?> <script> alert("กรุณากรอกข้อมูลจำนวนชุดแสตมป์ด้วยครับ"); history.back(); </script> <? }else{ if(!(ereg("[0-9]",$_POST[price]))){ // ตรวจสอบค่า ให้เป็นตัวเลขอย่างเดียว ?> <script> alert("กรุณากรอกราคาเฉพาะตัวเลขด้วยครับ"); history.back(); </script> <? }else{ }}}}}}}}} ?> <br /> </body> <? include'../under.php';?> </html> ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง