|  | 
	                
  
    | 
	 
        เพิ่มข้อมูลลงดาต้าเบสไม่ได้ มันขึ้นฟ้องว่า ('ไม่สามารถเพิ่มกระทู้ได้เนื่องจากพบคำหยาบ') ทั้งทีไม่ได้ใส่คำหยาบ อ่ะค่ะ  งงๆๆ ช่วยหน่อยค๊า     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | [<? session_start();
 if($_SESSION['user_id'] == "")
 {
 echo "<script> alert (' please LOGIN !!') ;</script>";
 echo"<meta http-equiv=\"refresh\" content=\"0;url='login.php'\">";
 exit();
 }
 if($_SESSION['status'] != "1")
 {
 echo "<script> alert ('This page for user only') ;</script>";
 echo"<meta http-equiv=\"refresh\" content=\"0;url='login.php'\">";
 exit();
 }
 ?>
 
 <meta http-equiv= "Content-Type" content="text/html; charset=utf-8" />
 
 <?
 function checkWordBad($word){
 $strwordArr = array("f u c k","f.u.c.k","ตายห่า","แม่เมิ่งสิ","สั ด ด","หีแม่","หี แม่","แม่ มึง ตาย","shit","fuck u","มึ_ง","กู","มึง","พ่อเมิ่ง","พ่ อ เ มิ่ ง","สาดดด","สัด","สัดด","สาด","เย็ดแม่","พ่อมึงตาย","แม่มึงตาย","เมิ่ง","เหี้ย","ควย","ตอแหล","ชาติหมา","เย็ดเข้","กะดอ","ห่าเอ๊ยย","สันดาน","ส้นตีน","แตด");
 $strCensor = "<font color='red'>Censor</font>" ;
 
 foreach ($strwordArr as $value) {
 $word = str_replace($value,$strCensor,$word);
 }
 return ($word) ;
 }
 //$post_detail2=checkWordBad($post_detail);
 //$post_detail1=$post_detail2;
 ?>
 
 
 <?
 include("connect.php");
 
 $forum_id		=$_GET['forum_id'];
 $subject		=checkWordBad($_POST['subject']);
 $post_detail	=checkWordBad($_POST['post_detail']);
 $user_id		=$_SESSION['user_id'];
 //$attach_file	=$_FILES['attach_file'];  // ตัวนี้มนรับค่าไม่สมบูรณ์
 $song_name		=checkWordBad($_POST['song_name']);
 $singer_name	=checkWordBad($_POST['singer_name']);
 $date_post	=date("Y-m-d H:i:s");
 
 $tmp_file      =$_FILES['attach_file']['tmp_name']; // ไฟล์ที่อัพโหลดมา จะถูกพักในโฟเดอร์ temp ของ windows ก่อน
 
 $attachfile    =$_FILES['attach_file']['name']; // ชื่อไฟล์
 
 if (empty($subject) || empty($post_detail) || empty($song_name) || empty($singer_name))
 {
 echo "<script> alert ('กรุณากรอกข้อมูลให้ครบถ้วน') ; history.back();</script>";
 exit();
 }
 
 if (empty($attach_file))
 {
 echo "<script> alert ('กรุณาเพิ่มเพลง') ; history.back();</script>";
 exit();
 }
 
 $path="song/";
 
 if ($attach_file!=""){
 
 if($types = getimagesize($attach_file))
 {
 if($type[2] == 1)
 {
 $music = $dt.".gif";
 }
 if($type[2] == 2)
 {
 $music = $dt.".jpg";
 }
 if($type[2] == 3)
 {
 $music = $dt.".png";
 }
 echo  "<script> alert ('ไม่สามารถโพสต์ได้ เนื่องจากไม่ได้เลือกไฟล์เพลง')  ; history.back();</script>";
 
 $attach_file!="";
 } else {
 
 $upload=copy($attach_file,"$path".$attachfile);
 if ($upload) {
 mysql_query("INSERT INTO webbord_post (question_id ,forum_id,subject ,post_detail ,user_id,attach_file ,count_view ,song_name,singer_name,date_post)VALUES
 ('','$forum_id','$subject', '$post_detail','$user_id','$attachfile','0', '$song_name', '$singer_name','$date_post')") or die ("<script> alert ('ไม่สามารถเพิ่มกระทู้ได้เนื่องจากพบคำหยาบ')  ;   history.back();</script>");
 
 {
 echo "<script> alert ('เพิ่มกระทู้เรียบร้อยแล้ว')  ; window.location='webboard.php'</script>";
 
 } } }
 
 }
 ?>
 
 
 
 Tag : PHP, MySQL
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2011-08-01 22:58:39 | By :
                          bb | View :
                          761 | Reply :
                          3 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | mysql_query("INSERT INTO webbord_post (question_id ,forum_id,subject ,post_detail ,user_id,attach_file ,count_view ,song_name,singer_name,date_post)VALUES ('','$forum_id','$subject', '$post_detail','$user_id','$attachfile','0', '$song_name', '$singer_name','$date_post')") or die ("<script> alert ('ไม่สามารถเพิ่มกระทู้ได้เนื่องจากพบคำหยาบ') ; history.back();</script>");
 
 ตัวหน้านี่เอาออกครับ แทนด้วย mysql_error()
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-08-01 23:32:07 | By :
                            ikikkok |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ไม่ก้อยังไม่ได้อ่ะค่ะ  มันเพิ่มข้อมูลลงไม่ได้เรย 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-08-01 23:56:16 | By :
                            bb |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ใส่นี่ mysql_error() ไปแทนแล้วมีอะไรออกมาครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-08-02 00:06:48 | By :
                            ikikkok |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |