Har følgende kode på den php sider der bliver henvist til fra min html form:
<?php
session_start();
mysql_connect("***","***","***");
mysql_select_db("****");
require("countries.php");
require("menu.php");
topmenu();
menuall();
print "
<html>
<head><title> Blabla</title><link rel=\"stylesheet\" href=\"style.css\"></head>
<body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\">
<p>
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"40\" height=\"100%\">
</td>
<td>";
$activationKey = mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
$profiletype = $_POST["profiletype"];
$email = $_POST["email"];
$password = $_POST["password"];
$repeat = $_POST["repeat"];
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$country = $_POST["country"];
$cityname = $_POST["cityname"];
$postalcode = $_POST["postalcode"];
$streetname = $_POST["streetname"];
$streetnumber = $_POST["streetnumber"];
$errorCount = "0";
$tjek = "SELECT email FROM users WHERE email = $_POST['email']";
$resultat = mysql_query($tjek);
if($profiletype == "")
{
echo "Please, choose your profiletype<br>";
$errorCount++;
}
if($email == "")
{
echo "Please, enter your email adress (your username)<br>";
$errorCount++;
}
if($password == "")
{
echo "Please, enter a password<br>";
$errorCount++;
}
if($repeat == "" || $repeat != $password)
{ echo "Your passwords don't match, please enter them carefully<br>";
$errorCount++;
}
if($firstname == "")
{
echo "Please, enter your first name<br>";
$errorCount++;
}
if($lastname == "")
{
echo "Please, enter your first name<br>";
$errorCount++;
}
if($country == "")
{
echo "Please, choose your country from the list<br>";
$errorCount++;}if($cityname == "")
{
echo "Enter your city's name<br>";
$errorCount++;
}
if($postalcode == "")
{
echo "Enter your postal code<br>";
$errorCount++;
}
if($streetname == "")
{
echo "Enter your street's name<br>";
$errorCount++;
}
if($streetnumber == "")
{
echo "Enter the number of your street where you live<br>";
$errorCount++;
}
if($errorcount == 0)
{
if(mysql_num_rows($resultat) == 0)
{
mysql_connect("***","***","***") or die(mysql_error());
mysql_select_db("***") or die(mysql_error());
$password = MD5($password);
$insert = mysql_query("INSERT INTO users (profiletype,email,password,firstname,lastname,country,cityname,postalcode,streetname,streetnumber,activationkey,status) VALUES ('$profiletype','$email','$password','$firstname','$lastname','$country','$cityname','$postalcode','$streetname','$streetnumber','$activationKey', 'verify')");
if (!mysql_query($insert))
{
die('Error: ' . mysql_error());
}
echo "An email has been sent to $_POST[email] with an activation key. Please check your mail to complete registration.";
$to = $_POST[email];
$subject = " blabla.net Registration";
$message = "Welcome to blabla Net! \r\r You, or someone using your email address, has completed registration at blabla.net. You can complete registration by clicking the following link:\rhttp://www.blabla.net/brugeroprettelse/verify.php?$activationKey\r\r If this is an error, ignore this email and you will be removed from our mailing list.\r\r Regards,\ blabla.net";
$headers = 'From: noreply@blabla.net' . "\r\n" .
'Reply-To: noreply@blabla.net' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
else
{
if ($_SERVER['QUERY_STRING'])
{
$queryString = $_SERVER['QUERY_STRING'];
$query = "SELECT * FROM users";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
if ($queryString == $row["activationkey"])
{
echo "Congratulations!" . $row["firstname"] . " " . $row["lastname"] . " is now the proud new owner of a blabla.net account.";
$insert="UPDATE users SET activationkey = '', status='activated' WHERE (id = $row[id])";
if (!mysql_query($insert))
{
die('Error: ' . mysql_error());
}
}
}
}
else
{
echo "The username/email you have entered is not available!";
}
}
}
else
{
echo "Go back";
}
print "
</td>
</tr>
</table>
</body>
</html>
";
?>
Får følgende fejl medd lige pt:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/clich.net/public_html/insertprofile.php on line 44
Har rettet en masse i koden, men intet ser ud til at fungerer.
Login systemet virkede fint før jeg tilføjede den del med aktiveringskoden der skal tilsendes på mail. Ved ikke hvad det er der går galt