exit是停止服务器端再向客户端发送脚本。所以EXIT之后的代码就都不会执行了。

解决方案 »

  1.   

    不是只终止脚本么,为什么连HTML的也都终止了呢?
      

  2.   


    <?php 
    session_start();
    include ('../config.inc.php');
    include ('../count.php');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title><?php echo $cfg['title'];?></title>
    <link rel="stylesheet" type="text/css" href="../css/css.css" media="screen" /></head>
    <body>
    <div class="pageHolder">
      <div id="main-page">
        <div id="header">
          <div class="info">
            <h4><?php echo $cfg['sitename'];?></h4>
          </div>
          <div class="leftHeader">
            <div class="menu">
              <ul>
             <li><a href="../index.php">首页</a></li>
             <li><a href="../article.php">文章</a></li>
             <li><a href="../message.php">留言</a></li>
             <li><a href="../about.php">关于</a></li>
             </ul>
            </div>
            <div class="mouse"></div>
          </div>
        </div>
        <div id="mid">
          <div class="middle">
            <div class="leftSide">
              <h2><span class="toph1">用户注册</span><span class="bottom">&nbsp;</span></h2>
              <div class="date">&nbsp;</div>
              <div class="article">
                <p><center>
        <?php   
         require('../common.php');   
         if ($_GET['action']=='save') {   
        // 清除空格   
        $_POST['username'] = trim($_POST['username']);   
        $_POST['passwd'] = trim($_POST['passwd']);   
        $_POST['passwd2'] = trim($_POST['passwd2']);   
        $_POST['email'] = trim($_POST['email']);   
      
        // 判断表单是否全部填写   
        if (!$_POST['username'] || !$_POST['passwd'] || !$_POST['passwd2'] || !$_POST['email']) {   
            die( ' 所有项目都需要填写!<a href="reg.php">返回</a>');   
      
        }   
           
        if (!get_magic_quotes_gpc()) {// 如果魔术引号关闭使用addslashes转换   
            $_POST['username'] = addslashes($_POST['username']);   
            $_POST['email'] = addslashes($_POST['email']);   
        }   
           
        // 判断用户名是否超出长度   
        if (strlen($_POST['username'])>16) {   
            die( '用户名超出长度!<a href="reg.php">返回</a><br>');
         
        }   
           
        // 判断再次密码是否相同   
        if ($_POST['passwd']!=$_POST['passwd2']) {   
            die( '两次密码不同!<a href="reg.php">返回</a><br>');
       
        }   
         
     //验证email格式
    function checkEmail($email){
         if(eregi('^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*$',$email) ){
             return true;
         }
    else{
             return false;
         }
    }    
        if (strlen($_POST['email'])>100 || checkEmail($_POST['email']) == FALSE) {   
            die( '输入的Email不正确!<a href="reg.php">返回</a><br>');
         
        }   
           
        // 判断用户名是否存在   
        $q = mysql_query('select id from user where username=\''.$_POST['username'].'\'');   
        $rs = mysql_fetch_array($q);   
        if ($rs['id']) {   
            die( '用户名被占用! <a href="reg.php">返回</a><br>');
          
        }   
        // insert SQL语句
    $ip1=getenv('REMOTE_ADDR');
    echo $ip1;
    $ip=$ip1;   
        $sql = "insert into user (username,passwd,email,insert_time,ip)    
                values ('".$_POST['username']."','".md5($_POST['passwd'])."','".$_POST['email']."',now(),'".$ip."')";   
        mysql_query($sql,$link);// 执行SQL查询   
        echo '注册成功! <a href="login.php">登录</a>';    
    }   
    ?>
          <table width="300" border="0" cellspacing="0" cellpadding="0" class="tb">
            <tr>
              <td><form id="form1" name="form1" method="post"  action="reg.php?action=save">
                  <table width="300" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="30%" align="right">用户名:</td>
                      <td width="70%" align="left"><input type="text" name="username" /></td>
                    </tr>
                    <tr>
                      <td width="30%" align="right">密码:</td>
                      <td width="70%" align="left"><input type="password" name="passwd">                  </td>
                    </tr>
                    <tr>
                      <td width="30%" align="right">重复密码:</td>
                      <td width="70%" align="left"><input type="password" name="passwd2">                  </td>
                    </tr>
                    <tr>
                      <td width="30%" align="right">Email:</td>
                      <td width="70%" align="left"><input type="text" name="email" />                  </td>
                    </tr>
                    <tr>
                      <td width="30%" align="right"></td>
                      <td width="70%" align="left"><input type="submit" name="submit" value="提 交"  /></td>
                    </tr>
                  </table>
                </form></td>
            </tr>
          </table>
    </center></p>
              </div>
              <div class="reset">&nbsp;</div>
            </div>
            <div class="rightSide">
              <div class="rightBox">
                <div class="top">
                  <h3>用户信息</h3>
                </div>
                <div class="middle">
                  <ul class="comments">
                    <?php
    if(!$_SESSION['user_id']){
    echo "<li><strong><a href='../user/reg.php'>注册</a></strong></li>
                 <li><strong><a href='../user/login.php'>登录</a></strong></li>";
    }
    else{
    if($_SESSION['po_id'] != 1){
    echo "<li><strong>" .$_SESSION['username'] . "</strong></li>";
    echo "<li><strong>普通会员</strong></li>";
    echo "<li><strong><a href='../user/logout.php'>退出登录</a></strong></li>";
    }
    else{
    echo "<li><strong>" .$_SESSION['username'] . "</strong></li>";
    echo "<li><strong>管理员</strong></li>";
    echo "<li><strong><a href='../admin/login.php'>登陆后台</strong></a></li>";
    echo "<li><strong><a href='../user/logout.php'>退出登录</strong></a></li>";
    }
    }
    ?>
                  </ul>
                </div>
                <div class="bottom">&nbsp;</div>
              </div>
              <div class="rightBox">
                <div class="top">
                  <h3>文章分类</h3>
                </div>
                <div class="middle">
                  <ul class="comments">
                    <li><strong><a href="article/log.php">心情驿站</a></strong></li>
                    <li><strong><a href="article/sto.php">休闲娱乐</a></strong></li>
                    <li><strong><a href="article/art.php">精品收藏</a></strong></li>
                  </ul>
                </div>
                <div class="bottom">&nbsp;</div>
              </div>
              <div class="rightBox">
                <div class="top">
                  <h3>友情链接</h3>
                </div>
                <div class="middle">
                  <ul class="comments">
                    <?php
    $result = mysql_query("SELECT * FROM link order by id desc");//查询数据   
       while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {// 取一条数据 
    ?>
                   <li><strong>
    <a href="<?php echo $row['url']?>"><?php echo $row['web_name']?></a>
            </strong></li>
                   <?php 
    }
    ?>
                  </ul>
                </div>
                <div class="bottom">&nbsp;</div>
              </div>
      <div class="rightBox">
                <div class="top">
                  <h3>站内统计</h3>
                </div>
                <div class="middle">
                  <ul class="comments">
                    <li><strong>会员:<?php echo $user_count; ?></strong></li>
                    <li><strong>在线:<?php echo $online_count;?></strong></li>
                    <li><strong>文章:<?php echo $article_count;?></strong></li>
    <li><strong>留言:<?php echo $message_count;?></strong></li>
    <li><strong>访问:<?php echo $visit_count;?></strong></li>
                  </ul>
                </div>
                <div class="bottom">&nbsp;</div>
              </div>
            </div>
            <div class="reset"></div>
          </div>
        </div>
        <div id="footer">
          <div class="copy"><a href="#" class="feed">RSS</a> &copy; Copyright (c) </div>
        </div>
      </div>
    </div>
    </body>
    </html>这代码该怎么修改?
      

  3.   

    apache最终也是将php解析成html的.至于你上面的哪段代码,不知道你要改成啥样子的.
      

  4.   

    在web程序里不要随便使用exit,很容易造成系统瘫痪