I have this code that has been working up until I adjusted it within the last hour. Now I keep getting the same error
Parse error: syntax error, unexpected T_ELSE in I:\xampp\htdocs\Project\Website\Forms\joinupform.php on line 253
even though there is no longer a line 253 in the text. I simply added to if/else statements, and then got an error and then readjusted the text, i have then cut the text down. I believe i now have all the if{}else{} statements correct, however I still get an error. I have also checked and each line is terminated with ;.
Code: Select all
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://localhost/project/website/css/homepage.css"/>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<table border="1">
<tr>
<td>
<p>Title:</p></td>
<td>
<select name="title" size="" align="center">
<option value=" ">[option]</option>
<option value="mr">Mr</option>
<option value="mrs">Mrs</option>
<option value="ms">Ms</option>
</select>
</td>
</tr>
<tr>
<td><p>First name:</p></td>
<td><input type = "text" name="firstname" size="18" maxlength="50"/>
</td>
</tr>
<tr>
<td>
<p>Last Name:</p>
</td>
<td>
<input type="text" name="lastname" size="18"
maxlength="50"/>
</td>
</tr>
<tr>
<td>
<p>House/Flat Number:</p>
</td>
<td>
<input type="text" name="house" size="18" maxlength="50"/>
</td>
</tr>
<tr>
<td><p>Street:</p></td>
<td>
<input type="text" name="street" size="18"
maxlength="50"/>
</td>
</tr>
<tr>
<td><p>Town or City:</p></td>
<td>
<input type="text" name="town" size="18"
maxlength="50"/>
</td>
</tr>
<tr>
<td><p>County</p></td>
<td>
<input type="text" name="county" size="50"
maxlength="50"/>
</td>
</tr>
<tr>
<td><p>Postcode</p></td>
<td>
<input type="text" name="postcode" size="7"
maxlength="7"/>
</td>
</tr>
<tr>
<td><p>Telephone Number</p></td>
<td>
<input type="text" name="telephone" size="11"
maxlength="20"/>
</td>
</tr>
<tr>
<td><p>Email Address</p></td>
<td>
<input type="text" name="email" size="18" maxlength="50"/>
</td>
</tr>
<tr>
<td><p>Username:</p></td>
<td><input type="text" name="username" size="18"
maxlength="50"/>
</td>
</tr>
<tr>
<td><p>Password:</p></td>
<td><input type="password" name="password" size="18"
maxlength="50"/>
</td>
</tr>
<tr>
<td><p>Re-Type Password:</p></td>
<td><input type="password" name="retypepassword" size="18" maxlength="15"/>
</td>
</tr>
<?php//captcha?>
<tr>
<td><p>Security Image:</p></td>
<td>
<img class="security" id="captcha" src="http:\\localhost\project\website\securimage\securimage_show.php" alt="CAPTCHA Image" />
</td>
</tr>
<tr>
<td>
<p>Enter Security Code:</p>
</td>
<td>
<input type="text" name="captcha_code" size="10" maxlength="6" />
</td>
</tr>
<tr>
<td>
<p>If it is not possible to read the image - click reload</p>
</td>
<td>
<a href="#" onclick="document.getElementById('captcha').src ='http:\\localhost\project\website\securimage\securimage_show.php?' + Math.random(); return false">Reload Image</a>
</td>
</tr>
<tr align="center">
<td colspan ="18">
<input type="submit" name="submit" value="Submit"/>
</td>
</tr>
</table>
</form>
<?php
if (isset($_POST['submit']))
{
session_start();
include ($_SERVER['DOCUMENT_ROOT'] . '\project\website\securimage\securimage.php');
//$securimage = new Securimage();
//if ($securimage->check($_POST['captcha_code']) == false)
//{
// the code was incorrect
// handle the error accordingly with your other error checking
// or you can do something really basic like this
// die('The code you entered was incorrect. Go back and try again.');
// }
//Code for validating a password is 6 digits long and strong. Turned off for testing.
//$password = "Fyfjk34sdfjfsjq7";
//if (preg_match("/^.*(?=.{6,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password))// {
// echo "Your passwords is strong.";
//} else {
// echo "Your password is weak.";
//}
$title = $_POST['title'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$house_number = $_POST['house'];
$street = $_POST['street'];
$town = $_POST['town'];
$county = $_POST['county'];
$postcode = $_POST['postcode'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$retypepassword = $_POST['retypepassword'];
if($password == $retypepassword)
{
//checker the current client library to ensure that a new client user cannot have the same username as a current client
$check_query = "select c.username from client as c where username = '$username'";
$check_result = mysql_query($check_query);
if(mysql_num_rows($check_result) == 0)
{
include ($_SERVER['DOCUMENT_ROOT'] . '\project\website\securimage\securimage.php');
//check the trainers to also ensure that a client cannot have the same username as a trainer
$check_t_query = "select t.username from trainer as t where t.username = '$username'";
$check_t_result = mysql_query($check_t_query);
if(mysql_num_rows($check_t_result) == 0)
{
include ($_SERVER['DOCUMENT_ROOT'] . '\project\website\securimage\securimage.php');
//add directory to hold user emails
$fullname = "$firstname$lastname";
mkdir($_SERVER['DOCUMENT_ROOT'].'\project\website\admin\client\accounts\\'."$fullname".'\inbox', 0700, true);
mkdir($_SERVER['DOCUMENT_ROOT'].'\project\website\admin\client\accounts\\'."$fullname".'\outbox', 0700, true);
mkdir($_SERVER['DOCUMENT_ROOT'].'\project\website\admin\client\accounts\\'."$fullname".'\files', 0700, true);
mkdir($_SERVER['DOCUMENT_ROOT'].'\project\website\admin\client\accounts\\'."$fullname".'\images', 0700, true);
mkdir($_SERVER['DOCUMENT_ROOT'].'\project\website\admin\client\accounts\\'."$fullname".'\videos', 0700, true);
//Insert the data into the client table
$query = "insert into client set client_id=' ', title='$title', first_name='$firstname', last_name='$lastname', house_number = '$house_number', street='$street', town='$town', county='$county', postcode='$postcode', contact_number = '$telephone', emailaddress = '$email', username='$username', password='$password'";
$result = mysql_query($query);
//Display an appropriate message
if($result)
echo "<p>You have successfully joined this site</p>";
else
echo "<p>There was a problem inserting the details!</p>";
}
else
{
echo "<p>THe username is already in use please select another</p>";
}
else
{
echo "<p>The username is already in use please select another</p>";
}
else
{
echo "<p>Password retype incorrect please re-enter your password details</p>";
}
}
?>
</body>
</html>