Connecting Tech Pros Worldwide Forums | Help | Site Map

Parse error: syntax error, unexpected T_VARIABLE

Newbie
 
Join Date: Jul 2008
Posts: 1
#1: Jul 31 '08
Parse error: syntax error, unexpected T_VARIABLE in /var/www/LukeSite/validateform.php on line 27

validateform.php
[PHP]
<?php
session_start();
if(empty($_SESSION)||!isset($_SESSION)){
header("Location: index.php?lang=fr");
exit;
}
$_SESSION["Valid"]=1;
$localization=array();
$config_valuez= parse_ini_file('localization.ini',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($_POST["name"]);
echo $chk;
chkempty(sanit($_POST["name"]));
checkSession($localization["errNameEm"],0);
$_SESSION["name"]=$_POST["name"];

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

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

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

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

$returnStr = chkempty(sanit($_POST["cp"]));
checkSession($localization["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+=$_SESSION["Validator"][$i];
}
if($validator==6){
echo "redirect";
}
else{
echo "YOU FAIL LOLZ@@@@@@";
}
?>
[/PHP]

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

if(empty($_SESSION)||!isset($_SESSION)){
header("Location: index.php?lang=fr");
exit;
}

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

//Cleans up the slashes that may have been added
function clean($arg){
$arg=stripslashes($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($str,$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($opt){
}

function getTshirtPrice($opt){
}
?>
[/PHP]

Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#2: Jul 31 '08

re: Parse error: syntax error, unexpected T_VARIABLE


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