Script works on computer but not server?
<p>Strange issue... I have no idea why this isn't working on my server.</p>

<p>For some reason the IF's aren't working.</p>

<p>The major one thats puzzling me is the one that checks the file extension. Even if it doesn't match for some reason its returning TRUE on my server and not my computer.</p>

<pre><code>    if (isset($_POST['submit'])) {

    $sizelimit = 50; //File size limit in KB.
    $destination_folder = 'images/user_avatars/temp/';

    $fileurl = $_POST['avatar_url'];
    $filetype = substr(strrchr($fileurl,'.'),1);
    $filename = "user_" . $_SESSION[user_id] . "." . $filetype;

    $temp = $destination_folder . $filename;

    if ($filetype == "gif" || "png" || "jpg" || "jpeg") {

        $file = fopen ($url, "rb");
        if ($file) {
            $newfile = fopen ($temp, "wb");
            if ($newfile) {
                while(!feof($file)) {
                    fwrite($newfile, fread($file, 1024 * 8 ), 1024 * 8 );
                }
            }
        }

        if ( filesize($temp) &gt; 1024 * $sizelimit ) {
            $errors .= "The file size of the image you entered is too large!";
        }
    } else {
        $errors .= "The URL you entered is not a valid image!";
    }

    if (isset($errors)) {
        $smarty-&gt;assign("error_message", $errors);
        unlink($temp);
    } else {
        $avatar_sql = "
            UPDATE
                users
            SET
                user_avatar = '$filename'
            WHERE
                user_id = '$_SESSION[user_id]'
        ";
        $avatar_query = @mysqli_query ($db_connect, $avatar_sql);

        fclose($file);
        fclose($newfile);
    }
}
</code></pre>
