Page 1 sur 2

Pb avec Wamp 1.4.5a

Posté : 12 mai 2006, 11:18
par Galliwok
Bonjour,

J'étais en version 1.4.5 RC1 et je viens de passer en 1.4.5a.
Je sais, je suis un peu en retard mais bon......

Mon appli qui fonctionnait parfaitement ne fonctionne plus avec cette version.
En fait, j'ai une page de connexion (login et mot de passe) et lorsque je la valide, je reste sur cette page au lieu d'être dirigé vers la première page de mon appli.

Peut-être faut-il rajouter qqchose dans le code....
Ci-dessous, un morceau de mon code.

Config.inc.php :
<?php
$mysqlserver = 'localhost';
$mysqllogin = 'root';
$mysqlpassword = '*****';
$mysqlbase = 'prospect';
$ressource = mysqli_connect($mysqlserver,$mysqllogin,$mysqlpassword,$mysqlbase);
?>

Connexion.php :
<?
session_start();
include("Config.inc.php");
if ($ressource == false)
{
exit();
}

// SAISIE DU LOGIN ET DU MOT DE PASSE
$Login = $_POST[Login];
$Paswd = $_POST[Mot_de_passe];

// VERIFICATION SI LE LOGIN ET LE MOT DE PASSE SONT CORRECT
if ($_POST[Btn_Valider] != "")
{
$Sql = "SELECT Login, Password FROM Utilisateur
WHERE Login = '".$Login."' AND Password = '".$Paswd."'";
$Resultat = mysqli_query ($ressource, $Sql);
if ($Tab = mysqli_fetch_assoc($Resultat))
{
$_SESSION['Login'] = $Login;
$_SESSION['Nom_Comm'] = $Tab['Nom_Comm'];
header("Location: Liste_Prospects.php");
}
else
{
header("Location: Erreur_Connexion.php");
}
mysqli_close ($ressource);
}
?>

Qqun a-t'il une idée ?

Merci

Posté : 12 mai 2006, 11:20
par charabia
Juste une info pour toi, la version wamp est à la 1.6.3, pourquoi ne prends-tu pas la dernière version ?

Posté : 12 mai 2006, 11:25
par Galliwok
Par expérience, je suis les mises à jour avec du retard car bien souvent les versions sortent avec qques dysfonctionnement.

Je ne parle pas uniquement de Wamp, cela vaut pour une grande majorité de programme style Microsoft comme le pack office et les Versions de Windows qui comportent de nombreux Sevice Pack.

De plus, la dernière version de Wamp fonctionne avec Apache2 (je crois) et j'ai lu qu'il fallait changé du code.....et j'ai pas trop le temps en ce moment.

Posté : 12 mai 2006, 11:28
par charabia
ça suit souvent les hébergeurs les mises à jour :)

Perso j'avais la 1.6.1 qui fonctionne parfaitement.

Pour ton souci, est-ce juste la redirection qui ne marche pas ? Tes sessions sont bien créees ?

Posté : 12 mai 2006, 11:33
par Galliwok
Oui c'est juste la redirection qui ne fonctionne pas.
Le code est inchangé et cela focntionnait bien en 1.4.5 RC1.

Je clique sur le bouton "Valider" et les 2 champrs (login et mot de passe) sont effacés et le curseur se repositionne sur le champ "Login".

Posté : 12 mai 2006, 11:39
par charabia
Comment sont constituées tes pages ? Une seule unique ou en deux ? Form + redirection ?

Montres nous le code du form aussi.

Posté : 12 mai 2006, 11:41
par Galliwok
En deux page.

La première s'intitule "Connexion.php"
et la seconde "Liste_Prospect.php"

Posté : 12 mai 2006, 11:43
par charabia
Donnes nous le code complet de "Connexion.php" si ce n'est pas trop long, avec le formulaire html compris.

Posté : 12 mai 2006, 11:47
par Galliwok
OK
en tout cas merci pour le temps que tu me consacres.
<?
// OUVERTURE DE LA SESSION AVEC ACCES A LA BASE DES PROSPECTS
session_start();
include("Config.inc.php");
if ($ressource == false)
{
    exit();
}

// SAISIE DU LOGIN ET DU MOT DE PASSE
$Login = $_POST[Login];
$Paswd = $_POST[Mot_de_passe];

// Drapeau de Modification servant à savoir si l'on revient de l'écran de Modification
$_SESSION['modif'] = 0;
$_SESSION['debut_liste'] = 0;

// Initialisation de variables globales servant à la recherche des Prospects
$_SESSION['Nom']        = '';
$_SESSION['CP']         = '';
$_SESSION['Ville']      = '';
$_SESSION['Site']       = '';
$_SESSION['Succursale'] = '1';
$_SESSION['Structure']  = '1';
$_SESSION['Service']    = '1';
$_SESSION['Fonction']   = '1';

