Notice: Undefined variable: db_host in C:\wamp\www\cbmall\index.php on line 7
Notice: Undefined variable: db_user in C:\wamp\www\cbmall\index.php on line 7
Notice: Undefined variable: db_pass in C:\wamp\www\cbmall\index.php on line 7
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\cbmall\index.php on line 7
Error connecting to database server: Access denied for user 'ODBC'@'localhost' (using password: NO)
index.php - <?php
-
// Setup some variables
-
include_once( "admin/settings.inc.php" );
-
-
-
// make the database connection
-
$db = mysql_connect( $db_host, $db_user, $db_pass ); # or die "Could not make connection to database server\n";
-
if ( ! $db ) {
-
print "Error connecting to database server: ".mysql_error();
-
exit;
-
}
-
mysql_select_db($db_name);
-
-
// grab the template...
-
$fh = fopen( 'templates/main.html', 'r' );
-
$content = '';
-
while( ! feof($fh) ) {
-
$content .= fgets($fh);
-
}
-
fclose($fh);
-
preg_match_all( "/\{Category: (.*?)\}/i", $content, $replacement_fields, PREG_SET_ORDER );
-
-
$content = str_replace( '{COUNT_ALL}', get_count_all(), $content );
-
foreach ( $replacement_fields as $category ) {
-
$repl_string = "{Category: $category[1]}";
-
$replacement = get_category_html($category[1]);
-
$content = str_replace( $repl_string, $replacement, $content );
-
}
-
print $content;
-
exit;
-
-
function get_count_all() {
-
global $db;
-
$sth = mysql_query("SELECT COUNT(*) as c FROM cb_urls");
-
$r = mysql_fetch_array($sth);
-
mysql_free_result($sth);
-
return $r['c'];
-
}
-
-
function get_category_html( $category_name ) {
-
global $db;
-
-
$count_all = 0;
-
$sql = mysql_query("SELECT COUNT(*) as c FROM cb_urls WHERE category LIKE '".addSlashes($category_name)."%'");
-
$r = mysql_fetch_array($sql);
-
mysql_free_result($sql);
-
$count_all = $r['c'];
-
-
$sql = "SELECT DISTINCT(category) AS c FROM cb_urls WHERE category LIKE '".addSlashes($category_name)."%'";
-
$sth = mysql_query($sql,$db);
-
$ret_string = ' <P ALIGN=LEFT><B><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica">'.$category_name.' ('.$count_all.')<BR></FONT></B>' . "\n";
-
while( $res = mysql_fetch_array($sth) ) {
-
$sth2 = mysql_query("SELECT COUNT(*) as cnt FROM cb_urls WHERE category='".addSlashes($res[c])."'");
-
$r = mysql_fetch_array($sth2);
-
mysql_free_result($sth2);
-
$nameA = split("::",$res[c]);
-
$name = $nameA[1];
-
if ( $name ) {
-
$ret_string .= ' <A HREF="search.php?keywords='.urlencode($res[c]).'" onMouseOver="window.status=\''.addSlashes($name).'\'; return true;" onMouseOut="window.status=\'\'; return true;"><FONT SIZE="-2" FACE="Verdana,Tahoma,Arial,Helvetica">'.$name.' ('.$r[cnt].')</FONT></A>'."\n";
-
$ret_string .= ' <FONT SIZE="-2" FACE="Verdana,Tahoma,Arial,Helvetica"></FONT>'."\n";
-
}
-
}
-
mysql_free_result($sth);
-
return $ret_string;
-
}
-
?>
-
settings.inc.php - <?
-
-
// Setup variables
-
-
-
// Database
-
$db_host = 'localhost'; // the host where your database server is running
-
$db_name = 'cbmall'; // the name of the database
-
$db_user = 'root'; // the username for connecting to the database
-
$db_pass = '696969'; // the password for connecting to the database
-
-
// Clickbank ID
-
$cb_user = 'Clickb'; // your clickbank affiliate id
-
-
// full url path to the script file - include trailing slash
-
$path = 'http://localhost/cbmall/';
-
-
// full url path to your XML file
-
$xmlfeed = 'http://localhost/cbmall/xml/marketplace_feed_v1.xml';
-
-
// Admin password - change to whatever you want
-
$adminpsd = '696969';
-
-
-
-
// PROBLEMS? Make sure ALL settings are 100% accurate.
-
-
-
?>
-
1 7554
on settings.inc.php
use <?php
?>
instead of <?
?>
it will solve your problem
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dan Finn |
last post by:
OpenBSD 3.2
Apache 1.3.26
PHP 4.3.4
PHP-Nuke 6.9
getting these in the apache error log:
Sun Nov 16 20:20:16 2003] PHP Notice: Undefined variable:
HTTP_USER_AGENT in...
|
by: Jason |
last post by:
hello,
i am new to PHP, so go easy.
I am using the examples in the book:
PHP: Your Visual Blueprint For Creating Open Source, Server Side Content
In the section where they talk about...
|
by: bissatch |
last post by:
Hi,
I get the following error:
Notice: Undefined variable: end_while in C:\Program
Files\Apache\Apache2\htdocs\csp\inc\xmlmenu.php on line 102
This is a script that works on the server...
|
by: prabhunew2005 |
last post by:
hi
I am doing web portal design using php.
I gave part of one of my screen coding.
<html>
<head>
<script language = "javascript">
function list_all_click()
|
by: dmain1971 |
last post by:
I have a class with an empty array like so:
private $detail = array();
Then I have a function later on in the class:
function get_array_value()
{
$detail_info = ' ';
|
by: Bob Bruyn |
last post by:
I've recently installed Apache 2 and php 5.2 on my WIndows XP
machine. Everything is up and running.
I'm passing some vars via the URL. It works fine online:...
|
by: Reggie |
last post by:
am trying to create a a upload file.am uploading files ok but i
recieve this message.
Notice: Undefined variable: uploaded_size in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/upload.php on...
|
by: printline |
last post by:
Can anyone help me with why i am getting this error message:
Notice: Undefined variable: SalesRepID in C:\Inetpub\wwwroot\index.php on line 158
Here is my php code:
<?php
session_start();...
|
by: siyaverma |
last post by:
Hi,
I am new to php, i was doing some small chnages in a project developed by my collegue who left the job and i got the responsibility for that,
After doing some changes when i run it on my...
|
by: cyberlei |
last post by:
hi all,
I`m getting this error
Notice: Undefined index: user in c:\inetpub\wwwroot\login.php on line 96
Notice: Undefined variable: message in c:\inetpub\wwwroot\login.php on line 101
Could...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |