⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 survey.php

📁 调查问卷系统源码。想下的就下吧。不要条件
💻 PHP
📖 第 1 页 / 共 4 页
字号:

				$modifyquery = "update phpQSurvey set ";
				$modifyquery .= "Name = \"$surveyname\", Description = \"$description\", ";
				$modifyquery .= "AdminNotes = \"$adminnotes\", QuestionStyle = \"$questionstyle\", ";
				$modifyquery .= "AnswerInputStyle = \"$answerinputstyle\", ";
				$modifyquery .= "AnswerTextStyle = \"$answertextstyle\", AnswerStyle = \"$answerstyle\", ";
				$modifyquery .= "Template = \"$template\", Language = \"$language\", Width = \"$surveywidth\", Indent = \"$indent\", ";
				$modifyquery .= "ErrorStyle = \"$errorstyle\", SurveyUsers = \"$surveyusers\", ";
				$modifyquery .= "SurveyResults = \"$surveyresults\", OnComplete = \"$oncomplete\", ";
				$modifyquery .= "RedirectURL = \"$redirecturl\", Completed = \"$completed\", QuestionNumb = \"$questionnumb\", ";
				$modifyquery .= "VerifyEmail = \"$verifyemail\", EmailFrom = \"$emailfrom\", ";
				$modifyquery .= "EmailSubject = \"$emailsubject\", ";
				$modifyquery .= "AdvanceInterface = \"$localadvance\", ";
				$modifyquery .= "ResultsWidth = \"$resultswidth\", ";
				$modifyquery .= "ResultsBorder = \"$resultsborder\", ";
				$modifyquery .= "ResultsAnswer = \"$resultsanswer\", ";
				$modifyquery .= "ResultsStats = \"$resultsstats\", ";
				$modifyquery .= "ResultsGraph = \"$resultsgraph\", ";
				$modifyquery .= "SubmitImageText = \"$submitimagealt\", ";
				$modifyquery .= "SubmitImageWidth = \"$submitimagewidth\", ";
				$modifyquery .= "SubmitImageHeight = \"$submitimageheight\", ";
				$modifyquery .= "SubmitImageSrc = \"$submitimagesrc\", ";
				$modifyquery .= "ResultImageText = \"$resultimagealt\", ";
				$modifyquery .= "ResultImageWidth = \"$resultimagewidth\", ";
				$modifyquery .= "ResultImageHeight = \"$resultimageheight\", ";
				$modifyquery .= "ResultImageSrc = \"$resultimagesrc\", ";
				$modifyquery .= "NextImageText = \"$nextimagealt\", ";
				$modifyquery .= "NextImageWidth = \"$nextimagewidth\", ";
				$modifyquery .= "NextImageHeight = \"$nextimageheight\", ";
				$modifyquery .= "NextImageSrc = \"$nextimagesrc\" ";
				$modifyquery .= ($startdate) ? ", StartDate = \"$startdate\" " : ", StartDate = \"0000-00-00\" ";
				$modifyquery .= ($enddate) ? ", EndDate = \"$enddate\" " : ", EndDate = \"0000-00-00\" ";
				$modifyquery .= ", ResponseNotice = \"$responsenotice\"";
				$modifyquery .= ", ResponseEmail = \"$responseemail\"";
				$modifyquery .= "where SID = \"".ProtectMySQL($modifyid)."\"";
			}
			else {
				$modifyquery = "update phpQSurvey set ";
				$modifyquery .= "Name = \"$surveyname\", SurveyUsers = \"$surveyusers\", SurveyResults = \"$surveyresults\", Template = \"$template\", Language = \"$language\", ";
				$modifyquery .= "SubmitImageText = \"".ProtectMySQL($phpQlang['Next'])."\", ";
				$modifyquery .= "ResultImageText = \"".ProtectMySQL($phpQlang['ShowResults'])."\", ";
				$modifyquery .= "NextImageText = \"".ProtectMySQL($phpQlang['Next'])."\", ";
				$modifyquery .= "AdvanceInterface = \"$localadvance\" ";
				$modifyquery .= "where SID = \"".ProtectMySQL($modifyid)."\"";
			}

			if (!mysql_query($modifyquery)) {
				$message = $phpQlang['ModifySurveyError'];
			}
			elseif (!$message) {
				$message = $phpQlang['ModifySurveySuccess'];
			}
		}
		break;
	case $phpQlang['RetrieveSurvey']:
		if (!$HTTP_POST_VARS["importurl"]) {
			$message = $phpQlang['ImportURLEmpty'];
			break;
		}

		$fp = @fopen($HTTP_POST_VARS["importurl"], 'r');
		if (!$fp) {
			$message = $phpQlang['ImportURLFail'];
			break;
		}
		$cs = ImportSurvey($fp, 'SWAP', 'save');
		if ($cs && !$message) { $message = $phpQlang['ImportSurveySuccess']; }
		fclose($fp);
		break;
	case $phpQlang['ImportSurvey']:
		if ($HTTP_POST_FILES["importfile"]['tmp_name'] == 'none') {
			$message = $phpQlang['UploadError'];
			break;
		}
		elseif (!$HTTP_POST_FILES["importfile"]['tmp_name']) {
			$message = $phpQlang['ImportFileEmpty'];
			break;
		}

		$fp = @fopen($HTTP_POST_FILES["importfile"]['tmp_name'], 'r');
		if (!$fp) {
			$message = $phpQlang['ImportFileUnreadable'];
			break;
		}
		$cs = ImportSurvey($fp, 'SWAP', 'save');
		if ($cs && !$message) { $message = $phpQlang['ImportSurveySuccess']; }
		fclose($fp);
		break;
	default:
		break;
}

