PHP expert |
|
heb nu een script en die stuur activatiemail naar je toe om je mail te activeren
maar returnt errors trug (die ik heb ingesteld )
let niet op mijn brak engels
ik kom er echt niet uit, hoop dat jullie wel een fout(je) zien
..::register.php::..
$activationcode = CreateKey();
$password = md5($_POST[password]);
$select = "SELECT * FROM members";
$query = mysql_query($select);
$count = mysql_num_rows($query);
if($count == 0){
$insert = "INSERT INTO leden (id, username, password, email, homepage, ip, activation, date, rank, subitle)
VALUES ('', '" . $_POST['username'] . "', '" . $password . "', '" . $_POST[email] . "', '" . $_POST[homepage] . "', '" . $_SERVER[REMOTE_ADDR] . "', '" . $activationcode . "', NOW(), 'Beheerder', 'Beheerder')";
$query = mysql_query($insert);
}
else {
$insert = "INSERT INTO leden (id, username, password, email, homepage, ip, activation, date)
VALUES ('', '" . $_POST['username'] . "', '" . $password . "', '" . $_POST[email] . "', '" . $_POST[homepage] . "', '" . $_SERVER[REMOTE_ADDR] . "', '" . $activationcode . "', NOW())";
$query = mysql_query($insert);
}
echo "You are succesfully signed up, please activate your account with the activationcode we've just send to your email address";
mail("$_POST['email']", "Aanmelding activeren", "Hi $_POST['username'],
Thank you for your registration on $site_name. To complete your registration, please click the link below.
$site_url/?page=users/activate&code=$activationcode
If you have not registert, just ignore this email and the account will be deleted in 48 hours
$webmaster,
$site_url", "From: $site_name <$webmaster_email>\nReturn-path: $webmaster_email");
$activationcode = CreateKey(); $password = md5($_POST[password ]); $select = "SELECT * FROM members"; if($count == 0){ $insert = "INSERT INTO leden (id, username, password, email, homepage, ip, activation, date, rank, subitle) VALUES ('', '" . $_POST['username'] . "', '" . $password . "', '" . $_POST[email] . "', '" . $_POST[homepage] . "', '" . $_SERVER[REMOTE_ADDR] . "', '" . $activationcode . "', NOW(), 'Beheerder', 'Beheerder')"; } else { $insert = "INSERT INTO leden (id, username, password, email, homepage, ip, activation, date) VALUES ('', '" . $_POST['username'] . "', '" . $password . "', '" . $_POST[email] . "', '" . $_POST[homepage] . "', '" . $_SERVER[REMOTE_ADDR] . "', '" . $activationcode . "', NOW())"; } echo "You are succesfully signed up, please activate your account with the activationcode we've just send to your email address"; mail("$_POST['email']", "Aanmelding activeren", "Hi $_POST['username'], Thank you for your registration on $site_name. To complete your registration, please click the link below. $site_url/?page=users/activate&code=$activationcode If you have not registert, just ignore this email and the account will be deleted in 48 hours $webmaster, $site_url", "From: $site_name <$webmaster_email>\nReturn-path: $webmaster_email");
..::activate.php::..
$select = "SELECT * FROM members WHERE activation='" . $_GET[code] . "' AND UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(date) < 48*60*60";
$query = mysql_query($select);
$exist = mysql_num_rows($query);
$list = mysql_fetch_array($query);
if($exist == 1 AND $list[activation] == $_GET[code] AND $list[activation] != 1){
mysql_query("UPDATE members SET activation = '1' WHERE activation = '" . $_GET[code] . "'");
echo "Your account has been activated.";
}
else {
echo "There was an error by activating your account<br /><br />";
echo "- Your account has already been activated<br />";
echo "- Your activation code is not correct<br />";
echo "- You didn't activated within 48 hours<br />";
}
?>
$select = "SELECT * FROM members WHERE activation='" . $_GET[code] . "' AND UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(date) < 48*60*60"; if($exist == 1 AND $list[activation] == $_GET[code] AND $list[activation] != 1){ mysql_query("UPDATE members SET activation = '1' WHERE activation = '" . $_GET[code ] . "'"); echo "Your account has been activated."; } else { echo "There was an error by activating your account<br /><br />"; echo "- Your account has already been activated<br />"; echo "- Your activation code is not correct<br />"; echo "- You didn't activated within 48 hours<br />"; } ?>
..::mysql tabel::..
Citaat: CREATE TABLE members (
id int(10) NOT NULL auto_increment,
username varchar(255) NOT NULL default '',
password varchar(255) NOT NULL default '',
email varchar(255) NOT NULL default '',
homepage varchar(255) NOT NULL default '',
ip varchar(15) NOT NULL default '',
activation int(10) NOT NULL default '0',
date datetime NOT NULL default '0000-00-00 00:00:00',
subtitle varchar(20) NOT NULL default 'Lid',
rank varchar(15) NOT NULL default 'Lid',
warnings int(1) NOT NULL default '0',
avatar varchar(50) NOT NULL default 'Geen',
PRIMARY KEY (id)
) TYPE=MyISAM;");
Citaat: Rensjuh edit:
code verwijderd.
Zie regels 7.2.3:
voorzie het bericht eventueel van codefragmenten (géén lappen text)
|