Parse Error Help Needed!

Discussion in 'PHP' started by 812402, Jun 1, 2011.

  1. #1
    Error:
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/content/14/7688814/html/812/register.php on line 77

    
    <!DOCTYPE HTML 5>
    <head>
    <title>Register</title>
    <link rel="stylesheet" type="text/css" href="812style.css">
    </head>
    <body>
    <a href="index.php"><img src="logo.png"></a>
    </body>
    </html>
    
    <?php
    
    if(isset($_SESSION['user_id'])) {
    
    $url = 'http://812402.com/812/index.php';
     
    } else {
    
    if(isset($_POST['submitted'])) {
    require_once ('XXXX');
    }
    
    
     if (isset($_POST['username'])) {
    
    $un = escape_data ($_POST[username]);
     } else {
    
     echo '<p align="center"><font color="red"><b>Please enter a username!</b></font color></p>';
    
     }
    
    if($_POST['age'] >'7') {
    $age = escape_data($_POST[age]);
    } else {
    echo '<p align="center"><font color="red">You are to young to be using this site.</font color></p>';
    }
    
     if(isset($_POST['password'])) {
    
    
     } else {
    
     echo '<font color="red"><b>Please enter a password!</b></font color>';
    
     }
    
     if(isset($_POST['password2'])) {
    
      if($_POST['password'] == $_POST['password2']) {
    $pw = escape_data($_POST[password]);
    
      } else {
    
      echo '<font color="red"><b>The two passwords must match!</b></font color>';
    
      }
    
     } else {
    
     echo '<font color="red"><b>Please enter a confirming password!</b></font color>';
    
     }
    
    
    
    
    }
    if (isset($_POST['email'])) {
    
    $e = escape_data($_POST[email]);
    
    } else {
    echo '<p align="center><font color="red">Please enter your email/parents email!</font color></p>
    
    if ($u && $pw && $age && $e) {
      $query = "SELECT FROM 'XXX' 'XXX' WHERE email='$e'"
      $result = mysql_query ($query) or trigger_error(Error: mysql_error());
    
      $query2 = "SELECT FROM 'XXX' 'XXX' WHERE username='$u'"
      $result2 = mysql_query ($query2) or trigger_error(Error: mysql_error());
    
      $query3 = "SELECT FROM XXX' 'XXX' WHERE password='$pw'"
      $result3 = mysql_query ($query3) or trigger_error(Error: mysql_error());
    
    } else {
    echo '<p align="center"><font color="red">Sorry, but you could not be registered. Please try again later.</font color></p>
    }
    
    if (mysql_num_rows($result) == 0) {
    
    
    $a = md5(uniqid(rand(), true));
    
    $query = "INSERT INTO 'XXX' 'XXX' (username, password, email, age, role, active, date_registered) VALUES ('$u', '$pw', '$e, '$age', '1', '$a', NOW() )"; 
    $result = mysql_query ($query) or trigger_error(Error: mysql_error());
    
    }
    
    if (mysql_affected_rows == 1) {
    
    $body = "Thank you for registering! Your activation link is: http://812402.com/812/activate.php?id=". mysql_insert_id() . "code=$a";
    mail($_POST['email'],
    'Confirm Email',
    $body);
    
    echo '<h4 align="center">Thanks for registering! An email has been sent to you that will activate your account.<h4>';
    exit();
    
    } else {
    <p align="center"><font color="red">Sorry, but you could not be registered. Please try again later.</font color></p>';
    
    };
    
    
    
    ?>
    
    
    
    <form action="register.php" method="post" action="register.php">
    
    <h4 align="center">username</h4><p align="center"><input type="text" maxlength="45" name="username"></p>
    <h4 align="center">password</h4><p align="center"><input type="password" name="password" maxlength="50"></p>
    <h4 align="center">confirm password</h4><p align="center"><input type="password" name="password2" maxlength="50"></p>
    <h4 align="center">email/parents email</h4><p align="center"><input type="text" name="email" maxlength="50"></p>
    <h4 align="center">age
    <p align="center">
    <select name="age">
    <option value="3">3
    <option value="4">4
    <option value="5">5
    <option value="6">6
    <option value="7">7
    <option value="8" selected>8
    <option value="9">9
    <option value="10">10
    <option value="11">11
    <option value="12">12
    <option value="13">13+
    </select></p>
    <input type="hidden" name="submitted" value="TRUE">
    <p align="center"><input type="submit" value="Join!"></p>
    
    </form>
    
    
    PHP:
     
    812402, Jun 1, 2011 IP
  2. littlejohn199

    littlejohn199 Peon

    Messages:
    42
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There are a couple of places where you missed semicolon at the end of the lines of code. I added semicolon to the code above. I haven't tested your code yet, there might still be some errors.
     
    littlejohn199, Jun 1, 2011 IP
  3. 812402

    812402 Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That got rid of one error, but I think there is a colon misplaced somewhere. I'm looking for it right now.
    (new) Error:

    Parse error: syntax error, unexpected ':' in /home/content/14/7688814/html/812/register.php on line 78
     
    812402, Jun 1, 2011 IP