Jump to content

suboshiyui

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by suboshiyui

  1. Ugh.  Okay.  LOL Just my luck.  Well I don't want to post all of them even though I only edited six other files.  I'll post one or two and can you check them for me?  Thank you so much for your quick response and help!

     

    index.php

    <?
    
    session_start();
    
    define ('IN_SITE', 1);
    
    if (!file_exists('includes/config.php')) echo "<script>document.location.href='install/install.php'</script>";
    
    include_once ('includes/global.php');
    
    include_once ('includes/functions_login.php');
    include_once ('includes/functions_item.php');
    
    if (preg_match('/logout/i', $_GET['option']))
    {
    	logout();
    }
    
    include_once ('global_header.php');
    
    if (isset($_GET['change_language']))
    {
    	$all_languages = list_languages('site');
    
    	if (in_array($_GET['change_language'], $all_languages))
    	{
    		$session->set('site_lang', $_GET['change_language']);
    	}
    
    	$refresh_link = 'index.php';
    
    	$template_output .= '<br><p class="contentfont" align="center">' . MSG_SITE_LANG_CHANGED . '<br><br>
    		Please click <a href="' . process_link('index') . '">' . MSG_HERE . '</a> ' . MSG_PAGE_DOESNT_REFRESH . '</p>';
    	$template_output .= '<script>window.setTimeout(\'changeurl();\',300); function changeurl(){window.location=\'' . $refresh_link . '\'}</script>';
    }
    else
    {
    	include_once ('global_mainpage.php');
    }
    
    include_once ('global_footer.php');
    
    echo $template_output;
    
    ?>
    

    includes/init.php

    <?php
    
    $current_version = "6.03";
    
    (array) $setts = NULL;
    
    define("CURRENT_TIME", time());
    define("CURRENT_TIME_MYSQL", date("Y-m-d H:i:s", time()));
    
    $setts = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "gen_setts LIMIT 1");
    
    define("DEFAULT_THEME", $setts['default_theme']);
    define("SITE_PATH", $setts['site_path']);
    define("EMAIL_FONT", "<font face=\"Verdana, Arial, Helvetica\" size=\"2\">");
    
    $layout = $db->get_sql_row("SELECT * FROM " . DB_PREFIX . "layout_setts LIMIT 1");
    $layout['nb_want_ads'] = $setts['enable_wanted_ads'] ? $layout['nb_want_ads'] : 0;
    $db->setts =& $setts;
    $db->layout =& $layout;
    $currentTime = time();
    
    if (!$session->is_set("site_lang"))
    {
        $session->set("site_lang", $setts['site_lang']);
    }
    
    include_once($fileExtension . "language/" . $session->value( "site_lang" ) . "/global.lang.php");
    include_once($fileExtension . "language/" . $session->value( "site_lang" ) . "/category.lang.php");
    
    if (IN_SITE == 1)
    {
        include_once($fileExtension . "language/" . $session->value( "site_lang" ) . "/site.lang.php");
    }
    
    if (IN_ADMIN == 1)
    {
        include_once($fileExtension . "language/" . $setts['admin_lang'] . "/admin.lang.php");
    }
    
    include_once($fileExtension . "language/" . $session->value("site_lang") . "/categories_array.php");
    $date_format_row = $db->get_sql_row("SELECT value FROM " . DB_PREFIX . "dateformat WHERE active='checked'");
    $datetime_format = $date_format_row['value'];
    define("DATETIME_FORMAT", $datetime_format);
    $date_format = substr($datetime_format, 0, -6);
    define("DATE_FORMAT", $date_format);
    define("TIME_OFFSET", $setts['time_offset']);
    
    if ($setts['is_mod_rewrite'])
    {
        $valsArray = explode(",", $_REQUEST['rewrite_params']);
        $valsCnt = 0;
        $count_valsArray = count($valsArray);
        while ($valsCnt < $count_valsArray)
        {
            $_REQUEST[$valsArray[$valsCnt + 1]] = $valsArray[$valsCnt];
            $_GET[$valsArray[$valsCnt + 1]] = $valsArray[$valsCnt];
            $_POST[$valsArray[$valsCnt + 1]] = $valsArray[$valsCnt];
            $valsCnt += 2;
        }
    }
    
    if (!preg_match("/sell_item.php/i", $_SERVER['PHP_SELF']) || !preg_match("/sell_item.php/i", $_SERVER['PHP_SELF']) || $_REQUEST['option'] == "new_item" || preg_match("/sell_item.php/i", $_SERVER['PHP_SELF']) && $_REQUEST['option'] == "sell_similar")
    {
        $session->unregister("auction_id");
        $session->unregister("refresh_id");
    }
    
    if (!preg_match("/wanted_manage.php/i", $_SERVER['PHP_SELF']))
    {
        $session->unregister("wanted_ad_id");
        $session->unregister("wa_refresh_id");
    }
    
    if (!preg_match("/edit_item.php/i", $_SERVER['PHP_SELF']))
    {
        $session->unregister("edit_refresh_id");
    }
    
    if (!preg_match("/bid.php/i", $_SERVER['PHP_SELF']))
    {
        $session->unregister("bid_id");
    }
    
    if (!preg_match("/buy_out.php/i", $_SERVER['PHP_SELF']))
    {
        $session->unregister("buyout_id");
    }
    
    if (!preg_match("/make_offer.php/i", $_SERVER['PHP_SELF']))
    {
        $session->unregister("make_offer_id");
    }
    
    if (!preg_match("/swap_offer.php/i", $_SERVER['PHP_SELF']))
    {
        $session->unregister("swap_offer_id");
    }
    
    $start = abs(intval($_GET['start']));
    ?>
    
  2. So, I'm working on updating the code for this store that I have since I've been getting all the errors to switch to preg versus ereg.

     

    Updated all the files, which are below:

     

    includes/init.php *
    includes/global.php *
    index.php *
    includes/functions.php *
    includes/class_banner.php *
    includes/class_database.php *
    themes/v6/templates/header.tpl.php
     
    Changed from ereg to preg, eregi to preg_match and added the delimiters plus i.  No more errors, however.  When I go tot he store page it now only shows the very top of the header and nothing else.  Above the header is this: //i  //i
     
    I figured that it is probably an error in the code in the global.php file but for the life of me I can't find it.  I'm attaching a screenshot for review.  Help?  ^^ I'm pretty new to php so any and all help would be appreciated.
    <?
    
    $fileExtension = (file_exists('includes/global.php')) ? '' : '../';
    
    include_once ($fileExtension.'includes/config.php');
    
    
    define('INCLUDED', 1);
    
    define('DEFAULT_DB_LANGUAGE', 'english');
    
    function getmicrotime()
    {
       list($usec, $sec) = explode(" ", microtime());
       return ((float)$usec + (float)$sec);
    }
    
    if(!function_exists('memory_get_usage'))
    {
    	function memory_get_usage()
    	{
    		if ( substr(PHP_OS,0,3) == 'WIN')
    		{
    			$output = array();
    			exec( 'tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $output );
    
    			return preg_replace( '/[\D]/', '', $output[5] ) * 1024;
    		}
    		else
    		{
    			//We now assume the OS is UNIX
    			$pid = getmypid();
    			exec("ps -eo%mem,rss,pid | grep $pid", $output);
    			$output = explode("  ", $output[0]);
    			//rss is given in 1024 byte units
    			return $output[1] * 1024;
    		}
    	}
    }
    
    $time_start = getmicrotime();
    ##$memory_start = memory_get_usage();
    
    include_once ($fileExtension.'language/'.DEFAULT_DB_LANGUAGE.'/db.lang.php');
    
    include_once ($fileExtension.'includes/class_database.php');
    
    $db = new database;
    
    $db->connect($db_host, $db_username, $db_password);
    $db->select_db($db_name);
    
    include_once ($fileExtension.'includes/class_session.php'); ## global
    ## create the session class, will contain all session variables.
    $session = new session;
    
    include_once ($fileExtension.'includes/init.php'); ## global
    $current_version = '6.03';
    
    include_once ($fileExtension.'includes/functions_security.php');
    
    cleanData();
    
    include_once ($fileExtension.'includes/functions.php'); ## global
    
    ## now do the theme alterations in case of categories and auction_details
    $is_custom_skin = 0;
    if (preg_match('/categories.php/i', $_SERVER['PHP_SELF']))
    {
    	$category_id = $db->main_category(intval($_GET['parent_id']));
    
    	$is_custom_skin = 1;
    }
    else if (preg_match('/auction_details.php/i', $_SERVER['PHP_SELF']))
    {
    	$category_id = $db->get_sql_field("SELECT category_id FROM " . DB_PREFIX . "auctions WHERE 
    		auction_id='" . intval($_GET['auction_id']) . "'", 'category_id');
    	
    	$category_id = $db->main_category($category_id);
    	
    	$is_custom_skin = 1;
    }
    
    if ($is_custom_skin)
    {
    	$custom_skin = $db->get_sql_field("SELECT custom_skin FROM " . DB_PREFIX . "categories WHERE 
    		category_id='" . $category_id . "'", 'custom_skin');
    	
    	if (!empty($custom_skin))
    	{
    		$setts['default_theme'] = $custom_skin;
    		define ('DEFAULT_THEME', $custom_skin);
    	}
    }
    
    unlink_pin();
    
    include_once ($fileExtension.'includes/class_template.php');
    
    ## initialize the template for the output that will be generated
    $template = new template('templates/');
    
    $template->set('setts', $setts);
    $template->set('layout', $layout);
    $template->set('current_version', $current_version);
    $template->set('is_seller', $session->value('is_seller'));
    
    (string) $template_output = NULL;
    
    if ($setts['maintenance_mode'] && $session->value('adminarea')!='Active' && IN_ADMIN != 1)
    {
    	$template_output = $template->process('maintenance_splash_page.tpl.php');
    
    	echo $template_output;
    	die();
    }
    
    include_once ($fileExtension.'includes/class_voucher.php');
    include_once ($fileExtension.'includes/class_fees_main.php');
    include_once ($fileExtension.'includes/class_tax.php');
    
    $fees = new fees_main();
    $fees->setts = &$setts;
    $template->set('fees', $fees);
    
    $template->set('db', $db);
    
    include_once ($fileExtension.'includes/class_banner.php');
    
    ## classes used in most files will be initialized here.
    
    include_once ($fileExtension.'includes/functions_date.php');
    
    ## declare all the pages that can contain custom fields
    $custom_fields_pages = array ('register', 'reputation_sale', 'reputation_purchase', 'auction', 'wanted_ad');
    
    ## custom section pages
    $custom_section_pages = array ('help', 'news', 'faq', 'custom_page', 'announcements');
    $custom_section_pages_ordering = array('help', 'faq', 'custom_page');
    
    $custom_pages = array('about_us', 'contact_us', 'terms', 'privacy');
    
    ## declare all tables that are linkable to custom fields
    $linkable_tables = array('countries');
    
    ## load the cron if it is run from the site.
    if ($setts['cron_job_type'] == 2 && IN_ADMIN != 1)
    {
    	$manual_cron = true;
    	include_once ($fileExtension . 'cron_jobs/main_cron.php');
    }
    
    $auction_ordering = array('a.name', 'a.start_price', 'a.max_bid', 'a.nb_bids', 'a.end_time');
    $order_types = array('DESC', 'ASC');
    ## suspend user accounts that are over the debit limit. -> placeholder
    
    ### IP Logging addon, created by Kevin
    
    if ($session->value('user_id') > 0) 
    {
    	$set = 0;
    	
    	$db->query("CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "iphistory (
    		`memberid` INT NOT NULL, 
    		`time1` INT NOT NULL, 
    		`time2` INT NOT NULL, 
    		`ip` VARCHAR(20) NOT NULL
    	)");
    	
    	$sql_select_iphistory = $db->query("SELECT time1, time2, ip FROM " . DB_PREFIX . "iphistory WHERE 
    		memberid='" . $session->value('user_id') . "' ORDER by time1 DESC LIMIT 1");
    	
    	if ($db->num_rows($sql_select_iphistory) > 0) 
    	{
    		if ($ip_details = $db->fetch_array($sql_select_iphistory)) 
    		{
    			if ($ip_details['ip'] == $_SERVER['REMOTE_ADDR']) 
    			{
    				$db->query("UPDATE " . DB_PREFIX . "iphistory SET time2='" . CURRENT_TIME . "' WHERE 
    					time1='" . $ip_details['time1'] . "' AND ip='" . $ip_details['ip'] . "'");
    
    				$set = 1;
    			}
    		}
    	}
    	
    	if (!$set) 
    	{
    		$db->query("INSERT INTO " . DB_PREFIX . "iphistory VALUES 
    			('" . $session->value('user_id') . "', '" . CURRENT_TIME . "', '0', '" . $_SERVER['REMOTE_ADDR'] . "')");
    	}
    }
    
    include_once ($fileExtension.'includes/class_shop.php');
    include_once ($fileExtension.'includes/functions_addons.php');
    
    ?>
    

    post-168303-0-31931700-1396146205_thumb.jpg

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.