/////////////////////////////////////////////////// //////////// INITIAL SETTINGS /////////////////////////////////////////////////// define('HOME_DIR', dirname(dirname(__FILE__)) . '/'); $tmp_path = "http://" . $_SERVER["HTTP_HOST"] . dirname($_SERVER["PHP_SELF"]) . '/'; while(substr($tmp_path, -2, 1) == "/") { $tmp_path = substr($tmp_path, 0, -1); } $tmp_path = str_replace('/admin/','/',$tmp_path); $tmp_path = str_replace('/credit-cards/','/',$tmp_path); $tmp_path = str_replace('/articles/','/',$tmp_path); $tmp_path = str_replace('/news/','/',$tmp_path); define('WEB_PATH', $tmp_path); $global_settings = array( 'MYSQL_HOST'=>'', 'MYSQL_USER'=>'ccreview_wrdp1', 'MYSQL_PASSWORD'=>'IRXGJ5IPegsd', 'MYSQL_DB_NAME'=>'ccreview_wrdp1', 'ADMIN_LOGIN'=>'lafsunlmtd', 'ADMIN_PASSWORD'=>'developer', 'SET_NEWSLETTER_EMAIL'=>'lafsunlmtd80@gmail.com', 'SET_NEWSLETTER_SUBJECT'=>'credit card info', 'SET_COMPANY'=>'IE Entertainment, Inc.' ); foreach($global_settings as $gkey=>$gval) { define($gkey, $gval); } /// FOLLOWING SHOULD NOT BE CHANGED // Images path. Must end with slash. define('IMG_PATH','img/'); // OS path to the admin script. // Must be full path from the root folder and must end with slash. define('HOME_DIR_ADMIN',HOME_DIR.'admin/'); // Web path to the admin script. Must end with slash. define('WEB_PATH_ADMIN',WEB_PATH.'admin/'); /******************************************************************* Credit Card Offers Database Updater ********************************************************************/ $link = @mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die("Could not connect to database"); @mysql_select_db(MYSQL_DB_NAME, $link) or die("Could not select database"); $lastupdate = @file_get_contents('admin/lastupdate.inf'); if ($lastupdate !== false && time() - $lastupdate > 21600) { $xmlreader = @simplexml_load_file('http://feed.ncsreporting.com/xmlfeedhandler.aspx?Za4O6dp3Us4%3d'); if ($xmlreader !== false) { $issuers = array('American Express' => 6, 'Discover®' => 7, 'Advanta' => 8, 'MasterCard' => 9, 'Visa ' => 10); $categories = array('Balance Transfer Credit Cards' => 3, 'Low Interest Credit Cards' => 3, 'Rewards Credit Cards' => 6, 'PrePaid Credit Cards' => 7, 'Debit Cards' => 7, 'Credit Cards for Bad Credit' => 8, 'Fair or Average Credit Cards' => 9, 'Secured Credit Cards' => 9, 'Business Credit Cards' => 4, 'Student Credit Cards' => 5); /* Auto Loans -1 Military Loans -1 Credit reports -1 Misc Offers -1 No Annual Fee -1 Low Interest Credit Cards 3 Balance Transfer Credit Cards 3 Rewards Credit Cards 6 Debit Cards 7 PrePaid Credit Cards 7 Credit Cards for Bad Credit 8 Fair or Average Credit Cards 9 Secured Credit Cards 9 */ $query = "DELETE FROM creditcard"; mysql_query($query); foreach ($xmlreader->children() as $node => $content) { if ($node == "OfferDetails") { $creditcard_name = $content->xpath("Offername"); $creditcard_description = $content->xpath("OfferTextdetails"); $creditcard_description1 = ''; $creditcard_pos = "0"; $creditcard_img_name = $content->xpath("SmallCreative"); $creditcard_apply_url = $content->xpath("RedirectLink"); $creditcard_intro_apr = $content->xpath("PurchaseIntroRate"); $creditcard_intro_apr_period = $content->xpath("PurchaseIntroPeriod"); $creditcard_regular_apr = $content->xpath("PurchaseGoToRate"); $creditcard_annual_fee = $content->xpath("AnnualFee"); $creditcard_balance_transfer = $content->xpath("BalanceTransferGoToRate"); $creditcard_credit_needed = $content->xpath("CreditType"); $creditcard_clicks = "0"; $creditcard_filename = ''; $creditcard_text = ''; $creditcard_date = '0000-00-00 00:00:00'; $creditcard_name = str_replace('"', '"', str_replace("'", "'", $creditcard_name[0])); $creditcard_description = str_replace('"', '"', str_replace("'", "'", $creditcard_description[0])); $creditcard_img_name = $creditcard_img_name[0]; $creditcard_apply_url = str_replace("[insert ac]", "100", $creditcard_apply_url[0]); $creditcard_intro_apr = $creditcard_intro_apr[0]; $creditcard_intro_apr_period = $creditcard_intro_apr_period[0]; $creditcard_regular_apr = $creditcard_regular_apr[0]; $creditcard_annual_fee = $creditcard_annual_fee[0]; $creditcard_balance_transfer = $creditcard_balance_transfer[0]; $creditcard_credit_needed = $creditcard_credit_needed[0]; $creditcard_issuer_id = -1; $creditcard_category_id = -1; foreach($content->xpath("OfferCategories/CategoryName") as $category) { foreach ($issuers as $name => $id) { if ($category == $name) { $creditcard_issuer_id = $id; break; } } foreach ($categories as $name => $id) { if ($category == $name) { $creditcard_category_id = $id; break; } } } $query = "INSERT INTO creditcard (creditcard_category_id, creditcard_issuer_id, creditcard_name, creditcard_description, creditcard_description1, creditcard_pos, creditcard_img_name, creditcard_apply_url, creditcard_intro_apr, creditcard_intro_apr_period, creditcard_regular_apr, creditcard_annual_fee, creditcard_balance_transfers, creditcard_credit_needed, creditcard_clicks, creditcard_filename, creditcard_text, creditcard_date) VALUES (".$creditcard_category_id.", ".$creditcard_issuer_id.", '".$creditcard_name."', '".$creditcard_description."', '".$creditcard_description1."', ".$creditcard_pos.", '".$creditcard_img_name."', '".$creditcard_apply_url."', '".$creditcard_intro_apr."', '".$creditcard_intro_apr_period."', '".$creditcard_regular_apr."', '".$creditcard_annual_fee."', '".$creditcard_balance_transfers."', '".$creditcard_credit_needed."', ".$creditcard_clicks.", '".$creditcard_filename."', '".$creditcard_text."', '".$creditcard_date."')"; mysql_query($query) or die("Failed to execute query"); } } file_put_contents('admin/text.txt', $queries); file_put_contents('admin/lastupdate.inf', time()); } } mysql_close($link); ?> Could not connect to database