[RESOLU] probleme de connection
Posté : 12 oct. 2010, 11:05
Bonjour,
Je suis novice en PHP et j'ai probleme de conection quand j'ai migre de server.
Jai un formulaire tout bete:
c'est ou le bug? (je ne recoit pas de message d'erreur)
Merci
Je suis novice en PHP et j'ai probleme de conection quand j'ai migre de server.
Jai un formulaire tout bete:
<form method="post" action="verif_login.php">
<table width="166" border="0" cellspacing="2" cellpadding="0">
<tr>
<td align="right"><span class="Style1">Login</span> </td>
</tr>
<tr>
<td align="right">Login
<input name="textfield" type="text" maxlength="20" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap">Password <input name="textfield2" type="password" maxlength="20" /></td>
</tr>
<tr>
<td align="right"><input type="submit" name="envoyer" value="" style="background-color : transparent; background-image:url(graphics/bt_valider.png); width:69px; height:23px;border:0px;" />
</td>
</tr>
</table></form>
Dans verif_login.php j'ai ca:
<?php
include_once("functions.php");
if(isset($_POST["textfield"]) && $_POST["textfield"] != "" && isset($_POST["textfield2"]) && $_POST["textfield2"] != ""){
$pwd_convert = hash_pass($_POST["textfield2"]);
$result = verif_user($_POST["textfield"],$_POST["textfield2"]);
if(!empty($result) && mysql_num_rows($result)> 0){
$row = mysql_fetch_assoc($result);
if(is_array($row)) {
extract($row);
}
session_start();
$_SESSION["connected"] = "validepeople".substr($use_chemin,40,7);
$_SESSION["admin"] = "adminpeople".$use_is_admin;
header("Location:".$use_chemin);
}else{
header("Location:http://www.toto.com/");
}
}else{
header("Location:http://www.toto22.com/");
}
?>
et dans functions.php j'ai ca:
<?php
function hash_pass($password) {
$clef = 'xxxxxxxxx';
return md5($password . $clef);
}
function verif_user($id, $pwd) {
$connexion = mysql_connect('localhost','xxxx','xxxx');
$result = mysql_query("SELECT * FROM db_name.users where use_login='".$id."' and use_pwd='".$pwd."'");
return $result;
}
?>
Le probleme est que ca me renvoi toujours a http://www.toto.com. ma session ne s'ouvre pas.c'est ou le bug? (je ne recoit pas de message d'erreur)
Merci