📄 survey.php
字号:
}
}
$language = protectmysql( $language );
$oncomplete = protectmysql( $oncomplete );
$redirecturl = protectmysql( $redirecturl );
$responsenotice = protectmysql( $responsenotice );
$responseemail = protectmysql( $responseemail );
$emailfrom = protectmysql( $emailfrom );
$emailsubject = protectmysql( $emailsubject );
$verifyemail = protectmysql( $verifyemail );
$localadvance = $localadvance == "y" || $localadvance == "n" ? $localadvance : $advance;
$questionnumb = $questionnumb == "y" || $questionnumb == "n" ? $questionnumb : "y";
$surveyusers = processsurveyusers( $surveyusersip, $surveyusersck, $surveyusersem );
$surveyresults = protectmysql( $surveyresults );
if ( $sdmonth || $sdday || $sdyear || $sdhr || $sdmt || $sdsc )
{
if ( checkdatetime( $sdmonth, $sdday, $sdyear, $sdhr, $sdmt, $sdsc ) )
{
$startdate = "{$sdyear}-{$sdmonth}-{$sdday} {$sdhr}:{$sdmt}:{$sdsc}";
}
else
{
$message = sprintf( $phpQlang['InvalidDateError'], $phpQlang['StartingDate'] );
}
}
if ( $edmonth || $edday || $edyear || $edhr || $edmt || $edsc )
{
if ( checkdatetime( $edmonth, $edday, $edyear, $edhr, $edmt, $edsc ) )
{
$enddate = "{$edyear}-{$edmonth}-{$edday} {$edhr}:{$edmt}:{$edsc}";
}
else if ( $edyear || $edmonth || $edday )
{
$message = sprintf( $phpQlang['InvalidDateError'], $phpQlang['EndingDate'] );
}
if ( $startdate && $enddate && mktime( $edhr, $edmt, $edsc, $edmonth, $edday, $edyear ) < mktime( $sdhr, $sdmt, $sdsc, $sdmonth, $sdday, $sdyear ) )
{
$startdate = "";
$enddate = "";
$message = sprintf( $phpQlang['DateOrderError'], $phpQlang['StartingDate'], $phpQlang['EndingDate'] );
}
$modifyquery = "update phpQSurvey set ";
$modifyquery .= "Name = \"{$surveyname}\", IINPUT = ".$iinput.",DEPT_ID = '".$TO_ID."',Description = \"{$description}\", ";
$modifyquery .= "AdminNotes = \"{$adminnotes}\", ";
$modifyquery .= "Template = \"{$template}\", Language = \"{$language}\", Width = \"{$surveywidth}\", Indent = \"{$indent}\", ";
$modifyquery .= "SurveyUsers = \"{$surveyusers}\", ";
$modifyquery .= " OnComplete = \"{$oncomplete}\", ";
$modifyquery .= "VerifyEmail = \"{$verifyemail}\", EmailFrom = \"{$emailfrom}\", ";
$modifyquery .= "EmailSubject = \"{$emailsubject}\"";
$modifyquery .= $startdate ? ", StartDate = \"{$startdate}\" " : ", StartDate = \"0000-00-00\" ";
$modifyquery .= $enddate ? ", EndDate = \"{$enddate}\" " : ", EndDate = \"0000-00-00\" ";
$modifyquery .= ", ResponseEmail = \"{$responseemail}\"";
$modifyquery .= "where SID = \"".protectmysql( $modifyid )."\"";
}
else
{
$modifyquery = "update phpQSurvey set ";
$modifyquery .= "Name = \"{$surveyname}\",IINPUT = '".$iinput."',";
$modifyquery .= "DEPT_ID = '".$TO_ID."',SurveyUsers = '".$surveyusers."',";
$modifyquery .= "SurveyResults = \"{$surveyresults}\",";
$modifyquery .= " Template = \"{$template}\", Language = \"{$language}\",";
$modifyquery .= "where SID = \"".protectmysql( $modifyid )."\"";
}
if ( !mysql_query( $modifyquery ) )
{
$message = $phpQlang['ModifySurveyError'];
}
else if ( !$message )
{
$message = $phpQlang['ModifySurveySuccess'];
}
if ( $iinput == 1 )
{
$sql = "UPDATE phpQSurvey SET IINPUT = 0 WHERE IINPUT = 1 AND SID !=".protectmysql( $modifyid )."";
mysql_query( $sql );
}
}
header( "Location: main.php" );
break;
case $phpQlang['RetrieveSurvey'] :
if ( !$HTTP_POST_VARS['importurl'] )
{
$message = $phpQlang['ImportURLEmpty'];
}
else
{
$fp = @fopen( $HTTP_POST_VARS['importurl'], "r" );
if ( !$fp )
{
$message = $phpQlang['ImportURLFail'];
}
else
{
$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;
}
else
{
if ( !$HTTP_POST_FILES['importfile']['tmp_name'] )
{
$message = $phpQlang['ImportFileEmpty'];
}
}
$fp = @fopen( $HTTP_POST_FILES['importfile']['tmp_name'], "r" );
if ( !$fp )
{
$message = $phpQlang['ImportFileUnreadable'];
}
else
{
$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 where CREATOR = '".$_SESSION['LOGIN_USER_ID']."' ";
$qstring .= " 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=\"\">";
}
else if ( $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 = "<script language='javascript' src='/inc/common.js'></script>\r\n<script language=\"javascript\">\r\nfunction clear_dept()\r\n{\r\n document.form1.TO_NAME.value=\"\";\r\n document.form1.TO_ID.value=\"\";\r\n}\r\n</script>\r\n<TABLE CELLPADDING=5 CELLSPACING=1 BORDER=0 WIDTH=100%>\r\n<FORM NAME=choosesurvey ACTION=survey.php METHOD=POST>\r\n<TR align='right'>\r\n\t<TD ALIGN=right ><B>{$sslabel}:</B>\r\n\t<SELECT NAME=choosesurvey ONCHANGE=\"ChangeSurvey()\" class=\"SmallSelect\">\r\n";
if ( 0 < sizeof( $surveylist ) )
{
$contents .= "<OPTION VALUE=0>".$phpQlang['NoSurveySelected'];
$i = 0;
for ( ; $i < sizeof( $surveylist ); ++$i )
{
$selected = $surveylist[$i]['SID'] == $cs ? "SELECTED" : "";
$svname = 50 < strlen( $surveylist[$i]['Name'] ) ? 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'] );
$tiinput = protecthtml( $surveylist[$csurvey]['IINPUT'] );
if ( $tiinput == 1 )
{
$selected = "checked";
}
$DEPT_ID = $surveylist[$csurvey]['DEPT_ID'];
$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'] ) : "";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -