├── my.js ├── css ├── b2.gif ├── bg.jpg ├── bg12.jpg ├── logo.png ├── style.css └── FrontLogo.png ├── 建环网投票系统.xmind ├── 建环网调查需求分析.doc ├── .gitignore ├── admin ├── index.php ├── footer.htm ├── cleanAll.php ├── cleanVote.php ├── header - 副本.htm ├── login.htm ├── judge.php ├── add.php ├── header.htm ├── Login.php ├── admin.php ├── menu.js └── left.htm ├── README.md ├── footer.htm ├── header.htm ├── vote.php ├── example.js ├── api ├── OperatorDB.php ├── OperatorDB - 副本.php ├── func.php └── OperatorVotingDB.php ├── index.php └── voting.sql /my.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /css/b2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanxi/voting/HEAD/css/b2.gif -------------------------------------------------------------------------------- /css/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanxi/voting/HEAD/css/bg.jpg -------------------------------------------------------------------------------- /css/bg12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanxi/voting/HEAD/css/bg12.jpg -------------------------------------------------------------------------------- /css/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanxi/voting/HEAD/css/logo.png -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanxi/voting/HEAD/css/style.css -------------------------------------------------------------------------------- /建环网投票系统.xmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanxi/voting/HEAD/建环网投票系统.xmind -------------------------------------------------------------------------------- /建环网调查需求分析.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanxi/voting/HEAD/建环网调查需求分析.doc -------------------------------------------------------------------------------- /css/FrontLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanxi/voting/HEAD/css/FrontLogo.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | INSTALL.txt 2 | LICENSE.txt 3 | README.txt 4 | demos/ 5 | extras/documentation 6 | 7 | -------------------------------------------------------------------------------- /admin/index.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | voting 2 | ====== 3 | 4 | 投票系统,提供后台 5 | 6 | 用户名:hanxi 7 | 8 | 密码:123456 9 | 10 | 11 | 在这里改数据库配置 12 | 13 | https://github.com/hanxi/voting/blob/master/api/OperatorDB.php#L8-L14 14 | -------------------------------------------------------------------------------- /footer.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

(c)2012 jianhuanwang.com Powered By 涵曦 Version 1.0.0

5 | 6 | -------------------------------------------------------------------------------- /admin/footer.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 |

(c)2012 jianhuanwang.com Powered By 涵曦 Version 1.0.0

8 | 9 | -------------------------------------------------------------------------------- /admin/cleanAll.php: -------------------------------------------------------------------------------- 1 | clearTables(); 10 | goToPgae("./admin.php?page=cleanAll&msg=清空成功"); 11 | ?> -------------------------------------------------------------------------------- /admin/cleanVote.php: -------------------------------------------------------------------------------- 1 | resetCountValues(); 10 | goToPgae("./admin.php?page=cleanVote&msg=清空成功"); 11 | ?> -------------------------------------------------------------------------------- /header.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 全国建环高校大比拼 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /vote.php: -------------------------------------------------------------------------------- 1 | 2 | vote($ip, $loc, $selectName); 15 | //echo "投票成功!"; 16 | echo "
3秒后自动返回..."; 17 | //goToPgae('./index.php'); 18 | ?> 19 | -------------------------------------------------------------------------------- /admin/header - 副本.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 投票系统【管理员】 6 | 7 | 8 | -------------------------------------------------------------------------------- /admin/login.htm: -------------------------------------------------------------------------------- 1 | 2 |
3 |

后台登录

