PageRenderTime 24ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/post_add_action.php

http://ouyo.googlecode.com/
PHP | 50 lines | 47 code | 1 blank | 2 comment | 7 complexity | f9d9858874f8967849d92340d5d49137 MD5 | raw file
  1. <?php session_start(); ?>
  2. <?php
  3. if(!$_SESSION['uname']){
  4. echo "??????????!";
  5. return false;
  6. }
  7. ?>
  8. <?php include("../inc/db_config.inc"); ?>
  9. <?php
  10. if(isset($_REQUEST['title'])&&$_REQUEST['title']!=""){
  11. $post_title=trim($_REQUEST['title']);
  12. }else{
  13. echo "??????<a href='javascript:history.back()'>??</a>";
  14. return false;
  15. }
  16. if(isset($_REQUEST['type'])&&$_REQUEST['type']!=""){
  17. $post_type=$_REQUEST['type'];
  18. }else{
  19. echo "???????<a href='javascript:history.back()'>??</a>";
  20. return false;
  21. }
  22. if(isset($_REQUEST['content'])&&$_REQUEST['content']!=""){
  23. if (get_magic_quotes_gpc()) {
  24. //$notice_cont = addslashes($_REQUEST['content']);
  25. $post_content = stripslashes(trim($_REQUEST['content']));
  26. } else {
  27. $post_content = trim($_REQUEST['content']);
  28. }
  29. $post_content = str_replace('\'', "''", $post_content);
  30. }else{
  31. echo "??????<a href='javascript:history.back()'>??</a>";
  32. return false;
  33. }
  34. date_default_timezone_set("Asia/Shanghai"); //????
  35. $post_created=date("Y-m-d H:i:s");
  36. $post_pubid=1;
  37. $post_audit=1;
  38. $post_allowComment=1;
  39. $post_commentAudit=0;
  40. //echo "insert into info (title,created,pubid,content,type,audit,allowComment,comment_audit) values('$post_title','$post_created','$post_pubid','$post_content','$post_type','$post_audit','$post_allowComment','$post_commentAudit')";
  41. $result_post=mysql_query("insert into info (title,created,pubid,content,type,audit,allowComment,comment_audit) values('$post_title','$post_created','$post_pubid','$post_content','$post_type','$post_audit','$post_allowComment','$post_commentAudit')");
  42. if(mysql_affected_rows()>0){
  43. $getID=mysql_insert_id();
  44. $ref=$_SERVER['HTTP_REFERER'];
  45. echo "????!????1???????.<a href='../show.php?pid=$getID'>??</a><script type='text/javascript'>setTimeout(function(){window.location.href='$ref'},1000)</script>";
  46. }else{
  47. echo "????!<a href='javascript:history.back()'>??</a>";
  48. }
  49. ?>