1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need your help........please

Discussion in 'PHP' started by googlecrawl, Apr 21, 2011.

  1. #1
    I have a site www.flupper.net everything is fine after I move to new host and something bad with my site. everything from index page is fine but when you click one of the page suddenly my site is down. I don't know what happen with my site. I have put correctly all data in config.php but still error..I think there is a bugs in my functions.php

    here the code:

    <?php
    
    	function ob_rewrite ($buffer) {
    		$buffer = preg_replace('#(href|src|action)="/#si', '\\1="' . SITE_BASE . '/', $buffer);
    		header('Content-Length: ' . strlen($buffer));
    		return $buffer;
    	}
    	function do_include ($file, $tab_count = 0, $return = 0, $siteuser) {
    		ob_start();
    
    
    
    
    
    		
    
    $realpath = dirname(__FILE__);
    
    		if($_GET['debug']) echo $realpath;
    
    		include $realpath.'/'. ltrim($file,"/");
    
    
    
    		$lines = preg_split('#[\r\n]+#si', ob_get_clean());
    		$tabs = str_repeat("\t", $tab_count);
    		$output = '';
    		$i = 0;
    		foreach ($lines as $line) {
    			$i++;
    			$start = $i == 1 ? '' : $tabs;
    			$output .= $start . $line . "\n";
    		}
    		if ($return)
    			return $output;
    		echo $output;
    	}
    	function abbreviate ($string, $limit) {
    		$string = strlen($string) >= $limit ? substr($string, 0, $limit) . '&hellip;' : $string;
    		return $string;
    	}
    	function split_url ($url, $key) {
    		$url_parsed = @parse_url($url);
    		return $url_parsed[$key];
    	}
    	function sanitize($data)
    	{
    		// remove whitespaces (not a must though)
    		$data = trim($data);
    
    		// apply stripslashes if magic_quotes_gpc is enabled
    		if(get_magic_quotes_gpc())
    		{
    		$data = stripslashes($data);
    		}
    
    		// a mySQL connection is required before using this function
    		$data = mysql_real_escape_string($data);
    
    		return $data;
    }
    	function clean ($string) {
    		if (is_array($string)) {
    			foreach ($string as $key => $value) {
    				if (function_exists('mysql_real_escape_string')) {
    					$string[$key] = mysql_real_escape_string($value);
    				} else {
    					$string[$key] = addslashes($value);
    				}
    			}
    		} elseif (is_string($string)) {
    			if (function_exists('mysql_real_escape_string')) {
    				$string = mysql_real_escape_string($string);
    			} else {
    				$string = addslashes($string);
    			}
    		}
    		return $string;
    	}
    	function is_image ($image) {
    		return @imagecreatefromjpeg($image) ? 'jpeg' : (@imagecreatefromgif($image) ? 'gif' : (@imagecreatefrompng($image) ? 'png' : false));
    	}
    	function create_image ($file) {
    		return @imagecreatefromjpeg($file) ? imagecreatefromjpeg($file) : (@imagecreatefromgif($file) ? imagecreatefromgif($file) : (@imagecreatefrompng($file) ? imagecreatefrompng($file) : false));
    	}
    	function create_thumbnail ($file_name, $width, $height, $picture_type = false, $destination = false) {
    		if (@imagecreatefromgif($file_name)) {
    			$type = 'gif';
    			$img = imagecreatefromgif($file_name);
    		} elseif (@imagecreatefromjpeg($file_name)) {
    			$type = 'jpeg';
    			$img = imagecreatefromjpeg($file_name);
    		} elseif (@imagecreatefrompng($file_name)) {
    			$type = 'png';
    			$img = imagecreatefrompng($file_name);
    		}
    		imagealphablending($img, true);
    		imagesavealpha($img, true);
    		list($org_width, $org_height) = getimagesize($file_name);
    		$xoffset = 0;
    		$yoffset = 0;
    		if ($picture_type == 'thumb') {
    			if ($org_width / $width > $org_height / $height) {
    				$xtmp = $org_width;
    				$xratio = 1 - ((($org_width / $org_height) - ($width / $height)) / 2);
    				$org_width = $org_width * $xratio;
    				$xoffset = ($xtmp - $org_width) / 2;
    			} elseif ($org_height / $height > $org_width / $width) {
    				$ytmp = $org_height;
    				$yratio = 1 - ((($width / $height) - ($org_width / $org_height)) / 2);
    				$org_height = $org_height * $yratio;
    				$yoffset = ($ytmp - $org_height) / 2;
    			}
    		} else {
    			$xtmp = $org_width / $width;
    			$new_width = $width;
    			$new_height = $org_height / $xtmp;
    			if ($new_height > $height) {
    				$ytmp = $org_height / $height;
    				$new_height = $height;
    				$new_width = $org_width / $ytmp;
    			}
    			$width = round($new_width);
    			$height = round($new_height);
    		}
    		$img_n = imagecreatetruecolor ($width, $height);
    		imagealphablending($img_n, true);
    		imagesavealpha($img_n, true);
    		imagealphablending($img, true);
    		imagesavealpha($img, true);
    		imagecopyresampled($img_n, $img, 0, 0, $xoffset, $yoffset, $width, $height, $org_width, $org_height);
    		switch ($type) {
    			default: case 'gif':
    				imagegif($img_n);
    				imagegif($img_n, $destination);
    			break;
    			case 'jpeg':
    				imagejpeg($img_n, false, 90);
    				imagejpeg($img_n, $destination, 90);
    			break;
    			case 'png':
    				imagepng($img_n);
    				imagepng($img_n, $destination);
    			break;
    		}
    	}
    	function logout () {
    		setcookie('user_id', '', time() - (60 * 60 * 24 * 7), '/', $_SERVER['HTTP_HOST']);
    		setcookie('user_password_hash', '', time() - (60 * 60 * 24 * 7), '/', $_SERVER['HTTP_HOST']);
    	}
    	function bb_handler ($bb_type, $string, $additional) {
    		$bb_type = strtolower($bb_type);
    		switch ($bb_type) {
    			case 'quote':
    				return "<div class=\"quote\">$string</div>";
    			break;
    			case 'b':
    				return "<strong>$string</strong>";
    			break;
    			case 'i':
    				return "<em>$string</em>";
    			break;
    			case 'code':
    				return highlight_string($string, true);
    			break;
    			case 'url':
    				return "<a href=\"$additional\">$string</a>";
    			break;
    			case 'img':
    				return "<img src=\"$string\" />";
    			break;
    			case 'color':
    				return "<font color=\"$additional\">$string</font>";
    			break;
    		}
    	}
    	function bb_parse ($string) {
    		$s = array('[quote]', '[/quote]', '[QUOTE]', '[/QUOTE]');
    		$r = array('<div class="quote">', '</div>', '<div class="quote">', '</div>');
    		preg_match_all('#\[([^]]+)=?(.*?)](.*?)\[/\\1]#', $string, $matches);
    		for ($i = 0; $i < count($matches[0]); $i++) {
    			$s[] = $matches[0][$i];
    			$r[] = bb_handler($matches[1][$i], bb_parse($matches[3][$i]), $matches[2][$i]);
    		}
    		return str_replace($s, $r, $string);
    	}
    	function time_left ($integer) {
    
    		$seconds=$integer;
    
    		if ($seconds/60 >=1)
    
    		{
    
    		$minutes=floor($seconds/60);
    
    		if ($minutes/60 >= 1)
    
    		{ # Hours
    
    		$hours=floor($minutes/60);
    
    		if ($hours/24 >= 1)
    
    		{ #days
    
    		$days=floor($hours/24);
    
    		if ($days/7 >=1)
    
    		{ #weeks
    
    		$weeks=floor($days/7);
    
    		if ($weeks>=2) $return="$weeks Weeks";
    
    		else $return="$weeks Week";
    
    		} #end of weeks
    
    		$days=$days-(floor($days/7))*7;
    
    		if ($weeks>=1 && $days >=1) $return="$return, ";
    
    		if ($days >=2) $return="$return $days days";
    
    		if ($days ==1) $return="$return $days day";
    
    		} #end of days
    
    		$hours=$hours-(floor($hours/24))*24;
    
    		if ($days>=1 && $hours >=1) $return="$return, ";
    
    		if ($hours >=2) $return="$return $hours hours";
    
    		if ($hours ==1) $return="$return $hours hour";
    
    		} #end of Hours
    
    		$minutes=$minutes-(floor($minutes/60))*60;
    
    		if ($hours>=1 && $minutes >=1) $return="$return, ";
    
    		if ($minutes >=2) $return="$return $minutes minutes";
    
    		if ($minutes ==1) $return="$return $minutes minute";
    
    		} #end of minutes
    
    		return $return;
    
    	}
    
    	function howlongago($ts) {
    	   $actualts = $ts;
    	   $ts=time()-$ts;
    
    	   if ($ts<1)
    
    	       // <1 second
    
    	       return "Just now!";
    
    
    
    	   elseif ($ts==1)
    
    	       // <1 second
    
    	       return $ts." second ago";
    
    	   elseif ($ts<60)
    
    	       // <1 minute
    
    	       return $ts." seconds ago";
    
    		 elseif ($ts<120)
    
    	       // 1 minute
    
    	      return "1 minute ago";
    
    
    
    		 elseif ($ts<60*60)
    
    	       // <1 hour
    
    	       return floor($ts/60)." minutes ago";
    
    	   elseif ($ts<60*60*2)
    
    	       // <2 hour
    
    	       return "1 hour ago";
    
    	     elseif ($ts<60*60*24)
    
    	       // <24 hours = 1 day
    
    	       return floor($ts/(60*60))." hours ago";
    
    	     elseif ($ts<60*60*24*2)
    
    	       // <2 days
    
    	       return "1 day ago";
    
    	     	   else
    
    	       // more than 1 year
    
    	       return date('jS F', $actualts);
    
    };
    
    
    	function niceurls( $title )
    		{
    
    			$title = urlencode( $title );
    
    			$title = str_replace( "+", "-", $title );
    
    			$title = str_replace( "--", "-", $title );
    			$title = str_replace( "--", "-", $title );
    
    			$title = str_replace( ".", "", $title );
    
    			$title = preg_replace( "#%([A-F0-9]{2,2})#", "", $title );
    
    			$title = strtolower($title);
    
    			return $title;
    
    	}
    
    ?>
    PHP:
    anyone can help me to fix it...please..I can't login now everything will be down if I click the page there....
     
    googlecrawl, Apr 21, 2011 IP
  2. x319

    x319 Well-Known Member

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    103
    #2
    Hey,

    Doesn't necessarily have to be your PHP files. THe problem can be within the .htaccess file. Make sure you modify and move that file correctly.
     
    x319, Apr 21, 2011 IP
  3. newcity

    newcity Peon

    Messages:
    1,015
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What is the error you get? Please post the error in detail.
    Thanks
     
    newcity, Apr 21, 2011 IP
  4. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #4
    enable error reporting

    put error_reporting(E_ALL); at the top
     
    Bohra, Apr 21, 2011 IP
  5. googlecrawl

    googlecrawl Banned

    Messages:
    1,739
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    put where. I have tried in every where but still can't..any body who can PHP please help me..if you click this: http://flupper.net/auction/25-ipad-niche-autoblog.html the site is down..only index page still work
     
    googlecrawl, Apr 21, 2011 IP
  6. googlecrawl

    googlecrawl Banned

    Messages:
    1,739
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Here the error in my error log
    [21-Apr-2011 17:43:33] PHP Notice:  Undefined index: order in /home/freexwal/public_html/flupper.net/php/page.home.php on line 14
    [21-Apr-2011 17:43:33] PHP Notice:  Undefined index: category_url in /home/freexwal/public_html/flupper.net/php/page.home.php on line 45
    [21-Apr-2011 17:43:33] PHP Notice:  Undefined index: category_url in /home/freexwal/public_html/flupper.net/php/page.home.php on line 54
    [21-Apr-2011 17:43:33] PHP Notice:  Undefined index: category_url in /home/freexwal/public_html/flupper.net/php/page.home.php on line 54
    [21-Apr-2011 17:43:33] PHP Notice:  Undefined index: category_url in /home/freexwal/public_html/flupper.net/php/page.home.php on line 54
    [21-Apr-2011 17:43:33] PHP Notice:  Undefined index: category_url in /home/freexwal/public_html/flupper.net/php/page.home.php on line 54
    [21-Apr-2011 17:43:33] PHP Notice:  Undefined index: category_url in /home/freexwal/public_html/flupper.net/php/page.home.php on line 54
    
    PHP:

    how to fix it..please help me guys..here my page.home.php code:

    <?php
    	global $main;
    	$q = mysql_query("SELECT * FROM `categories` ORDER BY `category_name` ASC");
    
    	#pagination
    	#listings
    	if (!$_GET['category_url']) {
    		$thelocation = "/";
    		$sql = 'SELECT `auction_id` FROM `auctions`';
    		$q = mysql_query($sql);
    		$page_count = ceil(mysql_num_rows($q) / $main->auctions_per_page);
    		$current_page = (int) $_GET['current_page'] > 0 && (int) $_GET['current_page'] <= $page_count ? $_GET['current_page'] : 1;
    		$offset = ($current_page - 1) * $main->auctions_per_page;
    		$order = in_array($_GET['order'], array('auction_id', 'auction_views', 'auction_title', 'category_name', 'auction_time_end')) ? $_GET['order'] : 'auction_timestamp';
    		$title = 'Latest Marketplace Listings<br>';
    		#query for newest listings
    		$sql = "SELECT `auctions`.*, `categories`.*, `users`.* FROM `auctions` LEFT JOIN `categories` ON `category_id` = `auction_category_id` LEFT JOIN `users` ON `user_id` = `auction_user_id` GROUP BY `$order` ORDER BY `$order` DESC LIMIT $offset, {$main->auctions_per_page}";
    	} else {
    		#get category name
    		$thelocation = "/category/".$_GET['category_url'];
    
    		$sql = "SELECT * FROM `categories` WHERE `category_url` = '{$_GET[category_url]}'";
    		$q = mysql_query($sql);
    		$r = mysql_fetch_assoc($q);
    
    		$sql2 = "SELECT `auction_id` FROM `auctions` WHERE `auction_category_id` = '{$r['category_id']}'";
    		$q2 = mysql_query($sql2);
    		$page_count = ceil(mysql_num_rows($q2) / $main->auctions_per_page);
    
    		$current_page = (int) $_GET['current_page'] > 0 && (int) $_GET['current_page'] <= $page_count ? $_GET['current_page'] : 1;
    		$offset = ($current_page - 1) * $main->auctions_per_page;
    		$order = in_array($_GET['order'], array('auction_id', 'auction_views', 'auction_title', 'category_name')) ? $_GET['order'] : 'auction_id';
    
    		$title = $r['category_name'];
    		$titledesc = $r['category_description'];
    		#query for listings by category
    		$sql = "SELECT `auctions`.*, `categories`.*, `users`.* FROM `auctions` LEFT JOIN `categories` ON `category_id` = `auction_category_id` LEFT JOIN `users` ON `user_id` = `auction_user_id` WHERE `categories`.`category_id` = $r[category_id] GROUP BY `$order` ORDER BY `$order` DESC LIMIT $offset, {$main->auctions_per_page}";
    	}
    	$q = mysql_query($sql);
    ?>
    <div id="tabs_container">
    	<ul id="tabs">
    		<?
    			echo '<li';
    			if(!$_GET['category_url']){ echo ' id="active"'; }
    				echo '><a href="/" title="Latest Listings"><span>Latest Listings </span></a></li>';
    
    			$q7= mysql_query("SELECT * FROM `categories` ORDER BY `category_name` ASC");
    			$i7 = 0;
    			$num_rows7 = mysql_num_rows($q7);
    			while ($r7 = mysql_fetch_assoc($q7)){
    			$i7++;
    				echo '<li';
    					if($_GET['category_url'] == $r7['category_url']){ echo ' id="active"'; }
    				echo '><a href="/category/'.$r7['category_url'].'/" title="'.$r7['category_name'].'"><span>'.$r7['category_name'].'</span></a></li>';
    			}
    		?>
    	</ul>
    </div>
    <div class="ninesixty">
    		<table class="auctiontables" cellspacing="0" cellpadding="3">
    			<thead>
    				<tr>
    					<td width="58%">&nbsp;</td>
    					<td width="7%" class="justcenter">Price</td>
    					<td width="7%" class="justcenter">Bids</td>
    					
    
    					<td width="7%" class="justcenter">Views</td>
    					<td width="21%">Ending</td>
    				</tr>
    			</thead>
    			<tbody>
    <?php
    $i = 0;
    while ($r = mysql_fetch_assoc($q)):
    	unset($theopacity);
    	if ($r['auction_status'] == 2 || $r['auction_status'] == 3 || ($r['auction_time_end'] - time()) < 0){
    		$theopacity = ' style="opacity: 0.3;
    		-moz-opacity: 0.3;
    		-khtml-opacity: 0.3;
    		filter: alpha(opacity=30);"';
    	}
    ?>
    		<tr<?php echo (($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '4')) ? ' class="blue"' : ''; ?><?php echo ($r['auction_upgrade_color'] == '3') ? ' style=\'border: 1px solid #5d91b5;\'' : ''; ?><?php if($i == 1){ echo ' class="alt"'; $i = 0; } else { $i = 1; } ?>>
    			<td<?php echo ((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3'))) ? ' style=\'border-top: 2px solid #5d91b5; border-bottom: 2px solid #5d91b5; border-left: 2px solid #5d91b5;\'' : ''; ?>><img src="/imgs/table_bullet.gif"<?=$theopacity;?>><?php echo (($r['auction_upgrade_color'] == '2')||((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '<strong>' : ''; ?><a href="/auction/<?php echo $r['auction_id']; ?>-<?php echo niceurls($r['auction_title']); ?>.html"<?=$theopacity;?>><?php echo $r['auction_title']; ?></a><?php echo (($r['auction_upgrade_color'] == '2')||((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '</strong>' : ''; ?></td>
    			<td class="justcenter" <?php echo ((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3'))) ? ' style=\'border-top: 2px solid #5d91b5; border-bottom: 2px solid #5d91b5;\'' : ''; ?>><?php
    								$qee = mysql_query("SELECT `bid_amount` FROM `bids` WHERE `bid_auction_id` = '{$r['auction_id']}' && `bid_approved` = '1' ORDER BY `bid_time` DESC LIMIT 1");
    								if (@mysql_num_rows($qee)){
    									while($twww = mysql_fetch_assoc($qee)){
    //									echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '<strong>' : '';
    										echo '$'.number_format($twww['bid_amount']);
    //										echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '</strong>' : '';
    									}
    								} else {
    //								echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '<strong>' : '';
    									echo '$'.number_format($r['auction_starting_bid']);
    //									echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '</strong>' : '';
    								}
    							    ?></td>
    
    			<td class="justcenter" <?php echo ((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3'))) ? ' style=\'border-top: 2px solid #5d91b5; border-bottom: 2px solid #5d91b5;\'' : ''; ?>><?php 
    $q123 = mysql_query("SELECT `bid_amount` FROM `bids` WHERE `bid_auction_id` = '".$r['auction_id']."'");
    //echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '<strong>' : '';
    											echo @mysql_num_rows($q123);	
    //echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '</strong>' : '';
    //			echo number_format($r['auction_bid']); 
    			
    			?></td
    			
    			><td class="justcenter" <?php echo ((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3'))) ? ' style=\'border-top: 2px solid #5d91b5; border-bottom: 2px solid #5d91b5;\'' : ''; ?>><?php 
    //			echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '<strong>' : '';
    			echo number_format($r['auction_views']);
    //			echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '</strong>' : ''; ?></td>
    
    			<td class="justright" <?php echo ((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3'))) ? ' style=\'border-top: 2px solid #5d91b5; border-bottom: 2px solid #5d91b5; border-right: 2px solid #5d91b5;\'' : ''; ?>><?php 
    //			echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '<strong>' : '';
    			echo howlongago($r['auction_time_end']);
    //			echo (((($r['auction_upgrade_color'] == '1')||($r['auction_upgrade_color'] == '3')))||($r['auction_upgrade_color'] == '4')) ? '</strong>' : ''; ?></td>
    		</tr>
    <?php endwhile; ?>
    <?php if (!mysql_num_rows($q)): ?>
    		<tr class="listing">
    			<td class="listing-title" colspan="5">
    				There are no auctions.			</td>
    		</tr>
    <?php endif; ?>
    	</tbody>
    </table>
    	<div class="pagination">
    <?php for ($i = 1; $i <= $page_count; $i++): ?>
    		<a href="<?=$thelocation;?>:<?php echo $i; ?>"<?php echo $i == $current_page ? ' class="current"' : ''; ?>><?php echo $i; ?></a>
    <?php endfor; ?>
    
    	</div>
    </div>
    PHP:
     
    googlecrawl, Apr 21, 2011 IP