-5

可能重复:
PHP 对不推荐使用的函数做了什么?

我的队友在 1.7.4 Xampp 上编写了代码,它在她这边运行顺利,但是当我在我的电脑上运行它时,它没有运行,因为我使用了最新的 XAMPP。我安装了一个旧版本的 xampp,但它的脖子很痛苦,因为 apache 和 mysql 甚至无法启动。看起来它不稳定或什么的。所以我最后的手段是希望有一种方法可以在我当前的 xampp 上运行已弃用的代码。

索引.php

<?PHP



session_start();



include('inc/config.php');
?>

<html>
<title>Login</title>
<head>



<link rel="stylesheet" type="text/css" href="style.css">

<style TYPE="text/css">
      <!--
    a {text-decoration: none;}
      -->
</style>

<script language="Javascript">

function validate()
{
  susername=document.myform.susername.value;
  if (susername == "" || susername == null || susername.charAt(0) == ' ')
  {
    alert("Please enter your username")
    document.myform.susername.focus();
    return false;
  }
  else
    {
    password=document.myform.password.value;

    if (password == "" || password == null || password.charAt(0) == ' ')
    {
        alert("Password cannot be blank")
        document.myform.password.focus();
        return false;
    }

    }
}

</script>



</head>

<body bgcolor="white" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">




<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" width="760" height="350">
    <tr>
      <td width="1" height="2" class=outline></td>
      <td width="162" height="2" class=blue valign="top"></td>
      <td width="8" height="2"></td>
      <td width="580" height="2" valign="top">


<!---------------------------------Center panel starts here------------------------------->
<!---------------------main table starts------------------->
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" width="580" height="200">

<!-----------------------main table ends----------------------->
    <tr>
      <td width="580" height="200">

<!------------------------- susername password table starts--------------------->

<form name=myform method="post" action="login.php" onSubmit="return validate()">



<div align="center">
  <table border="0" cellpadding="3" cellspacing="1" width="350" height="11">
  <tr>
  <br>
  <br>
    <br>
      <br>
  </tr>
  <tr>
              <td width="350" colspan="3" height="34"><font class=tablackb>Please Enter Your Username and Password:</font></td>
            </tr>


    <tr>
      <td width="90" height="21" valign="middle" align="left"><font class=tablack>Username</font></td>
      <td width="10" height="21" valign="middle" align="center"><font class=tablack>:</font></td>
      <td width="250" height="21" valign="middle" align="left"><font class=tablack><input id="username" class=ainput type="text" name="name" placeholder="Username" size="30"></font></td>      
    </tr> 

    <tr>
      <td width="90" height="21" valign="middle" align="left"><font class=tablack>Password</font></td>
      <td width="10" height="21" valign="middle" align="center"><font class=tablack>:</font></td>
      <td width="250" height="21" valign="middle" align="left"><font class=tablack><input id="password" class=ainput type="password" name="password" placeholder="Password" size="30"></font></td>      
        </tr> 
    <tr>
    <td width="350" height="21" valign="middle" align="center" colspan="3"><font class=tablack>password must be 6-18 characters</font></td>
    </tr>
    <tr>

      <td width="350" colspan="3" height="21" class=white valign="middle" align="center" colspan="3"><font class=tablack> <input  type="submit" value="Submit" name="Submit">&nbsp; &nbsp; &nbsp; &nbsp; <input type="reset" value="Reset" name="Reset"></font></td>      
    </tr> 

  </table>
</div>
</form>
<center>
</center>
<!-------------------------------susername password table ends------------------------->
</td>
    </tr>





<!----------------------------------copy this for more cells start---------------------------->
    <tr>
      <td width="580" height="1"></td>
    </tr>
<!----------------------------------copy this for more cells ends---------------------------->


<!-------------------------------main table starts-------------------------->

  </table>
  </center>
</div>
<!--------------------------------main table ends------------------------------>

<!---------------------------------Center panel ends here---------------------------------></td>
      <td width="8" height="2"></td>
      <td width="1" height="2" class=outline></td>
    </tr>
  </table>
  </center>
</div>




</body>

</html>

登录.php

4

1 回答 1

1

您可以更改错误报告以停止报告弃用警告。见这里

但是,您应该非常认真地考虑更新代码以使用未弃用的扩展,例如 MySQLi 或 PDO_MySQL。

编辑:您提供的图像还表明您没有提供连接到数据库的参数。

于 2012-12-19T02:50:17.123 回答