Script stopped working

I have script that no longer works. it was written by a friend several years ago and I’ve lost toch with him. I know nothing about php and have tried learning over the years, but I just don’t have a nack for it. The problem is anytime I click on a link that should list the database entry, it just reloads the page. My webhost uses php and fastcgi 5.3 if that matters.

If someone can please give me an idea of what the problem may be, it would be appreciated.

The web page that isn’t working is http://movies.bethsobsessions.com/movielist.php. The code is (with username and password removed):

<?php // looking better..a bit of clean up is needed $db = mysql_connect ("mysql.bethsobsessions.com", "", ""); mysql_select_db ("Obsessions", $db); // display individual record if ($id) { $result = mysql_query("select * from Movies where id=$id", $db); $myrow = mysql_fetch_array($result); ?>

Beth's Obsessions Movie Details

<?php printf("", $myrow["movie_image"]);?> <? printf("

%s

", $myrow["movie_title"]);?>

<? printf(" Starring: %s", $myrow["movie_stars"]);?>
<? printf("Director: %s", $myrow["movie_dir"]);?> <? printf("Rating: %s", $myrow["movie_rat"]);?>
<? printf("No. of discs: %s", $myrow["movie_disc"]);?> <? printf("Availability: %s", $myrow["movie_stat"]);?> <? printf("Wishlist: %s", $myrow["movie_wish"]);?>

<? printf("
Movie Description:

%s", $myrow["movie_desc"]);?>

 

<?

} else {
//show movie list
?>

Beth's Obsessions Movie List

<? $result = mysql_query("select * from Movies order by movie_title", $db); if ($myrow = mysql_fetch_array($result)) { do

printf("<a href="%s?id=%s">%s
\n", $php_self, $myrow[“id”], $myrow[“movie_title”]);

while ($myrow = mysql_fetch_array($result));

} else {
echo “Sorry, no records were found!”;
}
}

?>[/color]

Looks like this code was written relying on php setting register_globals = On, which is deprecated.
The safest way to fix problem with this script is to add this line at top of code (after php opening tag <?php ):
[php]$id = (int)$_GET[‘id’];[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service