你好!
下载了一个php在线考试系统,为什么链接不可以用啊???用127.0.0.1/index.php打开,谢谢!!!
index.php
<?php session_start();?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>在线考试系统</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style6 {color: #FFFFFF}
.STYLE7 {color: #FFFFFF; font-size: 12px; }
-->
</style></head>
<body>
<table width="1002" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="images/bg_1.jpg" width="1002" height="72" border="0" usemap="#Map"></td>
  </tr>
</table>
<table width="1002" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="images/bg_2.jpg" width="1002" height="142"></td>
  </tr>
</table>
<table width="1002" height="143" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="111" valign="top" bgcolor="#F0EFEB">&nbsp;</td>
    <td width="778" valign="top" bgcolor="#F0EFEB"><table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="26" background="images/bg_4.jpg"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="30%">&nbsp;</td>
            <td width="70%" height="26"><span class="STYLE7">当前位置:在线考试系统 &gt; <?php echo $online;?></span></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="350" align="center" valign="top" bgcolor="#FFFFFF"><?php 
switch($online){
case "用户注册":
include("zhuce.php");
break;
case "用户登录":
include("denglu.php");
break;
case "修改密码":
include("xgmm.php");
break;
case "成绩查询":
include("cjcx.php");
break;
case "进入考场":
include("ksgz.php");
break;
case "选择考题":
include("jrkc.php");
break;
case "开始考试":
include("ksks.php");
break; case "":
include("denglu.php");
break;}?></td>
      </tr>
      <tr>
        <td><img src="images/bg_7.jpg" width="778" height="24"></td>
      </tr>
    </table></td>
    <td width="113" valign="top" bgcolor="#F0EFEB">&nbsp;</td>
  </tr>
</table>
<map name="Map">
  <area shape="rect" coords="356,30,419,52" href="index.php?online=用户注册">
<area shape="rect" coords="443,30,508,50" href="index.php?online=用户登录">
<area shape="rect" coords="529,31,599,52" href="index.php?online=修改密码">
<area shape="rect" coords="618,29,680,53" href="index.php?online=成绩查询">
<area shape="rect" coords="706,29,773,53" href="index.php?online=进入考场">
<area shape="rect" coords="795,29,853,52" href="tc_dl.php">
</map></body>
</html>
cjcx.php
<?php session_start();include("conn/conn.php");
if($_SESSION[online_number]!=""){
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 12}
-->
</style>
</head>
<body>
<table width="592" height="103" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#676767">
 <form name="form1" method="post" action="index.php?online=成绩查询" >
 <tr>
    <td width="165" bgcolor="#FFFFFF">&nbsp;</td>
    <td colspan="2" align="center" bgcolor="#FFFFFF"><span class="STYLE1">考试科目:
        <select name="select">
          <?php $querys=mssql_query("select * from tb_ktlb");
  while($myrows=mssql_fetch_array($querys)){
  ?>
          <option value="<?php echo $myrows[online_ktlb];?>"><?php echo $myrows[online_ktlb];?></option>
          <?php  } ?>
          </select>
    </span></td>
    <td width="203" bgcolor="#FFFFFF"><input name="Submit" type="submit" value="提交" /></td>
  </tr>
  </form>
  <tr>
    <td align="center" bgcolor="#EEEEEE"><span class="STYLE1">准考证号</span></td>
    <td width="76" align="center" bgcolor="#EEEEEE"><span class="STYLE1">考试科目</span></td>
    <td width="120" align="center" bgcolor="#EEEEEE"><span class="STYLE1">考试时间</span></td>
    <td align="center" bgcolor="#EEEEEE"><span class="STYLE1">考试分数</span></td>
  </tr>
 <?php $query=mssql_query("select * from tb_user where online_number='".$_SESSION[online_number]."' and online_subject='$select'");
 if(mssql_num_rows($query)<1){
 echo "<span class='STYLE1'>您没有该科目的成绩!</span>";
 }else{
 while($myrow=mssql_fetch_array($query)){
 ?>
  <tr>
    <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_number];?></span></td>
    <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_subject];?></span></td>
    <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_date];?></span></td>
    <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_grade];?></span></td>
  </tr>
