Jump to content


Photo

Query failed only on IE browser


  • Please log in to reply
3 replies to this topic

#1 LucasGala

LucasGala

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 29 September 2013 - 10:27 AM

My goal is to move an PHP application from a Windows Server 2000 - SQL Server 2005 - Apache 2.2 to a new a server with Windows Server 2012 - SQL Server 2012 - Apache 2.2.

On the new server I've installed and configured SQL Server 2012 - Apache 2.2 and PHP 5.2.9.

I copied the application and the database on the new server.

Unfortunately the application didn't work with Internet Explorer. I cannot access to my application account because it failed on the login form. It works with Firefox and Chrome.

I can read on the Apache log : PHP Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near '='. (severity 15)

I tried the application under PHP 5.4 and Apache 2.4 using the ODBC library for handling requests. I meet again the same error with Internet Explorer.

On the old server the application work fine with IE7-8-9-10.

Somebody can help me ?

Regards



#2 mac_gyver

mac_gyver

    Advanced Member

  • Moderators
  • 1,909 posts

Posted 29 September 2013 - 10:35 AM

best guess is because different browsers can submit different form data for the same html markup and your code needs to take that into account.

 

you need to debug what data is actually being submitted and what your code is doing with that data. if you want us to help, you will need to post the relevant form and form processing code.


multi-purpose programming fool and resident naysayer [We try not be negative in replies, but telling someone what they're doing wrong, while staying politically correct, isn't always going to happen.]

#3 LucasGala

LucasGala

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 30 September 2013 - 03:59 AM

Hello,
 
Here is the form
 
<fieldset class="fld_type" style="width:80%;">
<legend class="lgd_style">Connexion - Inscription</legend>
<table align="center">
<?php if(!empty($erreur)){ ?>
<tr>
<td align="right" colspan="3" style="color:red; font-size:14px;" ><?php echo $erreur; ?></td>
</tr>
<?php } ?> 
<tr><td>&nbsp;</td></tr>
<tr>
<td rowspan="4"><img style="height:90px;" src="images/connect.png" alt="Authentification" /></td>
<td class="right"><b>N&ordm; Pan&eacute;liste (identifiant):</b></td>
<td><input style="border:1px solid #0075bc;" onFocus="modif_champs(this);" onBlur="default_champs(this);" type="text" id="txt_login" name="txt_login" /></td>
</tr>
<tr>
<td class="right"><b>Mot de passe :</b></td>
<td><input style="border:1px solid #0075bc;" onFocus="modif_champs(this);" onBlur="default_champs(this);" type="password" id="txt_mdp" name="txt_mdp" /></td>
</tr>
<tr>
<td></td>
<td><a class="strong" href="#MDPOublie" onClick="$('formMDPOublie').appear();Effect.ScrollTo('MDPOublie'); return false;" >Mot de passe oublié ?</a></td>
</tr>
<tr>
<td></td>
<td>
<!--<input onClick="verifLoginMDP(this.form);" type="button" value="Se connecter" id="btn_valider" name="btn_valider" class="btn_style" />-->
<input type="submit" value="Se connecter" id="btn_valider" name="btn_valider" class="btn_style" />
</td>
</tr>
<tr><td colspan="3"><hr style="color:white;" /></td></tr>
</table>
<table align="center">
<tr>
<td align="right"><a href="questionnaire_consommation/form_inscriptionPaneliste.php"><img style="height:40px; width:40px; " src="images/addP2.png" alt="Nouveau ?" /></a></td>
<td><a class="strong" href="questionnaire_consommation/form_inscriptionPaneliste.php">Vous n'&ecirc;tes pas encore inscrit ?</a></td>
</tr>
</table>
</fieldset>
 
