dqwcdqs358367 2015-06-22 21:20
浏览 9

isset不适用于带有撇号的变量

This is the exact part of the code that doesn't work

if(isset($_GET['Champion'])){
        $championget = trim(urldecode($_GET['Champion']));
        echo $championget;
        $championexists = $conn->prepare("SELECT * FROM champions where Champion = ?");
        $championexists->bind_param('s', $championget);
        $championexists->execute();
        $championexistsresult = $championexists->get_result();
        if(mysqli_num_rows($championexistsresult)==0){
            echo 'Champion doesn\'t exist'; 
            exit;
        }elseif(mysqli_num_rows($championexistsresult)>=1)
            {
                //Continue here
                include('php/champion.php');
                exit;
            }

    }

Works fine with regular names like http://localhost/leaguenotes/Cassiopeia but i have names that have ' in them that is why i encoded them so they look like this http://localhost/leaguenotes/Cho%27Gath but this redirects me to folder index

Here is also htaccess that might be at fault

ErrorDocument 404 /
ErrorDocument 403 /

Options ALL -Indexes

RewriteEngine On

RewriteRule ^([0-9/.]+)$ index.php?Patch_No=$1 [NC,L]

RewriteRule ^([0-9/.]+)&([0-9a-zA-Z_-]+)$ index.php?Patch_No=$1&tab=$2 [NC,L]

RewriteRule ^patches php/patches.php [NC,L]

RewriteRule ^([0-9a-zA-Z_-]+)$ index.php?Champion=$1 [NC,L]

It just seems like because of %27 my code doesn't interpert this as a variable

  • 写回答

2条回答 默认 最新

  • doutaoer3148 2015-06-22 21:23
    关注

    Don't use them. Stick purely to A-Za-z0-9 and _ . (There are some other characters you can use, but they are reserved and have special meaning).

    评论

报告相同问题?

悬赏问题

  • ¥15 关于无人驾驶的航向角
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退