BBS super classic produced by php
Release: 2016-07-25 08:48:36
Original
1252 people have browsed it
BBS super classic produced by PHP (full text here) http://115.com/lb/5lbcqol0flze
- $dsn = "mysql:host=localhost;dbname=database name";
- $dbh = new PDO($dsn, 'Username', 'Password', array(PDO::ATTR_PERSISTENT => true));
- $dbh -> query("SET NAMES 'utf8'; ");
-
- $id=$_POST['id'];
- $username = $_SESSION['username']; //Get information about the person who replied
- $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'];//Get information about replies
- //$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 table name (article ID, content, name, time) 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);
- }
- ?>
Copy code
|
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 Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31