熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java高級技術 >> 正文

投票系統制作基本模式

2022-06-13   來源: Java高級技術 

  功能介紹 可以隨機產生一個投票主題 其中很多部分尚待擴展!希望有時間的與我交流 ! 首先創建數據庫 CREATE TABLE voteadmin ( id int() NOT NULL auto_increment name varchar() NOT NULL default select varchar() NOT NULL default select varchar() NOT NULL default select varchar() NOT NULL default select varchar() NOT NULL default total int() NOT NULL default data int() NOT NULL default data int() NOT NULL default data int() NOT NULL default data int() NOT NULL default UNIQUE KEY name (name) UNIQUE KEY id (id) ) TYPE=MyISAM; indexphp refresephp "; } else { echo "出錯了!"; } } else { echo "出錯了!"; } } else { echo "出錯了!"; } ?> showvotephp
補充 tplphp為一個模板類 setRoot($root); $this>setUnknowns($unknowns); } function setRoot($root) { if (!is_dir($root)) { $this>halt(setRoot: $root is not a directory); return false; } $this>root = $root; return true; } function setUnknowns($unknowns = keep) { $this>unknowns = $unknowns; } function setfile($handle $filename = ) { if (!is_array($handle)) { if ($filename == ) { $this>halt(setFile: For handle $handle filename is empty); return false; } $this>file[$handle] = $this>_filename($filename); } else { reset($handle); while (list($h $f) = each($handle)) { $this>file[$h] = $this>_filename($f); } } } function setBlock($parent $handle $name = ) { if (!$this>_loadFile($parent)) { $this>halt(subst: unable to load $parent); return false; } if ($name == ) { $name = $handle; } $str = $this>getVar($parent); $reg = /\s+BEGIN $handle\s+>(*)\n\s*\s+END $handle\s+>/sm; preg_match_all($reg $str $m); $str = preg_replace($reg { $name} $str); $this>setVar($handle $m[][]); $this>setVar($parent $str); } function setvar($varname $value = ) { if (!is_array($varname)) { if (!empty($varname)) if ($this>debug) print scalar: set *$varname* to *$value*
\n; $this>_varKeys[$varname] = /$this>_varname($varname)/; $this>_varVals[$varname] = $value; } else { reset($varname); while (list($k $v) = each($varname)) { if (!empty($k)) if ($this>debug) print array: set *$k* to *$v*
\n; $this>_varKeys[$k] = /$this>_varname($k)/; $this>_varVals[$k] = $v; } } } function subst($handle) { if (!$this>_loadFile($handle)) { $this>halt(subst: unable to load $handle); return false; } $str = $this>getVar($handle); $str = @preg_replace($this>_varKeys $this>_varVals $str); return $str; } function pSubst($handle) { print $this>subst($handle); return false; } function parse($target $handle $append = false) { if (!is_array($handle)) { $str = $this>subst($handle); if ($append) { $this>setVar($target $this>getVar($target) $str); } else { $this>setVar($target $str); } } else { reset($handle); while (list($i $h) = each($handle))
From:http://tw.wingwit.com/Article/program/Java/gj/201311/27659.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.