T_CONSTANT_ENCAPSED_STRING Error

Discussion in 'PHP' started by nrodes, Nov 3, 2008.

  1. #1
    I can't figure out this error:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\Program Files\Abyss Web Server\htdocs\forum\login\validate.php on line 12


    This is my code:

    <?php

    //get input data
    $user=$_POST["username"];
    $pass=$_POST["password"];

    //encrypt username and pass
    $cuser=md5($user);
    $cpass=md5($pass);

    //include login file
    include($user".php");

    //make sure info matches and changes user's logged in file to 1
    if ($cuser==$realuser && $cpass==$realpass)
    {
    $File = $user"ok.txt";
    $Handle = fopen($File, 'w');
    $Data = "0";
    fwrite($Handle, $Data);
    fclose($Handle);

    //redirect to main.php
    header( 'Location: main.php' );

    ?>


    Thanks for any help :)
     
    nrodes, Nov 3, 2008 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    Try changing this line
    include($user".php");
    to this:
    include $user . ".php";
    Then the $File = line will have to be changed too.
    $File = $user . "ok.txt";
     
    shallowink, Nov 3, 2008 IP
  3. nrodes

    nrodes Peon

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks. that really helped :)
     
    nrodes, Nov 3, 2008 IP