Skip to content

Commit

Permalink
Merge pull request #13 from yihong0618/Feat_debug
Browse files Browse the repository at this point in the history
format code and change the database table name, also fix the sql inje…
  • Loading branch information
timeromantic authored Aug 19, 2019
2 parents 4d0c498 + 3c29e4e commit a7189f1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions App/Server.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package main

import (
"../Common"
"../Config"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"regexp"
"syscall"

"../Common"
"../Config"
)

func GetTypeInfo(w http.ResponseWriter, r *http.Request) {
Expand All @@ -17,7 +19,9 @@ func GetTypeInfo(w http.ResponseWriter, r *http.Request) {
log.Fatal("系统错误" + err.Error())
}
id := r.Form.Get("id")
sql := "select str from hotData where id=" + id
re := regexp.MustCompile("[0-9]+")
id = re.FindString(id)
sql := "select str from hotData2 where id=" + id
data := Common.MySql{}.GetConn().ExecSql(sql)
if len(data) == 0 {
fmt.Fprintf(w, "%s", `{"Code":1,"Message":"id错误,无该分类数据","Data":[]}`)
Expand Down

0 comments on commit a7189f1

Please sign in to comment.