Inherited code does not work in FF3+

I inherited a search engine program just after FireFox released v2.0.0.1 at which time everything was working properly. Now however, the program works in IE but the ratings system hangs (never finishes) when the user tries to vote for their favorite message board when using FF. Below is the code snippet called “ratings.php” which I think must be the culprit but I see nothing there which could (or should) cause this behavior in either php4 or php5… can anyone here help?

[php]<?php

header(“Cache-Control: no-cache”);
header(“Pragma: nocache”);

// START/CALL THE SESSION
session_start();

// DEFINE US AS RUNSEARCH, OTHERWISE, WON’T BE ABLE TO GET FUNCTIONS
define(‘RUNSEARCH’,1);
require_once(‘functions.php’);

// VALIDATE/MAKE SAFE THE VALUES
$rating = preg_replace("/[^0-9]/","",$_REQUEST[‘rate’]);
$id = preg_replace("/[^0-9]/","",$_REQUEST[‘id’]);
$voter = $_REQUEST[‘voter’];
$units = 5;
$starwidth = 16;
// MAKE SURE IP IS SAFE - NOT SPOOFING SOMETHING DANGEROUS
$ip = preg_replace("/[^0-9.]/","",$_SERVER[‘REMOTE_ADDR’]);

// KILL THE SCRIPT IF USER TRIES TO VOTE TOO HIGH OR LOW
if ($rating == 0 || $rating > $units) die(“Sorry, vote appears to be invalid.”);

// DETECT CHEATING
$user = $_SESSION[‘arandomnumber’];

if ($user != $voter) {
die(“Detecting cheating. Logged IP.”);
}

// GET THE INFORMATION FOR THIS BOARD
$connect = dbConnect();
$query = dbQuery("
SELECT id, totalvotes, totalratings, ratings_usedips
FROM “.$sql[‘boards’].”
WHERE id=’$id’
“)
or die(” Error: ".mysql_error());

$row = mysql_fetch_assoc($query);
mysql_free_result($query);
mysql_close($connect);

$voted = 0;
// IF THERE ARE VOTES, HAS THIS USER VOTED
if($row['totalvotes'] != 0) {
    $voted = strpos($row['ratings_usedips'],'#'.$ip.'#') !== FALSE ? 1 : 0;
}

$sum = $rating+$row['totalratings']; // add together the current vote value and the total vote value
$tense = ($row['totalvotes'] == 1) ? "vote" : "votes";

// checking to see if the first vote has been tallied
// or increment the current number of votes
($sum==0 ? $added=0 : $added=$row[‘totalvotes’]+1);

if(!$voted) {

// IF NOT VOTED, MAKE IT COUNT NOW
if ($rating >= 1 && $rating <= $units) {

    // FIRST LOG THE RATING
    logRatings($rating,$id);

    // NOW UPDATE THE DB
    $row['ratings_usedips'] = '#'.$ip.'#';
    $rating = @number_format($sum/$added,2);
    // CONNECT TO DB
    $connect = dbConnect();
        dbQuery("
                    UPDATE ".$sql['boards']."
                    SET rating='$rating', totalvotes='$added', totalratings='$sum', ratings_usedips = CONCAT(`ratings_usedips`,'".$row['ratings_usedips']."')
                    WHERE id='$id'
                ");
    mysql_close($connect);
}

}

$row[‘totalvotes’] = $added;
$row[‘totalratings’] = $sum;
$tense = ($row[‘totalvotes’]==1) ? “vote” : “votes”;

// WHETHER THE VOTER HAS JAVASCRIPT ENABLED (TRUE) OR NOT (FALSE)
if(isset($_REQUEST[‘ajax’])) {
// AJAX, SO WORK OUT THE DATA TO SEND BACK
$output = ’



Voted!
‘.@number_format($sum/$added,2).’/’.$units.’ (’.$row[‘totalvotes’].’ ‘.$tense.’)




  • 1

  • 2

  • 3

  • 4

  • 5


';
    $output = "unit_long$id|$output";
    echo $output;

} else {
// JAVASCRIPT DISABLED, SEND THEM BACK
$referer = $_SERVER[‘HTTP_REFERER’];
header(“Location: $referer”);
exit;
}

?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service