Ja, det du skal er at sætte " . $string . " uden om, og specielt når du skal udskrive noget fra et array:
" . $row['name'] . " ..
Også fandt jeg et " på linje 36, midt i en streng, så skal du huske enten \\" eller fjerne det helt..
jeg har rettet koden til, se om det fungere:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<?php
//Laver bruger information--------------------------------------------------------
//Opretter forbindelse til vores database og server (Database=membersystem) (Server = localhost)
require "connect.php"; //Bemærk at der står 'require'. Det gør at hvis connect ikke kan komme i kontakt med scriptet, lukker den resten
//Laver vigtige variable, og tager informationer fra formlen fra register.htm
$date=date("F j, Y, g:i a");
$ip = GetHostByName($REMOTE_ADDR);
$username=$_POST['username'];
$password=$_POST['password1'];
$password2=$_POST['password2'];
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$email=$_POST['email'];
$validate_key=md5(time()+rand(1000,9999).$username);
$message="
*Do not reply - this is a automatic message*
Thank you for signing up at Fortunato.com! Your user information is: /n/n
Username: $username \\n
Password: $password \\n\\n
You have to activate your user by clicking at the activation link: /n/n
[url]http://your_site_her..te.php?validate_key=$validate_key[/url] \\n\\n
";
$længde=strlen($password);
if ($længde < 6 || $længde == 6) {
echo "";
} else {
echo "Your password have to be <b>6</b> letters long! <p>The password you typed was only <b>$længde</b> letters long!";
exit;
}
//Tjekker om nogen vigtige felter mangler (Username, password og email)
if(empty($username)||empty($password)||empty($password2)||empty($email)){
die('One or more fields missing./n');
}
//Tjekker om koderne passer sammen.
if($password!=$password2){
die('Passwords do not match.');
}
//Password sikkerhed
$password=sha1($password);
//Tjekker om brugernavnet allerede er i brug
$result=mysql_query("SELECT username FROM users WHERE username='$username'");
if(mysql_num_rows($result)==1){
die("The username <b>$username</b> is already in use. <a href='javascript:history.go(-1)'>Please try again!</a>/n/n");
}
//Tjekker om email adressen allerede er i brug
$result=mysql_query("SELECT email FROM users WHERE email='$email'");
if(mysql_num_rows($result)==1){
die("The email address <b>$email</b> is already in use. <a href='javascript:history.go(-1)'>Please try again!</a>");
}
$status = "1";
$exp = "0";
//Sætter informationer ind i MYSQL tabel
mysql_query("INSERT INTO users VALUES(NULL,'$username','$password','$firstname','$lastname','$validate_key','$ip','$date',1,'$email','$exp','$status','')");
//Lukker MYSQL
mysql_close();
//Sender aktiverings email til brugeren
mail($email,"Validate Your Account",$message);
//Skriver at aktiverings email er sendt
echo "Thank you for registering. A verification email has been sent to the email specified.";
//------------------------------------------------------------------------------------------------------------
//Laver bruger side-------------------------------------------------------
//Laver selve siden.
$folder = opendir($whichSection . "C:\\wamp\\www\\Fortunato\\Userpage" . $who . "/");
$counter = 0;
while($file = readdir($folder)){
if($file != '.' && $file != '..'){
$counter++;
}
}
closedir($folder);
$file = $counter.$username.".php";
$filehandle = fopen($file, 'w') or die("can't open file");
fclose($filehandle);
$fh = fopen($file, 'a') or die("can't open file");
//Tekst
require "connect.php";
// Make a MySQL Connection
$query = "SELECT * FROM users WHERE username='$username'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
$indhold = "<html>
<head>
<meta http-equiv='Content-Language' content='da'>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>
<title>$username: Userpage</title>
</head>
<body>
<table border='1' width='100%' style='border-width: 0px'>
<tr>
<td colspan='2' bgcolor='#ECEBE8' style='border-style: none; border-width: medium'>
<h1 align='left'><font color='#808080'>$username's Userpage</font></h1></td>
<td width='53%' rowspan='2' bordercolor='#F3F3F1' style='border-style: none; border-width: medium' bgcolor='#F3F3F1'> </td>
</tr>
<tr>
<td width='17%' style='border-style: none; border-width: medium' bgcolor='#FFFFFF'>
Menu her!</td>
<td width='27%' style='border-style: none; border-width: medium' bgcolor='#FFFFFF'>
Username: " . $username . "<p>
Sign up date: " . $row['date'] . ";
E-mail: " . $email . "
Information om bruger her!</td>
</tr>
</table>
</body>
</html>";
//Skriver tekst ind i fil
fwrite($fh, $indhold);
//Lukker af
fclose($fh);
//-----------------------------------------------------------------------------------------------
?>
</body>
</html>