douwen0612 2018-02-01 23:17
浏览 49
已采纳

C#如果webbrowser显示消息,则显示标签

I am trying to setup a loader for cs:go but I am stuck at one part of the code where I check using PHP if user exits and if the user doesn't exist then show code 2 which means that user doesn't exist. Now in C# when code 2 is displayed in the webBrowser I want it to change the IncorrectUsername from invisible to visible but for some reason it doesn't work.

Now I know that the PHP side is working perfectly. Screenshot of Loader when user is incorrect. [When user is incorrect code = 2][1] Now there is supposed to be a label displayed above the first text box but its not displaying.

This is the problem

else if (webBrowser2.DocumentText.Contains("2"))
            {
                IncorrectUsername.Visible = true;
                username = false;
            }
        }
    }

Here is the PHP code

    <?php
$ini = parse_ini_file('config.ini');
$link = mysqli_connect($ini['db_host'],$ini['db_user'],$ini['db_password']);
$database = mysqli_select_db($link,$ini['db_name']);

$user = $_GET['username'];
$password = $_GET['password'];
$tables = $ini['mybb_usertable'];

$sql = "SELECT * FROM ". $tables ." WHERE username = '". mysqli_real_escape_string($link,$user) ."'" ;
$result = $link->query($sql);

if ($result->num_rows > 0) {
    // Outputting the rows
    while($row = $result->fetch_assoc())
    {

        $password = $row['password'];
        $salt = $row['salt'];
        $plain_pass = $_GET['password'];
        $stored_pass = md5(md5($salt).md5($plain_pass));

        function Redirect($url, $permanent = false)
        {
            if (headers_sent() === false)
            {
                header('Location: ' . $url, true, ($permanent === true) ? 301 : 302);
            }
        exit();
        }

        if($stored_pass != $row['password'])
        {
            echo "0"; // Wrong pass, user exists
        }
        else
        {
            echo "1"; // Correct pass
        }
    }
} 
else
{
    echo "2"; // User doesn't exist
}

?>

<head>
<title>Checking login info</title>
</head>
  • 写回答

1条回答 默认 最新

  • douyao1856 2018-02-02 00:40
    关注

    I found the part where I messed up thanks to @derloopkat. Basically the webBrowser2 was not loaded in. So I changed from webBrowser2 to webBrowser1.

    From this

                    else if (webBrowser2.DocumentText.Contains("2"))
                {
                    IncorrectUsername.Visible = true;
                    username = false;
                }
            }
        }
    

    To this

                else if (webBrowser1.DocumentText.Contains("2"))
                {
                    IncorrectUsername.Visible = true;
                    username = false;
                }
            }
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)