// Variable Globale utile pour le tri Ascendant et Descendant des colonnes
$_SESSION['Tri_Visite'] = 'DESC';

// CVariable Globale servant à compter les pages dans la liste des prospects
$_SESSION['num_page'] = 1;

// VERIFICATION SI LE LOGIN ET LE MOT DE PASSE SONT CORRECT
if ($_POST[Btn_Valider] != "")
{
    $Sql = "SELECT Login, Password, Code_Comm, Nom_Comm, Prenom_Comm FROM Utilisateur
            WHERE Login = '".$Login."' AND Password = '".$Paswd."'";
    $Resultat = mysqli_query ($ressource, $Sql);
    if ($Tab = mysqli_fetch_assoc($Resultat))
    {
        $_SESSION['Login']       = $Login;
        $_SESSION['Nom_Comm']    = $Tab['Nom_Comm'];
        $_SESSION['Prenom_Comm'] = $Tab['Prenom_Comm'];
        $_SESSION['Code_Comm']   = $Tab['Code_Comm'];
        header("Location: Liste_Prospects.php");
    }
    else
    {
        header("Location: Erreur_Connexion.php");
    }
    mysqli_close ($ressource);
}
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Connectez-vous !!!</title>
</head>
<body bgcolor="#ffffff" link="#ff0000" vlink="#0000ff" text="#000000" background="back.gif"  topmargin=0 leftmargin=0>
<form action="ConnexionProspect.php" method="post" name="formulaire" enctype="multipart/form-data">
<a name=top></a>

<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td><img src="blnk.gif" width=9 height=1></td>
<td><img src="blnk.gif" width=172 height=1></td>
<td><img src="blnk.gif" width=9 height=1></td>
<td><img src="blnk.gif" width=126 height=1></td>
<td><img src="blnk.gif" width=137 height=1></td>
<td><img src="blnk.gif" width=30 height=1></td>
<td><img src="blnk.gif" width=18 height=1></td>
<td><img src="blnk.gif" width=1 height=1></td>
<td><img src="blnk.gif" width=82 height=1></td>
<td><img src="blnk.gif" width=54 height=1></td>
<td><img src="blnk.gif" width=165 height=1></td>
<td><img src="blnk.gif" width=132 height=1></td>
</tr>
<tr>
<td width=9 height=19></td>
<td width=172></td>
<td width=9></td>
<td width=126></td>
<td width=137></td>
<td width=30></td>
<td width=18></td>
<td width=1></td>
<td width=82></td>
<td width=54></td>
<td width=165></td>
<td width=132></td>
</tr>
<tr>
<td height=29></td>
<td width=926 height=29 colspan=11 rowspan=1 valign=top align=left>
<img width=926 height=29 border=0 src="entete.gif"></td>
</tr>
<tr>
<td height=4></td>
<td colspan=11></td>
</tr>
<tr>
<td height=61></td>
<td width=181 height=61 colspan=2 rowspan=1 valign=top align=left>
<img width=181 height=61 border=0 src="logo_proteor.gif"></td>
<td colspan=9></td>
</tr>
<tr>
<td height=7></td>
<td colspan=11></td>
</tr>
<tr>
<td height=46></td>
<td></td>
<td width=622 height=46 colspan=9 rowspan=1 valign=top align=left>

<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=3 height=3></td>
<td width=614></td>
<td width=3></td>
</tr>
<tr>
<td height=37></td>
<td width=614 height=37 valign=top align=left>

<p align=center><center><font face="Georgia" color=#000000 size=6><I>Connectez-vous !!!<br></I></font>
</td>
<td></td>
</tr>
<tr>
<td height=3></td>
<td colspan=2></td>
</tr>
</table>

</td>
<td></td>
</tr>
<tr>
<td height=38></td>
<td colspan=11></td>
</tr>
<tr>
<td height=22></td>
<td colspan=3></td>
<td width=185 height=22 colspan=3 rowspan=1 valign=top align=left>

<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=3 height=3></td>
<td width=177></td>
<td width=3></td>
</tr>
<tr>
<td height=15></td>
<td width=177 height=15 valign=top align=left>

<p align=center><center><font face="Times New Roman" color=#000000 size=2>Saisissez votre nom d'utilisateur<br></font>
</td>
<td></td>
</tr>
<tr>
<td height=3></td>
<td colspan=2></td>
</tr>
</table>

