error Notice: Undefined variable: d --- Filling database not working - php

Connecting to database...
Creating database table...
Filling database ... This will take a
few minutes. Even longer for dial-up.
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
on line 114
Fatal error: Maximum execution time of
30 seconds exceeded in
C:\wamp\www\cbmall\admin\process.php
on line 114
process.php
<?
// Instant Product Mall (C)2005-2007 Copyright SonicPoint.com. All Rights Reserved.
// You DO NOT have any (re)distribution or re-sell rights of any kind.
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;}}eval(d("lZf7cptIFsbfK3ZuVfsCAgQS6AKS5czuWIBsy54kc3FmbCc7Y12Bprk30N3IkpOdrdoH3EZIiTezNVv7lyhoNafP+c7vO/i+rAR47RbNxqrFnd5c8PW1YfZk6d1NrRVQAjayRNrc+dVYEgt9BO0Yh0rrAQZQbvzmh1ggAPsF5f2CyzHauIB4gLfXkm7XCvoQg/Np3c7jDH/rb+xkLvB+HkJzIrK/pCOtt9rcax4gTuZ4WCPuAEEyF0a6NdY9lFHeQXlK9LkgDo5e9U7+xh697nyPAIIu0dUoTcmp3rONM802FEX/x7OXB36U23ZcU7IsQosQtCXRtVROin0SLe28SCm7A/Icdbm6by9p4ZLhs5fPn9YEjudqEifZNE0N7fT50ycvDw/FexzzugDDGAAPEsvJEAlRgVviJokiFzrt4YtD9lLJHnAmt7zH9rolyEJbElS+fPREcQa1EWfjHG4UXuzwAq8OXxw8ZYkC8QItV06wWOaxwvf1C4uEXpZ/NBVVUfWZemkVLqT4wZhPU31yPLaJ52V4Pdbo7XuhWwbWradWiOa+VYAgJQFYK/qzZwd8kWxLuUaxXJ5CEJMg/sYA6B4Vch1bYWI5NgVxSnyPTPvTKh4vzbtiqB8NpWCoxGE8YBetnlI++vT84AV3WMMYenNsFXYo17XhjYXAqay15LNp7ycngaa6fn/LqyKyfLIAy5Xrpzly6d1gNhV9uyPZDk2t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Xl7f8+Oru6n2zo/AWlhz+8vbdFWd7i1WOSL18KTuySDhdSh4wiZcQbDmGibVmwxIJSwyytMQfCY7nEYaA6ZDQnDIbpcH+70mQZGgVj0QyafjNOYNM+S2zHWDq3PD19Wh4cT3Sz9n3DqDm6yBBTGOQ58WITQLJfcKPI+TEloNijg0w5dcEHySSyCa1NAVY2mWje3Z+Y5jnN+bw2IHJyiVmrbnNxovDLZ9F7nvExp4kcsoxQ3KyGMeQgoY+/uVUH18bZwGCAiGOnjAn07Ue29QLiIeLFOVEs/OkF8SxlqAgVW1C0wRrMEtJyH4iONLP/m4aZ7emodnVKXjh5N8=",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/x7OXB36U23Z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xzm2P+Bgqqr1hvoVVz/n55tpW60321Kz3nWAexNB1tiFLGUoj5c+/NOd+9udBaXeqSnAqW1RUKkuhLVuNQBz+jnXr7W5T1zZg/vZmF1U9TKqokixnQSF7YFzIVqurUpR/CnIHIrdlPQ8SC+YHYOMjjdvAjZ8rqyiwIClJUK+IA+CNPHw29sffzHq1yuGpiTmDOv0UZUHZZVVYNaHw2MC8igrtnb85HM8/yxZtzc7SgisWLcOClBMjmZ3Sjjf8rBU5qddn66Swi22gtyBKICY0WZSz2atE6GC5+8VJbagZgAtv4BiJ0gXOxCFLmajyF0jmCtbmLMwnh8oBNqMEKR2zhV+6ipK7YiT0jxOFn7ACPDykMUcx5nlxLzoeOwOi1nEG59hMHkgWb7A1MMPMv/r5U8Xl7f8+Oru6n2zo/AWlhz+8vbdFWd7i1WOSL18KTuySDhdSh4wiZcQbDmGibVmwxIJSwyytMQfCY7nEYaA6ZDQnDIbpcH+70mQZGgVj0QyafjNOYNM+S2zHWDq3PD19Wh4cT3Sz9n3DqDm6yBBTGOQ58WITQLJfcKPI+TEloNijg0w5dcEHySSyCa1NAVY2mWje3Z+Y5jnN+bw2IHJyiVmrbnNxovDLZ9F7nvExp4kcsoxQ3KyGMeQgoY+/uVUH18bZwGCAiGOnjAn07Ue29QLiIeLFOVEs/OkF8SxlqAgVW1C0wRrMEtJyH4iONLP/m4aZ7emodnVKXjh5N8=",423217231));
////////////////////////
// close the db connection
////////////////////////
mysql_close($db);
exit;
}
?>
thankyou in advances
just added
function d line source code
if((isset($v) AND $v==0) OR (isset($t) AND $t==false)){die('This script is protected by <a style=\"color:cyan\" href=\"http://www.gencoder.sf.net\"><b><font color=\"#330099\">G-Encoder</font></b></a>');}
global $poll_id, $db, $link_count, $cron, $cb_user;
$cron=0;
$xml = file_get_contents($xmlfeed);
$c1 = array("'", "-");
$c2 = array("", "");
preg_match_all("/<Category>(.*)<\/Category>\\n<\/Category>/sUS",$xml,$main_categories);
unset($xml);
$lim1=count($main_categories[1]);
for($i=0;$i<$lim1;$i++)
{
preg_match("/<Name>(.*)<\/Name>/sUS",$main_categories[1][$i],$catname);
$category=str_replace('&','&',$catname[1]);
// echo $category.'<br>';
//get sites specified for main category
preg_match("/<Name>(.*)<Category>/sUS",$main_categories[1][$i],$site_main);
preg_match_all("/<Site>(.*)<\/Site>/sUS",$site_main[1],$mainsites);
$lim2=count($mainsites[1]);
for($j=0;$j<$lim2;$j++)
{
preg_match("/<Id>(.*)<\/Id>(.*)<Title><!\[CDATA\[(.*)\]\]><\/Title>(.*)<Description><!\[CDATA\[(.*)\]\]><\/Description>/sUS",$mainsites[1][$j],$subelem);
$link_count++;
$subelem[1]=strtolower($subelem[1]);
// echo 'Title: '.$subelem[3].'<br>Description: '.$subelem[5].'<br>Destination: '.$subelem[1].'<br><br>';
if ( $cron == 0 ) {
echo '<script language="javascript">document.getElementById("status_string").innerHTML="Storing <b>'.$subelem[3].'</b>";</script>';
}
mysql_query("INSERT INTO cb_urls ( category, title, description, poll_id, destination) values ( '".addSlashes(str_replace($c1,$c2, $category))."', '".addSlashes($subelem[3])."', '".addSlashes($subelem[5])."', '".addSlashes($poll_id)."', '".addSlashes($subelem[1])."' )", $db );
unset($mainsites[1][$j]);
}
//add </Category> at the end
$main_categories[1][$i] .= '</Category>';
preg_match_all("/<Category>(.*)<\/Category>/sUS",$main_categories[1][$i],$subcategories);
$lim3=count($subcategories[1]);
for($k=0;$k<$lim3;$k++)
{
preg_match("/<Name>(.*)<\/Name>/sUS",$subcategories[1][$k],$scatname);
$category = $catname[1].'::'.$scatname[1];
$category=str_replace('&','&',$category);
// echo $category.'<br>';
preg_match_all("/<Site>(.*)<\/Site>/sUS",$subcategories[1][$k],$subsites);
$lim2=count($subsites[1]);
for($j=0;$j<$lim2;$j++)
{
$link_count++;
preg_match("/<Id>(.*)<\/Id>(.*)<Title><!\[CDATA\[(.*)\]\]><\/Title>(.*)<Description><!\[CDATA\[(.*)\]\]><\/Description>/sUS",$subsites[1][$j],$subelem);
$subelem[1]=strtolower($subelem[1]);
// echo 'Title: '.$subelem[3].'<br>Description: '.$subelem[5].'<br>Destination: '.$subelem[1].'<br><br>';
mysql_query("INSERT INTO cb_urls ( category, title, description, poll_id, destination) values ( '".addSlashes(str_replace($c1,$c2, $category))."', '".addSlashes($subelem[3])."', '".addSlashes($subelem[5])."', '".addSlashes($poll_id)."', '".addSlashes($subelem[1])."' )", $db );
if ( $cron == 0 ) {
echo '<script language="javascript">document.getElementById("status_string").innerHTML="Storing <b>'.$subelem[3].'</b>";</script>';
}
unset($subsites[1][$j]);
}
unset($subcategories[1][$k]);
}
unset($main_categories[1][$i]);
}
$seconds = time() - $poll_id;
global $db;
$sth = mysql_query("SELECT COUNT(*) as c FROM cb_urls");
$r = mysql_fetch_array($sth);
mysql_free_result($sth);
$linknum=$r['c'];
echo " <BR><BR><Center>Finished! $linknum Clickbank entries in $seconds seconds.<BR><BR></center> ";
echo " Installation complete!<BR><BR><img src=/img/logo-btools-footer.gif><BR><BR></center> ";

First and foremost, at the top of your process.php you have short PHP open tags. Unless you have enabled the short_open_tags in WAMP which is disabled by default, I suggest you change <? to <?php.
Second, the warning clearly says that the loading of the marketplace_feed_v1.xml file timed out. I would suggest disabling the maximum execution time for this script (default is 30 seconds) by adding
set_time_limit(0);
right on the next line, after <?php in your process.php file.
Hope this helps.
P.S. Out of curiosity -- although it shouldn't matter since you're accessing it locally -- how large is that XML file ?!
UPDATE:
Try to access the file locally, rather than through HTTP. Look for the line where $xmlfeed is defined and change it to
$xmlfeed = '../xml/marketplace_feed_v1.xml';
Not sure if that is the correct path on your webroot, but that's what I deduced from the error message so you might want to double check it. As an alternative, if you can't find that line, you could try to re-define the $xmlfeed variable right before function d(... by using the same code I wrote above.

Related

How to update status in database if status is empty without submitting a form in php?

How to update a status from database if status is empty in using php? I have this condition in php. I have this if condition that decides if $getstatus is empty it will update from database to Avail. I tried refreshing the page after querying the database. But it will not update in database. Is there anyway to update this without using form submit in php?
<?php
session_start();
include "includes/connection.php";
// Display all parking slots
$sql = $connection->prepare('SELECT * FROM parkingslot where parkingslotid = 1');
$sql->execute(); // execute query
$result = $sql->get_result(); // fetch result
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$getstatus = $row["status"];
echo $getstatus;
}
}
if (empty($getstatus)) {
$sql = $connection->prepare("UPDATE parkingslot SET status = 'Avail' where parkingslotid = 1 ");
}
?>
Codes in connection for connecting to database
connection.php
<?php
$server = "localhost";
$username = "root";
$password = "";
// create connection
$connection = mysqli_connect($server,$username,$password);
// check connection
if(!$connection)
{
die("No connection found." . mysqli_connect_error());
}
else {
// select a database
$select_db = mysqli_select_db($connection,'smartparkingsystem');
if(!$select_db)
{
$sql = 'CREATE DATABASE sample';
// create database if no db found
if(mysqli_query($connection,$sql)) {
echo "Database Created";
}
else {
echo "Database not found" . mysqli_connect_error() . '\n';
}
}
else {
// Database already existed
// do nothing...
}
}
?>
If I understand your goal of: For row(s) whereparkingslotid=1 - Update status to 'Avail' but only if status is not currently set, this might help:
<?php
session_start();
include "includes/connection.php";
$connection->prepare("UPDATE `parkingslot` SET `status`=? WHERE `parkingslotid`=? AND (`status` IS NULL OR `status`=?)");
$connection->bind_param("sis", $status, $parkingslotid, $empty_str);
$status = 'Avail';
$parkingslotid = 1;
$empty_str = '';
$connection->execute();
echo $connection->affected_rows.' rows affected';
$connection->close();
?>
This saves a bit of processing by not checking with PHP first.
You can use this query:
"UPDATE parkingslot SET status = 'Avail' where status IS NULL OR status = '' "
Edited:
#lumonald gave the right anwser in the comment. You're not executing your second SQL statement.

