We have had a PHP script in our site for a long time which allows users to post little presentation of themselves to our site.
We have just decided to switch to a new server and I have been trying to get everything working on the new host. I have been able to get our forums, blogs etc. working without too much hassle but surprisingly I haven't been able to get the little presentation script working.
I cannot get the presentations displayed or submit new presentations. The weird thing is that I can get the presentation index page working which displays the list of all the presentation.
The index page uses the following function to gather three most recent presentations. This page works without any problems.
<? // three most recent registrants
$findrecent = @mysql_query("SELECT nicknames, regdateshown FROM profiles order by regdatesorted desc");
if (!$findrecent) {
echo("<P>Error accessing profiles" .
mysql_error() . "</P>");
exit();
}
for ($i = 1; $i < 4; $i++){
$myrow = mysql_fetch_row($findrecent);
$name = $myrow[0];
$date = $myrow[1];
// show date and create a link for each name
?>
<p align="LEFT"><b> <? echo "$date :"; ?> </b><br>
<a href="esittelyt.php?name=<?php echo(urlencode($name)); ?>">
<?php echo($name); ?> </a><br>
<?
} // end for
?>
The page for each presentation also lists all the presentation in dropdown boxes and this boxes get filled correctly.
The function to get the information for the presentation is following:
<?
// retrieve profile data
$result = @mysql_query("select * from profiles WHERE nimimerkit='$name'");
$myrow = @mysql_fetch_row($result);
$paikkakunta = $myrow[2];
$syntymaaika = $myrow[3];
$sukupuoli = $myrow[4];
$harrastukset = $myrow[5];
$siviilisaaty = $myrow[6];
$email = $myrow[7];
$kotisivu = $myrow[8];
$photoname = $myrow[12];
$emailvisible = $myrow[13];
$photovisible = $myrow[14];
$comments = $myrow[9];
// if photo is visible
if ($photovisible != "no") {
// resize any images larger than will fit the page design
// provide path to pictures as in following line
// $size = getimagesize("http://kotichat.planeetta.com/pictures/$photoname");
$size = @getimagesize("http://kotichat.planeetta.com/esittelyt/kuvat/$photoname");
// set the maximum width you want displayed
$maxwidth = "350";
$imagewidth = $size[0];
$imageheight = $size[1];
$imgorig = $imagewidth;
if ($imagewidth > $maxwidth) {
$imageprop=($maxwidth*100)/$imagewidth;
$imagevsize= ($imageheight*$imageprop)/100 ;
$imagewidth=$maxwidth;
$imageheight=ceil($imagevsize);
}
echo "<P ALIGN='center'><IMG height='$imageheight' width='$imagewidth' alt='$photoname' src='http://kotichat.planeetta.com/esittelyt/kuvat/$photoname' border='0'></P>";
} // end if
// show no photo
else {
echo "<P ALIGN='center'><IMG src=\"http://kotichat.planeetta.com/esittelyt/kuvat/eikuvaa.jpg\" border=\"0\"></P>";
}
?>
The URL address to the presentation contains the $name attribute and is following:
http://www.domain.com/presentation/presentation.php?name=Harald
The database connection works correctly because the presentation dropdown box gets filled and also because if I change the database information to be incorrect I get an error message.
Only reasons I have been able to think of are that the $name attribute isn't read correctly from the URL or that the new host is using newer version of PHP & MySQL which causes problems.
My old host was using following PHP and MySQL versions:
PHP VERSION: 4.4.0, mySQL VERSION: 3.23.58
New host is using the following versions:
PHP VERSION: 4.3.10, mySQL VERSION: 4.0.25
Could anyone help with this? I have been busting my brains out why the script works in my old host but not in the new one.