Jump to content

[SOLVED] Transfer from Ensim to CPanel broke my site.... php and mysql database.


Recommended Posts

A few years ago, a friend helped me make a web site for another friend called UnlikelyPhotos.com

 

I don't know much PHP so my techy-friend wrote all the scripts and dealt with most of the database feautures.

 

The site was fine until last week when my hosting provider switched me from an "Ensim" platform to "CPanel".  Since then, the page has failed completely.

 

My techy-friend is now in Rome and can't help!

 

The idea of the site is to sell photos that my retired-friend takes and edits of wild animals.

 

The gallery pages are supposed to display a column of thumbnails down the left side which people can then preview and purchase.  But they aren't showing up anymore!

 

http://www.unlikelyphotos.com

 

I updated the account information as per my host's instructions when they transfered the database for me but now the site is completely non-functioning.

 

I didn't change anything else and all the links are relative to the page they're linking from so the different directory paths between the Ensim and CPanel systems should not be a concern.  Just to double check I did a "find and replace" through the entire site and came back with nothing suspicious.

 

I've doubled checked the mysql database and it is populated correctly. I have read through all the pages that I could think were relevant and I can't find anything wrong. Perhaps something in the code is not compatible with CPanel???

 

I know this problem might be bigger than is solvable on this forum but my last question got solved so quickly, I just thought I would ask!  Thanks!!!

 

Snippit from attached PHP file:

<?
}


/* This function shows the images on the left in the gallery. */
function show_image_links($animal) {
$debug = false;

$my_rate = get_exchange_rate();

include "dbinfo.php";

$dbh = mysql_connect ($hostname, $username, $password)
     or die ('I cannot connect to the database because: ' . mysql_error());

$selected = mysql_select_db ($database, $dbh);

$result = mysql_query("select * from $table where animal_group='$animal';");
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
	$image_fullsize = $row{'image_fullsize'};

	if ($debug) {
		print "Checking if $image_fullsize exists";
	}

	if (file_exists($image_fullsize)) {
		$preview_link = $row{'image_preview'};
		$thumb_link = $row{'image_thumb'};
		$image_name = $row{'image_name'};
		$price = sprintf("%01.2f", $row{'price'});
		$the_us_amount = $my_rate * $price;
		$us_amount = sprintf("%01.2f", $the_us_amount);
		$the_dims = $row{'image_dimensions'};
		$the_size = human_file_size(filesize($image_fullsize));
		$the_resolution = $row{'resolution'};
		$the_height = $row{'height'};
		$the_date = $row{'date_uploaded'};

		print "  <tr>";

		print "    <td align=\"center\"><a href=\"purchase.php?key=$the_date\" onFocus=\"if(this.blur)this.blur()\" onClick=\"return confirm('Click OK to purchase this UnlikelyPhoto.')\" onMouseOver=\"MM_swapImage('preview','','$preview_link',1);MM_setTextOfLayer('specs','','<strong>Name:</strong> $image_name <strong>Price:</strong> \$ $price CDN (\$ $us_amount USD)%0D%0A%3Cp%3E<strong>Size:</strong> $the_dims px ($the_size) <strong>Resolution:</strong> $the_resolution ppi ')\" onMouseOut=\"MM_swapImgRestore();MM_setTextOfLayer('specs','','To preview an image, hover your mouse cursor over the thumbnail on the left-hand side.&#160;To purchase this jpeg, click the thumbnail and follow the prompts.')\"><img src=\"$thumb_link\" alt=\"\" name=\"Thumbnail\" width=\"100\" height=\"$the_height\" border=\"0\"></a></td>";

		print "  </tr>";
	}
}
}


?>

 

Additional scripts loaded into that page:

/*
* This function builds/outputs the preload info needed for
*  the body tag in the gallery.php file.
*/
function display_preload_images($animal) {
$the_dir = "images/galleries/$animal/preview/";

/* create an array to hold directory list */
$results = array();

/* create a handler for the directory */
$handler = opendir($the_dir);

/* keep going until all files in directory have been read */
while ($file = readdir($handler)) {

	// if $file isn't this directory or its parent, 
	// add it to the results array
	if ($file != '.' && $file != '..' && stristr($file, "jpg"))
	  $results[] = $file;
}

/* tidy up: close the handler */
closedir($handler);

foreach($results as $the_image) {
	print ",'" . $the_dir . $the_image . "'";
}
}

/*
* This function returns a human readable file size when
*  the passed in parameter is the size in bytes.
*
* Courtesy of <itsacon at itsacon dot net> and
*  <php at arcannon dot com>
*/
function human_file_size($size) {
if($size == 0) {
	return("0 Bytes");
}
$filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i];
}

 

Obviously there is more to it all but I think the problem must be in here somewhere.  If you think you can help and need to see more, I'm a little desperate as it's been down for over a week now!  Thanks!!

 

 

 

Hi,

Your web is requesting a user and password for all the pages, even the images.

 

Check your cpanel to see if the directories have been protected and, if so, remove that control.

 

Chris

Well hello again Chris! :)

 

I did password protect one directory in the images folder (where the images my retired-friend is selling are located) but I did that after the problem occured.

 

I've removed it anyways, at least until the original problem is solved.

 

Thanks.

 

Any other ideas?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.