2012-12-17 2 views
0

여기에 정말 이상한 점이 있습니다. 나는 index2.php (아래 코드를 줄 것이다)라는 두 개의 다른 디렉토리에이 파일을 가지고 있는데, 두 웹 브라우저에서로드 할 때 두 개의 다른 출력을 얻을 때 하나의 PHP 파일이있다. 누군가 이것이 어떻게 가능한지 말해 줄 수 있습니까?다른 폴더에있는 동일한 PHP 파일이지만 다른 출력을 표시합니다.

<?php 
////////////////////////////////////////////////////////////////// 
// DJ Status v3.0            // 
// ©2012 Joseph Scocca           // 
////////////////////////////////////////////////////////////////// 
include ("config.php"); // include the settings to connect to DB and ShoutCast 
include ("header.php"); // include the Header info 
if ($scsuccs!=1) { // Check is we can connect to ShoutCast Server 
if($streamstatus == "1"){ // Is the Stream broadcasting 
if (isset($dj)) { // is there a DJ in the DB connected 

// Open Container and Column 1 
echo "<div id=\"container\"><div id=\"column-1\">"; 

// connected DJ have a Avatar 
if (isset($djavatar) && $djavatar) { echo " 
<div id=\"avatarpic\"><img src=\"$djavatars/$djavatar\" /></div>"; }  

// Close Column 1 Open Column 2 Make the Div Stats and start showing data 
echo "</div><div id=\"column-2\"> 
<div id=\"stats\"> 
<div><strong><span>Now playing</span></strong></div>"; 


// if the song title is longer than 17 characters then scroll the title 
if (strlen($artisttitle[1]) > 17) { echo " 
<div><marquee behavior=\"scroll\" scrollamount=\"1\" direction=\"left\" width=\"160\">$artisttitle[1]</marquee> </div>"; 

// if the artist is longer than 16 characters then scroll the artists 
if (strlen($artisttitle[0]) > 16) { echo " 
<div><strong>By </strong><marquee behavior=\"scroll\" scrollamount=\"1\" direction=\"left\" width=\"135\">$artisttitle[0] </marquee></div> 
<div><strong>On Air</strong> $djname </div>"; 

// if the artist is short than or equals 16 characters then just display it as text 
} else if (strlen($artisttitle[0]) <=16) { echo " 
<div><strong>By </strong>$artisttitle[0]<div> 
<strong>On Air</strong> $djname </div>";} 

} else if (strlen($artisttitle[1]) <= 17) {  
echo "<div>$artisttitle[1]</div>"; 
//if the song title is less than 17 characters then just display it as text 

// if the artist is longer than 16 characters then scroll the artists 
if (strlen($artisttitle[0]) > 16) { echo " 
<div><strong>By </strong><marquee behavior=\"scroll\" scrollamount=\"1\" direction=\"left\" width=\"135\">$artisttitle[0]</marquee></div><div><strong>On Air</strong> $djname </div>"; 
    // if the artist is short than or equals 16 characters then just display it as text 
} else if (strlen($artisttitle[0]) <=16) { echo " 
<div><strong>By </strong>$artisttitle[0]<div><strong>On Air</strong> $djname </div>"; 
      } 
    } 
echo "</div></div></div> // Close Column 2, Stats, and Container. 
<div id=\"column-3\"><div id=\"social\">"; // Open Column 3 and social 
    if (isset($address) && $address) {echo " 
<a href=\"$address\" target=\"_blank\"> 
<img style=\"height:25px;width:94px;\" src=\"images/request.png\" border=\"0\" /> 
</a><br>";} // requestline 

if (isset($djname1) && $djname1) {echo " 
$djname1";} // Display the DJ Name (for shows that Have a Co Host.) 
if (isset($twitter) && $twitter) {echo " 
<a href=\"http://www.twitter.com/$twitter\" target=\"_blank\"> 
<img src=\"images/twitter.png\" border=\"0\" /></a>";} 
    // does the DJ have a Twitter, if so display it 

if (isset($facebook) && $facebook) {echo " 
<a href=\"http://www.facebook.com/$facebook\" target=\"_blank\"> 
<img src=\"images/facebook.png\" border=\"0\"/></a>"; } 
// does the DJ have a Facebook, if so display it 

if (isset($email) && $email) {echo " 
<a href=\"mailto:$email\"><img src=\"images/email.png\" border=\"0\"/></a>";} 
    // does the DJ have a Email, if so display it 

// if the Connected DJ has a Co Host do the following. 
if (isset($djname2) && $djname2) {echo " 
<br />$djname2";} // Display the Co Host Name 

if (isset($twitter2) && $twitter2) {echo " 
<a href=\"http://www.twitter.com/$twitter2\" target=\"_blank\"> 
<img src=\"images/twitter.png\" border=\"0\" /></a>";} // Co Host Tiwtter 

if (isset($facebook2) && $facebook2) {echo " 
<a href=\"http://www.facebook.com/$facebook2\" target=\"_blank\"> 
<img src=\"images/facebook.png\" border=\"0\"/></a>"; } // Co Host Facebook 

if (isset($email2) && $email2) {echo "<a href=\"mailto:$email2\"> 
<img src=\"images/email.png\" border=\"0\" />";} // Co Host email 

echo "</div></div>"; //Closing of the Social Div and Column 3 

} else { // when the current dj is not in the system do the following 

echo "<div id=\"container\"><div id=\"column-1\"><div id=\"avatarpic\"> 
<img src=\"$djavatars/default.png\" /></div>"; 
    // Open Container, Column 1, and avatar pic. Display the default avatar 
echo "</div><div id=\"column-2\">"; // Close Column 1, Open Column 2 

echo "<div id=\"stats\"><div><strong><span>Now playing</span></strong></div>"; 
// Make the Div Stats and start showing data 

// if the song title is longer than 25 charaters then scroll the title 
if (strlen($artisttitle[1]) > 17) { echo " 
<div><marquee behavior=\"scroll\" scrollamount=\"1\" direction=\"left\" width=\"160\"> $artisttitle[1] </marquee></div><div><strong>By:</strong> $artisttitle[0]</div>"; 

} else if (strlen($artisttitle[1]) <= 17) {echo " 
<div>$artisttitle[1]</div><div><strong>By:</strong> $artisttitle[0]</div></div>";} 
//if the song title is less than 25 charaters then just display it as text 

echo "</div>"; } // Close Column 2 

} else {echo "<b><span style=\"color:#FFF;\">Trek Radio is currently experiencing 
<br />technical difficulties.<br /> Please check again later. (Error 100)</b> 
</span>";} // Error 100 connetion error to the DB 

} else {echo "<b><span style=\"color:#FFF;\">Trek Radio is currently experiencing 
<br />technical difficulties.<br /> Please check again later. (Error 200)</b> 
</scpan>";} // Error 200 connection error to shoutcast 
echo "</div>"; // Close Container 
?> 

이제이 스크립트는 현재 방송중인 현재 노래 제목과 DJ를 제공해야합니다. 내가 얻지 못하는 것은 당신이 http://www.surayamedia.com/onair_tr/index2.phphttp://www.surayamedia.com/trdjs/index.php에 갈 때 결과가 다른 것입니다. 정확한 파일 일 때 어떻게 될 수 있습니까? 그들은 단지 두 개의 다른 디렉토리에 배치됩니다! 나는 그것을 얻지 않는다. 내가하려는 것은 스크립트를 서버의 다른 폴더로 옮기는 것입니다!

이 문제를 해결하기 위해 수행 할 수있는 작업을 누가 알아서 해 주셔서 감사합니다.

답변

0

코드 문제가 아닌 서버 문제였습니다.

+0

정확하게 문제의 원인을 자세히 기재하십시오 . 언젠가 누군가는 당신이 여기에서 제공 한 정보로부터 혜택을 볼 것입니다. "서버 문제"만 작성하면 다른 사람들을 도울 가능성이 없습니다. – andr

0

스크립트와 동일한 디렉토리에 포함이 포함되어 있으므로 DJ가 포함되지 않은 것을 보여주는 것과 같습니다. include를 복제하는 대신 public html 위에 별도의 디렉토리에 저장할 수 있습니다. 공용 HTML 상기 includes

include ("config.php"); 
include ("header.php"); 

이동 :

include ("../../includes/config.php"); 
include ("../../includes/header.php"); 

(가)가 포함 된 경우는 그것이가 상대 경로에 의존 포함 일부 코드가 의미 두 디렉토리에 존재한다.

+0

나는 당신이 여기서 말하는 것을 이해하지만 두 개의 디렉토리는 동일합니다. 그들은 모든 파일을 올바른 위치에두고 있지만, 다른 파일을 방금 표시하고 있습니다. – Feek

+1

Includes에는 상대 경로에 의존하는 무언가가 있습니다. 게시 한 스크립트는 문제가 아니며 HTML 만 작성하면 포함됩니다. – MrCode

+0

/airair_tr 및/trdjs 디렉토리는 동일합니다. onair_tr에서 trdjs로 모든 파일을 복사했습니다. 상대 경로가있는 유일한 것은 글꼴과 스크롤하는 js 파일이며, 알 수 있듯이 두 파일 모두 잘 작동합니다. – Feek

관련 문제