Keep getting a Parse error: syntax error, unexpected T_EXIT
Results 1 to 6 of 6

Thread: Keep getting a Parse error: syntax error, unexpected T_EXIT

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    3

    Keep getting a Parse error: syntax error, unexpected T_EXIT

    Hi guys wondering if I can get some help...
    Ive just started doing a small e commerce site.
    I have tried to to setup a simple form where the user would enter details and login. However, I am getting this message when trying to view my page in a browser.
    "Parse error: syntax error, unexpected T_EXIT in C:\####\####\####\####\####\admin_login.php on line 5"

    Here is the code:

    Thanks before hand for any help, much appreciated.

    PHP Code:
    <?php 
    session_start
    ();
    if(!isset(
    $_SESSION["manager"])){
        
    header("location: index_store_admin.php")
        exit(); 
        
    }


    ?>

    <?php 
    // Run script after user has clicked 'log in'
    if (isset($_POST["username"]) && isset($_POST["password"])) {
        
    $manager preg_replace('#[^A-Za-z0-9]#i'''$_POST["username"]); 
        
    $password preg_replace('#[^A-Za-z0-9]#i'''$_POST["password"]);
        
        
    // Connecting to database  
     
    include "/Scripts/Connection_MySQL.php"
        
    $sql mysql_query("SELECT id FROM tblAdmin WHERE username='$manager' AND password='$password' LIMIT 1"); // query the person
        //Ensuring user existence
        
    $existCount mysql_num_rows($sql); 
        if (
    $existCount == 1) { 
             while(
    $row mysql_fetch_array($sql)){ 
                 
    $id $row["id"];
             }
             
    $_SESSION["id"] = $id;
             
    $_SESSION["manager"] = $manager;
             
    $_SESSION["password"] = $password;
             
    header("location: index.php");
             exit();
        } else {
            echo 
    'That information is incorrect, try again <a href="index.php">Click Here</a>';
            exit();
        }
    }
    ?>
    Last edited by bradgrafelman; 03-21-2013 at 06:59 PM. Reason: bbcode tags modified

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,402
    Welcome to PHPBuilder! When posting PHP code, please use the board's [php]..[/php] bbcode tags (versus the generic CODE tags) as they make your code easier to read and analyze.

    As for your issue... the statement preceding the one identified in the error message is missing a terminating semicolon.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    3
    Thanks mate will bare that in mind next time.

    Tried your solutioin, added the semi colon, but still same error.

  4. #4
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,402
    Can you show us what the first few statements of the file look like with the added semicolon? When I added it, a lint check showed no further parse errors.

  5. #5
    Junior Member
    Join Date
    Mar 2013
    Posts
    3
    Yes this is what it looks like:

    PHP Code:
    <?php 
    session_start
    ();
    if(!isset(
    $_SESSION["manager"])){
        
    header("location: index_store_admin.php");    // added semicolon at the end here
        
    exit(); 
        
    }


    ?>

    <?php 
    // Run script after user has clicked 'log in'
    if (isset($_POST["username"]) && isset($_POST["password"])) {
        
    $manager preg_replace('#[^A-Za-z0-9]#i'''$_POST["username"]); 
        
    $password preg_replace('#[^A-Za-z0-9]#i'''$_POST["password"]);
        
        
    // Connecting to database  
     
    include "/Scripts/Connection_MySQL.php"
        
    $sql mysql_query("SELECT id FROM tblAdmin WHERE username='$manager' AND password='$password' LIMIT 1"); // query the person
        //Ensuring user existence
        
    $existCount mysql_num_rows($sql); 
        if (
    $existCount == 1) { 
             while(
    $row mysql_fetch_array($sql)){ 
                 
    $id $row["id"];
             }
             
    $_SESSION["id"] = $id;
             
    $_SESSION["manager"] = $manager;
             
    $_SESSION["password"] = $password;
             
    header("location: index.php");
             exit();
        } else {
            echo 
    'That information is incorrect, try again <a href="index.php">Click Here</a>';
            exit();
        }
    }
    ?>

  6. #6
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,848
    There are no syntax errors in the code as posted.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •