php制作的bbs超经典
时间:2021-07-01 10:21:17
帮助过:22人阅读
php制作的bbs超经典(全文在这里)http://115.com/lb/5lbcqol0flze
- $dsn = "mysql:host=localhost;dbname=数据库名";
- $dbh = new PDO($dsn, '用户名', '密码', array(PDO::ATTR_PERSISTENT => true));
- $dbh -> query("SET NAMES 'utf8'; ");
- $id=$_POST['id'];
- $username = $_SESSION['username']; //获取回帖人的相关信息
- $sql = "select * from user where username= '$username'";
- $result = mysql_query($sql);
- $row = mysql_fetch_array($result);
- $row['score']=$row['score']+2;
- mysql_query("update user set score = '".$row['score']."' where username ='".$row['username']."'");
-
- $content = $_POST['content'];//获取回帖的相关信息
- //$email = $row['email'];
- $date = date("Y-m-d H:i:s");
- $date=date("y-m-d H:i");
- date_default_timezone_set("Asia/Shanghai");
- $time = date('Y-m-d H:m:s');
- $y=date("Y",strtotime($time));
- $m=date("m",strtotime($time));
- $d=date("d",strtotime($time));
- $h=date("H",strtotime($time));
- $w=date("w",strtotime($time));
- //$weekNumber=intval(date('W'));
- //$url = "http://api.map.baidu.com/geocoder?location={$weidu},{$jingdu}&output=json";
- //$json = json_decode(file_get_contents($url), TRUE);
- //$a=file_get_contents($url);
- //$province = $json['result']['addressComponent']['province'];
- //$city = $json['result']['addressComponent']['city'];
- $sql=" insert into 表名(文章ID,内容, 名字, 时间)values('$id', '$content', '$username', now())";
- //$result=mysql_query($sql);
- if ($dbh -> query($sql)) {
- header("Content-Type:Application/json");
- $arr = array('status' => 'ok');
- echo json_encode($arr);
- }
- ?>
|