<? ob_start(); //============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล session_start(); require("connect.php"); if($_GET["action"]=="Register") { if(trim($_POST["user"]) == "")//ใส่ { echo "<script>alert('กรุณาใส่ กำหนด user ของคุณ')</script>"; echo"<script>history.back();</script>"; exit(); } elseif(trim($_POST["txtPass"]) == "")//พาส { echo "<script>alert('กำหนด Password ของคุณ')</script>"; echo"<script>history.back();</script>"; exit(); } elseif(trim($_POST["txtPassCon"]) == "")//ยืนยันพาส { echo "<script>alert('กรุณายืนยัน Password')</script>"; echo"<script>history.back();</script>"; exit(); } elseif($_POST["txtPass"] != $_POST["txtPassCon"])//ตรวจสอบพาสว่าตรงกันหรือไม่ { echo "<script>alert('Password ทั้งสองช่องไม่ตรงกัน')</script>"; echo"<script>history.back();</script>"; exit(); } elseif(trim($_POST["txtName"]) == "") { echo "<script>alert('กรุณากรอกชื่อของ คุณ!!!')</script>"; echo"<script>history.back();</script>"; exit(); } //คำสั่งแก้ในกรณีไม่เป็นภาษาไทย echo "<br>"; $sql="SELECT * FROM tbCategory"; mysql_query("SET NAMES tis620"); //============ บันทึกข้อมูลสมาชิก $sql = "insert into members (user,pass,name) Values ('$_POST[user]','$_POST[txtPass]','$_POST[txtName]')"; $dbquery = mysql_query($sql); //echo $sql_up; // exit(); //=========== แก้ไขไฟล์เล็ก if(copy($_FILES["filUpload"]["tmp_name"],"myfile/".$_FILES["filUpload"]["name"])) { echo "Copy/Upload Complete<br>"; //*** Insert Record ***// $strSQL = "INSERT INTO members (FilesName) VALUES ('".$_FILES["filUpload"]["name"]."')"; $objQuery = mysql_query($strSQL); } { echo "<script>alert('การสมัครสมาชิกสำเร็จ')</script>"; echo"<script>history.back();</script>"; exit(); } } ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> <title>สอบ</title> <link href="css/styles.css" rel="stylesheet" type="text/css"> </head> <body> <form name="frmRegister" method="post" action="?action=Register" onSubmit="return checkvalue()"> <table width="40%" height="30" border="0" align="center" cellpadding="1" cellspacing="3" id="Table_01"> <tr> <td width="100%" ><div align="center"><strong>:::หน้าหลัก:::</strong><hr></div></td> </tr> <tr> <td width="100%" ><div align="center"><strong>สมัครสมาชิก </strong></div></td> </tr> </table></td> </tr> <tr> <td><table width="41%" height="144" border="0.5" align="center" cellpadding="1" cellspacing="3" > <tr > <td width="34%" height="26"><div align="right">user : </div></td> <td width="66%"><input name="user" type="text" class="txtbox" id="txtEmailCon" size="20" maxlength="30"> <font color="#FF0000">*</font></td> </tr> <tr> <td height="26" valign="top"><div align="right">Password :</div></td> <td><h5> <input name="txtPass" type="password" class="txtbox" id="txtPass" size="20" maxlength="12"> <font color="#FF0000">*กรอกไม่เกิน 12 คำ</font></h5></td> </tr> <tr> <td height="26"><div align="right"><span class="style2">ยืนยัน Password :</span></div></td> <td><input name="txtPassCon" type="password" class="txtbox" id="txtPassCon" size="20" maxlength="12"> <font color="#FF0000">*</font></td> </tr> <tr> <td height="11" valign="top"><div align="right">ชื่อ :</div></td> <td><input name="txtName" type="text" class="txtbox" id="txtName" size="25" maxlength="30"> <font color="#FF0000">*</font> </td> </tr> <tr> <td height="13" valign="top"><div align="right">รูป : </div></td> <td><p> <input type="file" name="filUpload"> </p> </td> </tr> <tr> <td height="28"> </td> <td><label> <input type="submit" name="Submit" id="Submit" value="ตกลง"> </label> <label> <input type="reset" name="Reset" id="button" value="ล้างข้อมูล"> </label></td> </tr> <tr> <td> <a href="member.php">ดูรายชื่อสมาชิก</a></td> </tr> </table> </form> </body> </html>
if(copy($_FILES["filUpload"]["tmp_name"],"myfile/".$_FILES["filUpload"]["name"])) { }
$objQuery = mysql_query($strSQL) or die(mysql_error());
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง