ขอวิธีการทำ ไม่ให้ โพส วันนึง ฟิว id_name หริือ id_line เกิด 3 ครั้งต่อวันครับ
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ขอวิธีการทำ ไม่ให้ โพส วันนึง ฟิว id_name หริือ id_line เกิด 3 ครั้งต่อวันครับ
ขอวิธีการทำ ไม่ให้ โพส วันนึง ฟิว id_name หริือ id_line เกิด 3 ครั้งต่อวันครับ
รบกวนหน่อยครับ พอดี user โพส id ซ้ำกันต่อวันเยอะมาก อยากกำหนดว่า ถ้า โพส id_line ซ้ำกัน เกิด 3 ครั้งต่อวันจะไม่สามารถโพสได้

คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
ความคิดเห็นที่
1
แนวทางลองเช็คจากวันที่ของรายการโพสของ id นั้น ถ้าโพสของวันนั้น ของ id นั้นๆ ไม่เกิน 3 หรือก็คือ
น้อยกว่า 3 ก็อนุญาตให้โพสต่อได้
น้อยกว่า 3 ก็อนุญาตให้โพสต่อได้

ความคิดเห็นที่
2
รบกวนดู code ให้หน่อย ครับ ต้องแทรก ตรงไหนครับ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | <?php include ( 'connect.inc.php' ); require_once "thumb/global.func.php" ; if (isset( $_POST [submit])){ if (isset( $_POST [ 'g-recaptcha-response' ]) && ! empty ( $_POST [ 'g-recaptcha-response' ])){ //your site secret key $secret = '6LemLVAUAAAAAK6WHBoEfwYL8ZRtWCgufM1cz7vo' ; //get verify response data $verifyResponse = file_get_contents ( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $secret . '&response=' . $_POST [ 'g-recaptcha-response' ]); $responseData = json_decode( $verifyResponse ); if ( $responseData ->success){ //contact form submission code goes here $sql = "INSERT DELAYED member(m_id, m_name, m_line, m_info, m_age, m_sex, m_address, m_view, m_date)" ; $sql .= " VALUES('', '$_POST[name]', '$_POST[lineid]', '$_POST[info]', '$_POST[age]', '$_POST[sex]', '$_POST[address]', '0', NOW())" ; mysql_query( $sql ); $rand = substr ( str_shuffle ( 'abcdefghijklmnopqrstuvwxyz0123456789' ),0,5); $fileupload = $_FILES [ 'image' ] [ 'tmp_name' ]; $fileupload_name = $_FILES [ 'image' ] [ 'name' ]; $fileupload_size = $_FILES [ 'image' ] [ 'size' ]; $fileupload_type = $_FILES [ 'image' ] [ 'type' ]; if ( $fileupload ) { $array_last = explode ( "." , $fileupload_name ); $c = count ( $array_last ) -1 ; $lastname = strtolower ( $array_last [ $c ]); if ( $lastname == "gif" or $lastname == "jpg" or $lastname == "jpeg" or $lastname == "png" ) { $sql101 = "select max(m_id) from member " ; $result101 =mysql_query( $sql101 ); $row = mysql_fetch_row( $result101 ); $idm = $row [0]; $sql102 = "select max(m_line) from member " ; $result102 =mysql_query( $sql102 ); $row1 = mysql_fetch_row( $result102 ); $idm1 = $row1 [0]; $photonamet = $row [0]. $rand . "." . $lastname ; copy ( $fileupload , "photo/" . $photonamet ); $sql102 = "update member SET m_photo='$photonamet' where m_id='$row[0]' " ; $result102 = mysql_query( $sql102 ); $thumbdir = "photo/thumb/" ; //ระบบ thumb thumbnail( $fileupload , $thumbdir . $photonamet ); echo "<script>$error;window.location='https://www.xn--42c5bos5bn7a4bm8ese.com/complete/" . $idm . "/" . $_POST ['lineid ']."' ;</script>"; } } } } else { echo "<script>$error;window.location='https://www.xn--42c5bos5bn7a4bm8ese.com/error_recaptcha';</script>" ; } } else { $errMsg = 'Please click on the reCAPTCHA box.' ; } ?> |

ความคิดเห็นที่
3
ตอนนี้ผมเช็คได้แล้ว แต่ติดตรงจะเช็คจากวันที่ พร้อมกับเลขของ id นั้นๆได้อย่างไร ครับ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | <?php include ( 'connect.inc.php' ); require_once "thumb/global.func.php" ; if (isset( $_POST [submit])){ if (isset( $_POST [ 'g-recaptcha-response' ]) && ! empty ( $_POST [ 'g-recaptcha-response' ])){ //your site secret key $secret = '6LemLVAUAAAAAK6WHBoEfwYL8ZRtWCgufM1cz7vo' ; //get verify response data $verifyResponse = file_get_contents ( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $secret . '&response=' . $_POST [ 'g-recaptcha-response' ]); $responseData = json_decode( $verifyResponse ); //Check MEMBERNo for dupplicate $check = "SELECT * FROM member WHERE m_line = '" . $_POST [ "lineid" ]. "' " ; $result = mysql_query( $check ) or die (mysql_error()); $num =mysql_num_rows( $result ); if ( $num > 3) { } else { if ( $responseData ->success){ //contact form submission code goes here $sql = "INSERT DELAYED member(m_id, m_name, m_line, m_info, m_age, m_sex, m_address, m_view, m_date)" ; $sql .= " VALUES('', '$_POST[name]', '$_POST[lineid]', '$_POST[info]', '$_POST[age]', '$_POST[sex]', '$_POST[address]', '0', NOW())" ; mysql_query( $sql ); $rand = substr ( str_shuffle ( 'abcdefghijklmnopqrstuvwxyz0123456789' ),0,5); $fileupload = $_FILES [ 'image' ] [ 'tmp_name' ]; $fileupload_name = $_FILES [ 'image' ] [ 'name' ]; $fileupload_size = $_FILES [ 'image' ] [ 'size' ]; $fileupload_type = $_FILES [ 'image' ] [ 'type' ]; if ( $fileupload ) { $array_last = explode ( "." , $fileupload_name ); $c = count ( $array_last ) -1 ; $lastname = strtolower ( $array_last [ $c ]); if ( $lastname == "gif" or $lastname == "jpg" or $lastname == "jpeg" or $lastname == "png" ) { $sql101 = "select max(m_id) from member " ; $result101 =mysql_query( $sql101 ); $row = mysql_fetch_row( $result101 ); $idm = $row [0]; $sql102 = "select max(m_line) from member " ; $result102 =mysql_query( $sql102 ); $row1 = mysql_fetch_row( $result102 ); $idm1 = $row1 [0]; $photonamet = $row [0]. $rand . "." . $lastname ; copy ( $fileupload , "photo/" . $photonamet ); $sql102 = "update member SET m_photo='$photonamet' where m_id='$row[0]' " ; $result102 = mysql_query( $sql102 ); $thumbdir = "photo/thumb/" ; //ระบบ thumb thumbnail( $fileupload , $thumbdir . $photonamet ); echo "<script>$error;window.location='https://www.xn--42c5bos5bn7a4bm8ese.com/complete/" . $idm . "/" . $_POST ['lineid ']."' ;</script>"; } } } } } else { echo "<script>$error;window.location='https://www.xn--42c5bos5bn7a4bm8ese.com/error_recaptcha';</script>" ; } } else { $errMsg = 'Please click on the reCAPTCHA box.' ; } ?> |

ขอบคุณทุกการสนับสนุน
![]()