codice:
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<center>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','543','height','58','src','striscia sopra','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','striscia sopra' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="543" height="58">
<param name="movie" value="striscia sopra.swf" />
<param name="quality" value="high" />
<embed src="striscia sopra.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="543" height="58"></embed>
</object></noscript>
</p>
</p>
<?
//setto le variabili
$dbhost = "localhost";
$dbusername = "root";
$dbuserpass = "";
$dbname = "iscrizione";
$cartella = 'images/'; //cartella in cui salvare le foto, controllare i permessi di scrittura!
function ControlloEmail($email){
$result = eregi("^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$",$email);
if($result == false){
return false;
}else{
return true;
}
}
mysql_connect ($dbhost, $dbusername, $dbuserpass);
if (!mysql_select_db($dbname)) die(mysql_error());
// Define post fields into simple variables
$first_name = $_POST['first_name'];
$cognome = $_POST['cognome'];
$username = $_POST['username'];
$email = $_POST['email'];
$indirizzo = $_POST['indirizzo'];
$citta = $_POST['citta'];
$stato = $_POST['stato'];
$giorno = $_POST['giorno'];
$mese = $_POST['mese'];
$anno = $_POST['anno'];
$peso = $_POST['peso'];
$altezza = $_POST['altezza'];
$capelli = $_POST['capelli'];
$occhi = $_POST['occhi'];
$sesso = $_POST['sesso'];
/* Lets strip some slashes in case the user entered
any escaped characters. */
$first_name = stripslashes($first_name);
$cognome = stripslashes($cognome);
$username = stripslashes($username);
$email = stripslashes($email);
$indirizzo = stripslashes($indirizzo);
$citta = stripslashes($citta);
$stato = stripslashes($stato);
$giorno = stripslashes($giorno);
$mese = stripslashes($mese);
$anno = stripslashes($anno);
$peso = stripslashes($peso);
$altezza = stripslashes($altezza);
$capelli = stripslashes($capelli);
$occhi = stripslashes($occhi);
$sesso = stripslashes($sesso);
$file_new_name = '';
$file_new_path = '';
if(ControlloEmail($email))
echo 'Indirizzo email corretto... si procederà con la registrazione nel db';
else {
echo 'Indirizzo email non valido!';
exit(0);
}
if (isset($_FILES) && is_uploaded_file($_FILES['miofile']['tmp_name'])){//se c'è un file da caricare...lo faccio!
//se c'è un file da caricare...lo faccio!
// questo script è tutto tranne che sicuro...
// ecco un buona guida daseguire
// http://forum.html.it/forum/showthre...threadid=694523
$file_temp= $_FILES['miofile']['tmp_name'];
$file_new_name= time().'_'.$_FILES['miofile']['name']; //aggiungo un numero all'inizio
$file_new_path = $cartella . $file_new_name;
if($_FILES["miofile"]["type"] == "image/gif" || $_FILES["miofile"]["type"] == "image/jpg" || $_FILES["miofile"]["type"] == "image/png"){
// ESEGUO L'UPLOAD CONTROLLANDO L'ESITO
if (move_uploaded_file($file_temp, $file_new_path))
echo 'File caricato correttamente';
else
echo "Si sono verificati dei problemi durante l'Upload. Ti preghiamo di segnalarci il problema, <a href=http://www.ccc.com/segnala-errori.asp>clicca qui.</a>";
} else //nn ha una estensione valida
die("ATTENZIONE. Puoi caricare solamente file con la seguenti estenzioni: .jpg .png .gif");
}
/* Do some error checking on the form posted fields */
if((!$first_name) || (!$cognome) || (!$username) || (!$email) || (!$indirizzo) || (!$citta) || (!$stato) || (!$giorno) || (!$mese) || (!$anno) || (!$peso) || (!$altezza) || (!$capelli) || (!$occhi) || (!$sesso)){
echo 'I campi non sono corretti!
';
if(!$first_name){
echo "Inserisci il nome.
";
}
if(!$cognome){
echo "Inserisci il cognome.
";
}
if(!$username){
echo "Inserisci un username.
";
}
if(!$email){
echo "Inserisci un email valida.
";
}
if(!$indirizzo){
echo "Inserisci l'indirizzo.
";
}
if(!$citta){
echo "Inserisci la tua città.
";
}
if(!$stato){
echo "Inserisci lo stato.
";
}
if(!$giorno){
echo "Inserisci il giorno.
";
}
if(!$mese){
echo "Inserisci il mese.
";
}
if(!$anno){
echo "Inserisci l'anno.
";
}
if(!$peso){
echo "Inserisci il tuo peso.
";
}
if(!$altezza){
echo "Inserisci la tua altezza.
";
}
if(!$capelli){
echo "Inserisci il colore dei capelli.
";
}
if(!$occhi){
echo "Inserisci il colore degli occhi.
";
}
if(!$sesso){
echo "Inserisci il tuo sesso.
";
}
include 'join_form.php'; // Show the form again!
/* End the error checking and if everything is ok, we'll move on to
creating the user account */
exit(); // if the error checking has failed, we'll exit the script!
}
/* Let's do some checking and ensure that the user's email address or username
does not exist in the database */
$sql_email_check = mysql_query("SELECT email FROM utenti WHERE email='$email'");
$sql_username_check = mysql_query("SELECT username FROM utenti WHERE utenti='$username'");
$email_check = @mysql_num_rows($sql_email_check);
$username_check = @mysql_num_rows($sql_username_check);
if(($email_check > 0) || ($username_check > 0)){
echo "Errore nella compilazione:
";
if($email_check > 0){
echo "[b]Quest'email è stata già registrata da un'altro utente.!
";
unset($email);
}
if($username_check > 0){
echo "Username già in uso da un'altro utente!
";
unset($username);
}
include 'index.htm'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}
/* Everything has passed both error checks that we have done.
It's time to create the account! */
/* Random Password generator.
http://www.phpfreaks.com/quickcode/R...nerator/56.php
We'll generate a random password for the
user and encrypt it, email it and then enter it into the db.
*/
function makeRandomPassword() {
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$random_password = makeRandomPassword();
$db_password = md5($random_password);
$query = "SELECT username FROM utenti WHERE username = '" . $username ."' OR email = '" . $email . "'";
$rs = mysql_query($query);
if(mysql_num_rows($rs)>0) {
echo "esiste già uno unsername o l'indirizzo email inserito";
} else {
// Enter info into the Database.
$info2 = htmlspecialchars($info);
$sql = mysql_query("INSERT INTO utenti (first_name, cognome, username, password, email, indirizzo, citta, stato, giorno, mese, anno, peso, altezza, capelli, occhi, sesso, nomei, signup_date, decrypted_password)
VALUES('$first_name', '$cognome', '$username', '$db_password','$email', '$indirizzo', '$citta', '$stato', '$giorno', '$mese', '$anno', '$peso', '$altezza', '$capelli', '$occhi', '$sesso', '$file_new_name', now(), '$random_password')") or die (mysql_error());
if(!$sql){
echo 'Errore nel creare il tuo account. Contatta il webmaster.';
} else {
$userid = mysql_insert_id();
$activatepath = "activate.php?id=$userid&code=$db_password";
// Let's mail the user!
$subject = "Messaggio da: $sitename";
$message = "Caro $first_name $cognome,
Sei stato appena registrato su $sitepath !
Per attivare l'account, clicca qui: $sitepath$activatepath
Dopo l'attivazione, inserisci questi dati:
Username: $username
Password: $random_password
Conserva Username e Password per un login futuro.
Grazie!
Webmaster, $sitename
Questa è un email automatica, non rispondere a quest'email!";
mail($email, $subject, $message, "From: $sitename <$adminemail>\nX-Mailer: PHP/" . phpversion());
echo 'Le informazioni per il tuo account ti sono stati inviati nella tua casella email! Controlla la tua email!';
}
?>
</p>
HomePage</p>
</p>
</p>
</p>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','543','height','58','src','striscia sotto','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','striscia sotto' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="543" height="58">
<param name="movie" value="striscia sotto.swf" />
<param name="quality" value="high" />
<embed src="striscia sotto.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="543" height="58"></embed>
</object></noscript>
</p>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','220','height','39','src','logo','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','logo' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="220" height="39">
<param name="movie" value="logo.swf" />
<param name="quality" value="high" />
<embed src="logo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="220" height="39"></embed>
</object></noscript>
</p>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','543','height','28','src','copyright','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','copyright' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="543" height="28">
<param name="movie" value="copyright.swf" />
<param name="quality" value="high" />
<embed src="copyright.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="543" height="28"></embed>
</object></noscript>
</p>
</center>
l'errore e':