Hello everyone ! Sorry for my very bad english… I’m french
I’ve decided to create a member area for my site.
I’ve decided to created a page for a register:
And an page for the data processing, i’ve also create a data base for this with phpmyadmin.
My problème is when i’m register, my registration is not created in data base…
Have you got a idea ? Thank you for your help !
Hi @julien!
Did you created the member area using Wesite Builder, Wordpress, or did you programmed it by yourself? Could you please share the code with us, if so?
Hi @NGiNX, thank for your reply, i use a tutorial for created an member area the code for the formular page is
<h3>Inscription</h3'>
<form action="traitement-signin.php'" method="post">
<table>
<tbody>
<tr>
<td><label for="id">pseudo du jeu goodgame empire : </label></td>
<td><input id="id" name="id" type="text" placeholder="Pseudo" /></td>
</tr>
<tr>
<td><label for="em">Renseignez un email valide: </label></td>
<td><input id="em" name="email" type="email" placeholder="Email" /></td>
</tr>
<tr>
<td><label for="em2">Confirmez votre email : </label></td>
<td><input id="em2" name="email2" type="email" placeholder="Email à nouveau" /></td>
</tr>
<tr>
<td><label for="md">Choisissez un mot de passe : </label></td>
<td><input id="md" name="password" type="password" placeholder="Mot de passe" /></td>
</tr>
<tr>
<td><label for="md2">Confirmez le mot de passe : </label></td>
<td><input id="md2" name="password2" type="password" placeholder="Mot de passe à nouveau" /></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><input name="submit" type="submit" value="S'inscrire" /></td>
</tr>
</tbody>
</table>
</form><!--?php if(isset($_GET['error'])) { echo $_GET['error']; } ?-->
<footer></footer>
**and the treatment page :**
[insert_php]
$connect = new PDO("mysql:host=3306;dbname=id1860125_alliance";charset=utf8,"id1860125_admin","MYPASSWORD");
if(isset($_POST['submit'])) {
if(isset($_POST['id'],$_POST['email'],$_POST['email2'],$_POST['password'],$_POST['password2'])) {
if(!empty($_POST['id']) AND !empty($_POST['email']) AND !empty($_POST['email2']) AND !empty($_POST['password']) AND !empty($_POST['password2'])) {
$pseudo = htmlspecialchars($_POST['id']);
$email = htmlspecialchars($_POST['email']);
$email2 = htmlspecialchars($_POST['email2']);
$password = htmlspecialchars($_POST['password']);
$password2 = htmlspecialchars($_POST['password2']);
if(strlen($pseudo) < 255) { if(strlen($pseudo) > 4) {
if($email == $email2) {
if($password == $password2) {
if(strlen($password) > 8) {
if(strlen($password) < 255) { $insert = $connect->prepare("INSERT INTO users (pseudo,email,password) VALUES (?,?,?)");
$insert->execute(array($pseudo,$email,$password));
} else {
header('location:signin.php?error=Votre mot de passe doit contenir moins de 255 caractères');
}
} else {
header('location:signin.php?error=Votre mot de passe doit contenir plus de 8 caractères');
}
} else {
header('location:signin.php?error=Vos mots de passes sont différents');
}
} else {
header('location:signin.php?error=Vos adresses mails sont différentes');
}
} else {
header('location:signin.php?error=Le pseudo doit faire plus de 4 caractères');
}
} else {
header('location:signin.php?error=Le pseudo doit être inférieur à 255 caractères');
}
} else {
header('location:signin.php?error=Veuillez remplir tous les champs');
}
}
}
[/insert_php]
Thank you for your help.
Avoid using >
and other HTML entities in PHP scripts, as these would most likely be treated badly.
Simply use >
, <
, >=
, <=
, etc
Thank for your reply, i going to modify the code and i speak if it works.
After modify the code, my probleme is not resolved. I’ve forgot modify this genre of code “>” or an another ? Sorry the code don’t want use ctrl+shift+C he don’t work…
[insert_php]
$connect = new
PDO(“mysql:host=3306;dbname=id1860125_alliance”;charset=utf8,“id1860125_admin”,“MYPASSWORD”);
if(isset($_POST[‘submit’])) {
if(isset($_POST[‘id’],$_POST[‘email’],$_POST[‘email2’],$_POST[‘password’],$_POST[‘password2’])) {
if(!empty($_POST[‘id’]) AND !empty($_POST[‘email’]) AND !empty($_POST[‘email2’]) AND !empty($_POST[‘password’]) AND !empty($_POST[‘password2’])) {
$pseudo = htmlspecialchars($_POST[‘id’]);
$email = htmlspecialchars($_POST[‘email’]);
$email2 = htmlspecialchars($_POST[‘email2’]);
$password = htmlspecialchars($_POST[‘password’]);
$password2 = htmlspecialchars($_POST[‘password2’]);
if(strlen($pseudo) < 255) { if(strlen($pseudo) > 4) {
if($email == $email2) {
if($password == $password2) {
if(strlen($password) > 8) {
if(strlen($password) < 255) { $insert = $connect->prepare(“INSERT INTO users (pseudo,email,password) VALUES (?,?,?)”);
$insert->execute(array($pseudo,$email,$password));
} else {
header(‘location:signin.php?error=Votre mot de passe doit contenir moins de 255 caractères’);
}
} else {
header(‘location:signin.php?error=Votre mot de passe doit contenir plus de 8 caractères’);
}
} else {
header(‘location:signin.php?error=Vos mots de passes sont différents’);
}
} else {
header(‘location:signin.php?error=Vos adresses mails sont différentes’);
}
} else {
header(‘location:signin.php?error=Le pseudo doit faire plus de 4 caractères’);
}
} else {
header(‘location:signin.php?error=Le pseudo doit être inférieur à 255 caractères’);
}
} else {
header(‘location:signin.php?error=Veuillez remplir tous les champs’);
}
}
}
[/insert_php]
Hmm, please remove [insert_php]
and [/insert_php]
.
Do you get any kind of errors when running the code? It’s hard to debug it like this, especially for me because I don’t know/use MySQL PDO.
Go to 000webhost cPanel > Settings > General > Show errors > On in order to display PHP errors, and try executing the code again. Reply what errors do you get (if you get any)
Hi when i go to modify the code for this page, an erreur poster when i visit or modify all page
Yes, there are some issues with 000webhost network right now. Please press CTRL+F5.
If the problem persists, please try again after a while.
We are sorry for inconvenience
@NGiNX The problem is resolve.
I go to modify the code.
When i del [insert_php] and [/insert_php] (i have install a extension)
The code is display when i visite this page
Oh, if you have an extension, then leave them
Have you got an idea for the problem to creat a member, this problem is strange,
I have searched with google and I have not found a solution …
What you have written is just the code for updating a MySQL database.
Please follow one of these articles, according to your needs. I hope they help:
• https://www.codeinwp.com/blog/build-a-membership-site-on-wordpress/
• https://www.karks.com/creating-members-only-content-wordpress/
Thank i go to read this page
I want creat a member area for to that access to the site be limited just for members. It’s possible with this tutorial ?
In what way, or for what do you want to create a member area precisely?
Do you want it to be like on a forum? Or do you want to create just a form on which different users can complete with different information?
I’ve created this site for create a zoned for my alliance in a games. We want use this site for chat, tutorial and strategy. I want than all member have a this account. Because i want each person to be identified for both the time they can access the site and who comments or speaks either identifies for at once.
In this case I strongly suggest you to go with bbPress.
It has been created by those from Wordpress and I think it will comply with your needs
Thanks you for your help ! I go to download this extension and testing this.
I’ve don’t choise this extension i found “Ultimate Member” an extension he can manage member area create a zone for member and personalize this profile. I want thank you for your help. Without you i would not find.