No anzi piu' mi parli e piu' mi aiuti una cosa:
Questo e' il mio file register.php
codice:
<?
include 'db.php';
if(!eregi("^[a-z]{5,15}$",$first_name)){
echo "Nome non valido ";
echo "<a href=\"./join_form.php\">Torna</a>";
exit;
}
if(!eregi("^[a-z]{5,15}$",$last_name)){
echo "Cognome non valido ";
echo "<a href=\"./join_form.php\">Torna</a>";
exit;
}
if (!eregi( "^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$",$email_address)){
echo "E-mail non valida ";
echo "<a href=\"./join_form.php\">Torna</a>";
exit;
}
if(!eregi("^[0-9a-z]{4,10}$",$username)){
echo "Username non valido ";
echo "<a href=\"./join_form.php\">Torna</a>";
exit;
}
// Define post fields into simple variables
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email_address = $_POST['email_address'];
$username = $_POST['username'];
/* Lets strip some slashes in case the user entered
any escaped characters. */
$first_name = stripslashes($first_name);
$last_name = stripslashes($last_name);
$email_address = stripslashes($email_address);
$username = stripslashes($username);
/* 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_address FROM users WHERE email_address='$email_address'");
$sql_username_check = mysql_query("SELECT username FROM users WHERE username='$username'");
$email_check = mysql_num_rows($sql_email_check);
$username_check = mysql_num_rows($sql_username_check);
if(($email_check > 0) || ($username_check > 0)){
if($email_check > 0){
echo "[b]La tua E-mail risulta gia\' registrata nel nostro database. Inserisci una diversa E-mail!
";
unset($email_address);
}
if($username_check > 0){
echo "L\' Username risulta gia\' registrato nel nostro database. Inserisci un diverso Username!
";
unset($username);
}
include 'join_form.php'; // 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://cimo.altervista.org/file_regi...passRandom.php
We'll generate a random password for the
user and encrypt it, email it and then enter it into the db.
*/
function makeRandomPassword() {
bla bla =P
$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);
// Enter info into the Database.
$info2 = htmlspecialchars($info);
$sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, username, password, info, signup_date, decrypted_password)
VALUES('$first_name', '$last_name', '$email_address', '$username', '$db_password', '$info2', 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 = "Richiesta registrazione $sitename";
$message = "$first_name $last_name,
Hai inviato la registrazione su $sitepath
Per attivare il tuo account, clicca qui: $sitepath$activatepath
I tuoi dati:
Username: $username
Password: $random_password
CONSERVA QUESTI DATI XCHE' PER LA TUA PRIVACY E QUELLA DEGLI ALTRI I DATI SONO CRIPTATI!!
Grazie!
WebMaster, $sitename
Questa E-mail viene generata automaticamente quindi non rispondere!";
mail($email_address, $subject, $message, "From: $sitename <$adminemail>\nX-Mailer: PHP/" . phpversion());
echo 'La tua richiesta e\' stata inviata alla tua E-mail controlla!';
}
?>
E questo e' il mio file rec.php
codice:
<?php
include 'db.php';
$message="Ciao $username_check,\n ecco i dati di accesso che hai richiesto:\n
nick: $username\n
password: $random_password\n
A presto!!\n
Staff di $nomesito.\n\n\n\n\n";
mail($email_address, $subject, $message, "From: $sitename <$adminemail>\nX-Mailer: PHP/" . phpversion());
/* 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_address FROM users WHERE email_address='$email_address'");
if(email_check >0){
echo "<html>
<head>
<meta http-equiv=\"refresh\" content=\"3;url=./index.htm\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
</head>
<body>
<div align=\"center\" class=tit>I dati richiesti sono stati inviati a $email_address</div>
</body>
</html>";
}else{
echo "Si è verificato un errore
non è stato possibile inviare i dati richiesti a $email_address";
}
?>
Voglio che quando mi sono registrato e tutto .. mettiamo per un fulmine che mi colpisce mentre sto' cac... al bagno mi dimentico la pass ke ho trovato nell'e-mail che mi e' stata inviata e voglio richiederla nuovamente e essere inviata alla mia e-mail
Be' ho fatto questi de file...ma nn va'...dove sbaglio aiutami ti prego voglio capire davvero e risolvere!!
E poi ho notato che nel db quando mi registro la mia e-mail viene tagliata?!!?
codice:
email_address -> 'simone.dagostino@gmail.co'
Mi dai una mano? tnx =)