Jump to content

kala_shah

Members
  • Posts

    5
  • Joined

  • Last visited

kala_shah's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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'; ?>
  2. sorry, i,ll remember in future
  3. Thanks psycho! help ...."Any reason why you are trying to run on port 8888?" Nice point.... I got it Now script is running smootly I just change the port no 8888 to 80.
  4. Hi, I m tring to run a script during install i got an error: Parse error: syntax error, unexpected end of file in C:\Program Files\EasyPHP-12.1\www\car2\install.php on line 218 here is code: <?php require_once ("config.php"); require_once ("admincp/install_cls.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 transitional//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en" dir="ltr"> <head> <title>My Car Site <?php echo $name_of_site ?></title> <link href="<?php echo SITE_URL ?>/templates/admin/install.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<?php echo SITE_URL ?>/templates/admin/install.js"></script> </head> <body> <h2 style="margin-left:auto; margin-right:auto; width:75%; text-align:center"><?php echo $name_of_site ?> Install</h2> <?php define('VERSION', '1.0.8'); // version of script if (file_exists(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php")) { $db = "<div class=\"error\">" . TABLE_PREFIX . "db.php exits! You will be overwriting this file once you click continue.</div>"; $Connection = TRUE; } else { $db = "<div class=\"error\">" . TABLE_PREFIX . "db.php does not exits!</div>"; $Connection = FALSE; } $level = (isset($_POST['level'])) ? $_POST['level'] : ""; if ($level == "") { ?> <div class="raised" style="text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent" style="padding:3px"> Welcome to the <?php echo $name_of_site ?> install. In order for you to install this product, you will need to follow the steps in the next few screens. <hr /> <div class="raised" style="margin-top:5px; width:130px; height:50px; text-align:center; margin-left:75%"> <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent"><form action="install.php" method="post"><input type="hidden" name="level" value="1" /><input class="button" type="submit" name="next" value="Continue to Step 1" /></form></div> <b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b> </div> </div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div> <?php } if ($level == "1") { ?> <h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #1, MySql Connection Info</h3> <div class="raised" style="width:75%; text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent" style="padding:3px"> <?php if ($Connection) { echo $db; } ?> <form method="post" action="install.php" onsubmit="return valid_dbf(this)"> <p align="center">This information is generally given to you by your host. It is important to have this for the script to work.</p> <div style="margin:auto; text-align:center; width:70%"> <p align="left">Hostname : <input errortext="You have must enter a 'host'" type="text" name="hostname" size="20" value="localhost" />(often localhost)</p> <p align="left">DB Username : <input errortext="You must enter a 'Username'" type="text" name="db_username" size="20" /></p> <p align="left">DB Password : <input errortext="You have must enter a 'Password'" type="text" name="db_password" size="20" /></p> <p align="left">Database Name: <input errortext="You have must enter a 'Database Name'" type="text" name="db_name" size="20" /></p> </div> <div class="raised" style="width:130px; height:50px; text-align:center; margin-left:75%"> <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent"> <input type="hidden" name="level" value="2" /><input class="button" type="submit" name="next" value="Continue to Step 2" /></form></div> <b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b> </div> </div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div> <?php } if ($level == "2") { if (file_exists(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php")) { unlink(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php"); } $fd = fopen(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php", "w+") or die("<div class=\"error\">Unable to create " . TABLE_PREFIX . "db.php in admincp. Please chmod this folder to 777 and press refresh on this page.</div>"); $str_gen = "<?php\n\n // " . date("M d, Y G:i:s") . " \n\ndefine(\"HOSTNAME\", \"{$_POST['localhost']}\"); define(\"USER\", \"{$_POST['root']}\"); define(\"PASS\", \"{$_POST['']}\"); define(\"DBNAME\", \"{$_POST['car2']}\");\r\n?>"; $len_gen = strlen($str_gen); fwrite($fd, $str_gen, $len_gen); fclose($fd); ?> <h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #2, Connection Info Saved</h3> <div class="raised" style="width:75%; text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent" style="padding:3px"> <div class="error"><?php echo TABLE_PREFIX ?>db.php has been written to admincp succesfully.</div> <p align="center">The next step will create the mysql tables for you so the script can function properly.</p> <div class="raised" style="width:130px; height:50px; text-align:center; margin-left:75%"> <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent"> <form method="post" action="install.php"> <input type="hidden" name="level" value="3" /><input class="button" type="submit" name="next" value="Continue to Step 3" /></form></div> <b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b> </div> </div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div> <?php } if ($level == "3") { if ($Connection) { include (FULL_PATH . "/admincp/sql.php"); $DBc = new DBM; $DBc->connect(); foreach ($CarDealer_Query['Create'] AS $query) { $DBc->query($query); } foreach ($CarDealer_Query['Insert'] AS $query) { $DBc->query($query); } if (!$DBc->errdesc) { $GetResult = "<div class=\"error\">Tables have been created successfully.</div>"; $GetResult .= "<p align=\"center\">Next step will install the scripts templates. Please continue to the next step. <br /><br />"; $submitbtn = "<input class=\"button\" type=\"submit\" name=\"next\" value=\"Continue to Step 4\" />\n"; $go = "4"; } else { $GetResult = "<div class=\"error\">Table creation failed. Error below: <br /><br />" . $DBc->errdesc . "</div>"; $submitbtn = "<input class=\"button\" type=\"submit\" name=\"next\" value=\"Redo Step 3\" />\n"; $go = "3"; } } else { $GetResult = "<div class=\"error\">" . TABLE_PREFIX . "db.php is not found. No Connection to mysql can be established. Please go back to setp 1 to create this file.</div>"; $submitbtn = "<input class=\"button\" type=\"submit\" name=\"next\" value=\"Back to Step 1\" />\n"; $go = "1"; } ?> <h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #3, Mysql Table Creation</h3> <div class="raised" style="width:75%; text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent" style="padding:3px"> <form method="post" action="install.php"> <?php echo $GetResult ?> <div class="raised" style="width:130px; height:50px; text-align:center; margin-left:75%"> <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent"> <input type="hidden" name="level" value="<?php echo $go ?>" /><?php echo $submitbtn ?></form></div> <b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b> </div> </div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div> <? // End of level 3... } <?php if ($level == "4") { $Install = new INSTALL(); $Install->INSTALLS(); if ($Install->InstallError) { $GetResult = "<div class=\"error\">Style Import Failed. Error below: <br /><br />$Install->InstallError</div>"; $submitbtn = "<input type=\"hidden\" name=\"level\" value=\"4\" /><input class=\"button\" type=\"submit\" name=\"next\" value=\"Redo to Step 4\" /></form></div>\n"; } else { $GetResult = "<div class=\"error\">$Install->msg</div>"; $GetResult .= "<a href='admincp/index.php'>Login to Your Admin</a></p> <p align=\"center\">Thank you for the Installing The $name_of_site Script. It is required to Delete this install script once done.</p>\n"; $submitbtn = "<div class=\"boxcontent\">Finished</div></form>\n"; } ?> <h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #4, Master Style Insertion</h3> <div class="raised" style="width:75%; text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <div class="boxcontent" style="padding:3px"> <?php echo $GetResult ?> <form method="post" action="install.php"> <div class="raised" style="width:130px; height:50px; text-align:center; margin-left:75%"> <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b> <?php echo $submitbtn ?> <b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b> </div> </div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div> <?php } ?> <div class="copyright"><div style="display: inline;"><?php echo $name_of_site ?> <?php echo VERSION ?></div><div style="text-align:right; display: inline; width:200px"> © My Car Site</div></div> </body> </html> please help
  5. Hi all, Hi All, I m new with php I m trying to run an open source php script on local host. i m using Easyphp 12.1 apache 2.4.2 php 5.4.6 MySql 5.5.27 1st page of script is load successfully with this url: http://127.0.0.1:8888/phplogin/ when i click on any link "Login" given on page i m facing an error "The connection was reset" and url change with This: http://127.0.0.1/phplogin/login.php/ (no port )
  6. Hi All, I m a new with PhP i want to learn php form this forum , hope i,ll find all gorgeous php coder here.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.