<?php }}?>
</table>
</body>
</html>
<?php
}else{
echo "<script> alert('请您正确登录!'); window.location.href='index.php?online=用户登录';</script>";
}
?>
denglu.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 12px}
-->
</style>
</head>
<body>
<table width="500" height="50" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<form name="form1" method="post" action="denglu_ok.php">
<table width="592" height="103" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#676767">
  <tr>
    <td width="104" bgcolor="EEEEEE">&nbsp;</td>
    <td width="178" bgcolor="#FFFFFF">&nbsp;</td>
    <td width="74" bgcolor="EEEEEE">&nbsp;</td>
    <td width="208" bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
  
  <tr>
    <td align="center" bgcolor="EEEEEE"><span class="STYLE1">准考证号码:</span></td>
    <td bgcolor="#FFFFFF"><input name="online_number" type="text" id="online_number" size="20" /></td>
    <td align="center" bgcolor="EEEEEE"><span class="STYLE1">密码:</span></td>
    <td bgcolor="#FFFFFF"><input name="online_pass" type="password" id="online_pass" size="20" /></td>
  </tr>
  <tr>
    <td bgcolor="EEEEEE">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="EEEEEE"><input type="submit" name="Submit" value="提交" /></td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>
用了两个链接做例子,谢谢各位哦!!!

