| "encoding/json" | "encoding/json" | ||||
| "errors" | "errors" | ||||
| "fmt" | "fmt" | ||||
| "log" | |||||
| "math/rand" | "math/rand" | ||||
| "net/http" | "net/http" | ||||
| "net/url" | "net/url" | ||||
| } | } | ||||
| func crmpixel(w http.ResponseWriter, r *http.Request) { | func crmpixel(w http.ResponseWriter, r *http.Request) { | ||||
| //log.Println("a") | |||||
| log.Println(getHTTPRequestQuery(r, "abc")) | |||||
| cookie := crmpixelCookie(r) | cookie := crmpixelCookie(r) | ||||
| http.SetCookie(w, &cookie) | http.SetCookie(w, &cookie) | ||||
| w.WriteHeader(http.StatusNotFound) | w.WriteHeader(http.StatusNotFound) | ||||
| fmt.Fprintf(w, "not found") | fmt.Fprintf(w, "not found") | ||||
| } | } | ||||
| func getHTTPRequestQuery(r *http.Request, name string) (value string) { | |||||
| rq := r.URL.RawQuery | |||||
| m, _ := url.ParseQuery(rq) | |||||
| v, ok := m[name] | |||||
| if ok { | |||||
| value = v[0] | |||||
| } | |||||
| return | |||||
| } |