$message = ($message) ? "<B>".$phpQlang['Status'].":</B> ".$message : "<IMG SRC=\"images/invdot.gif\" WIDTH=100 HEIGHT=1 ALT=\"\">";

$qstring = "select *, month(StartDate) as sdmn, month(EndDate) as edmn, month(now()) as nwmn, ";
$qstring .= "dayofmonth(StartDate) as sddm, dayofmonth(EndDate) as eddm, dayofmonth(now()) as nwdm, ";
$qstring .= "year(StartDate) as sdyr, year(EndDate) as edyr, year(now()) as nwyr, ";
$qstring .= "hour(StartDate) as sdhr, hour(EndDate) as edhr, ";
$qstring .= "minute(StartDate) as sdmt, minute(EndDate) as edmt, ";
$qstring .= "second(StartDate) as sdsc, second(EndDate) as edsc, ";
$qstring .= "(now() < StartDate) as Pending, (now() > EndDate) as Expired ";
$qstring .= "from phpQSurvey order by AddDate desc, Name";
$mqsurvey = mysql_query($qstring);
$count = 0;
$csurvey = -1;
while ($masurvey = mysql_fetch_array($mqsurvey)) {
	if ($cs && $cs == $masurvey["SID"]) {
		$csurvey = $count;
		if ($masurvey["Active"] == "y") {
			if ($masurvey["Pending"] && substr($masurvey["StartDate"],0,10) != "0000-00-00") {
				$textimg = "<IMG SRC=\"$imgurl/textpending.gif\" WIDTH=58 HEIGHT=13 ALT=\"".$phpQlang['Pending']."\">";
				$buttonimg = "<IMG SRC=\"$imgurl/buttonpending.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
			} elseif ($masurvey["Expired"] && substr($masurvey["EndDate"],0,10) != "0000-00-00") {
				$textimg = "<IMG SRC=\"$imgurl/textexpired.gif\" WIDTH=58 HEIGHT=13 ALT=\"".$phpQlang['Expired']."\">";
				$buttonimg = "<IMG SRC=\"$imgurl/buttonpending.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
			} else {
				$textimg = "<IMG SRC=\"$imgurl/textactive.gif\" WIDTH=46 HEIGHT=13 ALT=\"".$phpQlang['Active']."\">";
				$buttonimg = "<IMG SRC=\"$imgurl/buttonactive.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
			}
		} else {
			$textimg = "<IMG SRC=\"$imgurl/textnotactive.gif\" WIDTH=79 HEIGHT=13 ALT=\"".$phpQlang['NotActive']."\">";
			$buttonimg = "<IMG SRC=\"$imgurl/buttondeactive.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
		}
	}
	$surveylist[] = $masurvey;
	$count++;
}

$choosealt = $phpQlang['ChooseASurvey'];
$staralt = $phpQlang['*'];
$helpalt = $phpQlang['?'];
$sslabel = $phpQlang['SelectSurvey'];

$contents = <<<END

<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0 WIDTH=100%>
<FORM NAME=choosesurvey ACTION=survey.php METHOD=POST>
<TR>
	<TD COLSPAN=3><IMG SRC="$imgurl/headingsurvey1.gif" WIDTH=109 HEIGHT=22 ALT="$choosealt"></TD>
</TR>
<TR>
	<TD ALIGN=right WIDTH=120><B>$sslabel:</B></TD>
	<TD><A HREF="javascript:phpQHelp('s_select', 'SelectSurvey')"><IMG SRC="$imgurl/qmark.gif" WIDTH=13 HEIGHT=13 BORDER=0 ALT="$helpalt"></A></TD>
	<TD><SELECT NAME=choosesurvey CLASS=huge ONCHANGE="ChangeSurvey()">

END;

