Parse error: syntax error, unexpected T_VARIABLE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • james2432
    New Member
    • Jul 2008
    • 1

    Parse error: syntax error, unexpected T_VARIABLE

    Parse error: syntax error, unexpected T_VARIABLE in /var/www/LukeSite/validateform.ph p on line 27

    validateform.ph p
    [PHP]
    <?php
    session_start() ;
    if(empty($_SESS ION)||!isset($_ SESSION)){
    header("Locatio n: index.php?lang= fr");
    exit;
    }
    $_SESSION["Valid"]=1;
    $localization=a rray();
    $config_valuez= parse_ini_file( 'localization.i ni',TRUE);

    if($_SESSION["lang"]==0){
    $localizationz= $config_valuez["en"];
    }
    else if ($_SESSION["lang"]==1){
    $localizationz= $config_valuez["fr"];
    }
    $returnStr="";
    require 'functions.php' ;
    $_SESSION["Validator"]= array(
    0=>1,
    1=>1,
    2=>1,
    3=>1,
    4=>1,
    5=>1
    )

    $chk=sanit($_PO ST["name"]);
    echo $chk;
    chkempty(sanit( $_POST["name"]));
    checkSession($l ocalization["errNameEm"],0);
    $_SESSION["name"]=$_POST["name"];

    chkempty(sanit( $_POST["lname"]));
    checkSession($l ocalization["errLNameEm "],1);
    $_SESSION["lname"]=$_POST["lname"];

    chkemail($_POST["e-mail"]);
    checkSession($l ocalization["errEmailNV "],2);
    $_SESSION["mail"]=$_POST["e-mail"];

    $returnStr = chkempty(sanit( $_POST["add1"]));
    checkSession($l ocalization["errAddEm"],3);
    $_SESSION["add1"]=$_POST["add1"];

    $returnStr = chkempty(sanit( $_POST["city"]));
    checkSession($l ocalization["errCityEm"],4);
    $_SESSION["city"]=$_POST["city"];

    $returnStr = chkempty(sanit( $_POST["cp"]));
    checkSession($l ocalization["errCPEm"],5);
    $_SESSION["cp"]=$_POST["cp"];

    $_SESSION["add2"]=sanit($_POST["add2"]);
    $_SESSION["cp"]= $_POST["prov"];
    $_SESSION["ctry"]= sanit($_POST["ctry"]);
    $_SESSION["phone"]= sanit($_POST["phone"]);
    $_SESSION["lang"]=sanit($_POST["lang"]);
    $_SESSION["tshirt"]= sanit($_POST["tshirt"]);
    $_SESSION["dvd"]= sanit($_POST["dvd"]);

    $validator=0;
    for($i=0;i<=5;i ++){
    $validator+=$_S ESSION["Validator"][$i];
    }
    if($validator== 6){
    echo "redirect";
    }
    else{
    echo "YOU FAIL LOLZ@@@@@@";
    }
    ?>
    [/PHP]

    functions.php
    [PHP]
    <?php
    session_start() ;

    if(empty($_SESS ION)||!isset($_ SESSION)){
    header("Locatio n: index.php?lang= fr");
    exit;
    }

    //Sanitises the sent string
    function sanit($arg){
    if(empty($arg)) {
    return "";
    }
    else{
    $arg=addslashes (strip_tags($ar g));
    return $arg;
    }
    }

    //Cleans up the slashes that may have been added
    function clean($arg){
    $arg=stripslash es($arg);
    return $arg;
    }

    //Checks if the sent arg is empty
    function chkempty($arg){
    $_SESSION["Valid"]=1;
    if(empty($arg)) {
    $_SESSION["Valid"]=0;
    }
    }

    //Validates the e-mail
    function chkemail($arg){
    chckempty($arg) ;
    $regex='/^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]/';
    if(!preg_match( $regex, $arg)){
    $_SESSION["Valid"]=0;
    }
    }

    function checkSession($s tr,$nb){
    if($_SESSION["Valid"]==0){
    $_SESSION["Validator"][$nb]=0;
    echo $str."<br/>";
    }
    }

    function getDVD($opt){
    }

    function getProv($opt){
    }

    function getTshirt($opt) {
    }

    function getTicket($d,$m ,$y){
    $date1= time();
    $date2= mktime(0,0,0,$m ,$d,$y);

    $datediff=floor (($date1-$date2)/31536000);

    if($datediff<=9 )
    {
    echo "child";
    }
    else
    {
    echo "adult";
    }

    }

    function getTicketPrice( $d,$m,$y){
    $date1= time();
    $date2= mktime(0,0,0,$m ,$d,$y);

    $datediff=floor (($date1-$date2)/31536000);

    if($datediff<=9 )
    {
    echo "15.00";
    }
    else
    {
    echo "30.00";
    }
    }

    function getDvdPrice($op t){
    }

    function getTshirtPrice( $opt){
    }
    ?>
    [/PHP]
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    You need to add a semi colon (;) to the last parenthesis on line 26.

    Comment

    Working...