解决方案 »

  1.   

    index.php
    <?php session_start();?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>在线考试系统</title>
    <style type="text/css">
    <!--
    body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    }
    .style6 {color: #FFFFFF}
    .STYLE7 {color: #FFFFFF; font-size: 12px; }
    -->
    </style></head>
    <body>
    <table width="1002" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td><img src="images/bg_1.jpg" width="1002" height="72" border="0" usemap="#Map"></td>
      </tr>
    </table>
    <table width="1002" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td><img src="images/bg_2.jpg" width="1002" height="142"></td>
      </tr>
    </table>
    <table width="1002" height="143" border="0" cellpadding="0" cellspacing="0">
      <tr>
      <td width="111" valign="top" bgcolor="#F0EFEB">&nbsp;</td>
      <td width="778" valign="top" bgcolor="#F0EFEB"><table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
      <td height="26" background="images/bg_4.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td width="30%">&nbsp;</td>
      <td width="70%" height="26"><span class="STYLE7">当前位置:在线考试系统 &gt; <?php echo $online;?></span></td>
      </tr>
      </table></td>
      </tr>
      <tr>
      <td height="350" align="center" valign="top" bgcolor="#FFFFFF"><?php  
    switch($online){
    case "用户注册":
    include("zhuce.php");
    break;
    case "用户登录":
    include("denglu.php");
    break;
    case "修改密码":
    include("xgmm.php");
    break;
    case "成绩查询":
    include("cjcx.php");
    break;
    case "进入考场":
    include("ksgz.php");
    break;
    case "选择考题":
    include("jrkc.php");
    break;
    case "开始考试":
    include("ksks.php");
    break;case "":
    include("denglu.php");
    break;}?></td>
      </tr>
      <tr>
      <td><img src="images/bg_7.jpg" width="778" height="24"></td>
      </tr>
      </table></td>
      <td width="113" valign="top" bgcolor="#F0EFEB">&nbsp;</td>
      </tr>
    </table>
    <map name="Map">
      <area shape="rect" coords="356,30,419,52" href="index.php?online=用户注册">
    <area shape="rect" coords="443,30,508,50" href="index.php?online=用户登录">
    <area shape="rect" coords="529,31,599,52" href="index.php?online=修改密码">
    <area shape="rect" coords="618,29,680,53" href="index.php?online=成绩查询">
    <area shape="rect" coords="706,29,773,53" href="index.php?online=进入考场">
    <area shape="rect" coords="795,29,853,52" href="tc_dl.php">
    </map></body>
    </html>
    cjcx.php
    <?php session_start();include("conn/conn.php");
    if($_SESSION[online_number]!=""){
    ?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    <!--
    .STYLE1 {font-size: 12}
    -->
    </style>
    </head>
    <body>
    <table width="592" height="103" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#676767">
     <form name="form1" method="post" action="index.php?online=成绩查询" >
     <tr>
      <td width="165" bgcolor="#FFFFFF">&nbsp;</td>
      <td colspan="2" align="center" bgcolor="#FFFFFF"><span class="STYLE1">考试科目:
      <select name="select">
      <?php $querys=mssql_query("select * from tb_ktlb");
    while($myrows=mssql_fetch_array($querys)){
    ?>
      <option value="<?php echo $myrows[online_ktlb];?>"><?php echo $myrows[online_ktlb];?></option>
      <?php } ?>
      </select>
      </span></td>
      <td width="203" bgcolor="#FFFFFF"><input name="Submit" type="submit" value="提交" /></td>
      </tr>
      </form>
      <tr>
      <td align="center" bgcolor="#EEEEEE"><span class="STYLE1">准考证号</span></td>
      <td width="76" align="center" bgcolor="#EEEEEE"><span class="STYLE1">考试科目</span></td>
      <td width="120" align="center" bgcolor="#EEEEEE"><span class="STYLE1">考试时间</span></td>
      <td align="center" bgcolor="#EEEEEE"><span class="STYLE1">考试分数</span></td>
      </tr>
     <?php $query=mssql_query("select * from tb_user where online_number='".$_SESSION[online_number]."' and online_subject='$select'");
     if(mssql_num_rows($query)<1){
     echo "<span class='STYLE1'>您没有该科目的成绩!</span>";
     }else{
     while($myrow=mssql_fetch_array($query)){
     ?>
      <tr>
      <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_number];?></span></td>
      <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_subject];?></span></td>
      <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_date];?></span></td>
      <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_grade];?></span></td>
      </tr>
    <?php }}?>
    </table>
    </body>
    </html>
    <?php
    }else{
    echo "<script> alert('请您正确登录!'); window.location.href='index.php?online=用户登录';</script>";
    }
    ?>
    denglu.php
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    <!--
    .STYLE1 {font-size: 12px}
    -->
    </style>
    </head>
    <body>
    <table width="500" height="50" border="0" cellpadding="0" cellspacing="0">
      <tr>
      <td>&nbsp;</td>
      </tr>
    </table>
    <form name="form1" method="post" action="denglu_ok.php">
    <table width="592" height="103" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#676767">
      <tr>
      <td width="104" bgcolor="EEEEEE">&nbsp;</td>
      <td width="178" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="74" bgcolor="EEEEEE">&nbsp;</td>
      <td width="208" bgcolor="#FFFFFF">&nbsp;</td>
      </tr>
       
      <tr>
      <td align="center" bgcolor="EEEEEE"><span class="STYLE1">准考证号码:</span></td>
      <td bgcolor="#FFFFFF"><input name="online_number" type="text" id="online_number" size="20" /></td>
      <td align="center" bgcolor="EEEEEE"><span class="STYLE1">密码:</span></td>
      <td bgcolor="#FFFFFF"><input name="online_pass" type="password" id="online_pass" size="20" /></td>
      </tr>
      <tr>
      <td bgcolor="EEEEEE">&nbsp;</td>
      <td bgcolor="#FFFFFF">&nbsp;</td>
      <td bgcolor="EEEEEE"><input type="submit" name="Submit" value="提交" /></td>
      <td bgcolor="#FFFFFF">&nbsp;</td>
      </tr>
    </table>
    </form>
    </body>
    </html>
      

  2.   

    你没配好php的环境,运行不了php代码唉。
      

  3.   

    不知道啊!!!我不懂啊!!!是为了交作业啊???贴给你
    index.php
    <?php session_start();?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>在线考试系统</title>
    <style type="text/css">
    <!--
    body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    }
    .style6 {color: #FFFFFF}
    .STYLE7 {color: #FFFFFF; font-size: 12px; }
    -->
    </style></head>
    <body>
    <table width="1002" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td><img src="images/bg_1.jpg" width="1002" height="72" border="0" usemap="#Map"></td>
      </tr>
    </table>
    <table width="1002" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td><img src="images/bg_2.jpg" width="1002" height="142"></td>
      </tr>
    </table>
    <table width="1002" height="143" border="0" cellpadding="0" cellspacing="0">
      <tr>
      <td width="111" valign="top" bgcolor="#F0EFEB">&nbsp;</td>
      <td width="778" valign="top" bgcolor="#F0EFEB"><table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
      <td height="26" background="images/bg_4.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td width="30%">&nbsp;</td>
      <td width="70%" height="26"><span class="STYLE7">当前位置:在线考试系统 &gt; <?php echo $online;?></span></td>
      </tr>
      </table></td>
      </tr>
      <tr>
      <td height="350" align="center" valign="top" bgcolor="#FFFFFF"><?php  
    switch($online){
    case "用户注册":
    include("zhuce.php");
    break;
    case "用户登录":
    include("denglu.php");
    break;
    case "修改密码":
    include("xgmm.php");
    break;
    case "成绩查询":
    include("cjcx.php");
    break;
    case "进入考场":
    include("ksgz.php");
    break;
    case "选择考题":
    include("jrkc.php");
    break;
    case "开始考试":
    include("ksks.php");
    break;case "":
    include("denglu.php");
    break;}?></td>
      </tr>
      <tr>
      <td><img src="images/bg_7.jpg" width="778" height="24"></td>
      </tr>
      </table></td>
      <td width="113" valign="top" bgcolor="#F0EFEB">&nbsp;</td>
      </tr>
    </table>
    <map name="Map">
      <area shape="rect" coords="356,30,419,52" href="index.php?online=用户注册">
    <area shape="rect" coords="443,30,508,50" href="index.php?online=用户登录">
    <area shape="rect" coords="529,31,599,52" href="index.php?online=修改密码">
    <area shape="rect" coords="618,29,680,53" href="index.php?online=成绩查询">
    <area shape="rect" coords="706,29,773,53" href="index.php?online=进入考场">
    <area shape="rect" coords="795,29,853,52" href="tc_dl.php">
    </map></body>
    </html>
    cjcx.php
    <?php session_start();include("conn/conn.php");
    if($_SESSION[online_number]!=""){
    ?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    <!--
    .STYLE1 {font-size: 12}
    -->
    </style>
    </head>
    <body>
    <table width="592" height="103" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#676767">
     <form name="form1" method="post" action="index.php?online=成绩查询" >
     <tr>
      <td width="165" bgcolor="#FFFFFF">&nbsp;</td>
      <td colspan="2" align="center" bgcolor="#FFFFFF"><span class="STYLE1">考试科目:
      <select name="select">
      <?php $querys=mssql_query("select * from tb_ktlb");
    while($myrows=mssql_fetch_array($querys)){
    ?>
      <option value="<?php echo $myrows[online_ktlb];?>"><?php echo $myrows[online_ktlb];?></option>
      <?php } ?>
      </select>
      </span></td>
      <td width="203" bgcolor="#FFFFFF"><input name="Submit" type="submit" value="提交" /></td>
      </tr>
      </form>
      <tr>
      <td align="center" bgcolor="#EEEEEE"><span class="STYLE1">准考证号</span></td>
      <td width="76" align="center" bgcolor="#EEEEEE"><span class="STYLE1">考试科目</span></td>
      <td width="120" align="center" bgcolor="#EEEEEE"><span class="STYLE1">考试时间</span></td>
      <td align="center" bgcolor="#EEEEEE"><span class="STYLE1">考试分数</span></td>
      </tr>
     <?php $query=mssql_query("select * from tb_user where online_number='".$_SESSION[online_number]."' and online_subject='$select'");
     if(mssql_num_rows($query)<1){
     echo "<span class='STYLE1'>您没有该科目的成绩!</span>";
     }else{
     while($myrow=mssql_fetch_array($query)){
     ?>
      <tr>
      <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_number];?></span></td>
      <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_subject];?></span></td>
      <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_date];?></span></td>
      <td bgcolor="#FFFFFF"><span class="STYLE1"><?php echo $myrow[online_grade];?></span></td>
      </tr>
    <?php }}?>
    </table>
    </body>
    </html>
    <?php
    }else{
    echo "<script> alert('请您正确登录!'); window.location.href='index.php?online=用户登录';</script>";
    }
    ?>
    denglu.php
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    <!--
    .STYLE1 {font-size: 12px}
    -->
    </style>
    </head>
    <body>
    <table width="500" height="50" border="0" cellpadding="0" cellspacing="0">
      <tr>
      <td>&nbsp;</td>
      </tr>
    </table>
    <form name="form1" method="post" action="denglu_ok.php">
    <table width="592" height="103" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#676767">
      <tr>
      <td width="104" bgcolor="EEEEEE">&nbsp;</td>
      <td width="178" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="74" bgcolor="EEEEEE">&nbsp;</td>
      <td width="208" bgcolor="#FFFFFF">&nbsp;</td>
      </tr>
       
      <tr>
      <td align="center" bgcolor="EEEEEE"><span class="STYLE1">准考证号码:</span></td>
      <td bgcolor="#FFFFFF"><input name="online_number" type="text" id="online_number" size="20" /></td>
      <td align="center" bgcolor="EEEEEE"><span class="STYLE1">密码:</span></td>
      <td bgcolor="#FFFFFF"><input name="online_pass" type="password" id="online_pass" size="20" /></td>
      </tr>
      <tr>
      <td bgcolor="EEEEEE">&nbsp;</td>
      <td bgcolor="#FFFFFF">&nbsp;</td>
      <td bgcolor="EEEEEE"><input type="submit" name="Submit" value="提交" /></td>
      <td bgcolor="#FFFFFF">&nbsp;</td>
      </tr>
    </table>
    </form>
    </body>
    </html>
      

  4.   

    你用的是apache吧?
    看看这里。
    http://tech.163.com/06/0206/11/299AMBLT0009159K_2.html