[RESOLVED] cant figure it out :(
wats wrong here...
Code:
<?php
require ('header.php');
echo '<div class="register">';
if (isset ($_POST['submit']))
{
$problem = FALSE;
if (empty ($_POST['first_name']))
{
$problem = TRUE;
echo '<p>Please enter your first name.</p>';
}
if (empty ($_POST['last_name']))
{
$problem = TRUE;
echo '<p>Please enter your last name.</p>';
}
if (empty ($_POST['email']))
{
$problem = TRUE;
echo '<p>Please enter a valid email address.</p>';
}
if (empty ($_POST['username']))
{
$problem = TRUE;
echo '<p>Please enter a username.</p>';
}
if (empty ($_POST['password']))
{
$problem = TRUE;
echo '<p>Please enter a password.</p>';
}
if ($_POST['password'] != $_POST['confirm'])
{
$problem = TRUE;
echo '<p>Your password did not match your confirmed password.</p>';
}
if (!problem)
{
if ($fp = fopen ('../users/users.txt', 'ab'))
{
$dir = time() . rand (0, 4596);
$data = $_POST['first_name'] . "\t" . $_POST['last_name'] . "\t" . $_POST['email'] . "\t" . $_POST['username'] . "\t" . crypt($_POST['password']) . "\t" . $dir . "\r\n";
fwrite ($fp, $data);
fclose ($fp);
mkdir ("../users/$dir");
echo '<p>You are now registered and can take advantage of all the features on our site!</p>';
} else {
echo '<p>You could not be registered due to a system error. Please try again later.</p>';
}
} else {
echo '<p>Please try again!</p>';
}
} else {
?>
<form action="register.php" method="post">
<fieldset>
<legend>
Register with us:
</legend>
<p>First name:
<input type="text" name="first_name" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /><br />
Last name:
<input type="text" name="last_name" value="<?php if(isset($_POST['last_name'])) echo $_POST['last_name']; ?>" /><br />
Email:
<input type="text" name="email" value="<?php if(isset($_POST['email'])) echo $_POST['email']; ?>" /><br />
Username:
<input type="text" name="username" value="<?php if(isset($_POST['username'])) echo $_POST['username']; ?>" /><br />
Password:
<input type="password" name="password" /><br />
Confirm password:
<input type="password" name="confirm" /><br />
<input type="submit" name="submit" value="Register" /></p>
</fieldset>
</form>
</div>';
<?php
}
require ('footer.php');
?>
its probably the stupidest thing im overlooking but yea i cant find it
everytime i fill it out correctly it displays please try again instead of the u are now registered part
Re: cant figure it out :(
never mind forgot to make (!problem) (!$problem) it worx now