2016-01-19 70 views
-1

所以我做了用於簽名的PHP代碼,這不是問題,現在的問題是,當我在代碼的開頭添加<html></html>標籤時,它不會顯示我在PHP中完成的任何事情。所以,當我把html標籤或在php前面留出空間時,頁面中沒有任何內容,但是當我刪除它們時,一切正常。我不是專家在PHP等等..添加html標籤後PHP代碼將不起作用

<?php 

    include_once("functions.php"); 

    $sign = !isset($_GET['s']) ? 1 : $_GET['s']; 

    $uname = !isset($_GET["name"]) ? "None" : $_GET['name']; 

    // Connection & Website Settings 

    $ftpad = ""; 

    $ftpuser = ""; 

    $ftppass = ""; 

    $comm = "SAMP"; 

    $weburl = "www.incoming.com"; 

    $usersdir = "/scriptfiles/Users"; 

    // 

    $ftpcon = ftp_connect($ftpad,4112) or die("Error|I can't connect to the database: $ftpad, contact web master"); 

    $login = ftp_login($ftpcon,$ftpuser,$ftppass); 

    $uname = ""; 

     $name = $_GET['name']; 

     ftp_pasv($ftpcon,true); 

     $fhandle = fopen("tempsign_".hash('sha256',"$name").".tmp","w+"); 

     ftp_fget($ftpcon,$fhandle,"$usersdir/$name.ini",FTP_ASCII); 

     $str = parse_ini_file2("tempsign_".hash('sha256',"$ime").".tmp"); 

     fclose($fhandle); 

     $skin = $str['Skin']; 

    $rImg = ImageCreateFromPNG("./signs/1.png"); 

if (file_exists("./signs/skins/$skin.jpg")) 

{ 

    $skinImg = ImageCreateFromjpeg("./signs/skins/$skin.jpg"); 

} 

else 

{ 

    $skinImg = ImageCreateFromjpeg("./signs/skins/0.jpg"); 

} 

    $cor_black = imagecolorallocate($rImg,0,0,0); 

    $cor_blue = imagecolorallocate($rImg,0,0,255); 

    $cor_lblue = imagecolorallocate($rImg,30,144,255); 

    $cor_green = imagecolorallocate($rImg,69,139,116); 

    $cor_red = imagecolorallocate($rImg,220,20,65); 

    $cor_wh = imagecolorallocate($rImg,255,255,255); 

     $cor_n = imagecolorallocate($rImg,246,74,14); 

    if(ftp_size($ftpcon,"$usersdir/$name.ini") == -1 || $ime == "None") 
    { 
     ?> 
     <tr> 

    <center><td align="center" valign="top"><img src="logo.png" width="400" height="155" alt="logo" /></td></center> 

    </tr> 
    <style type="text/css"> 

body{ 

    background-color:#000; 

    background-image:url(backg.png); 

} 
. 

</style> 
     <?php 

    echo "<center><br/><br/><br/><br/><font color='#FF3333'>Error | That signature doesn't exist! Possible reasons:<br/><br/></font></center>"; 

echo "<center><font color='#0FB9FC'>1. You didn't enter your username in field for that<br/></font></center>"; 

echo "<center><font color='#0FB9FC'>2. You entered wrong username(Example Your_Name)<br/></font></center>"; 

echo "<center><font color='#0FB9FC'>3. Username that you entered isn't in our databse<br/></font></center>"; 

return 1; 





    } 

    else 

    { 

     ftp_pasv($ftpcon,true); 

     $fhandle = fopen("tempsign_".hash('sha256',"$name").".tmp","w+"); 

     ftp_fget($ftpcon,$fhandle,"$usersdir/$name.ini",FTP_ASCII); 

     $str = parse_ini_file2("tempsign_".hash('sha256',"$name").".tmp"); 

     fclose($fhandle); 

     imagettftext($rImg,12,0,11,39,$cor_n,"font.TTF",urldecode($name)); 

     imagettftext($rImg,12,0,11,79,$cor_n,"font.TTF",urldecode($str['Level'])); 

       imagettftext($rImg,12,0,173,120,$cor_n,"font.TTF",urldecode($str['Points'])); 

       imagettftext($rImg,12,0,173,80,$cor_n,"font.TTF",urldecode($str['Hours'])); 

       imagecopymerge($rImg, $skinImg, 308,6,0,0,80,100,100); 

    } 



          if($str['Sex'] == 0) { imagettftext($rImg,12,0,10,122,$cor_n,"font.TTF","Male"); } 

          else if($str['Sex'] == 1) { imagettftext($rImg,12,0,10,122,$cor_n,"font.TTF","Female"); } 


       if($str['GM'] > 0) 
       { 
       imagettftext($rImg, 13,0,5,161,$cor_green,"font.TTF","GameSupport");} 
       if($str['Admin'] > 0) 
       { 
       imagettftext($rImg, 13,0,5,161,$cor_red,"font.TTF","Admin");} 

       if($str['Leader'] > 0) 

       { 

        if($str['Leader'] == 1) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","LSPD"); } 

          else if($str['Leader'] == 2) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","FBI"); } 

          else if($str['Leader'] == 3) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","CNN"); } 

          else if($str['Leader'] == 4) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","La Cocaina"); } 

          else if($str['Leader'] == 5) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","La Cosa Nostra"); } 

          else if($str['Leader'] == 6) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Terror Squad Crew"); } 

          else if($str['Leader'] == 7) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","GSF"); } 

          else if($str['Leader'] == 8) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Yakuza"); } 

          else if($str['Leader'] == 9) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Russian Mafia"); } 

          else if($str['Leader'] == 10) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Underground Racers"); } 

          else if($str['Leader'] == 11) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Hitman Agency"); } 

       } 

       else if($str['Member'] > 0) 

       { 

        if($str['Member'] == 1) { imagettftext($rImg,13,0,171,40,$cor_wh,"font.TTF","LSPD"); } 

          else if($str['Member'] == 2) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","FBI"); } 

          else if($str['Member'] == 3) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","CNN"); } 

          else if($str['Member'] == 4) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","La Cocaine"); } 

          else if($str['Member'] == 5) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","La Cosa Nostra"); } 

          else if($str['Member'] == 6) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Terror Squad Crew"); } 

          else if($str['Member'] == 7) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","GSF"); } 

          else if($str['Member'] == 8) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Yakuza"); } 

          else if($str['Member'] == 9) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Russian Mafia"); } 

          else if($str['Member'] == 10) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Underground Racers"); } 

          else if($str['Member'] == 11) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Hitman Agency"); } 

       } 

       else 

       { 

        imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Civil"); 

       } 

    ftp_close($ftpcon); 

    unset($str); 

    unset($ftpad); 

    unset($ftpuser); 

    unset($ftppass); 

    unset($ftpcon); 

    unset($login); 

    header('Content-type: image/png'); 

    imagepng($rImg); 

     imagepng($skinImg); 