if (sizeof($surveylist) > 0) {
	$contents .= "<OPTION VALUE=0>".$phpQlang['NoSurveySelected'];
	for ($i=0; $i<sizeof($surveylist); $i++) {
		$selected = ($surveylist[$i]["SID"] == $cs) ? "SELECTED" : "";
		$svname = (strlen($surveylist[$i]["Name"]) > 50) ? substr($surveylist[$i]["Name"],0,50)."..." : $surveylist[$i]["Name"];
		if ($csurvey == $i) { $shortsvname = $svname; }
		$text = substr($surveylist[$i]["AddDate"],0,10).": ".$svname;
		$contents .= "<OPTION $selected VALUE=".$surveylist[$i]["SID"].">".ProtectHTML($text);
	}
}
else {
	$contents .= "<OPTION VALUE=0>".$phpQlang['NoSurveyInDatabase'];
}

$tsurveyname = ProtectHTML($surveylist[$csurvey]["Name"]);
$tdescription = ProtectHTML($surveylist[$csurvey]["Description"]);
$tadminnotes = ProtectHTML($surveylist[$csurvey]["AdminNotes"]);
$tsurveywidth = ProtectHTML($surveylist[$csurvey]["Width"]);
$tindent = ProtectHTML($surveylist[$csurvey]["Indent"]);
$tquestionstyle = ProtectHTML($surveylist[$csurvey]["QuestionStyle"]);
$tanswerinputstyle = ProtectHTML($surveylist[$csurvey]["AnswerInputStyle"]);
$tanswertextstyle = ProtectHTML($surveylist[$csurvey]["AnswerTextStyle"]);
$tanswerstyle = ProtectHTML($surveylist[$csurvey]["AnswerStyle"]);
$terrorstyle = ProtectHTML($surveylist[$csurvey]["ErrorStyle"]);
$tredirecturl = ProtectHTML($surveylist[$csurvey]["RedirectURL"]);
$tresponseemail = ProtectHTML($surveylist[$csurvey]["ResponseEmail"]);

$tresultswidth = ProtectHTML($surveylist[$csurvey]["ResultsWidth"]);
$tresultsborder = ProtectHTML($surveylist[$csurvey]["ResultsBorder"]);
$tresultsanswer = ProtectHTML($surveylist[$csurvey]["ResultsAnswer"]);
$tresultsstats = ProtectHTML($surveylist[$csurvey]["ResultsStats"]);
$tresultsgraph = ProtectHTML($surveylist[$csurvey]["ResultsGraph"]);

$tsubmitimagesrc = ProtectHTML($surveylist[$csurvey]["SubmitImageSrc"]);
$tsubmitimagewidth = $surveylist[$csurvey]["SubmitImageWidth"] ? ProtectHTML($surveylist[$csurvey]["SubmitImageWidth"]) : '';
$tsubmitimageheight = $surveylist[$csurvey]["SubmitImageHeight"] ? ProtectHTML($surveylist[$csurvey]["SubmitImageHeight"]) : '';
$tsubmitimagealt = ProtectHTML($surveylist[$csurvey]["SubmitImageText"]);
$tresultimagesrc = ProtectHTML($surveylist[$csurvey]["ResultImageSrc"]);
$tresultimagewidth = $surveylist[$csurvey]["ResultImageWidth"] ? ProtectHTML($surveylist[$csurvey]["ResultImageWidth"]) : '';
$tresultimageheight = $surveylist[$csurvey]["ResultImageHeight"] ? ProtectHTML($surveylist[$csurvey]["ResultImageHeight"]) : '';
$tresultimagealt = ProtectHTML($surveylist[$csurvey]["ResultImageText"]);
$tnextimagesrc = ProtectHTML($surveylist[$csurvey]["NextImageSrc"]);
$tnextimagewidth = $surveylist[$csurvey]["NextImageWidth"] ? ProtectHTML($surveylist[$csurvey]["NextImageWidth"]) : '';
$tnextimageheight = $surveylist[$csurvey]["NextImageHeight"] ? ProtectHTML($surveylist[$csurvey]["NextImageHeight"]) : '';
$tnextimagealt = ProtectHTML($surveylist[$csurvey]["NextImageText"]);

if ($csurvey < 0) {
	$tresultswidth = '500';
	$tresultsborder = 'background-color: #333366; color: #FFFFFF; text-decoration: none;';
	$tresultsanswer = 'background-color: #FFFFFF; color: #333366;';
	$tresultsstats = 'background-color: #DDEEFF; color: #333366;';
	$tresultsgraph = 'background-color: #333366; height: 8px;';

	$tsubmitimagealt = $phpQlang['Submit'];
	$tresultimagealt = $phpQlang['ShowResults'];
	$tnextimagealt = $phpQlang['Next'];
}

