www.gusucode.com > 2060网博士成品网站管理系统 PHP网站源码程序 > 2060/2060/tools/admin/poll_set.php
<?php define("ROOTPATH", "../../"); include(ROOTPATH."includes/admin.inc.php"); include("language/".$sLan.".php"); include("func/vote.inc.php"); NeedAuth(82); $action=$_REQUEST["action"]; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link href="css/style.css" type="text/css" rel="stylesheet"> <title><?php echo $strAdminTitle; ?></title> <script> blank = new Image(); blank.src = "images/blank.gif"; aqua = new Image(); aqua.src = "images/aqua.gif"; blue = new Image(); blue.src = "images/blue.gif"; brown = new Image(); brown.src = "images/brown.gif"; darkgreen = new Image(); darkgreen.src = "images/darkgreen.gif"; gold = new Image(); gold.src = "images/gold.gif"; green = new Image(); green.src = "images/green.gif"; grey = new Image(); grey.src = "images/grey.gif"; orange = new Image(); orange.src = "images/orange.gif"; pink = new Image(); pink.src = "images/pink.gif"; purple = new Image(); purple.src = "images/purple.gif"; red = new Image(); red.src = "images/red.gif"; yellow = new Image(); yellow.src = "images/yellow.gif"; function ChangeBar(sel,img) { eval("document.bar"+img+".src="+sel+".src"); } function del_entry(entry) { if (window.confirm("<?php echo $strDeleteConfirm; ?>")) { window.location.href = "http://"+window.location.host+window.location.pathname+"?action=delete&id="+entry } function ResetPoll() { for (i=4; i<document.forms[0].elements.length-6; i+=3) { document.forms[0].elements[i].value = '0'; } } function CheckDays() { if(!(document.poll.exp_time.value >= 0)) { alert("Invalid value"); document.poll.exp_time.focus(); return false; } } } </script> </head> <body> <div class="<?php if($action=="show" || $action=="modify"){echo "lablenow";}else{echo "lable";}?>" onClick="self.location='poll_set.php?action=show'"><?php echo $strVoteList; ?></div> <div class="<?php if($action=="new"){echo "lablenow";}else{echo "lable";}?>" onClick="self.location='poll_set.php?action=new'"><?php echo $strVoteCreate; ?></div> <div class="<?php if($action=="option"){echo "lablenow";}else{echo "lable";}?>" onClick="self.location='poll_set.php?action=option'"><?php echo $strVoteSet; ?></div> <div class="formzone"> <?php $cc=$_REQUEST["cc"]; $id=$_REQUEST["id"]; $vote = new Vote; if($cc==$strVoteNewGroup){ $vote -> create_poll(); SayOk($strVoteCreatOk,$PHP_SELF . "?$action=new",""); } if (!isset($action)) { $action=''; } if ($action=="delete") { echo $vote -> delete_poll($id); } ?> <?php if($action=="new" || $action==""){?> <div class="tablezone"> <form action="" method="post" name="poll"> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr> <td width="90" > <?php echo $strVoteTitle; ?> </td> <td> <input name="groupname" type="text" id="groupname" size="30" class="input" /> </td> </tr> <?php function select_value(){ global $msql; global $strVoteSel; global $strVoteColor1,$strVoteColor2,$strVoteColor3,$strVoteColor4,$strVoteColor5,$strVoteColor6; global $strVoteColor7,$strVoteColor8,$strVoteColor9,$strVoteColor10,$strVoteColor11,$strVoteColor12; $msql -> query(" select def_options from {P}_tools_pollconfig "); if($msql -> next_record()){ $def_options = $msql -> f('def_options'); } for($i=1; $i<=$def_options; $i++){ $string.= "<tr><td width=\"90\">".$strVoteSel.$i."</td><td > <input name=\"option_id[$i]\" type=\"text\" size=\"30\" class=\"input\" /> <select class=\"select\" name=\"color[$i]\" onChange=\"javascript:ChangeBar(options[selectedIndex].value,$i)\"> <option value=\"blank\" >---</option> <option value=\"aqua\" selected>".$strVoteColor1."</option> <option value=\"blue\">".$strVoteColor2."</option> <option value=\"brown\">".$strVoteColor3."</option> <option value=\"darkgreen\">".$strVoteColor4."</option> <option value=\"gold\">".$strVoteColor5."</option> <option value=\"green\">".$strVoteColor6."</option> <option value=\"grey\">".$strVoteColor7."</option> <option value=\"orange\">".$strVoteColor8."</option> <option value=\"pink\">".$strVoteColor9."</option> <option value=\"purple\">".$strVoteColor10."</option> <option value=\"red\">".$strVoteColor11."</option> <option value=\"yellow\">".$strVoteColor12."</option> </select><img src=\"images/blank.gif\" name=\"bar$i\" width=\"8\" height=\"8\" align=\"absmiddle\"></td></tr>"; } return $string; } echo select_value(); ?> </tr> </table> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr> <td > <?php echo $strVoteStat; ?> <select name="status" id="status"> <option value="0"><?php echo $strClose; ?></option> <option value="1" selected ><?php echo $strOpen; ?></option> <option value="2"><?php echo $strHidden; ?></option> </select> <?php echo $strVoteExpday; ?> <input name="day" type="text" id="day" size="3" value="30"> <input name="expire" type="checkbox" id="expire" value="1"><?php echo $strVoteNotExp; ?> <input name="cc" type="submit" id="cc" value="<?php echo $strVoteNewGroup; ?>" class="button" /> <input name="Resert" type="reset" id="Resert" value="<?php echo $strVoteReset; ?>" class="input" /> </td> </tr> </table> </form> </div> <?php }elseif($action=="show"){?> <div class="tablezone"> <table width="100%" height="73" border="0" cellpadding="5" cellspacing="0"> <tr> <td height="23" class="innerbiaoti" width="30"> <?php echo $strNumber; ?> </td> <td class="innerbiaoti"> <?php echo $strVoteTitle; ?> </td> <td width="120" class="innerbiaoti"> <?php echo $strVotedate; ?> </td> <td width="100" class="innerbiaoti"> <?php echo $strVoteExpday; ?> </td> <td width="120" class="innerbiaoti"> <?php echo $strVoteExpday1; ?> </td> <td width="50" class="innerbiaoti"><?php echo $strModify; ?></td> <td width="50" class="innerbiaoti"> <?php echo $strDelete; ?> </td> </tr> <?php function listpoll(){ global $msql, $auth, $pollvars, $entry, $lang, $weekday,$months; if(!isset($entry)) { $entry = 0; } $msql->query(" SELECT * FROM {P}_tools_pollindex order by id desc "); while($msql->next_record()){ $poll_id = $msql->f('id'); $groupname = $msql->f('groupname'); $timestamp = $msql->f('timestamp'); $status = $msql->f('status'); $exp_time = $msql->f('exp_time'); $expire = $msql->f('expire'); $etime = $exp_time-$timestamp; $etime = date("d",$etime)-1; $timestamp = date("Y-n-j",$timestamp); $exp_time = date("Y-n-j",$exp_time); $lis_string.= "<tr class=\"list\"> <td >$poll_id</td><td height=\"23\" >$groupname</td> <td >$timestamp</td> <td >$etime</td> <td >$exp_time</td> <td ><a href=poll_set.php?action=modify&pollid=$poll_id><img src=images/edit.png border=0></a></td> <td ><a href=\"javascript:del_entry($poll_id)\"><img src=images/delete.png border=0></a></td> </tr>"; } return $lis_string; } echo listpoll(); ?> </table> </div> <?php }elseif($action=="option"){?> <div class="tablezone"> <?php if($cc==$strVoteModiSet){ $img_height=$_POST["img_height"]; $img_length=$_POST["img_length"]; $vodinfo=$_POST["vodinfo"]; $def_options=$_POST["def_options"]; $msql->query(" UPDATE {P}_tools_pollconfig SET img_height = '$img_height', img_length = '$img_length', vodinfo = '$vodinfo', def_options = '$def_options' "); SayOk($strVoteModiSetOk,"",""); } ?> <form action="" method="post" name="poll"> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <?php $msql->query(" SELECT * from {P}_tools_pollconfig "); if($msql->next_record()){ $img_height = $msql -> f('img_height'); $img_length = $msql -> f('img_length'); $vodinfo = $msql -> f('vodinfo'); $def_options = $msql -> f('def_options'); } ?> <tr> <td width="120" > <?php echo $strVoteHeight; ?> </td> <td ><input name="img_height" type="text" id="img_height" value="<?php echo $img_height;?>" size="30" class="input" /></td> </tr> <tr> <td width="120" > <?php echo $strVoteLen; ?> </td> <td ><input name="img_length" type="text" id="img_length" value="<?php echo $img_length;?>" size="30" class="input" /></td> </tr> <tr> <td width="120" ><?php echo $strVoteAl; ?></td> <td ><input name="vodinfo" type="text" id="vodinfo" value="<?php echo $vodinfo;?>" size="30" class="input" /></td> </tr> <tr> <td width="120" > <?php echo $strVoteNum; ?> </td> <td ><input name="def_options" type="text" id="def_options" value="<?php echo $def_options;?>" size="5" class="input" /></td> </tr> <tr> <td width="120" > </td> <td ><input name="cc" type="submit" id="cc" value="<?php echo $strVoteModiSet; ?>" class="button" /></td> </tr> </table> </form> </div> <?php }elseif($action=="modify"){ $pollid=$_REQUEST["pollid"]; ?> <div class="tablezone"> <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1"> <form action="" method="post" name="poll"> <?php function modify_poll($poll_id){ $groupname=$_POST["groupname"]; $cc=$_POST["cc"]; $option_id=$_POST["option_id"]; $votes=$_POST["votes"]; $status=$_POST["status"]; $color=$_POST["color"]; global $msql; global $strVoteSel,$strModifyOk,$strVoteSave,$strClose,$strOpen,$strHidden,$strVoteTitle; global $strVoteColor1,$strVoteColor2,$strVoteColor3,$strVoteColor4,$strVoteColor5,$strVoteColor6; global $strVoteColor7,$strVoteColor8,$strVoteColor9,$strVoteColor10,$strVoteColor11,$strVoteColor12; if($cc == $strVoteSave){ $msql -> query(" UPDATE {P}_tools_pollindex SET groupname = '$groupname', status = '$status' where id = '$poll_id' "); for($i=1; $i<=sizeof($option_id); $i++){ $option_id[$i] = trim($option_id[$i]); if(!empty($option_id[$i])){ if(!get_magic_quotes_gpc()){ $option_id[$i] = addslashes($option_id[$i]); } $msql -> query(" UPDATE {P}_tools_polldata SET option_text = '$option_id[$i]', color = '$color[$i]', votes = '$votes[$i]' where option_id = '$i' and poll_id = '$poll_id' "); } } SayOk($strModifyOk,"",""); } $msql->query(" SELECT * FROM {P}_tools_pollindex WHERE id = '$poll_id' "); if($msql->next_record()){ $groupname = $msql -> f('groupname'); $status = $msql -> f('status'); $modify_string = "<tr><td width=\"90\" >".$strVoteTitle."</td><td > <input type=\"text\" name=\"groupname\" value=\"$groupname\" size=\"29\" class=\"input\" /> <select name=\"status\" id=\"status\"> <option value=\"0\" ".seld($status,0).">".$strClose."</option><option value=\"1\" ".seld($status,1).">".$strOpen."</option><option value=\"2\" ".seld($status,2).">".$strHidden."</option></select></td></tr>"; } $msql->query(" SELECT * FROM {P}_tools_polldata WHERE poll_id = '$poll_id' ORDER BY option_id ASC"); while($msql->next_record()){ $option_id = $msql -> f('option_id'); $option_text = $msql -> f('option_text'); $color = $msql -> f('color'); $votes = $msql -> f('votes'); $seloption_id = $modify_string .= "<tr><td >".$strVoteSel."(".$option_id.")</td> <td > <input name=\"option_id[$option_id]\" type=\"text\" value=\"$option_text\" class=\"input\" /> <input name=\"votes[$option_id]\" type=\"text\" id=\"vote\" value=\"$votes\" size=\"5\" class=\"input\" /> <select class=\"select\" name=\"color[$option_id]\" onChange=\"javascript:ChangeBar(options[selectedIndex].value,$option_id)\"> <option value=\"blank\" ".seld($color,"blank").">---</option> <option value=\"aqua\" ".seld($color,"aqua").">".$strVoteColor1."</option> <option value=\"blue\" ".seld($color,"blue").">".$strVoteColor2."</option> <option value=\"brown\" ".seld($color,"brown").">".$strVoteColor3."</option> <option value=\"darkgreen\" ".seld($color,"darkgreen").">".$strVoteColor4."</option> <option value=\"gold\" ".seld($color,"gold").">".$strVoteColor5."</option> <option value=\"green\" ".seld($color,"green").">".$strVoteColor6."</option> <option value=\"grey\" ".seld($color,"grey").">".$strVoteColor7."</option> <option value=\"orange\" ".seld($color,"orange").">".$strVoteColor8."</option> <option value=\"pink\" ".seld($color,"pink").">".$strVoteColor9."</option> <option value=\"purple\" ".seld($color,"purple").">".$strVoteColor10."</option> <option value=\"red\" ".seld($color,"red").">".$strVoteColor11."</option> <option value=\"yellow\" ".seld($color,"yellow").">".$strVoteColor12."</option> </select><img src=\"images/".$color.".gif\" name=\"bar$option_id\" width=\"8\" height=\"8\" align=\"absmiddle\"></td></tr>"; } $modify_string .= "<tr><td ></td><td ><input type=\"submit\" name=\"cc\" value=\"".$strVoteSave."\"></td></tr>"; return $modify_string; } echo modify_poll($pollid); ?> </form> </table> </div> <?php }?> </div> </body> </html>