コード例 #1
0
ファイル: upload.php プロジェクト: stoic1979/php_transport
<?php

session_start();
include "class.upload.dao.php";
include_once "header.php";
$dao = new DAOupload();
?>
<center><b><u><font face ="Britannic Bold"><h1>Upload</h1></font></u></b></center><br>
<a href="form.upload.php" class="btn btn-info">Add upload</a><br>
<table class="table table-striped">
	<tr class ="info">
		<td>#</td>
		<td>Title</td>
		<td>Type</td>
		<td>Date</td>
		<td>Image</td>
		<td><b>Edit</b></td>
		<td><b>Delete</b></td>
	</tr>

<?php 
$rec_per_page = 10;
if (isset($_GET['page'])) {
    $page = $_GET['page'];
} else {
    $page = 1;
}
$limit1 = ($page - 1) * $rec_per_page;
$limit2 = $page * $rec_per_page;
$total_recs = $dao->getCount();
$rec = $dao->getAllByUser($_SESSION["uid"], $limit1, $limit2);
コード例 #2
0
<?php

session_start();
include "db.php";
include "class.upload.dao.php";
if (isset($_POST['upload']) && $_FILES['img']['size'] > 0) {
    $fileName = $_FILES['img']['name'];
    $tmpName = $_FILES['img']['tmp_name'];
    $fileSize = $_FILES['img']['size'];
    $fileType = $_FILES['img']['type'];
    $fp = fopen($tmpName, 'r');
    $content = fread($fp, filesize($tmpName));
    $content = addslashes($content);
    fclose($fp);
    if (!get_magic_quotes_gpc()) {
        $fileName = addslashes($fileName);
    }
    $dao = new DAOupload();
    $vo = new upload($_SESSION["uid"], $_POST["title"], $_POST["type"], $_POST["date"], $content);
    $dao->save($vo);
    header("Location: upload.php");
    echo "<br>File {$fileName} uploaded<br>";
}
コード例 #3
0
		return true;
	}
</script>
<?php 
include "header.php";
include "class.upload.dao.php";
?>
<center>
	<h3>Upload Form</h3>

<form name = "frmUpload" method="POST" action="save.upload.php" enctype="multipart/form-data" onsubmit = "return validateUpload();">
	<table cellspacing="5" cellpadding="5">
		<?php 
if (isset($_GET["id"])) {
    $dao = new DAOupload();
    $vo = $dao->get($_GET["id"]);
    ?>
			<tr>
				<td> Title </td>
				<td><input type = "text" name = "title" value= "<?php 
    echo $vo->title;
    ?>
 "/></td>
			</tr>
			<tr>
				<td> Type </td>
				<td><input type = "text" name = "type" list = "uploadType" value= "<?php 
    echo $vo->type;
    ?>
 "/>
コード例 #4
0
<?php

include "db.php";
include "class.upload.dao.php";
$dao = new DAOupload();
if (isset($_GET["id"])) {
    $vo = $dao->get($_GET["id"]);
    $dao->del($vo);
}
header("Location: upload.php");