davy_yg 2 Posting Whiz

metode image managementnya masih konstruksi

Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\rustoleum\administrator\input_image.php on line 123
Invalid file
Data telah tersimpan.

Judul Image

last uploaded image

database:

id image path judul
0 bottleAirFreshner.jp Air Freshener
0 Dispenser.jpg Dispenser
0 bottleAirFreshner.jp
0 php.php
0 74.jpg dsad
0 74.php dsad
0 s3x.php
0 s3x.php
0 A.jpg.flv
0 respec.php
0 dowen
0 respec.php dowen
0 respec.jpg dowen
0 private.png up
0 respec.jpg up
0 respec.jpg up
0 ups.jpg dowenns
0 ag.jpg awd
0 e.php
0 02.jpeg a
0 sulawesi.jpg
0 sulawesi.jpg
0 sulawesi.jpg

0 scenary.jpg

input_image.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Rustoleum Admin Page</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="rustoleum, coating" />
<meta name="description" content="Rustoleum Indonesia provides coating solution for industrial requirement and individual needs." />

<style type="text/css">
#slideshow { left: 35px; float: left; margin: 10px; z-index: 0;}
#nav { width: 270px; margin: 170px 0 0 225px; float: left; position: absolute; z-index: 1;}
#nav li { float: left; margin: 0 0 0 4px; list-style: none; background: url(images/pager3-2.jpg) no-repeat top;}
#nav a { width: 40px; padding: 3px; display: block; border: 1px solid #ccc;}
#nav li.activeSlide a { /* background: #88f */ background: url(images/pager3.jpg) no-repeat top;}
#nav a:focus { outline: none;}
#nav img { border: none; display: block;}
pre { clear: left }
</style>
<script src="../js/jquery.min.js" type="text/javascript"></script>
<script src="../js/chili-1.7.pack.js"></script>
<script src="../js/jquery.cycle.all.js" type="text/javascript"></script>
<script src="../js/jquery.easing.1.3.js" type="text/javascript" ></script>
<link href= "../css/admin.css" rel="stylesheet" type="text/css" media="screen">
<link href= "../css/navstyleadmin.css" rel="stylesheet" type="text/css" media="screen">
<script type="text/javascript">
$('#slideshow').cycle({ 
    fx:     'fade', 
    speed:   900, 
    timeout: 10000, 
    pager:  '#nav', 
    pagerAnchorBuilder: function(idx, slide) { 
        // return selector string for existing anchor 
        return '#nav li:eq(' + idx + ') a'; 
    } 
});
</script>

</head>

<div id="main-wrap">
<body>


<?php

// Check if session is not registered, redirect back to main page.
// Put this code in first line of web page.

session_start();

if(!$_SESSION['username'])
    {
    header("location:index.php");
    }

?>

<center>
<div id="logo"><img src="../images/logo.gif"></div>
ADMIN PAGE
</center>

<center>

<div id="demos">
    <div id="slideshow" class="pics">
        <img src="../images/Banner1.jpg" width="950" height="200" />
        <img src="../images/Banner2.jpg" width="950" height="200" />
        <img src="../images/Banner3.jpg" width="950" height="200" />       
    </div>
    <ul id="nav">
        <li><a href="#"></a></li>
        <li><a href="#"></a></li>
        <li><a href="#"></a></li>   
    </ul>
</div>

</center>

<?php   include('adminnav.php');  ?>

<div id="menu">
      <center>
        <h2>Image Manager</h2>
      </center>
      <p>&nbsp;</p>

  <p>metode image managementnya masih konstruksi</p><center>
      <p>


