What should i do?
I get these to messages:
Parse error: parse error in C:\wamp\www\d_bg,l_txt\users\add1.php on line 100
Parse error: parse error in C:\wamp\www\d_bg,l_txt\users\add1.php on line 121
I get the first one then if i delete it i get the second one.
here is the code in add1.php
<?php
// Connects to your Database
mysql_connect("localhost", "****", "***") or die(mysql_error());
mysql_select_db("email") or die(mysql_error());
//This code runs if the form has been submitted
if (isset($_POST['submit'])) {
//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !$_POST['email'] | !$_POST['fname'] | !$_POST['lname'])
{
die('You did not complete all of the required fields. Click your browsers back button to go back.');
}
// checks if the username is in use
if (!get_magic_quotes_gpc())
{
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$ucheck = mysql_query("SELECT username FROM users WHERE username = '$usercheck'") or die(mysql_error());
$ucheck2 = mysql_num_rows($ucheck);
//if the username exists it gives an error
if ($ucheck2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use. Click <a href="login.php">here</a> to log in or <a href="add.php">here</a> to try again.');
}
// checks if the email is in use
if (!get_magic_quotes_gpc())
{
$_POST['email'] = addslashes($_POST['email']);
}
$emailcheck = $_POST['email'];
$echeck = mysql_query("SELECT email FROM users WHERE email = '$emailcheck'") or die(mysql_error());
$echeck2 = mysql_num_rows($echeck);
//if the email address exists it gives an error
if ($echeck2 != 0) {
die('Sorry, the email '.$_POST['email'].' is already in use. Click <a href="login.php">here</a> to log in');
}
// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2'])
{
die('Your passwords did not match. ');
}
// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5('a1d3e1j2m1r6v1'.$_POST['pass']);
if (!get_magic_quotes_gpc())
{
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
$_POST['email'] = addslashes($_POST['email']);
$_POST['fname'] = addslashes($_POST['fname']);
$_POST['lname'] = addslashes($_POST['lname']);
}
// now we insert it into the database
$insert = "INSERT INTO users (username, password, email, fname, lname)
VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".$_POST['email']."', '".$_POST['fname']."', '".$_POST['lname']."')";
$add_member = mysql_query($insert);
?>
<?php
$content =
'<html>
<head>
<title>The profile of '.$_POST[username].'</title>
</head>
<body>
<h1>Welcome to the Profile page of '.$_POST[username].'<br>
<?php require("show_profile_format.php"); ?>
</body>
</html>
?>
<?php
$userinfo = "'.$_POST[username].'";
$file = "$userinfo.php";
$open = fopen($file, "a");
fwrite($open, $content);
fclose($open);
?>
<?php
$content = "<a href="'$userinfo'.php">$userinfo</a>\r\n";
$file = "profiles.php";
$open = fopen($file, "a");
fwrite($open, $content);
fclose($open);
?>
<h1>Registered</h1>
<p>Thank you, you have registered - you may now <a href="login.php">login</a>.</p>
<?php }
else {
?>
<html>
<body>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="0" style="color:white" align="center">
<tr bgcolor=#276B9A><td>First Name:</td><td> <input type="text" name="fname" maxlength="90"> </td></tr>
<tr bgcolor=#990033><td>Last Name:</td><td> <input type="text" name="lname" maxlength="90"> </td></tr>
<tr bgcolor=#276B9A><td>Email:</td><td> <input type="text" name="email" maxlength="90"> </td></tr>
<tr bgcolor=#990033><td>Username:</td><td> <input type="text" name="username" maxlength="60"> </td></tr>
<tr bgcolor=#276B9A><td>Password:</td><td> <input type="password" name="pass" maxlength="10"> </td></tr>
<tr bgcolor=#990033><td>Confirm Password:</td><td> <input type="password" name="pass2" maxlength="10"> </td></tr>
<tr bgcolor=#276B9A><td colspan=2 align="center"><input type="submit" name="submit" value="Register"></td></tr>
<tr bgcolor=#990033><td colspan=2 align="center">Already got an account? Click <a href="login.php">here</a> to login</td></tr>
</table>
</form>
</body>
</html>
<?php
} ?>
show_profile_format.php looks like this
<?php
// First connect to database
$host = "localhost";
$dbuser = "****";
$dbpass = "***";
$db = "roth";
$con = mysql_connect($host, $dbuser, $dbpass);
if(!$con){
die(mysql_error());
}
$select = mysql_select_db($db, $con);
$data = mysql_query("SELECT * FROM email_contact_list WHERE username == '$username'");
print ("<h3>Contact Information</h3> <hr>");
// This creates a loop which will repeat itself until there are no more rows to select from the database. We getting the field names and storing them in the $row variable. This makes it easier to echo each field.
while($row = mysql_fetch_array($data)){
echo $row['lastname']. " "; echo $row['firstname']. " ";
if (isset($row['wifename']) && $row['wifename'] != NULL && $/row['wifename'] != '') {
echo "&"; echo " "; echo $/row['wifename']. "<br>";
}
else {
echo "<br>";
}
if (isset($row['address']) && $row['address'] != NULL && $row['address'] != '') {
echo $row['address']. "<br>";
}
if (isset($row['city']) && $row['city'] != NULL && $row['city'] != '') {
echo $row['city']. "<br>";
}
if (isset($row['province']) && $row['province'] != NULL && $row['province'] != '') {
echo $row['province']. "<br>" ;
}
if (isset($row['pc']) && $row['pc'] != NULL && $row['pc'] != '') {
echo $row['pc']. "<br>";
}
if (isset($row['country']) && $row['country'] != NULL && $row['country'] != '') {
echo $row['country']. "<br>";
}
if (isset($row['notes']) && $row['notes'] != NULL && $row['notes'] != '') {
echo $row['notes']. "<br>";
}
if (isset($row['emorpm']) && $row['emorpm'] != NULL && $row['emorpm'] != '') {
echo $row['emorpm']. "<br>";
}
if (isset($row['phone']) && $row['phone'] != NULL && $row['phone'] != '') {
echo $row['phone']. "<br>";
}
if (isset($row['email']) && $row['email'] != NULL && $row['email'] != '') {
echo $row['email']. "<br>";
}
if (isset($row['notes']) && $row['notes'] != NULL && $row['notes'] != '') {
echo $row['notes']. "<br>";
}
echo "<hr>";
}
?>
</body>
</html>
<!--#########################################################################################################################-->
';
$file = "$_POST[username].php";
$open = fopen($file, "w");
fwrite($open, $content);
fclose($open);
?>
this all is supposed to create a file and then inside that file enter the username inside <title> and </title> aswell as inside the <h1> and </h1> tags then it is supposed to open up the file profiles.php and appened to the end the link with the username.php as the href and the username as the text to be shown.