Example #1
0
//System-----------------------------------------------------------
//Images UPLOAD------------------------------------------------------------
if (!empty($_POST['Goupload'])) {
    //若有點選上傳
    $upid = $_POST['upid'];
    if ($_FILES['file']['size'] > 0) {
        $sql = "select count(*) as total from `{$now_table}` where upid='{$upid}'";
        $res = mysql_query($sql);
        $row = mysql_fetch_array($res);
        if ($row['total'] >= $pro_download_num) {
            $tool->error('檔案上傳已達上限!');
        }
        //檢查檔案類型
        $type = array("application/pdf", "application/msword");
        //, "application/octet-stream", "application/x-msdownload", "application/vnd.ms-excel");
        $upload = new file_uploader();
        $upload->allow_type = $type;
        //允許上傳檔案類型
        $upload->allow_size = 1024 * 1024 * 10;
        //大小限制 10mb
        $upload->save_path = "../../images/file/" . date("Y-m-d");
        //儲存的資料夾路徑
        $file = $upload->save($_FILES['file']);
        if ($file === false) {
            $tool->error("檔案上傳失敗!!");
        }
    }
    if (!empty($file)) {
        //有檔
        $file = substr($file, 3);
        $name = $_POST['name'];
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../styles.css">
<title>מערכת מעקב סעודות - מרכז "בני ברוך" פתח גהגה תקוה</title>
<?php 
include "class_coll.php";
?>
</head>
<body>

<?php 
include "seudot_top_menu.html";
$display = new display();
$statistics = new statistics();
$condition = $statistics->f_get_condition(7);
$query_string = $condition;
$uploader = new file_uploader();
$if_tbl_exists = $uploader->if_tbl_exists('seudot_stat', $query_string);
$stat_query = 'select * from seudot_stat';
?>

<form name="xls" action="../e2xls.php" method="post">
<input type="hidden" name="xls_query" value="<?php 
echo preg_replace('/LIMIT (.*)/', '', $stat_query);
?>
" />
<input type="hidden" name="filename" value="stat" /> 
<input type="submit" value="Excel" class="button_excel"/>
</form> 
<TABLE><TR><TD>
<?php 
//In this example the table name to be displayed is  static, but it could be taken from a form
if (!session_is_registered(myusername)) {
    $url = "http://" . $_SERVER['HTTP_HOST'] . "/";
    die('<script type="text/javascript">window.location=\'' . $url . '\';</script>');
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="rtl" lang="he">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../styles.css">
<title>מערכת מעקב סעודות - מרכז "בני ברוך" פתח גהגה תקוה</title>
<?php 
include "class_coll.php";
?>
</head>
<body>

<?php 
include "seudot_top_menu.html";
$csv_filename = basename($_FILES['uploadedfile']['name']);
echo "<p>" . $csv_filename . "</p>";
$uploader = new file_uploader();
$f_uploader = $uploader->f_uploader('seudot_uploads', 0, 1);
?>

</body>
</html>