473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Notice: Undefined variable: db_host in C:\wamp\www\cbmall\index.php on line 7

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
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Setup some variables
  3. include_once( "admin/settings.inc.php" );
  4.  
  5.  
  6. // make the database connection
  7. $db            = mysql_connect( $db_host, $db_user, $db_pass ); # or die "Could not make connection to database server\n";
  8. if ( ! $db ) {
  9.     print "Error connecting to database server: ".mysql_error();
  10.     exit;
  11. }
  12. mysql_select_db($db_name);
  13.  
  14. // grab the template...
  15. $fh = fopen( 'templates/main.html', 'r' );
  16. $content = '';
  17. while( ! feof($fh) ) { 
  18.     $content .= fgets($fh);
  19. }
  20. fclose($fh);
  21. preg_match_all( "/\{Category: (.*?)\}/i", $content, $replacement_fields, PREG_SET_ORDER );
  22.  
  23. $content = str_replace( '{COUNT_ALL}', get_count_all(), $content );
  24. foreach ( $replacement_fields as $category ) { 
  25.     $repl_string = "{Category: $category[1]}";
  26.     $replacement = get_category_html($category[1]);
  27.     $content = str_replace( $repl_string, $replacement, $content );
  28. }
  29. print $content;
  30. exit;
  31.  
  32. function get_count_all() { 
  33.    global $db;
  34.    $sth = mysql_query("SELECT COUNT(*) as c FROM cb_urls");
  35.    $r = mysql_fetch_array($sth);
  36.    mysql_free_result($sth);
  37.    return $r['c'];
  38. }
  39.  
  40. function get_category_html( $category_name ) {
  41.     global $db;
  42.  
  43.    $count_all = 0;
  44.    $sql = mysql_query("SELECT COUNT(*) as c FROM cb_urls WHERE category LIKE '".addSlashes($category_name)."%'");
  45.    $r = mysql_fetch_array($sql);
  46.    mysql_free_result($sql);
  47.    $count_all = $r['c'];
  48.  
  49.     $sql = "SELECT DISTINCT(category) AS c FROM cb_urls WHERE category LIKE '".addSlashes($category_name)."%'";
  50.     $sth = mysql_query($sql,$db);
  51.     $ret_string = '                                          <P ALIGN=LEFT><B><FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica">'.$category_name.' ('.$count_all.')<BR></FONT></B>' . "\n";
  52.     while( $res = mysql_fetch_array($sth) ) { 
  53.       $sth2 = mysql_query("SELECT COUNT(*) as cnt FROM cb_urls WHERE category='".addSlashes($res[c])."'");
  54.       $r = mysql_fetch_array($sth2);
  55.       mysql_free_result($sth2);
  56.         $nameA = split("::",$res[c]);
  57.         $name = $nameA[1];
  58.         if ( $name ) { 
  59.             $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";
  60.             $ret_string .= '                                             <FONT SIZE="-2" FACE="Verdana,Tahoma,Arial,Helvetica"></FONT>'."\n";
  61.         }
  62.     }
  63.    mysql_free_result($sth);
  64.     return $ret_string;
  65. }
  66. ?>
  67.  
settings.inc.php
Expand|Select|Wrap|Line Numbers
  1. <?
  2.  
  3. // Setup variables
  4.  
  5.  
  6. // Database
  7. $db_host = 'localhost'; // the host where your database server is running
  8. $db_name = 'cbmall'; // the name of the database
  9. $db_user = 'root'; // the username for connecting to the database
  10. $db_pass = '696969'; // the password for connecting to the database
  11.  
  12. // Clickbank ID
  13. $cb_user = 'Clickb'; // your clickbank affiliate id
  14.  
  15. // full url path to the script file - include trailing slash
  16. $path = 'http://localhost/cbmall/';
  17.  
  18. //  full url path to your XML file
  19. $xmlfeed = 'http://localhost/cbmall/xml/marketplace_feed_v1.xml';
  20.  
  21. // Admin password - change to whatever you want
  22. $adminpsd = '696969';
  23.  
  24.  
  25.  
  26. // PROBLEMS? Make sure ALL settings are 100% accurate.
  27.  
  28.  
  29. ?>
  30.  
Nov 23 '10 #1
1 7554
johny10151981
1,059 1GB
on settings.inc.php

use
<?php

?>


instead of
<?

?>


it will solve your problem
Nov 24 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
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...
3
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...
3
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...
1
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()
4
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 = ' ';
2
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:...
2
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...
3
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();...
5
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...
4
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...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.