</td>
<td></td>
<td width=136 height=23 colspan=2 rowspan=2 valign=top align=left>
<input type="text" name="Login" maxlength=255 size=16 value="">
</td>
<td colspan=2></td>
</tr>
<tr>
<td height=1></td>
<td colspan=7></td>
<td colspan=2></td>
</tr>
<tr>
<td height=11></td>
<td colspan=11></td>
</tr>
<tr>
<td height=22></td>
<td colspan=3></td>
<td width=167 height=22 colspan=2 rowspan=1 valign=top align=left>

<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=3 height=3></td>
<td width=158></td>
<td width=3></td>
</tr>
<tr>
<td height=15></td>
<td width=158 height=15 valign=top align=left>

<p align=center><center><font face="Times New Roman" color=#000000 size=2>Saisissez votre mot de passe<br></font>
</td>
<td></td>
</tr>
<tr>
<td height=3></td>
<td colspan=2></td>
</tr>
</table>

</td>
<td colspan=2></td>
<td width=136 height=23 colspan=2 rowspan=2 valign=top align=left>
<input type="password" name="Mot_de_passe" maxlength=255 size=16 value="">
</td>
<td colspan=2></td>
</tr>
<tr>
<td height=1></td>
<td colspan=7></td>
<td colspan=2></td>
</tr>
<tr>
<td height=11></td>
<td colspan=11></td>
</tr>
<tr>
<td height=23></td>
<td colspan=4></td>
<td width=131 height=23 colspan=4 rowspan=1 valign=top align=left>
<input type="submit" name="Btn_Valider" value="Connexion">
</td>
<td colspan=3></td>
</tr>
<tr>
<td height=82></td>
<td colspan=11></td>
</tr>
<tr>
<td height=138></td>
<td width=926 height=138 colspan=11 rowspan=1 valign=top align=left>
<img width=926 height=138 border=0 src="organisation.gif"></td>
</tr>
<tr>
<td height=13></td>
<td colspan=11></td>
</tr>
<tr>
<td height=54></td>
<td width=926 height=54 colspan=11 rowspan=1 valign=top align=left>

<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=3 height=3></td>
<td width=918></td>
<td width=3></td>
</tr>
<tr>
<td height=47></td>
<td width=918 height=47 valign=top align=left>

<p align=center><center><font face="Arial" color=#000000 size=1><B>TÉLÉPHONE&nbsp;: 00 00 00 00 00<br>TÉLÉCOPIE&nbsp;: 00 00 00 00 00<br>MESSAGERIE&nbsp;: [email protected]<br></B></font>
</td>
<td></td>
</tr>
<tr>
<td height=3></td>
<td colspan=2></td>
</tr>
</table>

</td>
</tr>
</table>

<a name=bottom></a>
</form>
</body>
</html>

Posté : 12 mai 2006, 11:54
par charabia
Le forum est là pour ça ;)

Essaies ceci :
<?php
// OUVERTURE DE LA SESSION AVEC ACCES A LA BASE DES PROSPECTS 
session_start();
include("Config.inc.php");
if ($ressource == false)
{
    exit();
}

// SAISIE DU LOGIN ET DU MOT DE PASSE
if( isset($_POST['Login']) && $_POST['Login']!="" )
	$Login = $_POST['Login'];
else
	$Login = "";
	
if(isset($_POST['Mot_de_passe']) && $_POST['Mot_de_passe']!="" )
	$Paswd = $_POST['Mot_de_passe'];
else
	$Paswd = "";

// Drapeau de Modification servant à savoir si l'on revient de l'écran de Modification
$_SESSION['modif'] = 0;
$_SESSION['debut_liste'] = 0;

// Initialisation de variables globales servant à la recherche des Prospects
$_SESSION['Nom'] = '';
$_SESSION['CP'] = '';
$_SESSION['Ville'] = '';
$_SESSION['Site'] = '';
$_SESSION['Succursale'] = '1';
$_SESSION['Structure'] = '1';
$_SESSION['Service'] = '1';
$_SESSION['Fonction'] = '1';

// Variable Globale utile pour le tri Ascendant et Descendant des colonnes
$_SESSION['Tri_Visite'] = 'DESC';

// CVariable Globale servant à compter les pages dans la liste des prospects
$_SESSION['num_page'] = 1;

