144 lines
5.3 KiB
PHP
144 lines
5.3 KiB
PHP
<?php
|
|
//Cette page permet aux utilisateurs de s'inscrire
|
|
include('config.php');
|
|
?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
|
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
|
|
<script src="jquery.js"></script>
|
|
<script src="menus.js"></script>
|
|
<link rel="shortcut icon" type="image/x-icon" href="Images/favicon_ie.ico">
|
|
<title>Festiv'Algo - Inscription</title>
|
|
</head>
|
|
<body>
|
|
<div id="content">
|
|
<?php include("menu.php"); ?>
|
|
<?php
|
|
if(isset($_POST['username'], $_POST['password'], $_POST['passverif'], $_POST['email']) and $_POST['username']!='')
|
|
{
|
|
require_once('recaptchalib.php');
|
|
$privatekey = "6LeGoPgSAAAAAO_tUiza5OeW3R6JiPB5nrQzeKt4";
|
|
$resp = recaptcha_check_answer ($privatekey,
|
|
$_SERVER["REMOTE_ADDR"],
|
|
$_POST["recaptcha_challenge_field"],
|
|
$_POST["recaptcha_response_field"]);
|
|
|
|
if (!$resp->is_valid) {
|
|
// What happens when the CAPTCHA was entered incorrectly
|
|
$form = true;
|
|
$message = 'Votre réponse au test anti-spam est incorrecte.';
|
|
} else {
|
|
// Your code here to handle a successful verification
|
|
|
|
//On enleve lechappement si get_magic_quotes_gpc est active
|
|
if(get_magic_quotes_gpc())
|
|
{
|
|
$_POST['username'] = stripslashes($_POST['username']);
|
|
$_POST['password'] = stripslashes($_POST['password']);
|
|
$_POST['passverif'] = stripslashes($_POST['passverif']);
|
|
$_POST['email'] = stripslashes($_POST['email']);
|
|
}
|
|
if($_POST['password']==$_POST['passverif'])
|
|
{
|
|
if(strlen($_POST['password'])>=6)
|
|
{
|
|
if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+\.?)*[a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',$_POST['email']))
|
|
{
|
|
$username = mysql_real_escape_string($_POST['username']);
|
|
$password = mysql_real_escape_string($_POST['password']);
|
|
$email = mysql_real_escape_string($_POST['email']);
|
|
$dn = mysql_num_rows(mysql_query('select id from users where username="'.$username.'"'));
|
|
if($dn==0)
|
|
{
|
|
$dn2 = mysql_num_rows(mysql_query('select id from users'));
|
|
$id = $dn2+1;
|
|
//On enregistre les informations dans la base de donnee
|
|
if(mysql_query('insert into users(id, username, password, email, signup_date) values ('.$id.', "'.$username.'", "'.$password.'", "'.$email.'", "'.time().'")'))
|
|
{
|
|
$form = false;
|
|
|
|
//echo '<script language="Javascript">document.location.replace("forum.php");</script>';
|
|
echo '<div class="message">Inscription effectuée avec succès !<br />Vous pouvez désormais vous connecter sur le forum</div>';
|
|
|
|
}
|
|
else
|
|
{
|
|
$form = true;
|
|
$message = 'Une erreur est survenue lors de l\'inscription.';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$form = true;
|
|
$message = 'Un autre utilisateur utilise déjà ce nom.';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$form = true;
|
|
$message = 'L\'adresse mail que vous avez entrée n\'est pas valide.';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$form = true;
|
|
$message = 'Votre mot de passe contient moins de 6 caractères.';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$form = true;
|
|
$message = 'Vos mots de passe ne sont pas identiques.';
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$form = true;
|
|
}
|
|
if($form)
|
|
{
|
|
if(isset($message))
|
|
{
|
|
echo '<div class="message">'.$message.'</div>';
|
|
}
|
|
//On affiche le formulaire
|
|
?>
|
|
<div class="content">
|
|
<div class="box">
|
|
<div class="box_left">
|
|
<a href="<?php echo $url_home; ?>">Index du forum</a> > Inscription
|
|
</div>
|
|
<div class="box_right">
|
|
<a href="signup.php">Inscription</a> - <a href="login.php">Connexion</a>
|
|
</div>
|
|
<div class="clean"></div>
|
|
</div>
|
|
<form action="signup.php" method="post">
|
|
<p style="text-align: left; margin-left: 15px; margin-bottom: 50px;">Festiv'Algo est un site entièrement gratuit et sécurisé.<br />Il ne divulguera pas votre adresse mail et vos données personnelles.</p>
|
|
<div class="center">
|
|
<label for="username">Nom d'utilisateur</label><input type="text" name="username" value="<?php if(isset($_POST['username'])){echo htmlentities($_POST['username'], ENT_QUOTES, 'UTF-8');} ?>" /><br />
|
|
<label for="password">Mot de passe <span class="small">(6 caractères min.)</span></label><input type="password" name="password" /><br />
|
|
<label for="passverif">Mot de passe <span class="small">(vérification)</span></label><input type="password" name="passverif" /><br />
|
|
<label for="email">Email</label><input type="text" name="email" value="<?php if(isset($_POST['email'])){echo htmlentities($_POST['email'], ENT_QUOTES, 'UTF-8');} ?>" /><br />
|
|
<!--<label for="avatar">Image perso<span class="small">(facultatif)</span></label><input type="text" name="avatar" value="<?php if(isset($_POST['avatar'])){echo htmlentities($_POST['avatar'], ENT_QUOTES, 'UTF-8');} ?>" /><br />-->
|
|
<br />
|
|
<?php
|
|
require_once('recaptchalib.php');
|
|
$publickey = "6LeGoPgSAAAAADfNngmfplGzBlV7ZiCQm7gxnPfD"; // you got this from the signup page
|
|
echo "<div id='capcha'>".recaptcha_get_html($publickey)."</div>";
|
|
?>
|
|
<br /><input type="submit" value="Envoyer" />
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</body>
|
|
<?php include("bas_de_page.php"); ?>
|
|
</html>
|