Hi there,
I am trying to build a registration form, with activation email and so on. But now i finished the code, and besides that the links will obviously not work yet being sent in the email, the page is not loading (blank page). Probably I did some or perhaps even only one stupid mistake which destroys everything again :p .
Well here is the code, I hope you guys can help me 🙂
<?PHP
//Get Config
include("config.inc.php");
//Get Header
include("" . $absolute_path . "/elements/header.php");
//Get DB INFO and Connect
include("" . $absolute_path . "/config/settings.inc.php");
if (isset($_POST['submit'])) {
//Shortening Variables
$userid = $_POST['userid'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$password = md5($_POST['password']);
$vpassword = md5($_POST['vpassword']);
$ad1 = $_POST['ad1'];
$ad2 = $_POST['ad2'];
$zipcode = $_POST['zipcode'];
$hphone = $_POST['hphone'];
$mphone = $_POST['mphone'];
$pemail = $_POST['pemail'];
$agreed = $_POST['agreed'];
$level = 5;
//Passwords match?
if ($password == $vpassword) {
//Agreed to TOS?
if(isset($agreed)) {
//Fill table
$regdata = "INSERT INTO login_table (user_name, user_pass, user_level, user_email, user_fname, user_lname, user_adress, user_adress2, user_zipcode, user_hphone, user_mphone) VALUES ($userid, $level, $pemail, $fname, $lname, $ad1, $ad2, $zipcode, $hphone, $mphone)";
echo $regdata;
#$reg = mysql_query($regdata);
echo "Your registration has sucessfully been submitted";
//Send Activation email
$actcode = print rand(1, 1000000);
$emaildata = "Hello" . $fname . $lname . ", \n\n";
$emaildata . = "Your registration is nearly completed \n";
$emaildata . = "To complete your registration please click the following link: \n\n";
$emaildata . = "" . $public_url . "/members/register.php?userid=" . $userid . "?email=" . $pemail . "?activationcode=" . $actcode . "\n\n";
$emaildata . = "In case you did not request membership on or the registration occured in error you can cancel registration process by clicking the following link or ignoring this E-mail:";
$emaildata . = "" . $public_url . "/members/register.php?userid=" . $userid . "?email=" . $pemail . "?activationcode=" . $actcode . "?cancel=yes \n\n";
$emaildata . = "If you have any further questions do not hestitate to contact us.\n\n\n";
$emaildata . = "Best Regards \n";
#$mail = mail($pemail, Your activation, $emaildata);
echo $emaildata;
echo "An E-mail has been sent to " . $pemail . " with activation instructions.";
} else {
echo "<font color=\"red\">You have to read and agree the TOS</font>";
}
} else {
echo "<font color=\"red\">The passwords did not match.</font>";
}
}
?>
Ok that is the code, just no idea what I have done wrong n00b alert 😃
What you should know is that the actual form and if tags has worked with a simple echo, so it actually saves the data in the variables, but since my sql query and email is there it is not working again. As well I have outcommented the real filling commands and email sending commands and only echo them right now to check the commands easier, but for that the site first has to load .
I hope you can help me, thanks a lot in advance, you guys really help me on coding my site A LOT!!! Thanks for that
best regards
max