PHPbb3 -> inscription sur mon site
Posté : 30 mars 2012, 22:34
Bonjour,
J'ai un gros problème qui persiste. Quand je met le formulaire :
Un problème surgit :
Ce qui m'intrigue le plus c'est que quand je le met sur une page vierge tout va bien.
Sinon, si je l'assemble sur ma page que j'ai crée, sa me met l'erreur ci-dessus.
Merci d'avance. Locos974.
J'ai un gros problème qui persiste. Quand je met le formulaire :
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB3/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
require($phpbb_root_path . 'includes/functions_user.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
//ajout captcha
if ($config['enable_confirm'])
{
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_REG);
}
//
$error=array();
$data = array(
'username' => utf8_normalize_nfc(request_var('username', '', true)),
'password' => request_var('password', '', true),
'password_confirm' => request_var('password_confirm', '', true),
'email' => strtolower(request_var('email', '')),
'email_confirm' => strtolower(request_var('email_confirm', '')),
);
if (isset($_POST['submit']))
{
$error = validate_data($data, array(
'username' => array(
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
array('username', '')),
'password' => array(
array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
array('password')),
'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
'email' => array(
array('string', false, 6, 60),
array('email')),
'email_confirm' => array('string', false, 6, 60),
));
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
//ajout captcha
if ($config['enable_confirm'])
{
$vc_response = $captcha->validate($data);
if ($vc_response !== false)
{
$error[] = $vc_response;
}
if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts'])
{
$error[] = $user->lang['TOO_MANY_REGISTERS'];
}
}
//
if (!sizeof($error))
{
if ($data['password'] != $data['password_confirm'])
{
$error[] = $user->lang['NEW_PASSWORD_ERROR'];
}
if ($data['email'] != $data['email_confirm'])
{
$error[] = $user->lang['NEW_EMAIL_ERROR'];
}
}
if (!sizeof($error))
{
$group_name = 'REGISTERED';
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name = '" . $db->sql_escape($group_name) . "'
AND group_type = " . GROUP_SPECIAL;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$row)
{
trigger_error('NO_GROUP');
}
$group_id = $row['group_id'];
$user_row = array(
'username' => $data['username'],
'user_password' => phpbb_hash($data['password']),
'user_email' => $data['email'],
'group_id' => (int) $group_id,
'user_timezone' => (float) $config['board_timezone'],
'user_dst' => $config['board_dst'],
'user_lang' => basename($user->lang_name),
'user_type' => USER_NORMAL,
'user_actkey' => '',
'user_ip' => $user->ip,
'user_regdate' => time(),
'user_inactive_reason' => 0,
'user_inactive_time' => 0,
);
$user_id = user_add($user_row);
if ($user_id === false)
{
trigger_error('NO_USER', E_USER_ERROR);
}
//ajout captcha
if ($config['enable_confirm'])
{
$captcha->reset();
}
$url = append_sid('./index.php');
die( '<html>
<head>
<META http-equiv="Refresh"
content="10; URL=' . $url . '">
</head>
<body>
Votre compte a été enregistré avec succès<br />
Vous allez être maintenant redirigé vers <a href="' . $url . '">la page d\'index</a>
</body>
</html>');
}
}
echo '<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Vous enregistrer</title>
</head>
<body>
<form method="post">
<h1>Vous enregistrer</h1>';
//ajout patcha
if ($config['enable_confirm'])
{
$confirm_id = $captcha->confirm_id;
$confirm_code = true;
$confirm_image='<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&confirm_id=' . $confirm_id . '&type=' . CONFIRM_REG) . '" alt="" title="" />';
}
if (sizeof($error))
{
echo '<font color="red"><b>' . implode('<br />', $error) . '</b></font>';;
}
?>
<table>
<tr>
<td align="right">Pseudonyme:</td>
<td><input type="text" tabindex="1" name="username" size="25" value="<?php echo $data['username']; ?>" /></td>
</tr>
<tr>
<td align="right">Mot de passe:</td>
<td><input type="password" tabindex="2" name="password" size="25" value="<?php echo $data['password']; ?>" /></td>
</tr>
<tr>
<td align="right">Confirmez votre mot de passe:</td>
<td><input type="password" tabindex="3" name="password_confirm" size="25" value="<?php echo $data['password_confirm']; ?>" /></td>
</tr>
<tr>
<td align="right">Email:</td>
<td><input type="text" tabindex="4" name="email" size="25" maxlength="100" value="<?php echo $data['email']; ?>" /></td>
</tr>
<tr>
<td align="right">Confirmez votre Email</td>
<td><input type="text" tabindex="5" name="email_confirm" size="25" maxlength="100" value="<?php echo $data['email_confirm']; ?>" /></td>
</tr>
<?php
if ($confirm_code)
{
?>
<tr>
<td><?php echo $user->lang['CONFIRM_CODE'] . '<br />' . $user->lang['CONFIRM_CODE_EXPLAIN']; ?></td>
<td><input type="hidden" name="confirm_id" value="<?php echo $confirm_id; ?>" /><?php echo $confirm_image; ?></td>
</tr>
<tr>
<td> </td>
<td><input type="text" name="confirm_code" id="confirm_code" size="8" maxlength="8" /></td>
</tr>
<?php
}
?>
<tr>
<td colspan="2" align="center">
<input type="reset" value="Remettre à zéro" name="reset" />
<input type="submit" name="submit" id ="submit" value="S'enregistrer" />
</td>
</tr>
</table>
</form>
</body>
</html>
Qui viens de : http://forums.phpbb-fr.com/documentatio ... l#p1183736Un problème surgit :
Code : Tout sélectionner
Fatal error: Cannot redeclare deregister_globals() (previously declared in C:\wamp\www\Mini-entreprise\forum\includes\startup.php:28) in C:\wamp\www\Mini-entreprise\forum\includes\startup.php on line 98Sinon, si je l'assemble sur ma page que j'ai crée, sa me met l'erreur ci-dessus.
Merci d'avance. Locos974.