dousi8559 2012-05-23 18:56
浏览 37

另一个... 500内部服务器PHP

Been reading almost all of the error 500 internal questions here in SO, but still cant figure out whats app with mine.

This is the error message i get..

Server error
The website encountered an error while retrieving http://www.pixeltouch.no/book/register.php. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this webpage later.
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

I have looking at my codes for a while but still cant find the problem.

Any luck here ?

This is my login.php

 <?php 
 include('/core/inc/init.inc.php');


$errors = array();

if (isset($_POST['username'], $_POST['password'])){
    if(empty($_POST['username'])){
        $errors[] = 'The username cannot be empty.';    
    }
        if(empty($_POST['password'])){
        $errors[] = 'The password cannot be empty.';
    }
//Log in
    if (valid_credentials($_POST['username'], $_POST['password']) == false ){
        $errors[] = 'Username / Password incorrect.';
    }
        if (empty($errors)){
            $_SESSION['username'] = htmlentities($_POST['username']);
            $_SESSION['uid'] = fetch_user_id($_SESSION['username']);

            header("Location: profile.php?uid=" . $_SESSION['uid']);
                die();
                echo $_SESSION['uid'];
        }
}
?>

<!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" xml:lang="en" lang="en"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title>Pixeltouch</title> 

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

</head> 
<body> 
<div id="page-wrap"> 
<div id="main-content"> 
<br/>
<?php include_once('template/head.inc.php');
?>
<div id="menu"> 

<?php include_once('template/nav.inc.php');
?> 

</div> 
<!-- SKRIVBOX-->

<div>
<?php 
if(empty($errors) == false){
?>
<ul>

<?php

foreach ($errors as $error) {
    echo "<li>$error</li>";
}

?>
</ul>

<?php

}else{
echo 'Need an account ? <a href="register.php">Register here</a>'; 
}

?>



</div>
<br/>
<form method="post" action="" >
<p>
<label for="username">Username:</label>
<input type="text" name="username" id="username" value="<?php if (isset($_POST['username'])) echo  htmlentities($_POST['username']); ?>" />
</p>
<p>
<label for="password">Password: </label>
<input type="password" name="password"  id="password" />
</p>
<p>
<input type="submit" value="Login" />
</p>

</form>


<!-- SKRIVBOX END-->
</div> 

<?php include_once('template/foot.inc.php');
?>
</div>
</body>
</html>

And my Init.inc.php file

 <?php
 session_start();

 mysql_connect("SERVER", "USERNAME", "PASSW") or die(mysql_error()) ; 
 mysql_select_db("pixeltouch2") or die(mysql_error()) ;

 $path = dirname(__FILE__);
 include("{$path}/user.inc.php");

 ?>


                                    <!--Registration/Login (START)-->
 <?php 


 $exceptions = array('register', 'login', 'user_list', 'profile', 'edit_profile');

 $page = substr(end(explode('/', $_SERVER['SCRIPT_NAME'])), 0, -4);

 if(in_array($page, $exceptions) == false){
    if (isset($_SESSION['username']) == false){
    header('Location: login.php');
    die();
    }
  }
 ?>

                                    <!--Registration/Login (END)--> 


                                        <!--User Profile (START)-->
 <?php
 $_SESSION['uid'] = 1;


 ?>

                                        <!--User Profile (END)-->

I Got the Error logg from the webb hosters and it says

[Thu May 24 11:31:24 2012] [error] Warning: include(/core/inc/init.inc.php) [function.include]: failed to open stream: No such file or directory in /home/3/p/pixeltouch/www/book/login.php on line 2, referer: http://www.pixeltouch.no/book/login.php [Thu May 24 11:31:24 2012] [error] PHP Warning: include() [function.include]: Failed opening '/core/inc/init.inc.php' for inclusion (include_path='.:/usr/local/php5.2-suphp/lib/php') in /home/3/p/pixeltouch/www/book/login.php on line 2, referer: http://www.pixeltouch.no/book/login.php [Thu May 24 11:31:24 2012] [error] PHP Fatal error: Call to undefined function valid_credentials() in /home/3/p/pixeltouch/www/book/login.php on line 22, referer: http://www.pixeltouch.no/book/login.php

  • 写回答

1条回答 默认 最新

  • doufangyan6862 2012-05-23 19:02
    关注

    I believe the problem lies here:

    include('/core/inc/init.inc.php');
    

    The leading '/' is attempting to include the file from the root directory of your server. Try without the /. The path should be relative to the directory where register.php is located in this case.

    评论

报告相同问题?

悬赏问题

  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