Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 多个$\u获取处理_Php_Html_Get_Request - Fatal编程技术网

Php 多个$\u获取处理

Php 多个$\u获取处理,php,html,get,request,Php,Html,Get,Request,所以我有不同的按钮来调用get请求,但只有一个在工作,当它们被调用时,它们被act和act2调用,act工作正常,但act2在调用时什么都不做,有人能帮忙吗?我试过调整名字,更改数据库设置,现在似乎什么都不适合我 get的名称如下: <center><a href="?p=attempt&id='.$row['id'].'&act=delete" title="Delete log"><i class="fa fa-times-circle">

所以我有不同的按钮来调用get请求,但只有一个在工作,当它们被调用时,它们被act和act2调用,act工作正常,但act2在调用时什么都不做,有人能帮忙吗?我试过调整名字,更改数据库设置,现在似乎什么都不适合我

get的名称如下:

<center><a href="?p=attempt&id='.$row['id'].'&act=delete" title="Delete log"><i class="fa fa-times-circle"></i></a> <a href="?p=attempt&ip='.$row['ip'].'&act=blacklist" title="Blacklist IP"><i class="fa fa-lock"></i></a></center>'
'
这就是答案

if (isset($_GET['act2']))
                    {
                        if (!isset($_GET['ip']))
                        {
                            echo '<div class="alert alert-danger">No log ID.  </div><meta http-equiv="refresh" content="2;url=?p=settings">';
                        }else{
                            $act = $_GET['act2'];
                            $tid = $_GET['ip'];
                            if (ctype_digit($tid))
                            {
                                if (ctype_alnum($act))
                                {
                                    $arr = array('blacklist');
                                    if (in_array($act, $arr))
                                    {
                                        $cnt = $odb->prepare("SELECT COUNT(*) FROM login_attempts WHERE id = :i");
                                        $cnt->execute(array(":i" => $tid));
                                        if ($cnt->fetchColumn(0) > 0)
                                        {


                                            $cpermss = $odb->prepare("SELECT privileges FROM users WHERE username = :u");
                                            $cpermss->execute(array(":u" => $_SESSION['username']) );
                                            $cperms = $cpermss->fetchColumn(0);
                                            if ($userperms == "moderator" && $cperms == "admin")
                                            {
                                                echo '<div class="alert alert-danger">Invalid Permissions.</div>';
                                            }else{
                                                if ($userperms == "user" && strtolower($cr) != strtolower($username))
                                                {
                                                    echo '<div class="alert alert-danger">Invalid Permissions.</div>';
                                                }else{
                                                    switch ($act)
                                                    {
                                                        case "blacklist":
                                                            $de = $odb->prepare("INSERT INTO 'blacklist'(ip) VALUES [':i']");
                                                            $de->execute(array(":i" => $tid));
                                                            echo '<div class="alert alert-success">ip added to blacklist.  </div><meta http-equiv="refresh" content="2;url=settings.php">';
                                                            break;
                                                    }
                                                }
                                            }
                                        }else{
                                            echo '<div class="alert alert-danger">Log not found in database.  </div><meta http-equiv="refresh" content="2;url=?p=settings">';
                                        }
                                    }else{
                                        echo '<div class="alert alert-danger">Invalid action.  </div><meta http-equiv="refresh" content="2;url=?p=settings">';
                                    }
                                }
                            }
                        }
                    }





if (isset($_GET['act']))
                    {
                        if (!isset($_GET['id']))
                        {
                            echo '<div class="alert alert-danger">No log ID.  </div><meta http-equiv="refresh" content="2;url=?p=settings">';
                        }else{
                            $act = $_GET['act'];
                            $tid = $_GET['id'];
                            if (ctype_digit($tid))
                            {
                                if (ctype_alnum($act))
                                {
                                    $arr = array('delete');
                                    if (in_array($act, $arr))
                                    {
                                        $cnt = $odb->prepare("SELECT COUNT(*) FROM login_attempts WHERE id = :i");
                                        $cnt->execute(array(":i" => $tid));
                                        if ($cnt->fetchColumn(0) > 0)
                                        {


                                            $cpermss = $odb->prepare("SELECT privileges FROM users WHERE username = :u");
                                            $cpermss->execute(array(":u" => $_SESSION['username']) );
                                            $cperms = $cpermss->fetchColumn(0);
                                            if ($userperms == "moderator" && $cperms == "admin")
                                            {
                                                echo '<div class="alert alert-danger">Invalid Permissions.</div>';
                                            }else{
                                                if ($userperms == "user" && strtolower($cr) != strtolower($username))
                                                {
                                                    echo '<div class="alert alert-danger">Invalid Permissions.</div>';
                                                }else{
                                                    switch ($act)
                                                    {
                                                        case "delete":
                                                            $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">Log not found in database.  </div><meta http-equiv="refresh" content="2;url=?p=settings">';
                                        }
                                    }else{
                                        echo '<div class="alert alert-danger">Invalid action.  </div><meta http-equiv="refresh" content="2;url=?p=settings">';
                                    }
                                }
                            }
                        }
                    }
if(isset($\u GET['act2']))
{
如果(!isset($\u GET['ip']))
{
回显“无日志ID”;
}否则{
$act=$_GET['act2'];
$tid=$_GET['ip'];
if(ctype_数字($tid))
{
if(ctype_alnum($act))
{
$arr=数组(“黑名单”);
if(在数组中($act$arr))
{
$cnt=$odb->prepare(“从登录尝试中选择COUNT(*),其中id=:i”);
$cnt->execute(数组(“:i”=>$tid));
如果($cnt->fetchColumn(0)>0)
{
$cpermss=$odb->prepare(“从用户名=:u的用户选择权限”);
$cpermss->execute(数组(“:u”=>$\u会话['username']);
$cperms=$cperms->fetchColumn(0);
如果($userperms==“版主”&&$cperms==“管理员”)
{
回显“无效权限”;
}否则{
如果($userperms==“用户”&&strtolower($cr)!=strtolower($username))
{
回显“无效权限”;
}否则{
交换机($act)
{
案例“黑名单”:
$de=$odb->prepare(“插入到“黑名单”(ip)值[':i']);
$de->execute(数组(“:i”=>$tid));
echo“ip被添加到黑名单中”;
打破
}
}
}
}否则{
回显“数据库中未找到日志”;
}
}否则{
回应“无效操作”;
}
}
}
}
}
如果(isset($_GET['act']))
{
如果(!isset($\u GET['id']))
{
回显“无日志ID”;
}否则{
$act=$_GET['act'];
$tid=$_GET['id'];
if(ctype_数字($tid))
{
if(ctype_alnum($act))
{
$arr=数组('delete');
if(在数组中($act$arr))
{
$cnt=$odb->prepare(“从登录尝试中选择COUNT(*),其中id=:i”);
$cnt->execute(数组(“:i”=>$tid));
如果($cnt->fetchColumn(0)>0)
{
$cpermss=$odb->prepare(“从用户名=:u的用户选择权限”);
$cpermss->execute(数组(“:u”=>$\u会话['username']);
$cperms=$cperms->fetchColumn(0);
如果($userperms==“版主”&&$cperms==“管理员”)
{
回显“无效权限”;
}否则{
如果($userperms==“用户”&&strtolower($cr)!=strtolower($username))
{
回显“无效权限”;
}否则{
交换机($act)
{
案例“删除”:
$de=$odb->prepare(“从id=:i的登录尝试中删除”);
$de->execute(数组(“:i”=>$tid));
echo“日志已删除”;
打破
}
}
}
}否则{
href="?p=attempt&id='.$row['id'].'&act=delete"