1

Anyone able to assist on fixing this one annoying error been trying for like 30minutes.

<?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">&times;</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">&times;</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">&times;</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">&times;</span></button><i class="mdi mdi-check-all"></i>'.htmlspecialchars($username).' is Offline!</div></center>';
        }
    }
}
?>

When I submit for example google.com in form it echo's the result along with error

Notice: Use of undefined constant success - assumed 'success'

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
Immense
  • 11
  • 1
  • 5

1 Answers1

4

change if($proxyid == success) to if($proxyid == 'success')

The error tells you that success without ' ' means that is a constant, instead of a string.

user2342558
  • 5,567
  • 5
  • 33
  • 54