// VERIFICATION SI LE LOGIN ET LE MOT DE PASSE SONT CORRECT
if (isset($_POST['Btn_Valider']) && $_POST['Btn_Valider'] != "")
{ 
    $Sql = "SELECT Login, Password, Code_Comm, Nom_Comm, Prenom_Comm FROM Utilisateur 
            WHERE Login = '".$Login."' AND Password = '".$Paswd."'";
    $Resultat = mysqli_query($ressource, $Sql);
    if ($Tab = mysqli_fetch_assoc($Resultat))
    {
        $_SESSION['Login'] = $Login;
        $_SESSION['Nom_Comm'] = $Tab['Nom_Comm'];
        $_SESSION['Prenom_Comm'] = $Tab['Prenom_Comm'];
        $_SESSION['Code_Comm'] = $Tab['Code_Comm'];
        header("Location: Liste_Prospects.php");
    }
    else
    {
        header("Location: Erreur_Connexion.php");
    }
    mysqli_close($ressource);
}
?>
Autre chose, ton form redirige vers ConnexionProspect.php. C'est connexion.php ou ConnexionProspect.php ?

Posté : 12 mai 2006, 12:04
par Galliwok
non c'est bien ConnexionProspect.php comme indiqué dans le form.

Sinon, ben ca marche pas non plus le code que tu m'as indiqué.
Même effet.
Je ne suis pas redirigé.

Posté : 12 mai 2006, 14:15
par charabia
et ça ?
<?php
// OUVERTURE DE LA SESSION AVEC ACCES A LA BASE DES PROSPECTS 
session_start();
include("Config.inc.php");
if ($ressource == false)
{
    exit();
}

// SAISIE DU LOGIN ET DU MOT DE PASSE
if(isset($_POST['Login']))
	$Login = $_POST['Login'];
else
	$Login = "";
	
if(isset($_POST['Mot_de_passe']))
	$Paswd = $_POST['Mot_de_passe'];
else
	$Paswd = "";

// Drapeau de Modification servant à savoir si l'on revient de l'écran de Modification
$_SESSION['modif'] = 0;
$_SESSION['debut_liste'] = 0;

// Initialisation de variables globales servant à la recherche des Prospects
$_SESSION['Nom'] = '';
$_SESSION['CP'] = '';
$_SESSION['Ville'] = '';
$_SESSION['Site'] = '';
$_SESSION['Succursale'] = '1';
$_SESSION['Structure'] = '1';
$_SESSION['Service'] = '1';
$_SESSION['Fonction'] = '1';

// Variable Globale utile pour le tri Ascendant et Descendant des colonnes
$_SESSION['Tri_Visite'] = 'DESC';

// CVariable Globale servant à compter les pages dans la liste des prospects
$_SESSION['num_page'] = 1;

// VERIFICATION SI LE LOGIN ET LE MOT DE PASSE SONT CORRECT
if (isset($_POST['Btn_Valider']) && $_POST['Btn_Valider'] != "")
{ 
    $Sql = "SELECT Login, Password, Code_Comm, Nom_Comm, Prenom_Comm FROM Utilisateur 
            WHERE Login = '".$Login."' AND Password = '".$Paswd."'";
    $Resultat = mysqli_query($ressource, $Sql);
	$nbligne = mysqli_num_rows($Resultat);
    if($nbligne != 0)
    {
        $_SESSION['Login'] = $Login;
        $_SESSION['Nom_Comm'] = $Tab['Nom_Comm'];
        $_SESSION['Prenom_Comm'] = $Tab['Prenom_Comm'];
        $_SESSION['Code_Comm'] = $Tab['Code_Comm'];
        header("Location: Liste_Prospects.php");
    }
    else
    {
        header("Location: Erreur_Connexion.php");
    }
    mysqli_close($ressource);
}
?>
J'ai utilisé mysqli_num_rows pour calculer le nombre d'enregistrement retourné. Si c'est différent de 0 alors un enregistrement existe donc c'est ok, sinon erreur.

Posté : 12 mai 2006, 14:22
par Galliwok
Ca marche pas non plus.

Ce n'est pas un problème avec SQL car même avec uniquement le code ci-dessous, ca ne marche pas :
// OUVERTURE DE LA SESSION AVEC ACCES A LA BASE DES PROSPECTS
session_start();
include("Config.inc.php");
if ($ressource == false)
{
exit();
}

// VERIFICATION SI LE LOGIN ET LE MOT DE PASSE SONT CORRECT
if (isset($_POST['Btn_Valider']) && $_POST['Btn_Valider'] != "")
{
header("Location: Liste_Prospects.php");
}
else
{
header("Location: Erreur_Connexion.php");
}

Posté : 12 mai 2006, 14:24
par charabia
Faut voir étape par étape dans ce cas.

Si tu fais juste :
// VERIFICATION SI LE LOGIN ET LE MOT DE PASSE SONT CORRECT 
if (isset($_POST['Btn_Valider']) && $_POST['Btn_Valider'] != "") 
{ 
echo "ok";
} 
else 
{ 
echo "nonok";
}
Verdict ?

Posté : 12 mai 2006, 14:28
par Galliwok
Rien ne se passe....

Ca se comporte comme avant...