PHP-made BBS Super Classic

Source: Internet
Author: User
PHP made BBS Super Classic (full text here) Http://115.com/lb/5lbcqol0flze
  1. $DSN = "mysql:host=localhost;dbname= database name";
  2. $DBH = new PDO ($dsn, ' User name ', ' Password ', array (pdo::attr_persistent = true));
  3. $DBH, Query ("SET NAMES ' UTF8 ';");
  4. $id =$_post[' id '];
  5. $username = $_session[' username '];//get the relevant information of the reply person
  6. $sql = "SELECT * from user where username= ' $username '";
  7. $result = mysql_query ($sql);
  8. $row = Mysql_fetch_array ($result);
  9. $row [' Score ']= $row [' Score ']+2;
  10. mysql_query ("Update user set score = '". $row [' Score ']. "' WHERE username = '". $row [' username ']. "'";
  11. $content = $_post[' content '];//get information about replies
  12. $email = $row [' email '];
  13. $date = Date ("y-m-d h:i:s");
  14. $date =date ("y-m-d h:i");
  15. Date_default_timezone_set ("Asia/shanghai");
  16. $time = Date (' y-m-d h:m:s ');
  17. $y =date ("Y", Strtotime ($time));
  18. $m =date ("M", Strtotime ($time));
  19. $d =date ("D", Strtotime ($time));
  20. $h =date ("H", Strtotime ($time));
  21. $w =date ("W", Strtotime ($time));
  22. $weekNumber =intval (Date (' W '));
  23. $url = "http://api.map.baidu.com/geocoder?location={$weidu},{$jingdu}&output=json";
  24. $json = Json_decode (file_get_contents ($url), TRUE);
  25. $a =file_get_contents ($url);
  26. $province = $json [' result '] [' addresscomponent '] [' Province '];
  27. $city = $json [' result '] [' addresscomponent '] [' City '];
  28. $sql = "INSERT into table name (article ID, content, name, time) VALUES (' $id ', ' $content ', ' $username ', Now ())";
  29. $result =mysql_query ($sql);
  30. if ($dbh, query ($sql)) {
  31. Header ("Content-type:application/json");
  32. $arr = Array (' status ' = ' OK ');
  33. echo Json_encode ($arr);
  34. }
  35. ?>
Copy Code
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.