2017-03-18 5 views
-3

予期しない問題が発生しました{.....私はこれを削除する理由を理解していません。私はまだ問題が残っています。正しいコードで返信してください。構文解析エラー:予期しない構文エラーです。 '{' /path/to/the/website/file.php 18行目

ケビン・アンドリュース/認証

<?php 

$shortenedlink = mt_rand(10000,99999); 
$longlink = $_POST['longlink']; 
if(!isset($longlink) || trim($longlink) == '') 
{ 
    echo "The link field is empty. Redirecting you in 3 seconds."; 
    header ("refresh:3;url=http://auth.kenygamer.com"); 
    exit; 

$shortenedlinkpath = "$shortenedlink.asp"; 
if (file_exists($shortenedlinkpath)) 
{ 
    echo "An error occurred creating the shortened link, because the assigned number already exists. However, you can retry. Copy the link and paste it again on the main page:<br><br>$longlink<br><br>Redirecting you in 15 seconds."; 
    header("refresh:15;url=http://auth.kenygamer.com"); 
    exit; 

} 
else 
{ 
    echo ""; 
} 

$shortenedfilecontent = '<title>Outgoing link</title><meta http-equiv="refresh" content="5; url=$longlink">'; 
$fp = fopen("$shortenedlink.asp", "w"); 
fwrite($fp, $shortenedfilecontent).'&nbsp;'; 
fclose($fp); 

echo ("The shortened URL has been successfully created. The shortened number #$shortenedlink has been assigned to your long URL $longlink. Therefore, it is accessible at https://auth.kenygamer.com/$shortenedlink at any time. Remember that you can always create new shortened URLs.<br><br>Long link: $longlink<br>Shortened link: $shortenedlink<br><br>Redirecting you in 20 seconds."); 
header("refresh:20;url=https://auth.kenygamer.com/$shortenedlink"); 
?> 

答えて

1

あなたはexit;

後にこれはあなたを助ける必要がある}追加するのを忘れ:

<?php 

$shortenedlink = mt_rand(10000, 99999); 
$longlink = $_POST['longlink']; 
if (!isset($longlink) || trim($longlink) == '') { 
    echo "The link field is empty. Redirecting you in 3 seconds."; 
    header("refresh:3;url=http://auth.kenygamer.com"); 
    exit; 
} 

$shortenedlinkpath = "$shortenedlink.asp"; 
if (file_exists($shortenedlinkpath)) { 
    echo "An error occurred creating the shortened link, because the assigned number already exists. However, you can retry. Copy the link and paste it again on the main page:<br><br>$longlink<br><br>Redirecting you in 15 seconds."; 
    header("refresh:15;url=http://auth.kenygamer.com"); 
    exit; 
} else { 
    echo ""; 
} 

$shortenedfilecontent = '<title>Outgoing link</title><meta http-equiv="refresh" content="5; url=$longlink">'; 
$fp = fopen("$shortenedlink.asp", "w"); 
fwrite($fp, $shortenedfilecontent) . '&nbsp;'; 
fclose($fp); 

echo ("The shortened URL has been successfully created. The shortened number #$shortenedlink has been assigned to your long URL $longlink. Therefore, it is accessible at https://auth.kenygamer.com/$shortenedlink at any time. Remember that you can always create new shortened URLs.<br><br>Long link: $longlink<br>Shortened link: $shortenedlink<br><br>Redirecting you in 20 seconds."); 
header("refresh:20;url=https://auth.kenygamer.com/$shortenedlink"); 
?> 
+0

か誰にも、このコードは動作していないあなたは、修正することができますそれは?<?php if(!_ SERVER ['HTTP_REFERER'])){ { echo 'あなたは$ _SERVER ['HTTP_REFERER']、短縮URLの作成のみが受け入れられた場合http://auth.kenygamer.com

10秒後にリダイレクトします。 ヘッダー( "refresh:10; url = http://auth.kenygamer.com"); exit; } else { echo ""; } –

関連する問題