Page 1 sur 2

Probleme inscription

Posté : 08 mai 2010, 14:15
par Perrin
Bonjours a tous,

Voila j'ai créer ma page d'inscription, mais quand je veux m'inscrire il y a ces 3 messages d'erreur qui s'affiche:

Deprecated: Function ereg() is deprecated in C:\wamp\www\php\inscription.php on line 19

Deprecated: Function ereg() is deprecated in C:\wamp\www\php\inscription.php on line 24

Warning: mysql_close(): no MySQL-Link resource supplied in C:\wamp\www\php\inscription.php on line 157

Pourtant il me semble avoir fais sa correctement.

Merci a vous

Re: Probleme inscription

Posté : 08 mai 2010, 14:21
par visualight
Bonjour,

Si tu savais nous donner le code qui pose problème ...
Sinon, j'ai trouvé ça sur le net : http://forum.maarch.org/viewtopic.php?f=18&t=582

Alors vrai ou pas, je sais pas et ce serait bien d'avoir ton code pour vérifier d'abord si il est correct ;)

A+ ;)

Re: Probleme inscription

Posté : 08 mai 2010, 14:24
par Perrin

Code : Tout sélectionner

19 if(!ereg("^[A-Za-z0-9_]{4,20}$", $_POST["TB_Nom_Utilisateur"])) { $message = "Votre nom d'utilisateur doit comporter entre 4 et 20 caractères<br />\n"; $message .= "L'utilisation de l'underscore est autorisée"; } 24 elseif(!ereg("^[A-Za-z0-9]{4,}$", $_POST["TB_Mot_de_Passe"])) { $message = "Votre mot de passe doit comporter au moins 4 caractères"; } 157 mysql_close();

Re: Probleme inscription

Posté : 08 mai 2010, 14:34
par visualight
Confirmation : http://php.net/manual/fr/function.ereg.php
A mon avis c'est ta version de php qui est en cause, ton code me semblant correct

;)

Re: Probleme inscription

Posté : 08 mai 2010, 14:37
par Perrin
On ma conseiller d'utiliser la fonction PCRE, mais j'ignore ce que c'est :?

Re: Probleme inscription

Posté : 08 mai 2010, 14:38
par visualight
Tu peux utiliser preg_match à la place
http://php.net/manual/fr/function.preg-match.php

Re: Probleme inscription

Posté : 08 mai 2010, 14:39
par visualight

Re: Probleme inscription

Posté : 08 mai 2010, 14:57
par Perrin
fonctionne toujours pas :x

Re: Probleme inscription

Posté : 08 mai 2010, 15:00
par visualight
Comment as tu fais ton masque avec preg_match ?

Re: Probleme inscription

Posté : 08 mai 2010, 15:43
par Perrin
if(!preg_match("^[A-Za-z0-9_]{4,20}$", $_POST["TB_Nom_Utilisateur"]))

Re: Probleme inscription

Posté : 08 mai 2010, 15:46
par visualight
Le masque n'est pas le même avec preg_match que ereg.
EXEMPLE : if(preg_match("/^$regex$/", $variable))
if(!preg_match("/^[A-Za-z0-9_]{4,20}$/", $_POST["TB_Nom_Utilisateur"]))
Au passage vérifie quand même que $_POST["TB_Nom_Utilisateur"] te renvoie bien quelque chose.

A+ ;)

Re: Probleme inscription

Posté : 08 mai 2010, 15:51
par Perrin
ce qui veut dire que sa donne sa ?

Code : Tout sélectionner

if(preg_match("/^$regex$/", $variable))["TB_Nom_Utilisateur"]))

Re: Probleme inscription

Posté : 08 mai 2010, 15:54
par visualight
:non: #-o

Essaye un peu ça
if(preg_match("/^[A-Za-z0-9_]{4,20}$/", $_POST["TB_Nom_Utilisateur"])) {
echo 'OK';
} else {
echo 'PAS OK';
}

Re: Probleme inscription

Posté : 08 mai 2010, 16:00
par Perrin
et l'autre sa donen cela ? :)

Code : Tout sélectionner

elseif!preg_match("/^[A-Za-z0-9_]{4,20}$/", $_POST["TB_Mot_De_Passe"])) {

Re: Probleme inscription

Posté : 08 mai 2010, 16:04
par visualight
Essaye déjà avec un seul preg_match pour voir ce que ça raconte et si c'est OK, passe aux autres.