kala_shah Posted March 31, 2013 Share Posted March 31, 2013 Please help with that error: Parse error: syntax error, unexpected '$GLOBALS' (T_VARIABLE) in C:\Program Files\EasyPHP-12.1\www\xxxx\admincp\func.php on line 11 here is the code: <?php //include_once "admincp/system_cls.php"; $GLOBALS['sessionhash'] = session_id(); // ###################### escape string. ############### function EscapeString($text) { $text = htmlentities($text, ENT_NOQUOTES, "" . CHARSET . ""); if (!get_magic_quotes_gpc()) { $text = mysql_real_escape_string($text); } return $text; } // ###################### escape string html. ############### function EscapeStringHtml($text) { if (!get_magic_quotes_gpc() AND !get_magic_quotes_runtime()) { $text = mysql_real_escape_string($text); } return $text; } // ################## checks for valid numbers ############## function valid_id($id) { if (preg_match("/^([0-9]+)$/", $id)) { return $id; } else { return '0'; } } function getVal($a) { if ($_POST[$a]) { $ret = EscapeString($_POST[$a]); } else { $ret = EscapeString($_GET[$a]); } return $ret; } //Define function to insert security image function insertSecurityImage($inputname) { $refid = md5(mktime() * rand()); $insertstr = "<img src=\"securityimage.php?refid=" . $refid . "\" alt=\"Security Image\" title=\"Security Image\" /><input type=\"hidden\" name=\"" . $inputname . "\" value=\"" . $refid . "\" />"; return $insertstr; } //Define function to check security image confirmation function checkSecurityImage($referenceid, $enteredvalue) { $db = new DBM; $db->connect(); $referenceid = EscapeString($referenceid); $enteredvalue = EscapeString($enteredvalue); $Q = "SELECT ID FROM " . TABLE_PREFIX . "security_images WHERE referenceid='$referenceid' AND BINARY hiddentext='$enteredvalue'"; //echo $Q; $db->query($Q); if ($db->num_rows()) { return true; } else { return false; } } function DetectLongString($aboutme) { $text = explode(" ", EscapeString($aboutme)); $totalwords = count($text); for ($x = 0; $x < $totalwords; $x++) { if (strlen($text[$x]) > 50) { $text[$x] = wordwrap($text[$x], 50, "<br />", 1); } } $textnormal = implode(" ", $text); return $textnormal; } // ############# make checkbox ##################### // ################################################# function makeCheckbox($value, $gotvalue, $text = "", $extra = "", $name) { $selected = ($value == $gotvalue) ? "checked=\"checked\"" : ""; $option = ($text != "") ? $text : $value; $option .= " <input type=\"checkbox\" value=\"$value\" name=\"$name\" $selected $extra />\n"; return $option; } // ############# make checkbox ##################### //################################################# function makeInputbox($value, $name, $extra = '') { $option = " <input type=\"text\" value=\"$value\" name=\"$name\" $extra />\n"; return $option; } // ############# make options ##################### //################################################# function makeOption($value, $gotvalue, $text = "") { $selected = ($value == $gotvalue) ? "selected=\"selected\"" : ""; $option = "<option value=\"$value\" $selected>"; if ($text) { $option .= $text . "</option>\n"; } else { $option .= $value . "</option>\n"; } return $option; } // ############# make Radio ##################### //################################################# function makeRadio($value, $gotvalue, $text = "", $extra = "", $name, $class) { $selected = ($value == $gotvalue) ? "checked=\"checked\"" : ""; $optiont = ($text != "") ? $text : $value; $option .= "<label class=\"$class\" for=\"$extra\">$optiont<input id=\"$extra\" type=\"radio\" value=\"$value\" name=\"$name\" $selected /></label>\n"; return $option; } function MakeYearSelect() { $current = date("Y"); do { $selected = ($_POST['year'] == $current) ? "selected=\"selected\"" : ""; $mdate .= "<option value=\"$current\" $selected>$current</option>\n"; $current--; } while ($current >= 1950); return $mdate; } function MakeDateSelect($pre, $year, $month, $day, $type, $err, $ary = '') { global $Months; if (!$type) { $mtime[0] = $year; $mtime[1] = $month; $mtime[2] = $day; } else { $mtime = explode("-", $type); } $mdate = "<select name=\"{$pre}year{$ary}\" errortext=\"$err\">\n"; $mdate .= "<option value=\"\">-------</option>\n"; for ($x = 1900; $x < 2030; $x++) { $selected = ($mtime[0] == $x) ? "selected=\"selected\"" : ""; $mdate .= "<option value=\"$x\" $selected>$x</option>\n"; } $mdate .= "</select> - \n"; $mdate .= "<select name=\"{$pre}month{$ary}\">\n"; $mdate .= "<option value=\"\">-------</option>\n"; for ($y = 1; $y < 13; $y++) { $j = ($y < 10) ? $j = "0$y" : $y; $selected = ($mtime[1] == $y) ? "selected=\"selected\"" : ""; $mdate .= "<option value=\"$j\" $selected>" . date('F', mktime(0, 0, 0, $j, 1, date('Y'))) . "</option>\n"; } $mdate .= "</select> - \n"; $mdate .= "<select name=\"{$pre}day{$ary}\">\n"; $mdate .= "<option value=\"\">-------</option>\n"; for ($z = 01; $z < 32; $z++) { $j = ($z < 10) ? $j = "0$z" : $z; $selected = ($mtime[2] == $z) ? "selected=\"selected\"" : ""; $mdate .= "<option value=\"$j\" $selected>$z</option>\n"; } $mdate .= "</select>"; return $mdate; } function EscapeWord($search) { $searchword = EscapeString($search); $query = ereg_replace("[\n,]", " ", $searchword); $query = str_replace(". ", " ", $query); $query = preg_replace("/[\(\)\"':;\[\]!#{}_\-+\\\\]/s", "", $query); $query = ereg_replace("( ){2,}", " ", $query); $query = trim($query); $querywc = str_replace("%", "\\%", $query); $querywc = str_replace("_", "\\_", $querywc); $querywc = str_replace("*", "%", $querywc); $querywc = preg_replace("/(%){1,}/s", '%', $querywc); return $querywc; } function SendUserEmail($to, $subject, $mailmsg) { // sends email to users after registration is complete global $name_of_site; $signupEmail = "<html><head></head><body>"; $signupEmail .= $mailmsg; $signupEmail .= "</body></html>"; $header = "From: $name_of_site <" . FROM . ">\r\nContent-type: text/html; charset=" . CHARSET . "\n"; if (!mail($to, $subject, $signupEmail, $header)) { echo "Mail Failed"; } } function ErrorEmail($subject, $postvars, $message) { global $name_of_site; while (list($key, $value) = each($postvars)) { $message .= "[$key] => $value\r\n"; } $message .= "\r\n----Variables sent from Payment Module script----\r\n"; $header = "From: $name_of_site Payment Module <" . FROM . ">\r\n"; mail(FROM, $subject, $message, $header); } function gettotalusers() { global $_db; $datecut = time() - 600; $_db->query("SELECT COUNT(*) AS sessions FROM " . TABLE_PREFIX . "session WHERE lastactivity>{$datecut} and userid=0"); $loggedins = $_db->_fetch_row('DB_FETCH_ASSOC'); ; $numberguest = $loggedins['sessions']; $totalusers = "There are ($numberguest) Guests online right now."; return $totalusers; } function gettotalbuyers() { global $_db; $datecut = time() - 600; $_db->query("SELECT COUNT(*) AS sessions FROM " . TABLE_PREFIX . "session WHERE lastactivity>{$datecut} and userid!=0"); $loggedins = $_db->_fetch_row('DB_FETCH_ASSOC'); $numberbuyers = $loggedins['sessions']; $totalbuyers = "There are ($numberbuyers) Users online right now."; return $totalbuyers; } function CleanSessionTbl() { global $db; $db2 = new DBM; $db->connect(); $newsess_time = time() - 3600; // one hour $sql1 = "SELECT lastactivity FROM " . TABLE_PREFIX . "session WHERE lastactivity <= '$newsess_time'"; $get_session = $db->query($sql1); if ($db->num_rows()) { $db2->connect(); while ($old = $db->_fetch_row('DB_FETCH_ASSOC')) { $sql = "DELETE FROM " . TABLE_PREFIX . "session WHERE lastactivity = '" . $old['lastactivity'] . "'"; $del_session = $db2->query($sql); } if ($del_session) { @$db->free_result(); @$db2->free_result(); } } } function VerifySession() { if ((isset($_COOKIE["oid"]) AND !empty($_COOKIE["oid"]) AND isset($_SESSION['oid']) == $_COOKIE["oid"])) { if ($_SESSION["sessionhash"] == $_COOKIE["sess"]) { return true; } else { $_SESSION = array(); return false; } } else { return false; } } function LookupCountry($id) { $db = new DBM; $db->connect(); $sql = "select printable_name from " . TABLE_PREFIX . "country where country_id = '$id'"; $db->query($sql); if ($db->num_rows()) { $rows = $db->_fetch_row('DB_FETCH_ASSOC'); return $rows['printable_name']; } } function CreateJsString() { global $countryid, $ChooseStateProvince; $db = new DBM; $db->connect(); $listing = " <!-- function Fill_Sub1(formf) { var main_select = document.getElementById(formf).country_id; var sub_select = document.getElementById(formf).state_id; if( main_select.options[main_select.selectedIndex].value == 0 ) { sub_select.length = 0; }\n"; if ($countryid != '' AND $countryid != '0') { $selectC = "where country_id = '$countryid'"; } $sql = "select country_id, printable_name from " . TABLE_PREFIX . "country $selectC"; $db->query($sql); $_db2 = new DBM; $_db2->connect(); while ($Row1 = $db->_fetch_row('DB_FETCH_ASSOC')) { $listing .= "if(main_select.options[main_select.selectedIndex].value == \"{$Row1[country_id]}\") { sub_select.length = 0;\n"; $listing .= "sub_select.options[0] = new Option('$ChooseStateProvince');\n"; $listing .= "sub_select.options[0].value = '0';\n"; $sql2 = "select s.state_id, s.printable_name from " . TABLE_PREFIX . "state s where s.country_id='{$Row1[country_id]}' order by printable_name "; $rs2 = $_db2->query($sql2); //$selectedctrl=0; $ctr1 = 1; while ($Row2 = $_db2->_fetch_row('DB_FETCH_ASSOC')) { //$listing .= "alert('$Row2[modelname]');"; $listing .= "sub_select.options[$ctr1] = new Option('{$Row2[printable_name]}');\n"; $listing .= "sub_select.options[$ctr1].value = '{$Row2[state_id]}';\n"; if ($_POST['state_id'] == $Row2['state_id']) { $selectedctrl3 = $ctr1; $listing .= "sub_select.options[$selectedctrl3].selected=true;\n"; } else { $selectedctrl3 = 0; } $ctr1++; } $listing .= "} else \n"; } $listing .= " {\n"; $listing .= " sub_select.length = 0;\n"; $listing .= " sub_select.options[0] = new Option('$ChooseStateProvince');\n"; $listing .= " sub_select.options[0].value = '0';\n"; $listing .= "}\n"; $listing .= " }\n"; $listing .= "Fill_Sub1('{$_GET['fn']}'); -->\n"; return $listing; } if (!file_exists(FULL_PATH . "/install.php")) { $datecut = time() - 600; $_db = new DBM; $_db->connect(); $loggedins = $_db->query_first("SELECT COUNT(*) AS sessions FROM " . TABLE_PREFIX . "session WHERE lastactivity>{$datecut}"); $numberguest = $loggedins['sessions']; $Cartotal = $_db->query_first("select COUNT(cid) AS Total from " . TABLE_PREFIX . "car_mst where cstatus = 'A'"); $total_cars = $Cartotal['Total']; // lets start poll class only for user, not admin $CarInfo = new Cars($db); $CarInfo->GetMostPopular(); if (!eregi("admincp", $_SERVER['REQUEST_URI'])) { $db = new DBM; $Booth = &new Booth($db); if ($SystemInfo->_systemstatus['Display_Poll'] == 'A') { $Poll = $Booth->display_booth(); } } $SystemInfo->GetVersion(); require_once (FULL_PATH . "/sponsor_cls.php"); if (!$GLOBALS['noshutdownfunc']) { register_shutdown_function("CleanSessionTbl"); } } elseif (!eregi("install", $_SERVER['REQUEST_URI']) AND !eregi("install", $_SERVER['PHP_SELF'])) { echo "Please delete the install.php file"; exit; } include_once 'global.php'; ?> Link to comment https://forums.phpfreaks.com/topic/276338-parse-error/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.