phpsir 2008-08-23
代码如下:
<?php include '../common.inc.php'; $token = $_POST['token']; if(GToken::isToken($token,'REPORT')){ $names = $_POST['name']; $birthdays = $_POST['birthday']; $phones = $_POST['phone']; $sexs = $_POST['sex']; $emails = $_POST['email']; $scoreAs = $_POST['scoreA']; $scoreBs = $_POST['scoreB']; $scoreCs = $_POST['scoreC']; $list = array(); $score = array(); for($i=0;$i<sizeof($names);$i++){ $arr = array( 'name' => $names[$i], 'sexs' => $sexs[$i], 'birthday' => $birthdays[$i], 'email' => $emails[$i], 'phone' => $phones[$i] ); array_push($list,$arr); unset($arr); $arr = array( 'name' => $names[$i], 'scoreA' => $scoreAs[$i], 'scoreB' => $scoreBs[$i], 'scoreC' => $scoreCs[$i] ); array_push($score,$arr); unset($arr); } include '../lib/smarty/Smarty.class.php'; $gmt = GSmarty::getInstance('test'); $gmt->assign_by_ref("list",$list); $gmt->assign_by_ref('score',$score); header("Cache-Control: public"); header('content-type:application/vnd.ms-excel'); header("Content-Disposition:attachment; filename=report.xls"); $gmt->display('report'); } ?>
<?php. if (!empty($_POST)) {. $data1 = $_POST["data1"];$data2 = $_POST["data2"];$fuhao = $_POST["fuh