4 |
5 |
6 | 7 |
8 | -------------------------------------------------------------------------------- /admin/judge.php: -------------------------------------------------------------------------------- 1 | isRightUser()) 7 | { 8 | if (setcookie("user",$user,0)) 9 | { 10 | require_once '../api/func.php'; 11 | goToPgae("./admin.php"); 12 | } 13 | } 14 | else 15 | { 16 | echo ""; 17 | require_once '../api/func.php'; 18 | goToPgae("./index.php"); 19 | } 20 | ?> 21 | -------------------------------------------------------------------------------- /admin/add.php: -------------------------------------------------------------------------------- 1 | ".$label; 12 | require_once '../api/OperatorVotingDB.php'; 13 | $ovdb=new OperatorVotingDB(); 14 | $ovdb->addSelectName($name,$label); 15 | require './header.htm'; 16 | goToPgae("./admin.php?page=add&auto="."$label"."&id=cLabelName&foc=cSelectName&msg=添加成功"); 17 | ?> 18 | -------------------------------------------------------------------------------- /admin/header.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 投票系统【管理员】 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | var offset = $("#sidebar").offset(); 4 | var topPadding = 15; 5 | 6 | $(window).scroll(function() { 7 | 8 | if ($(window).scrollTop() > offset.top) { 9 | 10 | $("#sidebar").stop().animate({ 11 | 12 | marginTop: $(window).scrollTop() - offset.top + topPadding 13 | 14 | }); 15 | 16 | } else { 17 | 18 | $("#sidebar").stop().animate({ 19 | 20 | marginTop: 0 21 | 22 | }); 23 | 24 | } 25 | 26 | 27 | }); 28 | 29 | }); -------------------------------------------------------------------------------- /admin/Login.php: -------------------------------------------------------------------------------- 1 | name = $n; 17 | $this->passwd = $p; 18 | } 19 | 20 | public function isRightUser() 21 | { 22 | $isFind = false; 23 | $odb = new OperatorDB(); 24 | $sql = "SELECT * FROM user WHERE name='$this->name' AND passwd=MD5('$this->passwd');"; 25 | $stm = $odb->query($sql); 26 | if(count($stm->fetchAll()) == 1) 27 | { 28 | $isFind = true; 29 | } 30 | return $isFind; 31 | } 32 | } 33 | 34 | ?> 35 | -------------------------------------------------------------------------------- /admin/admin.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 |
13 |
14 |
15 | 18 |
19 | 24 | 25 | 26 | 48 | 49 | -------------------------------------------------------------------------------- /api/OperatorDB.php: -------------------------------------------------------------------------------- 1 | dsn="$this->dbms:host=$this->host;dbname=$this->dbName"; 21 | try 22 | { 23 | $this->conn=new PDO($this->dsn,$this->user,$this->passwd);//初始化一个PDO对象,就是创建了数据库连接对象$db 24 | } 25 | catch(PDOException $e) 26 | { 27 | die("
数据库连接失败(creater PDO Error!): ".$e->getMessage()."
"); 28 | } 29 | } 30 | public function __destruct() 31 | { 32 | $this->pdo = null; 33 | } 34 | 35 | public function exec($sql) 36 | { 37 | try 38 | { 39 | $this->conn->query("set names 'utf8'"); 40 | return $this->conn->exec($sql); 41 | } 42 | catch(PDOException $e) 43 | { 44 | die("
exec()失败(exec()Failed!): ".$e->getMessage()."
"); 45 | } 46 | } 47 | public function query($sql) 48 | { 49 | try 50 | { 51 | $this->conn->query("set names 'utf8'"); 52 | return $this->conn->query($sql); 53 | } 54 | catch(PDOException $e) 55 | { 56 | die("
query()失败(exec()Failed!): ".$e->getMessage()."
"); 57 | } 58 | } 59 | } 60 | ?> 61 | -------------------------------------------------------------------------------- /api/OperatorDB - 副本.php: -------------------------------------------------------------------------------- 1 | dsn="$this->dbms:host=$this->host;dbname=$this->dbName"; 21 | try 22 | { 23 | $this->conn=new PDO($this->dsn,$this->user,$this->passwd);//初始化一个PDO对象,就是创建了数据库连接对象$db 24 | } 25 | catch(PDOException $e) 26 | { 27 | die("
数据库连接失败(creater PDO Error!): ".$e->getMessage()."
"); 28 | } 29 | } 30 | public function __destruct() 31 | { 32 | $this->pdo = null; 33 | } 34 | 35 | public function exec($sql) 36 | { 37 | try 38 | { 39 | $this->conn->query("set names 'utf8'"); 40 | return $this->conn->exec($sql); 41 | } 42 | catch(PDOException $e) 43 | { 44 | die("
exec()失败(exec()Failed!): ".$e->getMessage()."
"); 45 | } 46 | } 47 | public function query($sql) 48 | { 49 | try 50 | { 51 | $this->conn->query("set names 'utf8'"); 52 | return $this->conn->query($sql); 53 | } 54 | catch(PDOException $e) 55 | { 56 | die("
query()失败(exec()Failed!): ".$e->getMessage()."
"); 57 | } 58 | } 59 | } 60 | ?> 61 | -------------------------------------------------------------------------------- /admin/menu.js: -------------------------------------------------------------------------------- 1 | 2 | //添加文本框 3 | function addInput(parent,id,pla) 4 | { 5 | //创建input 6 | var input = document.createElement("input"); 7 | input.type = "text"; 8 | input.id = id; 9 | input.placeholder = pla; 10 | document.getElementById(parent).appendChild(input); 11 | } 12 | 13 | function Request(strName) 14 | { 15 | var strHref = window.document.location.href; 16 | var intPos = strHref.indexOf("?"); 17 | var strRight = strHref.substr(intPos + 1); 18 | 19 | var arrTmp = strRight.split("&"); 20 | for(var i = 0; i < arrTmp.length; i++) 21 | { 22 | var arrTemp = arrTmp[i].split("="); 23 | if(arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1]; 24 | } 25 | return ""; 26 | } 27 | 28 | function goToPage(url,arg1,arg2) 29 | { 30 | var a = document.getElementById(arg1).value; 31 | var b = document.getElementById(arg2).value; 32 | url += '?'+arg1+'='+a; 33 | url += '&'+arg2+'='+b; 34 | window.location.href=url; 35 | } 36 | 37 | function goToPage1(url) 38 | { 39 | window.location.href=url; 40 | } 41 | 42 | function addVote() 43 | { 44 | right.innerHTML="

添加投票项

"; 45 | right.innerHTML+="