Por lo que veo estas mal cerrando las llaves de los if. Asumo que esto es lo que quieres hacer:
Código PHP:
<?php
require('../include/database_connection.php');
if($_POST['yes'] == '1'){
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$country = $_POST['country'];
$query = "SELECT *
FROM users
WHERE username = '$username'";
$result = mysql_db_query($base,$query,$conn) or die (mysql_error());
if(mysql_num_rows($result) == 0){
//delimitation
$sql = 'INSERT INTO users (username, password, email, name, lastname, day, month, year, country)
VALUES ("' . $username . '", "' . $password . '", "' . $email . '", "' . $firstname . '",
"' . $lastname . '", "' .$day. '", "' .$month. '", "' .$year. '", "' .$country. '");';
if(mysql_query($sql)){
echo 'Registration successful! Now you can <a href="login.php">Log In</a>.';
}else{
echo 'We are sorry, but you were not able to register, please contact the administrator.<br><small>' . mysql_error() . '</small>';
}
exit;
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("The Username already exists, please try again...");
history.go(-1);
</SCRIPT>
<?
} //End of Else
}
?>
Y esto es lo que tu tienes:
Código PHP:
<?php
require('../include/database_connection.php');
if($_POST['yes'] == '1'){
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$country = $_POST['country'];
$query = "SELECT *
FROM users
WHERE username = '$username'";
$result = mysql_db_query($base,$query,$conn) or die (mysql_error());
if(mysql_num_rows($result) == 0){
//delimitation
$sql = 'INSERT INTO users (username, password, email, name, lastname, day, month, year, country)
VALUES ("' . $username . '", "' . $password . '", "' . $email . '", "' . $firstname . '",
"' . $lastname . '", "' .$day. '", "' .$month. '", "' .$year. '", "' .$country. '");';
if(mysql_query($sql)){
echo 'Registration successful! Now you can <a href="login.php">Log In</a>.';
}else{
echo 'We are sorry, but you were not able to register, please contact the administrator.<br><small>' . mysql_error() . '</small>';
}
exit;
}
}else{
?>
<SCRIPT LANGUAGE="javascript">
alert("The Username already exists, please try again...");
history.go(-1);
</SCRIPT>
<?
} //End of Else
?>
Ojo que ordene el codigo y cambie minimas cosas para que se vea mas ordenado.
Suerte!