2016-08-07 24 views
0

申し訳ありませんが、この回答はたくさんありますが、私はすべての回答を試みました。 は私がウェブサイトを持っている(http://grmpixelmon.co/hwidreplace.html) 私はテキストファイルのテキストを置き換えるPHP

をしようとしたコードの入力にHWIDは、テキストファイル(HWIDs.txt) に交換するが、それはここで...私は500エラー与える を保つHWIDラベルがされています
<?php 
// See the password_hash() example to see where this came from. 
$hwid = $_POST['hwid']; 
$FILE = "HWIDs.txt"; 
$replace = $_POST['replace']; 
$replace_with = " "; 
$password = $_POST['password']; 
$password2 = 'mypassword'; 
if ($password2 === $password) { 
    if (empty ($hwid)){ 
    echo 'you did not enter an hwid'; 
    }else{ 
     file_put_contents("HWIDs.txt", $hwid, FILE_APPEND); 
     echo 'Succesfully added '; 
     echo $hwid; 
     echo ' as hwid'; 
    } 
     $data = file_get_contents("HWIDs.txt"); 
$newdata = str_replace($replace, $replace_with, $data); 
file_put_contents("HWIDs.txt", $newdata); 
} 
    } 
} else { 
    echo 'Invalid password.'; 

} 
?> 
+0

中括弧が正しく一致していないように見えます - コードの全セクションですか? – RamRaider

答えて

0

ポストに含まれていないコードが多い場合を除いて、中括弧はバランスが取れていません。開閉回数やコードのインデントが単純であることがわかります。

$hwid = $_POST['hwid']; 
$FILE = "HWIDs.txt"; 
$replace = $_POST['replace']; 
$replace_with = " "; 
$password = $_POST['password']; 
$password2 = 'mypassword'; 


if ($password2 === $password) { 
    if (empty ($hwid)){ 
     echo 'you did not enter an hwid'; 
    }else{ 
     file_put_contents("HWIDs.txt", $hwid, FILE_APPEND); 
     echo 'Succesfully added '; 
     echo $hwid; 
     echo ' as hwid'; 
    } 

    $data = file_get_contents("HWIDs.txt"); 
    $newdata = str_replace($replace, $replace_with, $data); 
    file_put_contents("HWIDs.txt", $newdata); 

} else { 
    echo 'Invalid password.'; 
} 
関連する問題