par
locos974 » 07 avr. 2012, 22:16
Le code de ma page register en entier :
<?php session_start(); include_once("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" xml:lang="fr" lang="fr">
<head>
<title><?php echo $name;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="Copyright" />
<meta name="classification" content="" />
<meta name="description" content="<?php echo $name;?>" />
<meta name="keywords" content="<?php echo $name;?>" />
<meta name="author" content="Sorrow" />
<link href="style/theme.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="shortcut icon" href="<?php echo $ico;?>">
<script type="text/javascript" src="script.js" ></script>
<script type="text/javascript" src="js/jquery.js" ></script>
<script type="text/javascript" src="js/function.js"></script>
<script type="text/javascript" src="js/flash.js"></script>
<script type="text/javascript">
function Popup_Picture() {window.open( "http://localhost/Web/index.php?page=404", "Changer d'Avatar", "height = 450, width = 510, status = no, resizable = no, directories = no, location = no, scrollbars = yes, toolbar = no, menubar = no" )}
</script>
<style type='text/css'>
#header { width: 1025px; height: 351px; background: url(images/theme/header/header1.png) top no-repeat; margin: 0 auto; }
.Style1 {
color: #FF0000;
font-weight: bold;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="sidebar_top">
<div class="sidebar">
<span class="left">
<div class="realmlist"><?php if (empty($_SESSION['account']))
{ ?>
<?php if (empty($_SESSION['account']))
{ ?>
<input readonly="readonly" value="Bienvenu Visiteur" /> </div>
<?php }
else
{
?>
<input readonly="readonly" value="Bienvenu <?php echo $_SESSION['account'] ;?>" /> </div>
<?php }?>
<?php }
else
{
?>
<input readonly="readonly" value="Bienvenu <?php echo $_SESSION['account'] ;?>" /> </div>
<?php }?>
</span>
<div class="clear"></div>
</div>
</div>
</div>
<?php include('menu.php')?>;
</div>
<div class="wrap-content">
<div id="box_758">
<div class="top">
<img src="images/theme/title/.png">
</div><div class="back">
<div class="box_top"></div>
<div class="box">
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './forum/';
$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>
</body>
</html>
</div>
<div class="box_footer"></div>
</div>
<div class="back_footer"></div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div id="footer">
<div class="text">
<br />
<br />
<br />
<br />
<img src="images/theme/footer.png" alt="" /><br /><br />
</div>
</div>
</body>
</html>
Le code de ma page register en entier :
[php]<?php session_start(); include_once("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" xml:lang="fr" lang="fr">
<head>
<title><?php echo $name;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="Copyright" />
<meta name="classification" content="" />
<meta name="description" content="<?php echo $name;?>" />
<meta name="keywords" content="<?php echo $name;?>" />
<meta name="author" content="Sorrow" />
<link href="style/theme.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="shortcut icon" href="<?php echo $ico;?>">
<script type="text/javascript" src="script.js" ></script>
<script type="text/javascript" src="js/jquery.js" ></script>
<script type="text/javascript" src="js/function.js"></script>
<script type="text/javascript" src="js/flash.js"></script>
<script type="text/javascript">
function Popup_Picture() {window.open( "http://localhost/Web/index.php?page=404", "Changer d'Avatar", "height = 450, width = 510, status = no, resizable = no, directories = no, location = no, scrollbars = yes, toolbar = no, menubar = no" )}
</script>
<style type='text/css'>
#header { width: 1025px; height: 351px; background: url(images/theme/header/header1.png) top no-repeat; margin: 0 auto; }
.Style1 {
color: #FF0000;
font-weight: bold;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="sidebar_top">
<div class="sidebar">
<span class="left">
<div class="realmlist"><?php if (empty($_SESSION['account']))
{ ?>
<?php if (empty($_SESSION['account']))
{ ?>
<input readonly="readonly" value="Bienvenu Visiteur" /> </div>
<?php }
else
{
?>
<input readonly="readonly" value="Bienvenu <?php echo $_SESSION['account'] ;?>" /> </div>
<?php }?>
<?php }
else
{
?>
<input readonly="readonly" value="Bienvenu <?php echo $_SESSION['account'] ;?>" /> </div>
<?php }?>
</span>
<div class="clear"></div>
</div>
</div>
</div>
<?php include('menu.php')?>;
</div>
<div class="wrap-content">
<div id="box_758">
<div class="top">
<img src="images/theme/title/.png">
</div><div class="back">
<div class="box_top"></div>
<div class="box">
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './forum/';
$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>
</body>
</html>
</div>
<div class="box_footer"></div>
</div>
<div class="back_footer"></div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div id="footer">
<div class="text">
<br />
<br />
<br />
<br />
<img src="images/theme/footer.png" alt="" /><br /><br />
</div>
</div>
</body>
</html>[/php]