有人可以帮帮我吗。我很难让表单仅在 Firefox 中显示和正确运行。每个其他浏览器都可以正常工作。
但我想尝试在 php 中设置一个规则来说明 chrome,ie 等是否这样做,如果 firefox 这样做。
我在下面尝试了这一点,当使用 ie 和 chrome 等时,登录表单按预期出现,但使用 firefox 时没有显示登录表单。没有错误信息。
<div id="login">
<?
if (preg_match('/Chrome|Opera|Safari|MSIE 8.0/', $_SERVER['HTTP_USER_AGENT'])) { ?>
<?php
if (!logged_in()) {
?>
<form id="myform" action="login.php" method="post" class="loginform">
Email
<input type="text" name="email" maxlength="30" />
Password
<input type="password" name="password" maxlength="30" />
<input type="image" src="../PTB1/assets/img/icons/loginarrow1.png" name="submit" class="loginbutton" />
</form>
<?php
}
if (logged_in()) {
?>
Logged in as, <?php echo $_SESSION['email'] ?>. <a href="dashboard.php">Dashboard</a>, <a href="logout.php">Logout</a> | <div class="login_settings" id="login_settings"></div>
<?php
}
else if (preg_match('/Firefox/', $_SERVER['HTTP_USER_AGENT'])) {
if (!logged_in()) {
?>
<form action="login.php" rel="shadowbox;height=300;width=500" method="post" >
<div class="row email">
<input type="email" id="email" name="email" placeholder="Email" value="<?php echo htmlentities($email); ?>" />
</div>
<div class="row password">
<input type="password" id="password" name="password" placeholder="Password" value="<?php echo htmlentities($email); ?>" />
</div>
<input type="submit" name="submit" value="Login >" />
</form>
<?php
}
if (logged_in()) {
?>
Logged in as, <?php echo $_SESSION['email'] ?>. <a href="dashboard.php">Dashboard</a>, <a href="logout.php">Logout</a> | <div class="login_settings" id="login_settings"></div>
<?
} } }
?>
</div>