salve ragazzi volevo chiedervi perche in questo switch se metto il break finale mi da errore
Codice PHP:
<?php
if($Ability_page ==1){
error_reporting(ALL);
@session_start();
$ts = time();
if(!isset($_POST['action'])){$action="";}else{$action = $_POST['action'];}
if(!isset($_POST['nome'])){$nome="";}else{$nome = $_POST['nome'];}
if(!isset($_POST['cognome'])){$cognome="";}else{$cognome = $_POST['cognome'];}
if(!isset($_POST['telefono'])){$telefono="";}else{$telefono = $_POST['telefono'];}
if(!isset($_POST['email'])){$email="";}else{$email = $_POST['email'];}
if(!isset($_POST['comment'])){$comment="";}else{$comment = $_POST['comment'];}
if(!isset($_POST['code'])){$code="";}else{$code = $_POST['code'];}
if(!isset($_POST['consenzo_trattamento_dati'])){$consenzo_trattamento_dati="";}else{$consenzo_trattamento_dati = $_POST['consenzo_trattamento_dati']?1:0;}
$CONFIG['check_table'] = array(
"action" => "check_global",
"nome" => "check_global",
"cognome" => "check_global",
"telefono" => "check_global",
"email" => "check_global",
"comment" => "check_global",
"code" => "check_global",
"consenzo_trattamento_dati" => "check_global"
);
function check_username($nome,$cognome,$telefono,$email,$comment,$code,$consenzo_trattamento_dati){
global $CONFIG;
$nome = trim($nome);
$cognome = trim($cognome);
$telefono = trim($telefono);
$email = trim($email);
$comment = trim($comment);
$code = trim($code);
$consenzo_trattamento_dati = trim($consenzo_trattamento_dati);
$controllo_pages = mysql_query("SELECT enable_captch_contact FROM inpostazioni");
while($array=mysql_fetch_array($controllo_pages)){
$enable_captch_contact = $array['enable_captch_contact'];
}
switch($enable_captch_contact){
case 0:
if(!isset($nome) OR $nome =='' ){
echo "<div class = 'error_page'>Il campo nome è obbligatorio</div>";
return;
}if(!isset($cognome) OR $cognome =='' ){
echo "<div class = 'error_page'>Il campo cognome è obbligatorio</div>";
return;
}if(!isset($telefono) OR $telefono =='' ){
echo "<div class = 'error_page'>Il campo telefono è obbligatorio</div>";
return;
}if(!isset($email) OR $email =='' ){
echo "<div class = 'error_page'>Il campo email è obbligatorio</div>";
return;
}elseif(!isset($email) OR (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) ) {
echo "<div class = 'error_page'>Il seguente indirizzo email :[b]$email[/b]
E'composto da caratteri non validi!</div>";
return;
}if(!isset($comment) OR $comment =='' ){
echo "<div class = 'error_page'>Il campo comment è obbligatorio</div>";
return;
}if ($consenzo_trattamento_dati = $_POST['consenzo_trattamento_dati'] == 0) {
echo"<div class='error_page' >Non approvando il consenso hai dati personai
non possiamo prelevare la tuaiscrizione</div>";
return;
}
else{
return "OK";
}
break;
case 1:
if(!isset($nome) OR $nome =='' ){
echo "<div class = 'error_page'>Il campo nome è obbligatorio</div>";
return;
}if(!isset($cognome) OR $cognome =='' ){
echo "<div class = 'error_page'>Il campo cognome è obbligatorio</div>";
return;
}if(!isset($telefono) OR $telefono =='' ){
echo "<div class = 'error_page'>Il campo telefono è obbligatorio</div>";
return;
}if(!isset($email) OR $email =='' ){
echo "<div class = 'error_page'>Il campo email è obbligatorio</div>";
return;
}elseif(!isset($email) OR (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) ) {
echo "<div class = 'error_page'>Il seguente indirizzo email :[b]$email[/b]
E'composto da caratteri non validi!</div>";
return;
}if(!isset($comment) OR $comment =='' ){
echo "<div class = 'error_page'>Il campo comment è obbligatorio</span>";
return;
}if ($consenzo_trattamento_dati = $_POST['consenzo_trattamento_dati'] == 0) {
echo"<div class='error_page' >Non approvando il consenso hai dati personai
non possiamo prelevare la tuaiscrizione</div>";
return;
}
if (isset($_POST['code'])) {
if (md5(strtoupper($_POST['code'])) != $_SESSION['__img_code__']) {
echo "<div class = 'error_page'>Il Codice di sicurezza non è esatto</div>";
}else{
return "OK";
}
}
}
break;
}
echo"<div class='pagediv' >";
echo "<h2>".$title_pages."</h2>";
echo"
";
if($action =="send")
{
$controllo = check_username($nome,$cognome,$telefono,$email,$comment,$code,$consenzo_trattamento_dati);
if($controllo != "OK"){
echo $controllo;
} else{
echo" e tutto ok e fin qui lo script va come il barcarolo";
}
}
echo"
";
?>
<form action="" method="post" >
<input type="hidden" name="action" value="send" />
<table class="tabinputtex" border="0" cellpadding="3" cellspacing="0" align="center">
<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>Telefono *</td><td><input type="text" name="telefono" /></td>
</tr>
<tr>
<td>Email *</td><td><input type="text" name="email" /></td>
</tr>
<tr>
<td>Motivazione *</td><td><input type="text" name="" /></td>
</tr>
<tr>
<td>Messaggio *</td><td><textarea cols="25" rows="5" name="comment"></textarea></td>
</tr>
</table>
<?php
$controllo_pages = mysql_query("SELECT enable_captch_contact FROM inpostazioni");
while($array=mysql_fetch_array($controllo_pages)){
$enable_captch_contact = $array['enable_captch_contact'];
}
if($enable_captch_contact==1){?>
<table class="tabinputtex" border="0" cellpadding="3" cellspacing="0" align="center">
<tr>
<td><input type="text" size="" name="code" style="width:60px;" /> </td>
<td class ="partecaptcha"> <?php
if (!extension_loaded('gd')){
echo"non sono presenti le librerie gd";
}else{
echo"[img]$path_site/include/captcha/code.php?id=$ts[/img][url='".$_SERVER['][img]$path_site/images/icone_mini/arrow_refresh.gif[/img][/url]";
}?>
</td>
</tr>
</table>
<?php }?>
<table border="0" cellpadding="3" cellspacing="0" align="center">
<tr>
<td>Acconsento al trattamento dei dati personali ai sensi dell’art. 13 D.Lgs. 196/2003 Si? </td>
</tr>
<tr>
<td>Si<input type="radio" name="consenzo_trattamento_dati" value="1" /></td>
</tr>
</table>
<table border="0" cellpadding="3" cellspacing="0" align="center">
<tr>
<td> <input type="submit" value="invia" class="pulsant" /> </td> <td><input type="reset" value="reset" class="pulsant" /> </td>
</tr>
</table>
</form>
<?php
echo"</div>";
}else{
echo"<div class='pagediv' >";
echo "<h2>".$title_pages."</h2>";
echo"
";
echo "<div class = 'error_page'>LA PAGINA E STATA DISABILITATA DALL AMMINISTRATORE</div>";
echo "</div>>";
}
?>