所以这很奇怪。我在我的网站的某些特定页面上收到间歇性内部服务器错误消息。
我有一个包含滑块脚本的fancybox iframe,它在每个加载PHP页面的iframe之间滑动(总共9个iframes / php页面)。我知道在iframe中使用iframe并不是特别好,但它使这个特定的项目更容易管理。
有时,一个或多个php页面显示内部服务器错误。如果我重新加载父页面或iframe它会消失。我真的无法弄清楚为什么会这样。它只发生在这些页面上,而且只是间歇性地发生。
任何人都可以想到发生这种情况的原因。已知PHP或Iframe会导致此问题吗?如果我自己加载php页面(不是在框架中),这不会发生。
PHP页面的代码如下:
滑块容器代码:
<?php
if ($pass != "password") {
exit('<head>
<script type="text/javascript">
<!--
window.location="../index.php";
//-->
</script>
</head>');
}
if(isset($_GET['today']))
{
if(isset($_GET['mrn']))
{
$mrn = $_GET['mrn'];
$date = isset($_GET['today']) ? $_GET['today'] : date('Y-m-d');
$dateplus1 = date('Y-m-d', strtotime($date .' +1 day'));
$dateminus1 = date('Y-m-d', strtotime($date .' -1 day'));
$dateminus2 = date('Y-m-d', strtotime($date .' -2 day'));
$dateminus3 = date('Y-m-d', strtotime($date .' -3 day'));
$dateminus4 = date('Y-m-d', strtotime($date .' -4 day'));
$dateminus5 = date('Y-m-d', strtotime($date .' -5 day'));
$dateminus6 = date('Y-m-d', strtotime($date .' -6 day'));
echo '### html page containing javacript slider script and iframes (src of iframes uses
$dateminus1 etc... to tell the page which date to display in the frame ###
';
}
else {echo 'error no mrn set';}
}
else {echo 'error no date set';}
?>
滑块中的页面代码(每页上的代码相同):
<?php
$hostname = "localhost";
$username = "";
$password = "";
$database = "";
$connection = mysql_connect($hostname, $username, $password) OR die('Could not connect
to MySQL: ' . mysql_error());
mysql_select_db($database);
$Search = $_GET['mrn'];
$mrn = $_GET['mrn'];
$Date = $_GET['date'];
$Date2 = date("Y/m/d", strtotime($Date));
$Date3 = date("d/m/Y", strtotime($Date));
$Find_Query2 = mysql_query("SELECT * FROM patients WHERE mrn ='$Search' ");
if(!$Find_Query2)
{
die(mysql_error());
}
while($row = mysql_fetch_assoc($Find_Query2))
{
$FNAME = $row['fname'];
$LNAME = $row['lname'];
$MRN2 = $row['mrn'];
$DOB = $row['dob'];
$WARD = $row['ward'];
}
date_default_timezone_set('Europe/London');
$Find_Query1 = mysql_query("SELECT DATE_FORMAT(COALESCE(datetime_man, datetime),'%Y/%m/%d %H:%i:%s') AS datetime2, DATE_FORMAT(COALESCE(datetime_man, datetime),'%H:%i on %d/%m/%y') AS datetime3, DATE_FORMAT(COALESCE(datetime_man, datetime),'%H%i%s') AS datetime4, SBP, SBP_R, SBP_B, DBP, DBP_R, DBP_B, HR, HR_R, HR_B, HRreg, RR, RR_R, RR_B, SpO2, SpO2_R, SpO2_B, O2flow, O2flow_R, O2flow_B, O2device, O2deviceOther, TEMP, TEMP_R, TEMP_B, AVPU, AVPU_R, PAR, PAR_B, UO, UO_B, pain_movement, pain_rest, sedation FROM addobs WHERE mrn='$Search' AND DATE(datetime)='$Date' AND NOT hidden = 'yes' order by datetime2 ASC");
if ($Find_Query1) {
$ASBP = array();
$ADBP = array();
$AHR = array();
$ARR = array();
$ASpO2 = array();
$AO2flow = array();
$ATEMP = array();
$AAVPU = array();
$APAR = array();
$AUO = array();
$APM = array();
$APR = array();
$ASED = array();
while ($row = mysql_fetch_assoc($Find_Query1)) {
$ASBP[] = "['" . $row["datetime2"] . "'," . $row["SBP_R"] . ", 'rgba(" . $row["SBP_B"] . ",0,0,1)', 'Blood pressure was " . $row["SBP"] . "/" . $row["DBP"] . " mmHg at " . $row["datetime3"] . ".'],";
$ADBP[] = "['" . $row["datetime2"] . "'," . $row["DBP_R"] . ", 'rgba(" . $row["DBP_B"] . ",0,0,1)', 'Blood pressure was " . $row["SBP"] . "/" . $row["DBP"] . " mmHg at " . $row["datetime3"] . ".'],";
$AHR[] = "['" . $row["datetime2"] . "'," . $row["HR_R"] . ", 'rgba(" . $row["HR_B"] . ",0,0,1)', 'Heart rate was " . $row["HR"] . " (" . $row["HRreg"] . " rhythm) at " . $row["datetime3"] . ".'],";
$ARR[] = "['" . $row["datetime2"] . "'," . $row["RR_R"] . ", 'rgba(" . $row["RR_B"] . ",0,0,1)', 'Respiratory rate was " . $row["RR"] ." at " . $row["datetime3"] . ".'],";
$ASpO2[] = "['" . $row["datetime2"] . "'," . $row["SpO2_R"] . ", 'rgba(" . $row["SpO2_B"] . ",0,0,1)', 'Oxygen saturations were " . $row["SpO2"] ."% at " . $row["datetime3"] . ".'],";
$AO2flow[] = "['" . $row["datetime2"] . "'," . $row["O2flow_R"] . ", 'rgba(" . $row["O2flow_B"] . ",0,0,1)', 'Patient was on " . $row["O2flow"] ." l/min of supplementary oxygen " . $row["O2device"] . $row["O2deviceOther"] . " at " . $row["datetime3"] . ".'],";
$ATEMP[] = "['" . $row["datetime2"] . "'," . $row["TEMP_R"] . ", 'rgba(" . $row["TEMP_B"] . ",0,0,1)', 'Patient\'s temperature was " . $row["TEMP"] ." degrees celsius at " . $row["datetime3"] . ".'],";
$AAVPU[] = "['" . $row["datetime2"] . "'," . $row["AVPU_R"] . ", 'rgba(1,0,0,1)', '" . $row["AVPU"] . " at " . $row["datetime3"] . ".'],";
$APAR[] = "var msec_" . $row["datetime4"] . " = Date.parse('" . $row["datetime2"] . "'); var x_" . $row["datetime4"] . " = scatter.getXCoord(msec_" . $row["datetime4"] . "); var y_" . $row["datetime4"] . " = 25; var text = new RGraph.Drawing.Text('par', x_" . $row["datetime4"] . ", y_" . $row["datetime4"] . ", '". $row["PAR"] . "').Set('valign', 'top').Set('font', 'Verdana').Set('halign', 'center').Set('size', 10).Set('colors', ['rgb(255," . $row["PAR_B"] . ",0)']).Draw();" ;
$AUO[] = "var msec_" . $row["datetime4"] . "_2 = Date.parse('" . $row["datetime2"] . "'); var x_" . $row["datetime4"] . "_2 = scatter.getXCoord(msec_" . $row["datetime4"] . "_2); var y_" . $row["datetime4"] . "_2 = 25; var text = new RGraph.Drawing.Text('uo', x_" . $row["datetime4"] . "_2, y_" . $row["datetime4"] . "_2, '". $row["UO"] . "').Set('valign', 'top').Set('font', 'Verdana').Set('halign', 'center').Set('size', 10).Set('colors', ['rgb(" . $row["UO_B"] . ",0,0)']).Draw();" ;
$APM[] = "var msec_" . $row["datetime4"] . "_3 = Date.parse('" . $row["datetime2"] . "'); var x_" . $row["datetime4"] . "_3 = scatter.getXCoord(msec_" . $row["datetime4"] . "_3); var y_" . $row["datetime4"] . "_3 = 25; var text = new RGraph.Drawing.Text('pm', x_" . $row["datetime4"] . "_3, y_" . $row["datetime4"] . "_3, '". $row["pain_movement"] . "').Set('valign', 'top').Set('font', 'Verdana').Set('halign', 'center').Set('size', 10).Set('colors', ['rgb(0,0,0)']).Draw();" ;
$APR[] = "var msec_" . $row["datetime4"] . "_4 = Date.parse('" . $row["datetime2"] . "'); var x_" . $row["datetime4"] . "_4 = scatter.getXCoord(msec_" . $row["datetime4"] . "_4); var y_" . $row["datetime4"] . "_4 = 25; var text = new RGraph.Drawing.Text('pr', x_" . $row["datetime4"] . "_4, y_" . $row["datetime4"] . "_4, '". $row["pain_rest"] . "').Set('valign', 'top').Set('font', 'Verdana').Set('halign', 'center').Set('size', 10).Set('colors', ['rgb(0,0,0)']).Draw();" ;
$ASED[] = "var msec_" . $row["datetime4"] . "_5 = Date.parse('" . $row["datetime2"] . "'); var x_" . $row["datetime4"] . "_5 = scatter.getXCoord(msec_" . $row["datetime4"] . "_5); var y_" . $row["datetime4"] . "_5 = 25; var text = new RGraph.Drawing.Text('sed', x_" . $row["datetime4"] . "_5, y_" . $row["datetime4"] . "_5, '". $row["sedation"] . "').Set('valign', 'top').Set('font', 'Verdana').Set('halign', 'center').Set('size', 10).Set('colors', ['rgb(0,0,0)']).Draw();" ;
}
$BSBP = join(" ", $ASBP);
$BDBP = join(" ", $ADBP);
$BHR = join(" ", $AHR);
$BRR = join(" ", $ARR);
$BSpO2 = join(" ", $ASpO2);
$BO2flow = join(" ", $AO2flow);
$BTEMP = join(" ", $ATEMP);
$BAVPU = join(" ", $AAVPU);
$BPAR = join(" ", $APAR);
$BUO = join(" ", $AUO);
$BPM = join(" ", $APM);
$BPR = join(" ", $APR);
$BSED = join(" ", $ASED);
}
$numCount = mysql_num_rows($Find_Query1);
if ($numCount < 1)
{
$ERROR = '
<div class="errorbox"></div><div class="errorboxint">
<span style="text-align:center; font-family:Verdana, Geneva, sans-serif; font-size:14px; color:#FFF; font-weight:bold">No Observations Recorded</span></br>
<p>Sorry, no results were found for ' .$FNAME . ' ' . $LNAME . ' (d.o.b ' . $DOB . ') on ' . $Date3 . '</p>
<p><img src="no-obs.png"></img>
</p>
</div>';
}
?> ### then follows html page which makes use of arrays to plot information on charts ###
提前致谢。