Here is the php code that handle the login
 
    if(isset($_POST['txt_login']) AND isset($_POST['txt_mdp'])){
     $login = Securite::bdd($_POST['txt_login']);
     $mdp = md5($_POST['txt_mdp']); // cryptage du mot de passe
     $erreur = "";
     
     /* Verification de l'utilisateur
      *********************************/ 
     $requeteVerif = "SELECT COUNT(*) FROM paneliste WHERE PANELISTE_LOGIN = '" . $login . "' AND PANELISTE_MDP = '" . $mdp . "'";
     $stmtVerif = ExecRequete($requeteVerif, Connexion());
     $donneesVerif = ObjetSuivant($stmtVerif);
     
     if($donneesVerif[0] == 0){
     //Le paneliste n'est pas referencé dans la base de données
     $erreur = "Les identifiants de connexion sont incorrects !";
     }else{ 
     $requeteIDPaneliste = "SELECT PANELISTE_ID, PANELISTE_TYPE, PANELISTE_DATENAISS, SITE_ID FROM paneliste WHERE PANELISTE_LOGIN = '" . $login . "' AND PANELISTE_MDP = '" . $mdp . "'";
     $stmtIDPaneliste = ExecRequete($requeteIDPaneliste, Connexion());
     $IDPaneliste = ObjetSuivant($stmtIDPaneliste);
     $_SESSION['id_paneliste'] = $IDPaneliste[0];
     $_SESSION['site_id'] = $IDPaneliste[3];
     $_SESSION['type_user'] =  $IDPaneliste[1];
     $_SESSION['type_questionnaire'] = getTypeQuestionnaire($IDPaneliste[2]);
    
     // Correction de l'erreur #90 : Des références au site de Vandoeuvre (e-mail et téléphone) apparaissent quelque soit le site de rattachement du panéliste.
     // A la connexion, on enregistre donc ces valeurs en session.
     $siteInfo = recupererSiteInfo($_SESSION['id_paneliste']);
     $_SESSION['site_admin_nom'] = $siteInfo['SITE_ADMIN_NOM'];
     $_SESSION['site_admin_prenom'] = $siteInfo['SITE_ADMIN_PRENOM'];
     $_SESSION['site_tel'] = $siteInfo['SITE_TEL'];
     $_SESSION['site_email'] = $siteInfo['SITE_EMAIL'];
     $_SESSION['site_horaires'] = $siteInfo['SITE_HORAIRES'];
    
     // Correction de l'erreur #132 : Certains panélistes ne peuvent accéder au site, car la variable de session est effacée après une redirection par header().
     session_write_close();
    
     header("Location: /partie_paneliste/accueil_paneliste.php"); 
     }
    }
    
     afficheEnTete("Espace de Connexion", "");
    
    
Here is the php code that execute query
 
  
  <?php
    
    // Execution d'une requête SQL
    function ExecRequete($requete, $connexion){
    
     $resultat = mssql_query($requete, $connexion);
     
     if($resultat){
     return $resultat;
     }
     else{
     echo "<b>Erreur dans l'execution de la requete '$requete' .</b>";
     exit;
     }
    } // Fin de la fonction ExecRequete
    
    //Recherche de l'objet suivant
    function ObjetSuivant($resultat){
     return mssql_fetch_array($resultat);
    }
    
    //Recherche de la ligne suivante (retourne un tableau)
    function LigneSuivante($resultat){
     return mssql_fetch_assoc($resultat);
    }
    
    // Correction de l'erreur #187 : Erreur SQL lors de la mise à jour des fréquences de consommation.
    // Nombre d'enregistrements trouvés
    function Nombre($resultat){
     return mssql_num_rows($resultat);
    }
    
    ?>
 
It fails on line 
$resultat = mssql_query($requete, $connexion);
 


#4 Ch0cu3r

Ch0cu3r

    Advanced Member

  • Moderators
  • 1,722 posts

Posted 30 September 2013 - 08:55 AM

Add some more debug information to the ExecRequete function
// Execution d'une requête SQL
    function ExecRequete($requete, $connexion){
    
    $resultat = mssql_query($requete, $connexion) or echo('<p style="border:red 2px solid;padding:10px">DEBUG QUERY: <pre>' . $requete . '</pre></p>');
     
     if($resultat){
     return $resultat;
     }
     else{
     echo "<b>Erreur dans l'execution de la requete '$requete' .</b>";
     exit;
     }
    } // Fin de la fonction ExecRequete

Edited by Ch0cu3r, 30 September 2013 - 08:55 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com