Hele den nye kode:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Sign Up Process</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'];
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$email=$_POST['email'];
$password=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
If you experince any bugs or have questions, feel free to contact the support team!
";
//Tjekker om begge felter mangler
if(empty($username)||empty($email)){
die('Email and Username needed!');
}
//Tjekker om Email feltet er fyldt
if(empty($username)||empty($email)){
die('Email needed!');
}
//Tjekker om username feltet er fyldt
if(empty($username)){
die('Username needed!');
}
//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><p>");
}
//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','$ip','$date',1,'$email','$exp','$status','')");
//Lukker MYSQL
mysql_close();
//Sender aktiverings email til brugeren
mail($email,"Thanks for signing up!",$message);
//Skriver at aktiverings email er sendt
echo "Thank you for signing up! Your password have been sent to your email";
//------------------------------------------------------------------------------------------------------------
//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 = $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";
$date=$row['date'];
$email2=$row['email'];
$exp=$row["exp"];
$indhold = "
<?php
require 'connect.php';
$a=mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username='qq'"));
?>
<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'>Dugh'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'>
<b>Username:</b> $username<p>
<b>Sign up date:</b> <?php echo $a['date']; ?><p>
<b>E-mail:</b> <?php echo $a['email']; ?><p>
<b>Exp:</b> <?php echo $a['exp']; ?><p>
Information om bruger her!</td>
</tr>
</table>
</body>
</html>
";
//Skriver tekst ind i fil
fwrite($fh, $indhold);
//Lukker af
fclose($fh);
//-----------------------------------------------------------------------------------------------
?>
</body>
</html>
Mit problem er at når den laver filen, fjerner den = tegnene!
Fejl besked:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\\wamp\\www\\Fortunato\\MemberSystem\\process_register.php on line 159