So, this is the code:
<?php
echo "<h2>Sign Up!</h2>";
$signup = $_POST['signup'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
if ($signup) {
if ($firstname && $lastname && $email && $password && $confirmpassword) {
//check if passwords match
if ($password == $confirmpassword) {
//check length of fields
if (strlen($email)>55 || strlen($email)<6 || strlen($password)>25 || strlen($password)<6) {
echo "<font color=\"#8B0000\">Please enter a real email address and a password that is more than 6 characters.</font>";
}
else {
echo "Congratulations. You've been registered to iShare. Before you can log in, you must check the email you provided us for an activation email.";
//generate random string for activation process
$random = rand(23456789, 98765432);
//open database
$connect = mysql_connect("localhost", "root", "");
mysql_select_db("ishareusers… //select database
$queryreg = mysql_query("
INSERT INTO users VALUES ('', '$email', '$password', '$random', '0')
");
$lastid = mysql_insert_id;
//send activation email
$to = $email;
$subject = "iShare Account Activation";
$headers = "From: [email protected]." . "X-Mailer: PHP/".phpversion();
ini_set(SMTP, $server);
$server =
$body = "
Dear user, \n\n
You need to activate your account with the link below:
<a href=\"http://localhost/ishare/activate.… \n\n
Thank you for creating an account with iShare
";
//function to send email
mail($to, $subject, $body, $headers);
}
}
}
else {
echo "<font color=\"#8B0000\">Your passwords do not match.</font>";
}
}
else {
echo "<font color=\"#8B0000\">Please fill in <b>all</b> fields.</font>";
}
?>
<form method="post" action="index.php">
<table>
<tr><td>First Name: </td><td><input type="text" name="firstname" value="<?php echo $firstname ?>" /></td></tr>
<tr><td>Last Name: </td><td><input type="text" name="lastname" value="<?php echo $lastname ?>" /></td></tr>
<tr><td>Email
(this will be
your username): </td><td><input type="text" name="email" value="<?php echo $email ?>" /></td></tr>
<tr><td>Password: </td><td><input type="password" name="password" value="<?php echo $password ?>" /></td></tr>
<tr><td>Confirm Password: </td><td><input type="password" name="confirmpassword" value="<?php echo $confirmpassword ?>" /></td></tr>
<tr><td><input type="submit" name="signup" value="Sign Up!" style="background-color: #DC143C; width: 60px; height: 25px;" /></td><td>*Note: You will have to add more information to your profile once your email has been activated.</td></tr>
</table>
</form>
Everything works except on the above the little signup box that i created, after the "Congratulations, you're account has been created" (bla bla bla) there's an error message. It says that my php.ini file must be configured but i already did so i don't know what's wrong
<?php
echo "<h2>Sign Up!</h2>";
$signup = $_POST['signup'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
if ($signup) {
if ($firstname && $lastname && $email && $password && $confirmpassword) {
//check if passwords match
if ($password == $confirmpassword) {
//check length of fields
if (strlen($email)>55 || strlen($email)<6 || strlen($password)>25 || strlen($password)<6) {
echo "<font color=\"#8B0000\">Please enter a real email address and a password that is more than 6 characters.</font>";
}
else {
echo "Congratulations. You've been registered to iShare. Before you can log in, you must check the email you provided us for an activation email.";
//generate random string for activation process
$random = rand(23456789, 98765432);
//open database
$connect = mysql_connect("localhost", "root", "");
mysql_select_db("ishareusers… //select database
$queryreg = mysql_query("
INSERT INTO users VALUES ('', '$email', '$password', '$random', '0')
");
$lastid = mysql_insert_id;
//send activation email
$to = $email;
$subject = "iShare Account Activation";
$headers = "From: [email protected]." . "X-Mailer: PHP/".phpversion();
ini_set(SMTP, $server);
$server =
$body = "
Dear user, \n\n
You need to activate your account with the link below:
<a href=\"http://localhost/ishare/activate.… \n\n
Thank you for creating an account with iShare
";
//function to send email
mail($to, $subject, $body, $headers);
}
}
}
else {
echo "<font color=\"#8B0000\">Your passwords do not match.</font>";
}
}
else {
echo "<font color=\"#8B0000\">Please fill in <b>all</b> fields.</font>";
}
?>
<form method="post" action="index.php">
<table>
<tr><td>First Name: </td><td><input type="text" name="firstname" value="<?php echo $firstname ?>" /></td></tr>
<tr><td>Last Name: </td><td><input type="text" name="lastname" value="<?php echo $lastname ?>" /></td></tr>
<tr><td>Email
(this will be
your username): </td><td><input type="text" name="email" value="<?php echo $email ?>" /></td></tr>
<tr><td>Password: </td><td><input type="password" name="password" value="<?php echo $password ?>" /></td></tr>
<tr><td>Confirm Password: </td><td><input type="password" name="confirmpassword" value="<?php echo $confirmpassword ?>" /></td></tr>
<tr><td><input type="submit" name="signup" value="Sign Up!" style="background-color: #DC143C; width: 60px; height: 25px;" /></td><td>*Note: You will have to add more information to your profile once your email has been activated.</td></tr>
</table>
</form>
Everything works except on the above the little signup box that i created, after the "Congratulations, you're account has been created" (bla bla bla) there's an error message. It says that my php.ini file must be configured but i already did so i don't know what's wrong