我正在尝试使用案例功能在我的网站上进行导航。
但是,当我尝试将它与 php 请求一起使用时,它给了我这个错误:
Warning: include(work.php?user=EEN0422) [function.include]: failed to open stream: Operation not permitted in E:\vhosts\example.com\httpdocs\vtlog\browse.php on line 16
Warning: include(work.php?user=EEN0422) [function.include]: failed to open stream: Operation not permitted in E:\vhosts\example.com\httpdocs\vtlog\browse.php on line 16
Warning: include() [function.include]: Failed opening 'work.php?user=EEN0422' for inclusion (include_path='.;./includes;./pear') in E:\vhosts\example.com\httpdocs\vtlog\browse.php on line 16
browse.php 的脚本是:
<?php
$status = $_GET['status'];
$user = $_GET['user'];
switch ($status) {
case "working":
include("index2.php");
break;
case "log":
include("admin.php");
break;
case "admin":
include("settings.php");
break;
case "users":
include("work.php?user=$user");
break;
}
?>
对于 work.php,这是这里的问题:
<?php
session_start();
if(!$_SESSION['LoggedIn']) header("location: settingsauth.php");
$host="localhost";
$username="root";
$password="root";
$db_name="db";
$tbl_name="log";
$user=$_GET['user'];
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT *, (UNIX_TIMESTAMP(end) - UNIX_TIMESTAMP(start)) / 60.0 / 60.0 as hours_difference FROM $tbl_name WHERE user='$user'";
$result=mysql_query($sql);
if ($result === false) { echo "An error occurred."; }
?>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>Start</strong></td>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>End</strong></td>
<td width="30%" align="center" bgcolor="#E6E6E6"><strong>Kommentar</strong></td>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>Tid</strong></td>
<td width="5%" align="center" bgcolor="E6E6E6"></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<title>VTLog - <? echo $rows['user']; ?></title>
<tr>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['start']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['end']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['comment']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?$var = number_format($rows['hours_difference'],2);
$var = number_format($var,1);
echo $var; ?></td>
<td align="center" bgcolor="#FFFFFF"><a href="editwork.php?editid=<? echo $rows['editid']; ?>"><img src="ret.jpg" alt="Ret"></a><form action="workstatus.php" method="get"><input type="hidden" name="editit" value="<? echo $rows['editid']; ?>" /><input type="submit" value="Slet" /></form></td>
</tr>
<?php
}
mysql_close();
?>
<tr>
<td align="left" bgcolor="#E6E6E6"><a href="settings.php">Tilbage til oversigt</a></td><td colspan="2" align="center" bgcolor="#E6E6E6">Total arbejdstid: <?php $var = number_format($rows['hours_difference'],2);
$var = number_format($var,1);
echo $var;?></td><td bgcolor="#E6E6E6" colspan="2"></td>
</tr>
</table>