Example #1
0
                    $starttime = time();
                    while (!feof($fp) && time() < $starttime + 5) {
                        $_SESSION['ca_pic']['data'] .= fread($fp, 8192);
                    }
                    fclose($fp);
                }
                $_SESSION['ca_pic']['dirty'] = true;
            }
        }
        break;
    case "reset":
        unset($_SESSION['ca_pic']);
        break;
}
if (!isset($_SESSION['ca_pic'])) {
    $_SESSION['ca_pic'] = array();
    $_SESSION['ca_pic']['dirty'] = false;
    $db = new dbconn();
    $return = $db->query("SELECT picture FROM pictures WHERE id=" . $_SESSION['ca_id']);
    if ($db->row_count($return) > 0) {
        $_SESSION['ca_pic']['in_db'] = true;
        $arr = $db->fetch_row($return);
        $_SESSION['ca_pic']['data'] = $arr[0];
    } else {
        $_SESSION['ca_pic']['in_db'] = false;
        $fp = fopen("unknown.jpg", "rb");
        $_SESSION['ca_pic']['data'] = fread($fp, 906240);
        fclose($fp);
    }
}
echo $_SESSION['ca_pic']['data'];