term_put.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. $currTime=sprintf("%d",microtime(true)*1000);
  3. if(isset($_GET["modify_time"])){
  4. $mTime=$_GET["modify_time"];
  5. }
  6. else{
  7. $mTime=mTime();
  8. }
  9. if($_GET["guid"]!=""){
  10. $query="UPDATE term SET meaning= ? ,other_meaning = ? , tag= ? ,channal = ? , language = ? , note = ? , receive_time= ?, modify_time= ? where guid= ? ";
  11. $stmt = @PDO_Execute($query,array($_GET["mean"],
  12. $_GET["mean2"],
  13. $_GET["tag"],
  14. $_GET["channal"],
  15. $_GET["language"],
  16. $_GET["note"],
  17. mTime(),
  18. $mTime,
  19. $_GET["guid"]
  20. ));
  21. }
  22. else{
  23. $parm = array();
  24. $parm[]=UUID::v4();
  25. $parm[]=$_GET["word"];
  26. $parm[]=pali2english($word);
  27. $parm[]=$_GET["mean"];
  28. $parm[]=$_GET["mean2"];
  29. $parm[]=$_GET["tag"];
  30. $parm[]=$_GET["channal"];
  31. $parm[]=$_GET["language"];
  32. $parm[]=$_GET["note"];
  33. $parm[]=$_COOKIE["userid"];
  34. $parm[]=0;
  35. $parm[]=mTime();
  36. $parm[]=mTime();
  37. $parm[]=mTime();
  38. $query="INSERT INTO term (id, guid, word, word_en, meaning, other_meaning, tag, channal, language,note,owner,hit,create_time,modify_time,receive_time )
  39. VALUES (NULL, ? , ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
  40. $stmt = @PDO_Execute($query,$parm);
  41. }
  42. $respond=array("status"=>0,"message"=>"");
  43. if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
  44. $error = PDO_ErrorInfo();
  45. $respond['status']=1;
  46. $respond['message']=$error[2].$query;
  47. }
  48. else{
  49. $respond['status']=0;
  50. $respond['message']=$word;
  51. }
  52. echo json_encode($respond, JSON_UNESCAPED_UNICODE);
  53. ?>