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

📄 main.php

📁 php+mysql做的调查问卷管理系统php+mysql做的调查问卷管理系统
💻 PHP
字号:
<?
################################################################################
# phpQuestionnaire                           Version 2.2                       #
# Copyright 2003-2005 chumpsoft, inc.        March 28, 2005                    #
################################################################################
#              SCRiPTMAFiA 2005 - THE DiRTY HANDS ON YOUR SCRiPTS              #
################################################################################

$GLOBALS["inAdmin"] = 1;

#-->> Including Files

require("../inc/init.php");
require("../inc/mysql.php");
require("../inc/functions.php");
require("../inc/pfunctions.php");

#-->> GET and POST Variables

$varnames = array("logoff", "phpQpasswd", "cs");

SetVars($varnames);

#-->> Logging In

IsAdmin(1);
SetLanguage('', 'ADMIN');
$imgurl = $GLOBALS["phpQImageDir"];

# Perform some security checks to make sure users are taking care of themselves.
if (file_exists('../install.php')) {
	$GLOBALS['message'] = '<b>'.$phpQlang['SecurityAlert'].':</b> '.$phpQlang['SecurityInstall'];
}

if ($phpQAdmin["Passwd"] == 'password') {
	$GLOBALS['message'] = '<b>'.$phpQlang['SecurityAlert'].':</b> '.$phpQlang['SecurityPassword'];
}

#-->> Content

$overviewtitle = $phpQlang['OverviewTitle'];
$version = $GLOBALS["PHPQVERSION"];
$contents = <<<END

<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=600>
<TR><TD WIDTH=48></TD><TD WIDTH=500></TD><TD WIDTH=48></TD>
<TR>
	<TD>&nbsp;</TD>
	<TD COLSPAN=2><TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%><TR>
		 <TD><IMG SRC="$imgurl/headingoverview.gif" WIDTH=107 HEIGHT=22 ALT="$overviewtitle"></TD>
		 </TR></TABLE></TD>
</TR>
<TR><TD COLSPAN=3>&nbsp;</TD></TR>
<TR>
	<TD>&nbsp;</TD>
	<TD ALIGN=center>
	<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0>

END;

$scriptloc = '';
if ($HTTP_HOST != '') {
	$scriptloc .= "http://$HTTP_HOST";
}
elseif ($HTTP_SERVER_VARS["HTTP_HOST"] != '') {
	$scriptloc .= 'http://'.$HTTP_SERVER_VARS["HTTP_HOST"];
}
$php_self = $PHP_SELF ? $PHP_SELF : $HTTP_SERVER_VARS["PHP_SELF"];
if (!$php_self && $HTTP_SERVER_VARS['REQUEST_URI']) {
	$php_self = $HTTP_SERVER_VARS['REQUEST_URI'];
}
$scriptloc .= $php_self;
$scriptloc = preg_replace("/(.*)\/.*/", "\\1", $scriptloc);
$scriptloc = preg_replace("/(.*)\/.*/", "\\1", $scriptloc);

$qstring = "select *, ";
$qstring .= "date_format(StartDate, '".$phpQlang['MySQLDateFormat']."') as FStartDate, ";
$qstring .= "date_format(EndDate, '".$phpQlang['MySQLDateFormat']."') as FEndDate, ";
$qstring .= "(now() < StartDate) as Pending, (now() > EndDate) as Expired ";
$qstring .= "from phpQSurvey order by Active, Name";

