GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — OPMS/main.go at master · sannji/OPMS Expand file tree/ Copy pathmain.goMore file actions executable file ·39 lines (33 loc) · 1.04 KB / Copy pathmain.goFile metadata and controlsexecutable file ·39 lines (33 loc) · 1.04 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 package main import ( "html/template" "net/http" _ "opms/initial" _ "opms/routers" "github.com/astaxie/beego" "github.com/astaxie/beego/context" ) func main() { beego.InsertFilter("/*", beego.BeforeRouter, FilterUser) beego.ErrorHandler("404", page_not_found) beego.ErrorHandler("401", page_note_permission) beego.Run() } var FilterUser = func(ctx *context.Context) { _, ok := ctx.Input.Session("userLogin").(string) if !ok && ctx.Request.RequestURI != "/login" { ctx.Redirect(302, "/login") } } func page_not_found(rw http.ResponseWriter, r *http.Request) { t, _ := template.New("404.tpl").ParseFiles("views/404.tpl") data := make(map[string]interface{}) //data["content"] = "page not found" t.Execute(rw, data) } func page_note_permission(rw http.ResponseWriter, r *http.Request) { t, _ := template.New("401.tpl").ParseFiles("views/401.tpl") data := make(map[string]interface{}) //data["content"] = "你没有权限访问此页面,请联系超级管理员。或去<a href='/'>开启我的OPMS之旅</a>。" t.Execute(rw, data) } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |