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 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题