$active = ($surveylist[$csurvey]["Active"] == "y") ? $phpQlang['Deactivate'] : $phpQlang['Activate'];
$activate = ($surveylist[$csurvey]["Active"] == "y") ? "off" : "on";
$activebutton = ($cs) ? "<INPUT TYPE=button ONCLICK=\"ActivateSurvey('$activate')\" VALUE=\"$active\">" : "";

$editbutton = ($cs) ? "<INPUT TYPE=button ONCLICK=\"EditSurvey()\" VALUE=\"".$phpQlang['EditQuestions']."\">" : "";
$previewbutton = ($cs) ? "<INPUT TYPE=button ONCLICK=\"PreviewSurvey($cs)\" VALUE=\"".$phpQlang['Preview']."\">" : "";
$exportbutton = ($cs) ? "<INPUT TYPE=button ONCLICK=\"ExportSurvey()\" VALUE=\"".$phpQlang['Export']."\">" : "";
$deletebutton = ($cs) ? "<INPUT TYPE=button ONCLICK=\"DeleteSurvey()\" VALUE=\"".$phpQlang['Delete']."\">" : "";

$addmodifyalt = $phpQlang['AddModifyASurvey'];
$requiredfield = $phpQlang['RequiredField'];
$interface = $phpQlang['Interface'];

$contents .= <<<END

		</SELECT></TD>
</TR>
<TR>
	<TD ALIGN=right>$textimg</TD>
	<TD>$buttonimg</TD>
	<TD>$editbutton $previewbutton $activebutton $exportbutton $deletebutton</TD>
</TR>
<INPUT TYPE=hidden NAME=action VALUE="activate">
<INPUT TYPE=hidden NAME=activate VALUE="">
<INPUT TYPE=hidden NAME=activateid VALUE="">
<INPUT TYPE=hidden NAME=deleteid VALUE="">
<INPUT TYPE=hidden NAME=cs VALUE="$cs">
</FORM>
</TABLE>

<BR>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%>
<TR><TD BACKGROUND="images/border.gif"><IMG SRC="images/invdot.gif" WIDTH=100 HEIGHT=1 ALT=""></TD></TR>
</TABLE>
<BR>

<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0>
<FORM NAME=addsurvey METHOD=POST>
<TR>
	<TD COLSPAN=4>
	<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%>
	<TR>
		<TD><IMG SRC="$imgurl/headingsurvey2.gif" WIDTH=136 HEIGHT=22 ALT="$addmodifyalt"></TD>
		<TD ALIGN=center><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><IMG SRC="$imgurl/star.gif" WIDTH=11 HEIGHT=11 ALT="$staralt"></TD><TD>&nbsp;$requiredfield</TD></TR></TABLE></TD>
		<TD ALIGN=right><B>$interface:</B> <SELECT NAME=localadvance ONCHANGE="ChangeInterface()">

END;

$advancetf = ($advance) ? "y" : "n";
for ($i=0; $i<sizeof($advancearray); $i++) {
	$selected = ($advancetf==$advancearray[$i][1]) ? "SELECTED" : "";
	$contents .= "<OPTION $selected VALUE=\"".$advancearray[$i][1]."\">".$advancearray[$i][0];
}

$snlabel = $phpQlang['SurveyName'];
$contents .= <<<END

			</SELECT></TD>
	</TR>
	</TABLE>
	</TD>
</TR>
<TR>
	<TD ALIGN=right WIDTH=120><B>$snlabel:</B></TD>
	<TD><A HREF="javascript:phpQHelp('s_name', 'SurveyName')"><IMG SRC="$imgurl/qmark.gif" WIDTH=13 HEIGHT=13 BORDER=0 ALT="$helpalt"></A></TD>
	<TD><INPUT TYPE=text NAME=surveyname CLASS=huge VALUE="$tsurveyname"></TD>
	<TD><IMG SRC="$imgurl/star.gif" WIDTH=11 HEIGHT=11 ALT="$staralt"></TD>
</TR>

END;

$stlabel = $phpQlang['SurveyTemplate'];
$contents .= <<<END

<TR>
	<TD ALIGN=right><B>$stlabel:</B></TD>
	<TD><A HREF="javascript:phpQHelp('s_template', 'SurveyTemplate')"><IMG SRC="$imgurl/qmark.gif" WIDTH=13 HEIGHT=13 BORDER=0 ALT="$helpalt"></A></TD>
	<TD><SELECT NAME=template CLASS=huge>

END;

$template = $surveylist[$csurvey]["Template"] ? $surveylist[$csurvey]["Template"] : $phpQAdmin["Template"];
$contents .= TemplateOptionList($template);

$contents .= <<<END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -