lundi 16 avril 2018

unexpected 'else' on get request

ive been working on this code awhile, the error thrown just doesnt make any sense, ive googled around but i just cant find a working solution, or anyone to explain why so i can prevent it in the future

this error is thrown: Parse error: syntax error, unexpected 'else' (T_ELSE) in /home/cabox/workspace/up/frontend/pages/settings.php on line 139

line 139 is the first else statement

if (isset($_GET['act']))
    {
        $act = $_GET['act'];
        $arr = array('delete');
        $arr2 = array('blacklist');
        $arr3 = array('unblacklist');
        if (in_array($act, $arr)) 
        {
                $de = $odb->prepare("DELETE FROM login_attempts WHERE id = :i");
                $de->execute(array(":i" => $tid));
                echo '<div class="alert alert-success">log deleted.  </div><meta http-equiv="refresh" content="2;url=settings.php">';
                break;
            }else{
                echo '<div class="alert alert-danger">Something went wrong, please try again</div>';
            }
        }else{
        }
        if (in_array($act, $arr2))
        {
            echo 'div class="alert alert-danger">blacklist</div>';
        }else{
            $getblack = $_GET['ip'];
            $de2 = $odb->prepare("INSERT INTO blacklist VALUES(null, :ip)");
            $de2 = $odb->execute(array(":ip" => $getblack));
        }else{
            echo '<div class="alert alert-danger">Something went wrong, please try again</div>';
        }

}

Aucun commentaire:

Enregistrer un commentaire