?> 
</style> 
+1

廣場,嘗試錯誤的步驟又是一個讓我知道什麼是錯誤訊息。 'ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL);' –

+1

從最後關閉的''標籤,我會建議你的問題是你期待HTML(它本身是非常過時的)如何顯示。 –

+1

您的頁面沒有遵循HTML標記首選項和大量錯誤標記的使用 – AnkiiG

回答

0

請檢查你的代碼如下:下面的PHP代碼第一行

<?php 

//Error reporting section 
ini_set('display_errors', 1); 
ini_set('display_startup_errors', 1); 
error_reporting(E_ALL); 


include_once("functions.php"); 

$sign = !isset($_GET['s']) ? 1 : $_GET['s']; 

$uname = !isset($_GET["name"]) ? "None" : $_GET['name']; 

// Connection & Website Settings 

$ftpad = ""; 

$ftpuser = ""; 

$ftppass = ""; 

$comm = "SAMP"; 

$weburl = "www.incoming.com"; 

$usersdir = "/scriptfiles/Users"; 

$ftpcon = ftp_connect($ftpad,4112) or die("Error|I can't connect to the database: $ftpad, contact web master"); 

$login = ftp_login($ftpcon,$ftpuser,$ftppass); 

$uname = ""; 

$name = $_GET['name']; 

ftp_pasv($ftpcon,true); 

$fhandle = fopen("tempsign_".hash('sha256',"$name").".tmp","w+"); 

ftp_fget($ftpcon,$fhandle,"$usersdir/$name.ini",FTP_ASCII); 

$str = parse_ini_file2("tempsign_".hash('sha256',"$ime").".tmp"); 

fclose($fhandle); 

$skin = $str['Skin']; 

$rImg = ImageCreateFromPNG("./signs/1.png"); 

if (file_exists("./signs/skins/$skin.jpg")) 
{ 
    $skinImg = ImageCreateFromjpeg("./signs/skins/$skin.jpg"); 
} 
else 

{ 
    $skinImg = ImageCreateFromjpeg("./signs/skins/0.jpg"); 
} 

$cor_black = imagecolorallocate($rImg,0,0,0); 

$cor_blue = imagecolorallocate($rImg,0,0,255); 

$cor_lblue = imagecolorallocate($rImg,30,144,255); 

$cor_green = imagecolorallocate($rImg,69,139,116); 

