si piero, avevo già corretto
infatti ho fatto come hai detto tu ma non riesco a farla funzionare, sto cercando di aggiungere una funzione al tutorial di farina sulla registrazione utente ma non riesco a farla funzionare....
config.php
Codice PHP:
....
$_CONFIG['check_table'] = array(
"username" => "check_username",
"password" => "check_global",
"password2" => "check_global",
"nome" => "check_global",
"cognome" => "check_global",
"email" => "check_global"
);
...
...
...
function check_two_password($password, $password2){
global $_CONFIG;
$password= trim($password);
$password2= trim($password2);
if($password != $password2)
return "attenzione le password non coincidono";
return true;
}
e questa è la pagina che contiene la chiamata al file config.php
Codice PHP:
<?php
include_once("include/config.php");
include_once("include/reg.lib.php");
if(isset($_POST['action']) and $_POST['action'] == 'Invia'){
$ret = reg_check_data($_POST);
$status = ($ret === true) ? reg_register($_POST) : REG_ERRORS;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Login Utente</title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
</head>
<body>
<table cellpadding="0" cellspacing="0" align="ceter">
<tr>
<td><?php include ('header.php'); ?></td>
</tr>
<tr>
<td><?php include ('menu.php'); ?></td>
</tr>
<tr>
<td>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<div align="center">
<table border="0" width="300" class="style1">
<tr>
<td colspan="2" height="10"></td>
</tr>
<tr>
<td>Nome:</td>
<td><input type="text" name="nome"></td>
</tr>
<tr>
<td>Cognome:</td>
<td><input type="text" name="cognome"></td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td>Riscrivi la password:</td>
<td><input type="password" name="password2"></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="action" value="Invia"></td>
</tr>
</table>
</div>
</form>
<div>
<?
switch($status){
case REG_ERRORS:
?>
<span class="style1">Sono stati rilevati i seguenti errori:</span>
<span class="style2">
<?php
foreach($ret as $error)
printf("[b]%s[/b]: %s
", $error[0], $error[1]);
printf("[b]%s[/b]: %s
", $pass);
?>
</span>
<?php
break;
case REG_FAILED:
echo "Registrazione Fallita a causa di un errore interno.";
break;
case REG_SUCCESS:
echo "Registrazione avvenuta con successo.";
require_once('ty.php');
//Vi è stata inviata una email contente le istruzioni per confermare la registrazione.";
break;
}
?>
</div>