任何能够帮助解决这个令人讨厌的错误的人都试着等了30分钟。
<?php
if(isset($_POST['statusBtn']))
{
$username = htmlspecialchars($_POST['address']);
strtolower($username);
if(empty($username))
{
echo '<center><div class="alert alert-icon alert-danger alert-dismissible fade in col-md-7" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span></button><i class="mdi mdi-check-all"></i>Fill in all fields</div></center>';
} else if($username == "" || $username == ""){
echo '<center><div class="alert alert-icon alert-danger alert-dismissible fade in col-md-7" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><i class="mdi mdi-check-all"></i>Domain Whitelisted</div></center>';
} else {
$geo = @file_get_contents("http://ip-api.com/json/{$username}");
$json_a = json_decode($geo, true);
$proxyid = $json_a['status'];
if($proxyid == success)
{
echo '<center><div class="alert alert-icon alert-success alert-dismissible fade in col-md-7" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><i class="mdi mdi-check-all"></i>'.htmlspecialchars($username).' is Online!</div></center>';
} else {
echo '<center><div class="alert alert-icon alert-danger alert-dismissible fade in col-md-7" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><i class="mdi mdi-check-all"></i>'.htmlspecialchars($username).' is Offline!</div></center>';
}
}
}
?>
当我以表格形式提交google.com时,它会显示结果以及错误
注意:使用未定义的常数成功 - 假设成功&#39;
答案 0 :(得分:4)
将if($proxyid == success)
更改为if($proxyid == 'success')
错误告诉您success
没有' '
表示这是一个常量,而不是字符串。