is_valid) { // What happens when the CAPTCHA was entered incorrectly die ('
驗證碼錯誤,請回上一頁重新輸入
上一頁
'); } else { $present_date=date("Y-m-d H:i:s"); $SQLStr="INSERT INTO present(phonenumber,idnumber,book_name ,book_author,presenter,present_date,present_contents) values('$phonenumber','$idnumber','$book_name' ,'$book_author','$presenter','$present_date','$present_contents')"; $message="新增心得完成!!"; db_query($SQLStr); }}else{ $message="未更新任何資訊!"; } } }else{ //處理使用者輸入的特殊字元 function ChangWord($NewWord){ $NewWord=str_replace("\r\n","
",$NewWord); $NewWOrd=ereg_replace("[']+","'",$NewWord); return $NewWord; } //check參數為upd,才進行修改的動作 if($check==upd){ $update_date=date("Y-m-d H:i:s"); $SQLStr="update present SET book_name='$book_name',book_author='$book_author',presenter='$presenter',idnumber='$idnumber',phonenumber='$phonenumber',present_date='$update_date',present_contents='$present_contents' WHERE present_id='$present_id'"; $message="此文章內容已更新!"; } //check參數為del,才進行刪除整篇的動作 if($check==del){ $SQLStr="DELETE FROM present WHERE present_id='$present_id' "; //連其他的回覆也要一起刪除 $SQLStr1="DELETE FROM reply WHERE present_id='$present_id' "; db_query($SQLStr1); $message="此文章所有相關資料都已刪除!"; } //check參數為reply,才進行新增回覆的動作 if($check==reply){ $reply_date=date("Y-m-d H:i:s"); $SQLStr="INSERT INTO reply(present_id ,reply_name,reply_date,reply_contents) values('$present_id','$reply_name','$reply_date','$reply_contents')"; $message="回覆完成!"; } //check參數為star,才進行增加星星數的動作 if($check==star){ $SQLStr1="select star_num from present WHERE present_id='$present_id' "; $row=db_str($SQLStr1); $star_num=$row[star_num]+1; $SQLStr="update present SET star_num='$star_num' WHERE present_id='$present_id' "; $message="感謝您的支持!"; } db_query($SQLStr); } ?>