Notice: Undefined variable: db_host in C:\wamp\www\cbm all\index.php on line 7
Notice: Undefined variable: db_user in C:\wamp\www\cbm all\index.php on line 7
Notice: Undefined variable: db_pass in C:\wamp\www\cbm all\index.php on line 7
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localho st' (using password: NO) in C:\wamp\www\cbm all\index.php on line 7
Error connecting to database server: Access denied for user 'ODBC'@'localho st' (using password: NO)
index.php
settings.inc.ph p
Notice: Undefined variable: db_user in C:\wamp\www\cbm all\index.php on line 7
Notice: Undefined variable: db_pass in C:\wamp\www\cbm all\index.php on line 7
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localho st' (using password: NO) in C:\wamp\www\cbm all\index.php on line 7
Error connecting to database server: Access denied for user 'ODBC'@'localho st' (using password: NO)
index.php
Code:
<?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;
}
?>
Code:
<? // 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. ?>
Comment