$mqsurvey = mysql_query($qstring);
while ($masurvey = mysql_fetch_array($mqsurvey)) {
	$mqresponse = mysql_query("select count(*) as ct from phpQUser where SID = \"".ProtectMySQL($masurvey["SID"])."\"");
	$responsect = 0;
	if ($maresponse = mysql_fetch_array($mqresponse)) {
		$responsect = $maresponse["ct"];
	}

	$responsemsg = ($responsect == 1) ? $phpQlang["response"] : $phpQlang["responses"];
	$responsemsg = sprintf($responsemsg, $responsect);

	$responseloc = "(<A HREF=\"choose.php?cs=".$masurvey["SID"]."\" CLASS=link STYLE=\"color: #336699;\">$responsemsg</A>)";

	$editloc = "<A HREF=\"survey.php?cs=".$masurvey["SID"]."\" ";
	$editloc .= "STYLE=\"color: #336699;\"><IMG SRC=\"$imgurl/edit.gif\" WIDTH=51 HEIGHT=15 BORDER=0 ALT=\"".$phpQlang['Edit']."\"></A>";

	$previewloc = "<A HREF=\"".$scriptloc."/fillsurvey.php?sid=".$masurvey["SID"]."&action=preview\" CLASS=link ";
	$previewloc .= "TARGET=_new STYLE=\"color: #336699;\"><IMG SRC=\"$imgurl/preview.gif\" WIDTH=80 HEIGHT=15 BORDER=0 ALT=\"".$phpQlang['Preview']."\"></A>";

	$svname = (strlen($masurvey["Name"]) > 30) ? substr($masurvey["Name"],0,30)."..." : $masurvey["Name"];

	$surveyloc = $scriptloc."/fillsurvey.php?sid=".$masurvey["SID"];

	if ($masurvey["Active"]=="y") {
		if ($masurvey["Pending"] && substr($masurvey["StartDate"],0,10) != "0000-00-00") {
			$activeimg = "<IMG SRC=\"$imgurl/textpending.gif\" WIDTH=58 HEIGHT=13 ALT=\"".$phpQlang['Pending']."\">";
			$activebtn = "<IMG SRC=\"$imgurl/buttonpending.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
		}
		elseif ($masurvey["Expired"] && substr($masurvey["EndDate"],0,10) != "0000-00-00") {
			$activeimg = "<IMG SRC=\"$imgurl/textexpired.gif\" WIDTH=58 HEIGHT=13 ALT=\"".$phpQlang['Expired']."\">";
			$activebtn = "<IMG SRC=\"$imgurl/buttonpending.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
		}
		else {
			$activeimg = "<IMG SRC=\"$imgurl/textactive.gif\" WIDTH=46 HEIGHT=13 ALT=\"".$phpQlang['Active']."\">";
			$activebtn = "<IMG SRC=\"$imgurl/buttonactive.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
		}
	} else {
		$activeimg = "<IMG SRC=\"$imgurl/textnotactive.gif\" WIDTH=79 HEIGHT=13 ALT=\"".$phpQlang['NotActive']."\">";
		$activebtn = "<IMG SRC=\"$imgurl/buttondeactive.gif\" WIDTH=13 HEIGHT=13 ALT=\"\">";
	}

	$editorloc = "<A HREF=\"$surveyloc\" CLASS=link TARGET=_new STYLE=\"color: #6699CC;\">";
	$editorloc .= $svname."</A>";

	$contents .= "<TR>";
	$contents .= "<TD ALIGN=right>$activeimg</TD><TD>$activebtn</TD>";
	$contents .= "<TD>";
	$contents .= "<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0 WIDTH=100%><TR>";
	$contents .= "<TD STYLE=\"color: #6699CC; font-size: 12px;\"><NOBR><B>$editorloc</B></NOBR></TD>";
	$contents .= "<TD><NOBR>$responseloc</NOBR></TD>";
	$contents .= "<TD WIDTH=100% ALIGN=right>$editloc</TD><TD>$previewloc</TD>";
	$contents .= "</TR></TABLE>";
	$contents .= "</TD>";
	$contents .= "</TR>";
	if ($masurvey["Description"]) {
		$contents .= "<TR>";
		$contents .= "<TD COLSPAN=2 ALIGN=right VALIGN=top><NOBR><B>".$phpQlang['Description']."</B>:</NOBR></TD>";
		$contents .= "<TD>".$masurvey["Description"]."</TD>";
		$contents .= "</TR>";
	}
	$sdtest = (substr($masurvey["StartDate"],0,10) != "0000-00-00") ? true : false;
	$edtest = (substr($masurvey["EndDate"],0,10) != "0000-00-00") ? true : false;
	if ($masurvey["Active"]=="y" && ($sdtest || $edtest)) {
		$contents .= "<TR>";
		$contents .= "<TD COLSPAN=2 ALIGN=right><B><NOBR>".$phpQlang['ActiveDates']."</B>:</NOBR></TD>";
		if ($sdtest && !$edtest) {
			$contents .= "<TD>".sprintf($phpQlang['StartsOn'], $masurvey["FStartDate"])."</TD>";
		}
		elseif (!$sdtest && $edtest) {
			$contents .= "<TD>".sprintf($phpQlang['EndsOn'], $masurvey["FEndDate"])."</TD>";
		}
		else {
			$contents .= "<TD>".sprintf($phpQlang['RunsBetween'], $masurvey["FStartDate"], $masurvey["FEndDate"])."</TD>";
		}
		$contents .= "</TR>";
	}

	if ($masurvey["Active"]=="y") {
		$contents .= "<TR>";
		$contents .= "<TD COLSPAN=2 ALIGN=right><B><NOBR>".$phpQlang['LinktoSurvey']."</B>:</NOBR></TD>";
		$contents .= "<TD><A HREF=\"$surveyloc\" TARGET=_new CLASS=link>$surveyloc</A></TD>";
		$contents .= "</TR>";

		if ($masurvey["SurveyResults"]) {
			$statsloc = $scriptloc."/stats.php?sid=".$masurvey["SID"];
	 		$contents .= "<TR>";
	 		$contents .= "<TD COLSPAN=2 ALIGN=right><NOBR><B>".$phpQlang['PublicResults']."</B>:</NOBR></TD>";
	 		$contents .= "<TD><A HREF=\"$statsloc\" TARGET=_new CLASS=link>$statsloc</A></TD>";
	 		$contents .= "</TR>";
		}
	}

	$contents .= "<TR><TD COLSPAN=3>";
	$contents .= "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%><TR>";
	$contents .= "<TD BACKGROUND=\"images/border.gif\"><IMG SRC=\"images/invdot.gif\" WIDTH=100 HEIGHT=1 ALT=\"\"></TD>";
	$contents .= "</TR></TABLE>";
	$contents .= "</TD></TR>\n";
}

$contents .= <<<END

	</TABLE>
	</TD>
	<TD>&nbsp;</TD>
</TR>
</TABLE>

END;

#-->> Output Page

CreatePage("main", $phpQlang['AdminTitle'].' :: '.$phpQlang['OverviewTitle'], $contents, true, "");

?>

⌨️ 快捷键说明

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