<?php

    include('../includes/koneksi.php');

    $id = isset($_POST['id']) ? $_POST['id'] : '';  
    $confirmation = isset($_POST['confirmation']) ? $_POST['confirmation'] : '';  
    $judul = isset($_POST['judul']) ? $_POST['judul'] : ''; 
    $image = isset($_POST['image']) ? $_POST['image'] : '';

    //Load berita
    if (!empty($_REQUEST['id'])){
        $result = mysql_query("SELECT * FROM gallery WHERE id =".$_REQUEST['id']) or die(mysql_error());
        $data = mysql_fetch_array($result);
        $id = $data['id'];
        $judul = $data['judul'];
        $image = $image['image'];

    }

    //Simpan berita 
    if (isset($_REQUEST['ok'])){

        if (empty($_REQUEST['id']))
            $sqlstr = "INSERT INTO gallery(judul, image) VALUES('".$judul."','".$image."')";
        else
            $sqlstr = "UPDATE gallery SET judul='".$judul."', image='".$image."' WHERE id=".$_REQUEST['id'];
        $result = mysql_query($sqlstr) or die(mysql_error());

            // cek type file & simpan file pada folder
            $file_exts = array("jpg", "bmp", "jpeg", "gif", "png");
            $upload_exts = end(explode(".", $_FILES["image"]["name"]));
            if ((($_FILES["image"]["type"] == "image/gif")
            || ($_FILES["image"]["type"] == "image/jpeg")
            || ($_FILES["image"]["type"] == "image/png")
            || ($_FILES["image"]["type"] == "image/pjpeg"))
            && ($_FILES["image"]["size"] < 2000000)
            && in_array($upload_exts, $file_exts))
            {
            if ($_FILES["image"]["error"] > 0)
            {
            echo "Return Code: " . $_FILES["image"]["error"] . "<br>";
            }
            else
            {
            echo "Upload: " . $_FILES["image"]["name"] . "<br>";
            echo "Type: " . $_FILES["image"]["type"] . "<br>";
            echo "Size: " . ($_FILES["image"]["size"] / 1024) . " kB<br>";   
            echo "Temp file: " . $_FILES["image"]["tmp_name"] . "<br>";
            // Enter your path to upload file here
            if (file_exists("c:\xampp\xampp\htdocs\rustoleum/photocms/" .
            $_FILES["image"]["name"]))
            {
            echo "<div class='error'>"."(".$_FILES["image"]["name"].")".
            " already exists. "."</div>";
            }
            else
            {
            move_uploaded_file($_FILES["image"]["tmp_name"],
            "c:\xampp\xampp\htdocs\rustoleum/photocms/" . $_FILES["image"]["name"]);
            echo "<div class='sucess'>"."Stored in: " .
            "c:\xampp\xampp\htdocs\rustoleum/photocms/" . $_FILES["image"]["name"]."</div>";
            }
            }
            }
            else
            {
            echo "<div class='error'>Invalid file</div>";
            }

        //Jika mode edit, maka tidak akan dikirimkan konfirmasi kepada subscriber
        //if (empty($_REQUEST['id']))   kirimEmail($idKategori, $judul, $news);
        $confirmation = ($result) ? "Data telah tersimpan." : "Gagal menyimpan data.";  
    }
    ?>
    <div align="center">
        <div style="width:800px;text-align:left;">
        <script type="text/javascript" src="../../Masterlink/cgoods/ckeditor/ckeditor.js"></script>
        <link href="../../Masterlink/cgoods/ckeditor/content.css" rel="stylesheet" type="text/css"/>
        <?php echo $confirmation;?>
        <form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
            <input type="hidden" name="id" value="<?php echo $id; ?>"/>
            <table id="admintable" border="1" cellpadding="2" cellspacing="0">
                <tr>
                    <th>Judul</th>
                    <th>Image</th>
                </tr>
                <tr>
                    <td><input size="30px" type="text" name="judul" value="<?php echo $judul; ?>"/></td>
                </tr>
                <tr>
                    <td><input size="30px" type="file" name="image" value="<?php echo $image; ?>"/></td>
                </tr>
                <tr><?php // showing the picture ?>
                    <td><img src="photos/<?php echo $image; ?>"/></td>
                </tr>                
                <tr>             
                    <td><input type="submit" name="ok" value="Simpan"/></td>
              </tr>
            </table>
        </form>
        </div>
    </div>

<?php 

    if(isset($image))echo "<div><img src=\"$imagepath\" alt=\"last uploaded image\" title=\"{$judul}\" height=\"100\" /><p>$imagepath</p></div>"; 

?>

<!--
<form action="upload.php" method="post" enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file"><br>
    <input type="submit" name="submit" value="Submit">
</form>
-->    

<p>&nbsp;</p>



</body>
</div>

<?php include('adminfooter.php'); ?>
</div>
</html> 

I have tried to see the image file showing at the front, yet nothing appears.

line 123: $upload_exts = end(explode(".", $_FILES["image"]["name"]));

How to fix this program?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.