The Error is [B]Parse error: syntax error, unexpected T_DNUMBER in [B]/home/a9720714/public_html/lib/lib.php on line [B]48[/B][/B][/B] Code (markup): Lib.php Is <?php /* security*/ $xHost = $_SERVER['SERVER_NAME']; $xReferer = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; //$xContents = @file_get_contents("http://ptcpay.com/license.php?id=5&domain=$xHost&referer=".urldecode($xReferer)); if(!empty($xContents)) die($xContents); //lib startsession_start(); if(!defined('DB_DETAILS')) {include_once($prefix_s.'lib/lib_database.php');} if(!function_exists("set_error")) {include_once($prefix_s.'lib/lib_functions.php');} if(mysql_ver() < 5){set_error("Your server doesn't support MySQL 5, Please install MySQL 5 to have Gen2 perform at it's best.");} if(PHP_VERSION < 5.1){set_error("Your server's PHP version is incompatible with Gen2. Gen2 is only compatible with PHP Version 5.1.0 and above.");} if(!defined('load_gen2')){set_error("We could not load the agent because a request was not declared properly.");$err_l = true;} if(!$c = mysql_connect(DB_HOST, DB_USER, DB_PASS)){set_error("We couldn't establish a connection to your MySQL server.");$err_l = true;}if(!mysql_select_db(DB_NAME, $c)){set_error("We couldn't establish a connection to your MySQL database.");$err_l = true;} if(!$error_load){DEFINE('START_PROCESS', true);} $do->refresh_sess();?> PHP: And line 48 is if(!$c = mysql_connect(DB_HOST, DB_USER, DB_PASS)){set_error("We couldn't establish a connection to your MySQL server.");$err_l = true;}if(!mysql_select_db(DB_NAME, $c)){set_error("We couldn't establish a connection to your MySQL database.");$err_l = true;} PHP: If someone could slove this problem.I will Pay you 3$ Via paypal.
I believe the culprit here is the value of DB_HOST. If the hostname is an IP address make sure you define it using double quotes instead of single quotes. If you have a period mark (dot) in DB_USER or DB_PASS you will have to wrap them using double quotes. Hope that helps!
NOT that you should be storing the mysql information in DEFINE where any script that can get itself running regardless of privileges can suddenly have access to it. Scripting language 101, passwords/login info + DEFINE == security hole big enough to sail the USS IOWA through... No matter what the ignorant fools behind wordpress think. Though @krishmk, singles or doubles shouldn't matter on a STRING value -- both make strings, even on define. I'd suspect no quotes are being used. Singles in fact should be preferred, since they have less parsing overhead.
Find the line where you have this: DEFINE('DB_HOST', ....); and change it to DEFINE("DB_HOST", "127.0.0.1"); of course the IP address should be the one your mysql is on.
Why add overhead when there's no variable to parse? Aside from the security hole, DEFINE('DB_HOST', '127.0.0.1'); is the same thing, but it parses faster.
You can define DB values as follow $DB_HOST = "localhost"; $DB_USER = "root"; $DB_PASS = "test"; $DB_NAME = "anydb"; then u can use them as if(!$c = mysql_connect($DB_HOST, $DB_USER, $DB_PASS)){set_error("We couldn't establish a connection to your MySQL server.");$err_l = true;}if(!mysql_select_db($DB_NAME, $c)){set_error("We couldn't establish a connection to your MySQL database.");$err_l = true;} I can help but i need full source code in include file specially error thing and DB inclusion file Regards, D NAjmi
Hi, I think I'm having a similar problem with a DB, which won't connect. This is "store bought code, and I'm a newbie, so I'm lost. I get the 111 error code, no connection. Any help much appreciated. Here's the code: <?php // CONNECT TO THE SERVER AND SELECT DATABASE $server = "jimmybryantnet.ipagemysql.com"; $user = "jimmybryantnet"; $password = "******"; $dataBase = "guestbook"; $conx = mysql_connect($server,$user,$password); $db_selected = mysql_select_db($dataBase,$conx); if($conx && $db_selected){ // IF CONNECTION IS ESTABLISHED $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; $xml .= "<data>\n"; if(isset($_POST['name'])){ $result = 0; $name=mysql_escape_string(trim($_POST['name'])); $email=mysql_escape_string(trim($_POST['email'])); $message=mysql_escape_string(trim($_POST['message'])); // ADD DATA TO THE TABLE guestbook WHEN THE USER PRESS THE send_btn in FLASH $sql="INSERT INTO guestbook(name,email,message,dateAdded)values('$name','$email','$message',now())"; $query = mysql_query($sql,$conx); if ($query){ $result= 1; $sql2 = "SELECT * FROM guestbook ORDER BY id DESC"; $query2 = mysql_query($sql2,$conx); //WHEN query == true , GET LIST OF MESSAGES AND PUT THEM AS XML FILE while($data = mysql_fetch_array($query2)){ $xml .= "<guest>\n"; $xml .= "<name>".$data['name']."</name>\n"; $xml .= "<msg><![CDATA[".$data['message']."]]></msg>\n"; $xml .= "<sdate>".$data['dateAdded']."</sdate>\n"; $xml .= "</guest>\n"; } } else{ $result=0; } $xml .= "<inserted>".$result."</inserted>\n"; } if(isset($_POST['getMessage'])){ // GET LIST OF MESSAGES AND PUT THEM AS XML FILE $sql = "SELECT * FROM guestbook ORDER BY id DESC"; $query = mysql_query($sql,$conx); while($data = mysql_fetch_array($query)){ $xml .= "<guest>\n"; $xml .= "<name>".$data['name']."</name>\n"; $xml .= "<msg><![CDATA[".$data['message']."]]></msg>\n"; $xml .= "<sdate>".$data['dateAdded']."</sdate>\n"; $xml .= "</guest>\n"; } } $xml .= "</data>\n"; echo $xml; } else{ // IF CONNECTION == false OR DATABASE DOESN'T EXISTE die (mysql_error()); } ?>