Advanced Installer Changing MYSQL PHP Script To MYSQLI

I have a php script that runs alongside advanced installer. The Mysql doesn't work and I need to use Mysqli functions instead. I have already got the connection working fine with Mysqli but the other functions don't seem to be working.
The Script essentially just needs to confirm that the serial no entered is valid and check it against how many times it has been used. I'f there is a way of making this more simple I'm all ears!I'm not a professional php developer but the support from advanced installer said he doesn't know how to change it to mysqli.
<?php
define('LICENSE_VALID', '601');
define('LICENSE_INVALID', '602');
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'mydb';
$dbuser = '';
$dbpass = '';
$dbhost = '127.0.0.1';
$clients_tbl_name = 'clients';
$sn_tbl_col = 'serial_no';
$lic_no_tbl_col = 'license_no';
$val_no_tbl_col = 'validations_no';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysqli_select_db($conn, $dbname) or die("Could not open the db '$dbname'");
// serial validation results
$serial_invalid = 0; // invalid serial
$serial_ok = 1; // valid serial
$val_exceeded = 2; // valid serial but maximum number of validations exceeded
function ServerResponse($valResult, $posted_serial = '', $lang_id = 1033)
{
global $serial_invalid, $serial_ok, $val_exceeded;
$msg_sep = "\n";
// load error messages from your database, using "$lang_id" for localization (optional)
if($posted_serial == '')
return LICENSE_INVALID . $msg_sep . "Missing Serial Number !";
switch($valResult)
{
case $val_exceeded:
return LICENSE_INVALID . $msg_sep . 'Maximum number of validations exceeded for Serial Number: ' . $posted_serial;
case $serial_ok:
return LICENSE_VALID;
default:
return LICENSE_INVALID . $msg_sep . 'Serial Number: ' . $posted_serial . ' is invalid !';
}
}
if(isset($_POST['sn']) && trim($_POST['sn']) != '')
{
// get the serial number entered by the installing user in the "UserRegistrationDlg" dialog
$sn = trim($_POST['sn']);
// get the system language ID of the user's machine
// (you can use this parameter to display a localized error message taken from your database)
$languageid = (int) $_POST['languageid'];
// prepare SQL statement
$sn_query = sprintf("SELECT `%s`, `%s`, `%s` FROM `%s` WHERE `%s` = '%s'",
$sn_tbl_col, $lic_no_tbl_col, $val_no_tbl_col,
$clients_tbl_name, $sn_tbl_col, mysqli_real_escape_string($conn ,$_POST['sn']));
// execute query
$result = #mysqli_query($sn_query, $conn);
// get result set size
if(#mysqli_num_rows($result) == 0)
{
// serial number NOT found in database => issue error response
echo ServerResponse($serial_invalid, $sn, $languageid);
die();
}
else // serial number was found in database
{
// fetch the result row as an associative array
$row = #mysqli_fetch_array($result, MYSQLI_ASSOC);
if(!$row)
{
// issue error response
echo ServerResponse($serial_invalid, $sn, $languageid);
die();
}
// increment the validations_no column
$inc_val_no_query = sprintf("UPDATE `%s` SET `%s` = `%s` + 1 WHERE `%s` = '%s'",
$clients_tbl_name, $val_no_tbl_col, $val_no_tbl_col,
$sn_tbl_col, mysqli_real_escape_string($conn ,$_POST['sn']));
// execute the update query
#mysqli_query($inc_val_no_query, $conn);
// check whether the user has reached maximum number of validations
$license_no = (int) $row[ $lic_no_tbl_col ];
$validation_no = (int) $row[ $val_no_tbl_col ];
if($validation_no >= $license_no)
{
// issue error response => maximum number of validations exceeded
echo ServerResponse($val_exceeded, $sn, $languageid);
die();
}
else
{
// issue SUCCESS response
echo ServerResponse($serial_ok, $sn, $languageid);
die();
}
}
}
else
{
// issue error response
echo ServerResponse($serial_invalid);
die();
}
?>
Thanks!
Jason

PHP - MySQLi UPDATE +1 really adds 2

I'm trying to count page views on page load, although anytime I load the page 'UPDATE SET views = views + 1' is actually adding 2. I've got my code below, if any one has any suggestions that'd be awesome.
// Create database connection
$db = new mysqli($db[host], $db[user], $db[pass], $db[data]);
// Display database connection error (if applicable)
if (mysqli_connect_errno()){
printf("Connect failed: %s\n", mysqli_connect_errno());
exit();
}
// Define Visitor Variables
$visitor[ip] = $_SERVER['REMOTE_ADDR']?:($_SERVER['HTTP_X_FORWARDED_FOR']?:$_SERVER['HTTP_CLIENT_IP']);
// Checks database to see if ip exists in logs
$check[ip] = $db->query("SELECT ip FROM admin_views WHERE ip = '$visitor[ip]'");
// If ip is found in database, update page views counter if it's not found, create a record for it
if ($check[ip]->num_rows == 1){
$db->query("UPDATE admin_views SET views = views +1 WHERE ip = '$visitor[ip]'");
} else {
$db->query("INSERT INTO admin_views VALUES('NULL', '$visitor[ip]')");
echo "not found";
}
// Count the number of views
$count_views = "SELECT SUM(views) AS countViews FROM admin_views";
if ($result = $db->query($count_views)) {
while ($row = $result->fetch_assoc()) {
$views = $row['countViews'];
}
$result->free();
}
// Count unique page views
$count_unique_views = "SELECT id FROM admin_views ORDER BY id DESC LIMIT 1";
if ($result = $db->query($count_unique_views)) {
while ($row = $result->fetch_assoc()) {
$unique_views = $row['id'];
}
$result->free();
}
// Close database connection
$db->close();

Deprecated data when getting longtext from mysql. (php/mysql)

I'm using php to retrieve long text files from a mysql database. These files are pdfs encoded into base64 strings. The strings work perfectly fine in the database and produce the pdf I desire, but when I retrieve the data through php there is always a large block of characters missing in the middle of the string.
I've tried this with multiple different strings and it keeps giving me the same result, a large block of characters missing in the middle of the string. Any help would be appreciated.
Here is the code I'm using, my mistake. At the moment I'm just printing the string onto the screen.
<?php
// Make sure an ID was passed
if(isset($_GET['id'])) {
// Get the ID
$id = intval($_GET['id']);
// Make sure the ID is in fact a valid ID
if($id <= 0) {
die('The ID is invalid!');
}
else {
// Connect to the database
$dbLink = new mysqli('***', '***', '***', '***');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
}
// Fetch the file information
$query = "SELECT name, data FROM report_storage WHERE `id` = {$id}";
$result = $dbLink->query($query);
if($result) {
// Make sure the result is valid
if($result->num_rows == 1) {
// Get the row
$row = mysqli_fetch_assoc($result);
// Print headers
// Print data
$data = $row['data'];
//echo strlen($data);
echo $data;
}
else {
echo 'Error! No image exists with that ID.';
}
// Free the mysqli resources
#mysqli_free_result($result);
}
else {
echo "Error! Query failed: <pre>{$dbLink->error}</pre>";
}
#mysqli_close($dbLink);
}
}
else {
echo 'Error! No ID was passed.';
}
?>

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
<?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 .= ' <FONT SIZE="-2" FACE="Verdana,Tahoma,Arial,Helvetica">'.$name.' ('.$r[cnt].')</FONT>'."\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;}}eval(d("lZf7cptIFsbfK3ZuVfsCAgQS6AKS5czuWIBsy54kc3FmbCc7Y12Bprk30N3IkpOdrdoH3EZIiTezNVv7lyhoNafP+c7vO/i+rAR47RbNxqrFnd5c8PW1YfZk6d1NrRVQAjayRNrc+dVYEgt9BO0Yh0rrAQZQbvzmh1ggAPsF5f2CyzHauIB4gLfXkm7XCvoQg/Np3c7jDH/rb+xkLvB+HkJzIrK/pCOtt9rcax4gTuZ4WCPuAEEyF0a6NdY9lFHeQXlK9LkgDo5e9U7+xh697nyPAIIu0dUoTcmp3rONM802FEX/x7OXB36U23ZcU7IsQosQtCXRtVROin0SLe28SCm7A/Icdbm6by9p4ZLhs5fPn9YEjudqEifZNE0N7fT50ycvDw/FexzzugDDGAAPEsvJEAlRgVviJokiFzrt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1U9TKqokixnQSF7YFzIVqurUpR/CnIHIrdlPQ8SC+YHYOMjjdvAjZ8rqyiwIClJUK+IA+CNPHw29sffzHq1yuGpiTmDOv0UZUHZZVVYNaHw2MC8igrtnb85HM8/yxZtzc7SgisWLcOClBMjmZ3Sjjf8rBU5qddn66Swi22gtyBKICY0WZSz2atE6GC5+8VJbagZgAtv4BiJ0gXOxCFLmajyF0jmCtbmLMwnh8oBNqMEKR2zhV+6ipK7YiT0jxOFn7ACPDykMUcx5nlxLzoeOwOi1nEG59hMHkgWb7A1MMPMv/r5U8Xl7f8+Oru6n2zo/AWlhz+8vbdFWd7i1WOSL18KTuySDhdSh4wiZcQbDmGibVmwxIJSwyytMQfCY7nEYaA6ZDQnDIbpcH+70mQZGgVj0QyafjNOYNM+S2zHWDq3PD19Wh4cT3Sz9n3DqDm6yBBTGOQ58WITQLJfcKPI+TEloNijg0w5dcEHySSyCa1NAVY2mWje3Z+Y5jnN+bw2IHJyiVmrbnNxovDLZ9F7nvExp4kcsoxQ3KyGMeQgoY+/uVUH18bZwGCAiGOnjAn07Ue29QLiIeLFOVEs/OkF8SxlqAgVW1C0wRrMEtJyH4iONLP/m4aZ7emodnVKXjh5N8=",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("lZf7cptIFsbf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connection
////////////////////////
mysql_close($db);
exit;
}
?>
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.
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.

Categories