BBS super classic produced by php

WBOY
Release: 2016-07-25 08:48:36
Original
1190 people have browsed it
BBS super classic produced by PHP (full text here) http://115.com/lb/5lbcqol0flze
  1. $dsn = "mysql:host=localhost;dbname=database name";
  2. $dbh = new PDO($dsn, 'Username', 'Password', array(PDO::ATTR_PERSISTENT => true));
  3. $dbh -> query("SET NAMES 'utf8'; ");
  4. $id=$_POST['id'];
  5. $username = $_SESSION['username']; //Get information about the person who replied
  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


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!