session_start();
require("config/config.php");
function TagliaStringa($stringa, $max_char){
if(strlen($stringa)>$max_char){
$stringa_tagliata=substr($stringa, 0,$max_char);
$last_space=strrpos($stringa_tagliata," ");
$stringa_ok=substr($stringa_tagliata, 0,$last_space);
return $stringa_ok."...";}
else{return $stringa;}
}
$operazione = $_POST['operazione'];
$nome = $_POST['nome'];
$cognome = $_POST['cognome'];
$username = $_POST['username'];
$telefono = $_POST['telefono'];
$email = $_POST['email'];
$password = $_POST['password'];
$password2=$_POST['password2'];
$cod1=$_POST['cod1'];
$cod2=$_POST['cod2'];
if ($operazione == 'iscriviti') {
if(empty($nome)
or empty($cognome)
or empty($username)
or empty($password)
or empty($password2)
or $password != $password2
or empty($cod2)
or empty($email)
or (!ereg('^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$', $email))
) {
if(empty($nome)) { $alert_1="
ERRORE! Il campo nome è obbligatorio.
"; }
if(empty($cognome)) { $alert_2="ERRORE! Il campo cognome è obbligatorio.
"; }
if(empty($username)) { $alert_10="ERRORE! Il campo username è obbligatorio.
"; }
if(empty($email)) { $alert_3="ERRORE! Devi inserire un indirizzo e-mail.
"; }
else if(!ereg('^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$', $email)) {$alert_4="ERRORE! Devi inserire un indirizzo e-mail valido.
";}
if(empty($password)) {$alert_5="ERRORE! Inserisci la tua password.
";}
if(empty($password2)) {$alert_6="ERRORE! Non ha inserito la password di conferma.
";}
if ($password != $password2) {$alert_7="ERRORE! La password di conferma non corrisponde.
";}
if(empty($cod2)) { $alert_8="ERRORE! Non ha inserito il codice di verifica
"; }
if ($cod1 != $cod2) { $alert_9="ERRORE!Il codice di verifica non corrisponde
";}
} else {
$query = "insert into reggina_utenti (email,password,nome,cognome,telefono,username)
values ('$email', '$password', '$nome', '$cognome', '$telefono', '$username')";
mysql_query($query) or die (mysql_error());
header("Location: filter.php");
}
}
echo "
REGGINA NEWS
";
require("menu.php");
echo "
";
require("left.php");
echo "
";
require("banner_centrale.php");
echo "
";
$conferma_iscrizione=$_GET['conferma_iscrizione'];
if ($conferma_iscrizione=='ok'){
echo "
Grazie per esserti iscritti. Puoi adesso essere protagonista sul nostro sito inserendo le tue foto pił belle.
";
} else {
function CreateCode($Length,$Elements)
{
mt_srand((double)microtime()*1000000);
$sCode="";
for($i=0;$i<$Length;$i++)
{
$sCode .= $Elements[ mt_rand(0,strlen($Elements)-1) ];
}
return $sCode;
}
$cod1=CreateCode(5, "ABCDE12345");
echo "
$alert_1$alert_2$alert_10$alert_3$alert_4$alert_5$alert_6$alert_7$alert_8$alert_9
";
}
echo "
";
require("right.php");
echo "
.
";
require("sponsor.php");
echo "
";
require("banner_grande.php");
echo "
";
require("footer.php");
echo "
";
?>