2010-06-10 84 views
0

我認爲錯誤必須與IE8和cookies操作不兼容,因爲在IE8中您可以看到密碼和登錄詢問屏幕,但是當您輸入數據併發送它的瀏覽器似乎什麼都不做,這是你可以試試我的代碼的URL:http://200.8.27.127/tiempo/teacher.phpPHP代碼適用於每個瀏覽器,但不適用於IE8

,這是代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta content="it" http-equiv="Content-Language" /> 
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> 
<title>Formulario</title> 
<style type="text/css"> 
h1 { font: 50px Tahoma, Helvetica, Arial, Sans-Serif; text-align: center; color: #111; text-shadow: 0px 2px 3px #555; } 
h2 { font: 14px Tahoma, Helvetica, Arial, Sans-Serif; text-align: center; color: #CCC; text-shadow: 0px 1px 2px #555; } 
h3 { font: 10px Tahoma, Helvetica, Arial, Sans-Serif; text-align: center; color: #CCC; } 
b1 { font: 16px Tahoma, Helvetica, Arial, Sans-Serif; color: #DDD; } 
b2 { font: 10px Tahoma, Helvetica, Arial, Sans-Serif; color: #F9F7ED; } 

.caja { width: 690px; height: 40px; background-color: transparent; border: 0px solid #000000; font-size:x-large; color: #222; font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; font-weight: bold;" size="299"; } 
.style1 { text-align: right; } 
</style> 
</head> 
<body style="background-image: url('IMG/bg.png')"> 
<script type="text/javascript" src="JS/jquery-1.4.2.min.js"></script> 
<script type="text/javascript" src="JS/jquery.notifications-1.1.min.js"></script> 
<link rel="stylesheet" type="text/css" href="JS/jquery.notifications.css" /> 
<script> function checkCharCount(textfield) { if(textfield.value.length > 300) textfield.value = textfield.value.substr(0, 300); document.getElementById("charCounter").innerHTML = 300 - textfield.value.length; } </script> 
<?php 
include("/LIB/HeadSQL.php"); 
include("/LIB/error.php"); 
if (isset($_COOKIE['ID_tablon'])) { 
     $username = $_COOKIE['ID_tablon']; 
     $pass = $_COOKIE['Key_tablon']; 
     $check = mysql_query("SELECT * FROM usuarios WHERE nombre = '$username'") or die(mysql_error()); 
     while($info = mysql_fetch_array($check)) { 
      if ($pass != $info['clave']) { 
       login(); 
      } 
      else { 
       entro($info['email'],$username); 
      } 
     } 
} else { 
    login(); 
} 


function login() 
{ 
    if (isset($_POST['quiere'])) { 
     if(!$_POST['username'] | !$_POST['pass']) { 
      include("LIB/login.php"); 
      error('Debes llenar todos los campos.',0); 
     } else { 
      $check = mysql_query("SELECT * FROM usuarios WHERE nombre = '".$_POST['username']."'") or die(mysql_error()); 
      $check2 = mysql_num_rows($check); 
      if ($check2 == 0) { 
       include("LIB/login.php"); 
       error('Ese usuario no existe.',0); 
      } 
      while($info = mysql_fetch_array($check)) { 
       $_POST['pass'] = stripslashes($_POST['pass']); 
       $info['clave'] = stripslashes($info['clave']); 
       //$_POST['pass'] = md5($_POST['pass']); 
       if ($_POST['pass'] != $info['clave']) { 
        include("LIB/login.php"); 
        error('La clave es incorrecta.',0); 
       } else { 
        $_POST['username'] = stripslashes($_POST['username']); 
        $hour = time() + 3600; 
        setcookie("ID_tablon", $_POST['username'], $hour); 
        setcookie("Key_tablon", $_POST['pass'], $hour); 
        entro($info['email'],$_POST['username']); 
       } 
      } 
     } 
    } else { 
     include("LIB/login.php"); 
    } 
    exit; 
} 


function entro($email,$username) 
{ 
?> 

<div id="todo" align="center" > 
    <div id="cabeza" style="width:850px;height:100px"> 
    </div> 
    <div id="contenido" style="width:850px;height:420px;background-image: url(IMG/cuadro.png)" > 
     <div id="titulo" style="width:765px;height:75px;padding-top: 18px;margin: auto;text-align: left;"> 
      <b1>Bienvenido <b><?php echo($username); ?></b></b1><br> 
      <?php $check = mysql_query("SELECT * FROM sms WHERE ref = '".$username."' ORDER BY fecha DESC LIMIT 0, 1") or die(mysql_error()); 
      while($info = mysql_fetch_array($check)) { 
       echo("<b1> Tu ultimo mensaje enviado fue: </b1><b2>" . $info['texto'] . " enviado el " . $info['fecha'] . "</b2>"); 
      } 
      ?> 
     </div> 
     <form method="post"> 
     <div id="formulario" style="width:850px;height:255px;margin-top: 10px"> 
      <div id="foto" align="right" style="width:725px; height:40px;padding-top: 11px;margin: auto"> 
       <?php $size = 60; $grav_url = "http://www.gravatar.com/avatar/" . md5(strtolower($email)) . "?size=" . $size; 
       $size = 256; $grav_urlB = "http://www.gravatar.com/avatar/" . md5(strtolower($email)) . "?size=" . $size; 
       echo('<img alt="Image" src="' . $grav_url . '" />'); ?> 
      </div> 
      <div id="texto" style="width:850px;height:29px; margin-top: 38px;margin-left: 4px"> 
        <input name="sms" type="text" onKeyUp="checkCharCount(this)" class="caja" /> 
      </div> 
      <div id="botones" style="width:725px;height:27px; margin-top: 15px" class="style1"> 
       <input name="usuario" type="hidden" value="<?php echo($username); ?>" /> 

       <input name="Submit1" type="image" value="submit" src="IMG/envia.png" /> 
      </div> 
      <div id="resta" style="width:850px;height:29px; margin-top: 53px;margin-left: 4px"> 
       <h2><span id="charCounter">300</span> caracteres restantes.</h2> 
       <h3><a href=logout.php>Cerrar Sesion</a></h3> 
      </div> 

     </div> 
     </form> 
    </div> 
</div> 

</body> 

</html> 


<?php 
session_start(); 
if (isset($_POST['Submit1'])) { 
if (isset($_SESSION['token']) && (time() - $_SESSION['token']) < 5) { 
    error('Debes esperar 5 segundos para poder enviar otra informacion.',0); 
} else { 
    $_SESSION['token'] = time(); 
    include("/LIB/HeadSQL.php"); 
    include("/LIB/comprueba.php"); 
    $insert = "INSERT INTO sms (ref, texto, fecha) VALUES ('" . addslashes($_POST['usuario']) . "', '" . addslashes($_POST['sms']) . "', NOW())"; 
    $add_member = mysql_query($insert); 
    error("Tu mensage ha sido enviado con exito.",1); 
} 
} 
    exit; 
} 
?> 

你覺得isuue可以上的JavaScript?

嘗試使用Firefox或谷歌瀏覽器的代碼firts,然後在IE8中嘗試。

回答

2

這絕對是JS。 PHP是一種服務器端語言,這意味着它只需要在你的服務器上工作......不管他們使用什麼瀏覽器,相同的內容都會被髮送到客戶端。這就是說,我不知道在哪裏具體錯誤在於你的JS。你正在使用jQuery ......爲什麼不利用它呢?擺脫的那個

document.getElementById("charCounter").innerHTML 

而且隨着

$('#charCounter').html(...) 

例如更換... jQuery是專爲跨瀏覽器的兼容性,所以用它儘可能多地。

+0

document.getElementById(「charCounter」)。innerHTML = 300 - textfield.value.length; 您是否允許將innerHTML設置爲數字?它是否隱式轉換爲字符串? 您可以嘗試: document.getElementById(「charCounter」)。innerHTML =「」+(300 - textfield.value.length); – Chad 2010-06-10 02:20:18

+0

它不是,我必須添加到我的問題: 嘗試用戶:djsoftlayer和密碼:1234 在Firefox中你會得到訪問,但不是在IE8 請試試這個 – DomingoSL 2010-06-10 02:50:22

-2

猜測它與cookies和/或HTTP頭有關 - 只是懶得調試你的代碼。 檢查IE8中的Mozilla和開發人員工具上的FireBug接收/發送的cookie一次...... IE可能是一個b * tch,當它是關於標題時 - 我的意思是,並不總是按預期行事。

曾經檢查過IE安全/ cookie設置?

+0

爲什麼-1 ...什麼不對的回答?? 請解釋。 – 2013-02-10 03:01:39

+0

我同意這是糟糕的形式來轉儲整個頁面,並要求人們去調試它,但是同樣糟糕的是,拋出猜測。這對任何人都沒有幫助。你最初只有一句話。 – 2013-02-10 03:02:20

+0

這不是一個猜測 - 這是基於經驗(以及對IE問題的適當解決方案)。那麼,調試其他人的代碼根本就不是我的工作 - 而我靠這個謀生;)就像,「嘿,我在IE8中發現了一個bug」 - 並不是我真的會在乎。並解釋如何調試是一切,只是一個猜測 - 這是值得的黃金(如果有人想投資一些時間)。除了所提供的代碼在沒有這些庫的情況下是沒有用的,不可測試。 – 2013-02-10 03:05:59

相關問題