$cor_red = imagecolorallocate($rImg,220,20,65); 

$cor_wh = imagecolorallocate($rImg,255,255,255); 

$cor_n = imagecolorallocate($rImg,246,74,14); 

if(ftp_size($ftpcon,"$usersdir/$name.ini") == -1 || $ime == "None") 
{ 
    ?><tr> 
     <center><td align="center" valign="top"><img src="logo.png" width="400" height="155" alt="logo" /></td></center> 
    </tr> 
    <style type="text/css"> 

     body{ 

      background-color:#000; 

      background-image:url(backg.png); 

     } 
    </style><?php 

echo "<center><br/><br/><br/><br/><font color='#FF3333'>Error | That signature doesn't exist! Possible reasons:<br/><br/></font></center>"; 

    echo "<center><font color='#0FB9FC'>1. You didn't enter your username in field for that<br/></font></center>"; 

    echo "<center><font color='#0FB9FC'>2. You entered wrong username(Example Your_Name)<br/></font></center>"; 

    echo "<center><font color='#0FB9FC'>3. Username that you entered isn't in our databse<br/></font></center>"; 

    return 1; 

} 
else 
{ 

    ftp_pasv($ftpcon,true); 

    $fhandle = fopen("tempsign_".hash('sha256',"$name").".tmp","w+"); 

    ftp_fget($ftpcon,$fhandle,"$usersdir/$name.ini",FTP_ASCII); 

    $str = parse_ini_file2("tempsign_".hash('sha256',"$name").".tmp"); 

    fclose($fhandle); 

    imagettftext($rImg,12,0,11,39,$cor_n,"font.TTF",urldecode($name)); 

    imagettftext($rImg,12,0,11,79,$cor_n,"font.TTF",urldecode($str['Level'])); 

    imagettftext($rImg,12,0,173,120,$cor_n,"font.TTF",urldecode($str['Points'])); 

    imagettftext($rImg,12,0,173,80,$cor_n,"font.TTF",urldecode($str['Hours'])); 

    imagecopymerge($rImg, $skinImg, 308,6,0,0,80,100,100); 

} 



if($str['Sex'] == 0) { imagettftext($rImg,12,0,10,122,$cor_n,"font.TTF","Male"); } 
else if($str['Sex'] == 1) { imagettftext($rImg,12,0,10,122,$cor_n,"font.TTF","Female"); } 


if($str['GM'] > 0){ imagettftext($rImg, 13,0,5,161,$cor_green,"font.TTF","GameSupport");} 
if($str['Admin'] > 0){ imagettftext($rImg, 13,0,5,161,$cor_red,"font.TTF","Admin");} 

if($str['Leader'] > 0){ 

    if($str['Leader'] == 1) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","LSPD"); } 

    else if($str['Leader'] == 2) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","FBI"); } 

    else if($str['Leader'] == 3) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","CNN"); } 

    else if($str['Leader'] == 4) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","La Cocaina"); } 

    else if($str['Leader'] == 5) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","La Cosa Nostra"); } 

    else if($str['Leader'] == 6) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Terror Squad Crew"); } 

    else if($str['Leader'] == 7) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","GSF"); } 

    else if($str['Leader'] == 8) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Yakuza"); } 

    else if($str['Leader'] == 9) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Russian Mafia"); } 

    else if($str['Leader'] == 10) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Underground Racers"); } 

    else if($str['Leader'] == 11) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Hitman Agency"); } 

} 
else if($str['Member'] > 0) 
{ 

    if($str['Member'] == 1) { imagettftext($rImg,13,0,171,40,$cor_wh,"font.TTF","LSPD"); } 

    else if($str['Member'] == 2) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","FBI"); } 

    else if($str['Member'] == 3) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","CNN"); } 

    else if($str['Member'] == 4) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","La Cocaine"); } 

    else if($str['Member'] == 5) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","La Cosa Nostra"); } 

    else if($str['Member'] == 6) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Terror Squad Crew"); } 

    else if($str['Member'] == 7) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","GSF"); } 

    else if($str['Member'] == 8) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Yakuza"); } 

    else if($str['Member'] == 9) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Russian Mafia"); } 

    else if($str['Member'] == 10) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Underground Racers"); } 

    else if($str['Member'] == 11) { imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Hitman Agency"); } 

} 
else 
{ 
    imagettftext($rImg,13,0,171,40,$cor_n,"font.TTF","Civil"); 
} 

ftp_close($ftpcon); 

unset($str); 

unset($ftpad); 

unset($ftpuser); 

unset($ftppass); 

unset($ftpcon); 

unset($login); 

header('Content-type: image/png'); 

imagepng($rImg); 

imagepng($skinImg); 
?>