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 我有个餐饮系统,用wampserver把环境配置好了,但是后端的网页却进去,是为什么,能不能帮远程一下?
  • ¥15 R运行没有名称为"species"的插槽对于此对象类"SDMmodelCV"
  • ¥20 基于决策树的数字信号处理,2ask 2psk 2fsk的代码,检查下报错的原因
  • ¥20 python作业求过程
  • ¥15 wincc已组态的变量过多
  • ¥60 如图:直线与椭圆X轴平行,求直线与椭圆任意一点的相切坐标计算公式
  • ¥50 如何用python使用opencv里的cv::cudacodec::VideoWriter函数对视频进行GPU硬编码
  • ¥100 c#solidworks 二次开发 工程图自动标边线法兰 等折弯尺寸怎么标
  • ¥15 halcon DrawRegion 提示错误
  • ¥15 FastAPI Uvicorn启动显示404