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
|