update_image2.php

<?php

session_start();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Portal</title>

<!-- CSS -->
<link href="style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie7.css" /><![endif]-->

<!-- JavaScripts-->
<script type="text/javascript" src="style/js/jquery.js"></script>
<script type="text/javascript" src="style/js/jNice.js"></script>
<style>
th{
    background-color: lightgray;    
}
</style>
</head>

<body>
    <div id="wrapper">
        <!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
        <h1><a href="#"><span>Transdmin Light</span></a></h1>
        <img src="../../images/logo.png" height="50px" style="margin: -45px 0 0 -180px; position: absolute;"><br><!--<img src="images/admin.png" height="60px" style="margin: -20px 0 0 430px">--><br><br>
        <!-- You can name the links with lowercase, they will be transformed to uppercase by CSS, we prefered to name them with uppercase to have the same effect with disabled stylesheet -->

        <div style="margin-left: -190px;">
        <img src="images/<?php echo $_SESSION['banner']; ?>" width="1300px" height="220px"></div>
        <br><br>

        <?php include('top_nav.php') ?>

        <!-- // #end mainNav -->

        <div id="containerHolder" style="background-color: #ffffcc;>
            <div id="container">
                <div id="sidebar">

                    <?php include("admin_nav2.php"); ?>

                    <!-- // .sideNav -->
                </div>    
                <!-- // #sidebar -->

                <div style="margin: -10px 0 0 230px; width: 700px; position: absolute;">
                <!-- h2 stays for breadcrumbs -->
                <h2><a href="#">Dashboard</a> &raquo; <a href="#" class="active">Image Gallery</a></h2>
                </div>


                <!-- // #main -->



                <!-- Insert New -->

<div id="menu" style="margin: -80px 0 0 300px; position: absolute;">

      <p>&nbsp;</p>

<br><br><br><br><br><br><br><br><br><br><br><br>      

    <!-- begin extra -->

    <!-- begin styles -->
    <link href="css/styles.css" rel="stylesheet" type="text/css" media="all" /><!-- end styles -->

    <!-- begin javascript -->
    <script type="text/javascript" src="js/ajax.js"></script><!-- end javascript -->


   <!-- begin logo -->
   <!--<a href="http://demo.zmeutz.com/image_upload/" class="logo"></a><!-- end logo -->

    <!-- begin content -->
    <div id="content" class="corners">

        <?php

        include('includes/koneksi.php');    

        ?>

    </div><!-- end content -->        

        <?php            

        // Untuk filter file size

        // temporary file
        // $uploadedfile = $_FILES['uploadfile']['tmp_name'];

        // capture the original size of the uploaded image
        // list($width,$height) = getimagesize($uploadedfile);


        if(isset($_POST['ok2'])){

            if (isset($_FILES['file']['name']) && $_FILES['file']['name']!=''){
                $size = getimagesize($_FILES['file']['tmp_name']);
            //echo "<pre>";print_r($size);echo "</pre>";
            $image_width = $size[0];
            $image_height = $size[1];
            //echo "Image width : ".$image_width.'<br>';
            //echo "Image height: ".$image_height;

                }else{
                echo "No files uploaded!";
                }



            //print_r($_POST['location'], 1);
            echo "test";

            if (empty($_GET['image_id']))
                {

                // Picture Upload

                $allowedExts = array("gif", "jpeg", "jpg", "png");
                //$temp = explode(".", $_FILES["file"]["name"]);


                $extension = pathinfo($_FILES["file"]["name"],PATHINFO_EXTENSION);  
                //$extension = end($temp);

                if ((($_FILES["file"]["type"] == "image/gif")
                || ($_FILES["file"]["type"] == "image/jpeg")
                || ($_FILES["file"]["type"] == "image/jpg")
                || ($_FILES["file"]["type"] == "image/pjpeg")
                || ($_FILES["file"]["type"] == "image/x-png")
                || ($_FILES["file"]["type"] == "image/png"))
                && ($_FILES["file"]["size"] < 41943040)  //40MB
                && in_array($extension, $allowedExts)) {

                if ($_FILES["file"]["error"] > 0) {
                echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                } else {
                echo "Successfully upload pictures";
                //echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                //echo "Type: " . $_FILES["file"]["type"] . "<br>";
                //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                if (file_exists("upload/" . $_FILES["file"]["name"]))
                {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $ii = (rand());
                $iii = (rand());
                $newfilename = $ii.$iii.$i.$filename;

                //echo $_FILES["file"]["name"] . " new file name is $newfilename. ";
                } else {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $newfilename = $i.$filename;

                move_uploaded_file($_FILES["file"]["tmp_name"],
                "images/" . $newfilename);
                //echo "Stored in: " . "upload/" . $newfilename;
                }


                } 

                /*$filename = $_FILES["file"]["name"];
                */
                //$image_info[] = getimagesize($_FILES["file"]["name"]);
                list($image_width, $image_height) = getimagesize('images/' . $newfilename);
                //echo "width: " . $width . "<br />";
                //echo "height: " . $height;

                /*
                echo "image info : ".$image_info[0];
                echo "image info : ".$image_info;
                echo "image width : ".$image_width;
                echo "image height : ".$image_height;
                /*
                /*if($_FILES)
                {
                $tmp = $_FILES['file']['tmp_name'];
                $data = getimagesize($tmp);
                print_r($data);
                }*/


                //$username = substr($stu_fname, 0, 1).$stu_lname;
                //$username = strtolower($username);

                // default password for new student
                $encrypteddefaultpassword = MD5('squprime');

                $image_id = $_GET['image_id'];
                $image = $_FILES["file"]["name"];

                // counter mysql injection              
                $image_id = mysql_real_escape_string($image_id);
                $image = mysql_real_escape_string($image);
                //$location = mysql_real_escape_string($location);

                $result2 = mysql_query("SELECT * FROM image_upload");

                $data2 = mysql_fetch_array($result2);

                if($image_width > $data2['maxwidth'] || $image_height > $data2['maxheight'])
                    {

                    echo '<br>'."Image is too big".'<br>';
                    echo $image_width.'>'.$data2['maxwidth'].'<br>';
                    echo $image_height.'>'.$data2['maxheight'];
                    exit();
                    }       
                elseif($image_width < $data2['minwidth'] || $image_height < $data2['minheight'])
                    {
                    echo "Image is too small";
                    echo $image_width.'<'.$data2['minwidth'].'<br>';
                    echo $image_height.'<'.$data2['minheight'];
                    exit();
                    }
                else    
                    {
                    $sqlstr = "INSERT INTO image_upload(image, newfilename, minwidth, maxwidth, minheight, maxheight) VALUES('".$image."', '".$newfilename."', '450px', '550px', '600px', '700px')";
                    echo "pass";
                    }
                    // minwidth, maxwidth, minheight, maxheight
                    echo $sqlstr;
                }
            }
        else
            {   
            echo "test2";
            // Picture Upload 

            $allowedExts = array("gif", "jpeg", "jpg", "png");
            $temp = explode(".", $_FILES["file"]["name"]);
            $extension = end($temp);

            if ((($_FILES["file"]["type"] == "image/gif")
            || ($_FILES["file"]["type"] == "image/jpeg")
            || ($_FILES["file"]["type"] == "image/jpg")
            || ($_FILES["file"]["type"] == "image/pjpeg")
            || ($_FILES["file"]["type"] == "image/x-png")
            || ($_FILES["file"]["type"] == "image/png"))
            && ($_FILES["file"]["size"] < 41943040)  //40MB
            && in_array($extension, $allowedExts)) {
            if ($_FILES["file"]["error"] > 0) {
                echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                } else {
                //echo "Successfully upload pictures";
                //echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                //echo "Type: " . $_FILES["file"]["type"] . "<br>";
                //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                if (file_exists("upload/" . $_FILES["file"]["name"]))
                {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $ii = (rand());
                $iii = (rand());
                $newfilename = $ii.$iii.$i.$filename;

                //echo $_FILES["file"]["name"] . " new file name is $newfilename. ";
                } else {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $newfilename = $i.$filename;

                move_uploaded_file($_FILES["file"]["tmp_name"],
                "images/" . $newfilename);
                //echo "Stored in: " . "upload/" . $newfilename;
                }
                }
            } /*else {
                echo "No picture uploaded";
            } */

            //$filename = $_FILES["file"]["name"];

            //$username = substr($stu_fname, 0, 1).$stu_lname;
            //$username = strtolower($username);

            $image_id = $_REQUEST['image_id'];

            // Query to get student picture filename
            $result = mysql_query("SELECT * FROM image_upload WHERE image_id =".$image_id) or die(mysql_error());
            $data1 = mysql_fetch_assoc($result);
            $pic_filename = $data1['newfilename'];

            if($result){
                unlink('images/'.$pic_filename);
            }


            //LOAD IMAGE TABLE

            $image = $_FILES["file"]["name"];

            //echo $_POST['location'];die();
            $location = $_POST['location'];
            //$location = $_GET['location'];

            $image_id = $_GET['image_id'];

            $class = $_POST['class'];

            //echo $class;          

            //counter mysql injection           

            $image = mysql_real_escape_string($image);

            $result2 = mysql_query("SELECT * FROM image_upload");

                $data2 = mysql_fetch_array($result2);

                /*
                if( $_FILES['file'][size] > $data2['maxwidth'] ){
                        echo $_FILES['file'][error];
                        exit;
                }
                else    
                    {
                    $sqlstr = "UPDATE image_upload SET image_id='".$image_id."', image='".$image."', newfilename='".$newfilename."', location='".$location."' WHERE image_id='".$image_id."'";
                    }
                */


                if($image_width > $data2['maxwidth'] or $image_height > $data2['maxheight'])
                    {
                    echo "Image is too big";
                    exit();
                    }       
                elseif($image_width < $data2['minwidth'] or $image_height < $data2['minheight'])
                    {
                    echo "Image is too small";
                    exit();
                    }
                else    
                    {
                    $sqlstr = "UPDATE image_upload SET image_id='".$image_id."', image='".$image."', newfilename='".$newfilename."', location='".$location."', class='".$class."' WHERE image_id='".$image_id."'";

                    }

            echo $sqlstr;   
            } 
        echo $sqlstr;

        $result = mysql_query($sqlstr) or die(mysql_error());

        //Jika mode edit, maka tidak akan dikirimkan konfirmasi kepada subscriber
        //if (empty($_REQUEST['id']))   kirimEmail($idKategori, $judul, $news);
        $confirmation = ($result) ? "Data has been saved." : "Fail to save data.";



        }


        ?>          



  <!-- end extra --> 



<br><br><br><br>    

                <?php
                //LOAD IMAGE TABLE
                //echo "1";

                if (!empty($_GET['image_id'])){
                //echo "2";

                $result = mysql_query("SELECT * FROM image_upload WHERE image_id='".$_GET['image_id']."'") or die(mysql_error());

                $data = mysql_fetch_array($result);

                $image_id = $_GET['image_id'];
                $newfilename = $data['newfilename'];
                $class = $data['class'];
                $location = $data['location'];
                $minwidth = $data['minwidth'];
                $maxwidth = $data['maxwidth'];
                $minheight = $data['minheight'];
                $maxheight = $data['maxheight'];
                }
                else {

                //echo "3";
                    //echo "unable to select data".'<br>';
                    //echo "package_id is empty";
                    $image_id = "";
                    $newfilename = "";
                    $class = "";
                    $location = "";
                    $minwidth = "450";
                    $maxwidth = "550";
                    $minheight = "600";
                    $maxheight = "700";

                }
                ?>

                <form method="post" action="<?php echo $_SERVER['PHP_SELF'] .'?image_id='. $image_id;?>" enctype="multipart/form-data">

                            <b>Class name :</b>&nbsp;&nbsp;<input type="text" name="class" value="<?php echo $class; ?>"><br><br><br>

                            <?php                            

                            //echo '<div id="location"><b>Location: <input type="text" size="50px" name="location" value="'.$location.'" disabled></b></div><br><br><br>';

                            //echo '<input type="text" size="30px" name="location" value="'.$location.'" hidden>';

                            //echo '<div id="size"><b>min width: <input type="text" size="10px" name="size" value="'.$minwidth.'px" disabled></b></div><br><br><br>';

                            echo '<div id="size"><b>min width: ' .$minwidth. 'px</b></div><br><br><br>';

                            //echo '<div id="size"><b>max width: <input type="text" size="10px" name="size" value="'.$maxwidth.'px" disabled></b></div><br><br><br>';

                            echo '<div id="size"><b>max width: ' .$maxwidth. 'px</b></div><br><br><br>';

                            //echo '<div id="size"><b>min height: <input type="text" size="10px" name="size" value="'.$minheight.'px" disabled></b></div><br><br><br>';

                            //echo '<div id="size"><b>min height: "'.$minheight.'px"></b></div><br><br><br>';

                            echo '<div id="size"><b>min height: '.$minheight.'px</b></div><br><br><br>';

                            //echo '<div id="size"><b>max height: <input type="text" size="10px" name="size" value="'.$maxheight.'px" disabled></b></div><br><br><br>';

                            echo '<div id="size"><b>max height: '.$maxheight.'px</b></div><br><br><br>';

                            //echo $data['image'];

                            //echo '<div id="updateimage"><img src="images/'.$data['newfilename'].'" height="250px"></div>';

                            if(isset($data['image']) && isset( $data['newfilename'])) {
                            echo $data['image'];
                            echo '<div id="updateimage"><img src="images/'.$data['newfilename'].'" height="250px"></div>';
                            }

                            echo '<br><br><br>.<input type="file" value="upload" name="file"/><br><br>';

                            ?>

                <!--<td><br><input type="submit" name="ok" value="Save" class="abutton"/></td>-->

                </form>

<hr>

 <?php            

        // Untuk filter file size

        // temporary file
        // $uploadedfile = $_FILES['uploadfile']['tmp_name'];

        // capture the original size of the uploaded image
        // list($width,$height) = getimagesize($uploadedfile);


        if(isset($_POST['ok2'])){

            if (isset($_FILES['file']['name']) && $_FILES['file']['name']!=''){
                $size = getimagesize($_FILES['file']['tmp_name']);
            //echo "<pre>";print_r($size);echo "</pre>";
            $image_width = $size[0];
            $image_height = $size[1];
            //echo "Image width : ".$image_width.'<br>';
            //echo "Image height: ".$image_height;

                }else{
                echo "No files uploaded!";
                }



            //print_r($_POST['location'], 1);


            if (empty($_GET['image_id']))
                {

                // Picture Upload

                $allowedExts = array("gif", "jpeg", "jpg", "png");
                //$temp = explode(".", $_FILES["file"]["name"]);


                $extension = pathinfo($_FILES["file"]["name"],PATHINFO_EXTENSION);  
                //$extension = end($temp);

                if ((($_FILES["file"]["type"] == "image/gif")
                || ($_FILES["file"]["type"] == "image/jpeg")
                || ($_FILES["file"]["type"] == "image/jpg")
                || ($_FILES["file"]["type"] == "image/pjpeg")
                || ($_FILES["file"]["type"] == "image/x-png")
                || ($_FILES["file"]["type"] == "image/png"))
                && ($_FILES["file"]["size"] < 41943040)  //40MB
                && in_array($extension, $allowedExts)) {

                if ($_FILES["file"]["error"] > 0) {
                echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                } else {

                echo "Successfully upload pictures";
                //echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                //echo "Type: " . $_FILES["file"]["type"] . "<br>";
                //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                if (file_exists("upload/" . $_FILES["file"]["name"]))
                {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $ii = (rand());
                $iii = (rand());
                $newfilename = $ii.$iii.$i.$filename;

                //echo $_FILES["file"]["name"] . " new file name is $newfilename. ";
                } else {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $newfilename = $i.$filename;

                move_uploaded_file($_FILES["file"]["tmp_name"],
                "images/" . $newfilename);
                //echo "Stored in: " . "upload/" . $newfilename;
                }


                } 

                /*$filename = $_FILES["file"]["name"];

                $image_info = getimagesize($_FILES["file"]["name"]);
                $image_width = $image_info[0];
                $image_height = $image_info[1];

                echo "image info : ".$image_info[0];
                echo "image info : ".$image_info;
                echo "image width : ".$image_width;
                echo "image height : ".$image_height;*/

                /*if($_FILES)
                {
                $tmp = $_FILES['file']['tmp_name'];
                $data = getimagesize($tmp);
                print_r($data);
                }*/


                //$username = substr($stu_fname, 0, 1).$stu_lname;
                //$username = strtolower($username);

                // default password for new student
                $encrypteddefaultpassword = MD5('squprime');

                $image_id = $_GET['image_id'];
                $image = $_FILES["file"]["name"];

                // counter mysql injection              
                $image_id = mysql_real_escape_string($image_id);
                $image = mysql_real_escape_string($image);
                //$location = mysql_real_escape_string($location);

                $result2 = mysql_query("SELECT * FROM image_upload");

                $data2 = mysql_fetch_array($result2);

                if($image_width > $data2['maxwidth_bn'] || $image_height > $data2['maxheight_bn'])
                    {
                    echo '<br>'."Image banner is too big".'<br>';
                    echo $image_width.'>'.$data2['maxwidth_bn'].'<br>';
                    echo $image_height.'>'.$data2['maxheight_bn'];
                    exit();
                    }       
                elseif($image_width < $data2['minheight_bn'] || $image_height < $data2['minheight_bn'])
                    {
                    echo "Image is too small";
                    exit();
                    }
                else    
                    {
                    $sqlstr = "INSERT INTO image_upload(image_bn, newfilename_bn, location_bn, minwidth_bn, maxwidth_bn, minheight_bn, maxheight_bn) VALUES('".$image."', '".$newfilename."', '".$location."', '990px', '1000px', '220px', '240px')";
                    }
                    // minwidth, maxwidth, minheight, maxheight
                }
            }
        else
            {   

            // Picture Upload 

            $allowedExts = array("gif", "jpeg", "jpg", "png");
            $temp = explode(".", $_FILES["file"]["name"]);
            $extension = end($temp);

            if ((($_FILES["file"]["type"] == "image/gif")
            || ($_FILES["file"]["type"] == "image/jpeg")
            || ($_FILES["file"]["type"] == "image/jpg")
            || ($_FILES["file"]["type"] == "image/pjpeg")
            || ($_FILES["file"]["type"] == "image/x-png")
            || ($_FILES["file"]["type"] == "image/png"))
            && ($_FILES["file"]["size"] < 41943040)  //40MB
            && in_array($extension, $allowedExts)) {
            if ($_FILES["file"]["error"] > 0) {
                echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                } else {
                //echo "Successfully upload pictures";
                //echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                //echo "Type: " . $_FILES["file"]["type"] . "<br>";
                //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                if (file_exists("upload/" . $_FILES["file"]["name"]))
                {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $ii = (rand());
                $iii = (rand());
                $newfilename = $ii.$iii.$i.$filename;

                //echo $_FILES["file"]["name"] . " new file name is $newfilename. ";
                } else {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $newfilename_bn = $i.$filename;

                move_uploaded_file($_FILES["file"]["tmp_name"],
                "images/" . $newfilename_bn);
                //echo "Stored in: " . "upload/" . $newfilename;
                }
                }
            } /*else {
                echo "No picture uploaded";
            } */

            //$filename = $_FILES["file"]["name"];

            //$username = substr($stu_fname, 0, 1).$stu_lname;
            //$username = strtolower($username);

            $image_id = $_REQUEST['image_id'];

            // Query to get student picture filename
            $result = mysql_query("SELECT * FROM image_upload WHERE image_id =".$image_id) or die(mysql_error());
            $data1 = mysql_fetch_assoc($result);
            $pic_filename = $data1['newfilename'];

            if($result){
                unlink('images/'.$pic_filename);
            }


            //LOAD IMAGE TABLE

            $image_bn = $_FILES["file"]["name"];

            //echo $_POST['location'];die();
            //$location_bn = $_POST['location_bn'];
            //$location = $_GET['location'];

            $image_id = $_GET['image_id'];

            //counter mysql injection           

            $image_bn = mysql_real_escape_string($image_bn);


<?php

session_start();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Portal</title>

<!-- CSS -->
<link href="style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie7.css" /><![endif]-->

<!-- JavaScripts-->
<script type="text/javascript" src="style/js/jquery.js"></script>
<script type="text/javascript" src="style/js/jNice.js"></script>
<style>
th{
    background-color: lightgray;    
}
</style>
</head>

<body>
    <div id="wrapper">
        <!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
        <h1><a href="#"><span>Transdmin Light</span></a></h1>
        <img src="../../images/logo.png" height="50px" style="margin: -45px 0 0 -180px; position: absolute;"><br><!--<img src="images/admin.png" height="60px" style="margin: -20px 0 0 430px">--><br><br>
        <!-- You can name the links with lowercase, they will be transformed to uppercase by CSS, we prefered to name them with uppercase to have the same effect with disabled stylesheet -->

        <div style="margin-left: -190px;">
        <img src="images/<?php echo $_SESSION['banner']; ?>" width="1300px" height="220px"></div>
        <br><br>

        <?php include('top_nav.php') ?>

        <!-- // #end mainNav -->

        <div id="containerHolder" style="background-color: #ffffcc;>
            <div id="container">
                <div id="sidebar">

                    <?php include("admin_nav2.php"); ?>

                    <!-- // .sideNav -->
                </div>    
                <!-- // #sidebar -->

                <div style="margin: -10px 0 0 230px; width: 700px; position: absolute;">
                <!-- h2 stays for breadcrumbs -->
                <h2><a href="#">Dashboard</a> &raquo; <a href="#" class="active">Image Gallery</a></h2>
                </div>


                <!-- // #main -->



                <!-- Insert New -->

<div id="menu" style="margin: -80px 0 0 300px; position: absolute;">

      <p>&nbsp;</p>

<br><br><br><br><br><br><br><br><br><br><br><br>      

    <!-- begin extra -->

    <!-- begin styles -->
    <link href="css/styles.css" rel="stylesheet" type="text/css" media="all" /><!-- end styles -->

    <!-- begin javascript -->
    <script type="text/javascript" src="js/ajax.js"></script><!-- end javascript -->


   <!-- begin logo -->
   <!--<a href="http://demo.zmeutz.com/image_upload/" class="logo"></a><!-- end logo -->

    <!-- begin content -->
    <div id="content" class="corners">

        <?php

        include('includes/koneksi.php');    

        ?>

    </div><!-- end content -->        

        <?php            

        // Untuk filter file size

        // temporary file
        // $uploadedfile = $_FILES['uploadfile']['tmp_name'];

        // capture the original size of the uploaded image
        // list($width,$height) = getimagesize($uploadedfile);


        if(isset($_POST['ok2'])){

            if (isset($_FILES['file']['name']) && $_FILES['file']['name']!=''){
                $size = getimagesize($_FILES['file']['tmp_name']);
            //echo "<pre>";print_r($size);echo "</pre>";
            $image_width = $size[0];
            $image_height = $size[1];
            //echo "Image width : ".$image_width.'<br>';
            //echo "Image height: ".$image_height;

                }else{
                echo "No files uploaded!";
                }



            //print_r($_POST['location'], 1);
            echo "test";

            if (empty($_GET['image_id']))
                {

                // Picture Upload

                $allowedExts = array("gif", "jpeg", "jpg", "png");
                //$temp = explode(".", $_FILES["file"]["name"]);


                $extension = pathinfo($_FILES["file"]["name"],PATHINFO_EXTENSION);  
                //$extension = end($temp);

                if ((($_FILES["file"]["type"] == "image/gif")
                || ($_FILES["file"]["type"] == "image/jpeg")
                || ($_FILES["file"]["type"] == "image/jpg")
                || ($_FILES["file"]["type"] == "image/pjpeg")
                || ($_FILES["file"]["type"] == "image/x-png")
                || ($_FILES["file"]["type"] == "image/png"))
                && ($_FILES["file"]["size"] < 41943040)  //40MB
                && in_array($extension, $allowedExts)) {

                if ($_FILES["file"]["error"] > 0) {
                echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                } else {
                echo "Successfully upload pictures";
                //echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                //echo "Type: " . $_FILES["file"]["type"] . "<br>";
                //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                if (file_exists("upload/" . $_FILES["file"]["name"]))
                {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $ii = (rand());
                $iii = (rand());
                $newfilename = $ii.$iii.$i.$filename;

                //echo $_FILES["file"]["name"] . " new file name is $newfilename. ";
                } else {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $newfilename = $i.$filename;

                move_uploaded_file($_FILES["file"]["tmp_name"],
                "images/" . $newfilename);
                //echo "Stored in: " . "upload/" . $newfilename;
                }


                } 

                /*$filename = $_FILES["file"]["name"];
                */
                //$image_info[] = getimagesize($_FILES["file"]["name"]);
                list($image_width, $image_height) = getimagesize('images/' . $newfilename);
                //echo "width: " . $width . "<br />";
                //echo "height: " . $height;

                /*
                echo "image info : ".$image_info[0];
                echo "image info : ".$image_info;
                echo "image width : ".$image_width;
                echo "image height : ".$image_height;
                /*
                /*if($_FILES)
                {
                $tmp = $_FILES['file']['tmp_name'];
                $data = getimagesize($tmp);
                print_r($data);
                }*/


                //$username = substr($stu_fname, 0, 1).$stu_lname;
                //$username = strtolower($username);

                // default password for new student
                $encrypteddefaultpassword = MD5('squprime');

                $image_id = $_GET['image_id'];
                $image = $_FILES["file"]["name"];

                // counter mysql injection              
                $image_id = mysql_real_escape_string($image_id);
                $image = mysql_real_escape_string($image);
                //$location = mysql_real_escape_string($location);

                $result2 = mysql_query("SELECT * FROM image_upload");

                $data2 = mysql_fetch_array($result2);

                if($image_width > $data2['maxwidth'] || $image_height > $data2['maxheight'])
                    {

                    echo '<br>'."Image is too big".'<br>';
                    echo $image_width.'>'.$data2['maxwidth'].'<br>';
                    echo $image_height.'>'.$data2['maxheight'];
                    exit();
                    }       
                elseif($image_width < $data2['minwidth'] || $image_height < $data2['minheight'])
                    {
                    echo "Image is too small";
                    echo $image_width.'<'.$data2['minwidth'].'<br>';
                    echo $image_height.'<'.$data2['minheight'];
                    exit();
                    }
                else    
                    {
                    $sqlstr = "INSERT INTO image_upload(image, newfilename, minwidth, maxwidth, minheight, maxheight) VALUES('".$image."', '".$newfilename."', '450px', '550px', '600px', '700px')";
                    echo "pass";
                    }
                    // minwidth, maxwidth, minheight, maxheight
                    echo $sqlstr;
                }
            }
        else
            {   
            echo "test2";
            // Picture Upload 

            $allowedExts = array("gif", "jpeg", "jpg", "png");
            $temp = explode(".", $_FILES["file"]["name"]);
            $extension = end($temp);

            if ((($_FILES["file"]["type"] == "image/gif")
            || ($_FILES["file"]["type"] == "image/jpeg")
            || ($_FILES["file"]["type"] == "image/jpg")
            || ($_FILES["file"]["type"] == "image/pjpeg")
            || ($_FILES["file"]["type"] == "image/x-png")
            || ($_FILES["file"]["type"] == "image/png"))
            && ($_FILES["file"]["size"] < 41943040)  //40MB
            && in_array($extension, $allowedExts)) {
            if ($_FILES["file"]["error"] > 0) {
                echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                } else {
                //echo "Successfully upload pictures";
                //echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                //echo "Type: " . $_FILES["file"]["type"] . "<br>";
                //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                if (file_exists("upload/" . $_FILES["file"]["name"]))
                {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $ii = (rand());
                $iii = (rand());
                $newfilename = $ii.$iii.$i.$filename;

                //echo $_FILES["file"]["name"] . " new file name is $newfilename. ";
                } else {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $newfilename = $i.$filename;

                move_uploaded_file($_FILES["file"]["tmp_name"],
                "images/" . $newfilename);
                //echo "Stored in: " . "upload/" . $newfilename;
                }
                }
            } /*else {
                echo "No picture uploaded";
            } */

            //$filename = $_FILES["file"]["name"];

            //$username = substr($stu_fname, 0, 1).$stu_lname;
            //$username = strtolower($username);

            $image_id = $_REQUEST['image_id'];

            // Query to get student picture filename
            $result = mysql_query("SELECT * FROM image_upload WHERE image_id =".$image_id) or die(mysql_error());
            $data1 = mysql_fetch_assoc($result);
            $pic_filename = $data1['newfilename'];

            if($result){
                unlink('images/'.$pic_filename);
            }


            //LOAD IMAGE TABLE

            $image = $_FILES["file"]["name"];

            //echo $_POST['location'];die();
            $location = $_POST['location'];
            //$location = $_GET['location'];

            $image_id = $_GET['image_id'];

            $class = $_POST['class'];

            //echo $class;          

            //counter mysql injection           

            $image = mysql_real_escape_string($image);

            $result2 = mysql_query("SELECT * FROM image_upload");

                $data2 = mysql_fetch_array($result2);

                /*
                if( $_FILES['file'][size] > $data2['maxwidth'] ){
                        echo $_FILES['file'][error];
                        exit;
                }
                else    
                    {
                    $sqlstr = "UPDATE image_upload SET image_id='".$image_id."', image='".$image."', newfilename='".$newfilename."', location='".$location."' WHERE image_id='".$image_id."'";
                    }
                */


                if($image_width > $data2['maxwidth'] or $image_height > $data2['maxheight'])
                    {
                    echo "Image is too big";
                    exit();
                    }       
                elseif($image_width < $data2['minwidth'] or $image_height < $data2['minheight'])
                    {
                    echo "Image is too small";
                    exit();
                    }
                else    
                    {
                    $sqlstr = "UPDATE image_upload SET image_id='".$image_id."', image='".$image."', newfilename='".$newfilename."', location='".$location."', class='".$class."' WHERE image_id='".$image_id."'";

                    }

            echo $sqlstr;   
            } 
        echo $sqlstr;

        $result = mysql_query($sqlstr) or die(mysql_error());

        //Jika mode edit, maka tidak akan dikirimkan konfirmasi kepada subscriber
        //if (empty($_REQUEST['id']))   kirimEmail($idKategori, $judul, $news);
        $confirmation = ($result) ? "Data has been saved." : "Fail to save data.";



        }


        ?>          



  <!-- end extra --> 



<br><br><br><br>    

                <?php
                //LOAD IMAGE TABLE
                //echo "1";

                if (!empty($_GET['image_id'])){
                //echo "2";

                $result = mysql_query("SELECT * FROM image_upload WHERE image_id='".$_GET['image_id']."'") or die(mysql_error());

                $data = mysql_fetch_array($result);

                $image_id = $_GET['image_id'];
                $newfilename = $data['newfilename'];
                $class = $data['class'];
                $location = $data['location'];
                $minwidth = $data['minwidth'];
                $maxwidth = $data['maxwidth'];
                $minheight = $data['minheight'];
                $maxheight = $data['maxheight'];
                }
                else {

                //echo "3";
                    //echo "unable to select data".'<br>';
                    //echo "package_id is empty";
                    $image_id = "";
                    $newfilename = "";
                    $class = "";
                    $location = "";
                    $minwidth = "450";
                    $maxwidth = "550";
                    $minheight = "600";
                    $maxheight = "700";

                }
                ?>

                <form method="post" action="<?php echo $_SERVER['PHP_SELF'] .'?image_id='. $image_id;?>" enctype="multipart/form-data">

                            <b>Class name :</b>&nbsp;&nbsp;<input type="text" name="class" value="<?php echo $class; ?>"><br><br><br>

                            <?php                            

                            //echo '<div id="location"><b>Location: <input type="text" size="50px" name="location" value="'.$location.'" disabled></b></div><br><br><br>';

                            //echo '<input type="text" size="30px" name="location" value="'.$location.'" hidden>';

                            //echo '<div id="size"><b>min width: <input type="text" size="10px" name="size" value="'.$minwidth.'px" disabled></b></div><br><br><br>';

                            echo '<div id="size"><b>min width: ' .$minwidth. 'px</b></div><br><br><br>';

                            //echo '<div id="size"><b>max width: <input type="text" size="10px" name="size" value="'.$maxwidth.'px" disabled></b></div><br><br><br>';

                            echo '<div id="size"><b>max width: ' .$maxwidth. 'px</b></div><br><br><br>';

                            //echo '<div id="size"><b>min height: <input type="text" size="10px" name="size" value="'.$minheight.'px" disabled></b></div><br><br><br>';

                            //echo '<div id="size"><b>min height: "'.$minheight.'px"></b></div><br><br><br>';

                            echo '<div id="size"><b>min height: '.$minheight.'px</b></div><br><br><br>';

                            //echo '<div id="size"><b>max height: <input type="text" size="10px" name="size" value="'.$maxheight.'px" disabled></b></div><br><br><br>';

                            echo '<div id="size"><b>max height: '.$maxheight.'px</b></div><br><br><br>';

                            //echo $data['image'];

                            //echo '<div id="updateimage"><img src="images/'.$data['newfilename'].'" height="250px"></div>';

                            if(isset($data['image']) && isset( $data['newfilename'])) {
                            echo $data['image'];
                            echo '<div id="updateimage"><img src="images/'.$data['newfilename'].'" height="250px"></div>';
                            }

                            echo '<br><br><br>.<input type="file" value="upload" name="file"/><br><br>';

                            ?>

                <!--<td><br><input type="submit" name="ok" value="Save" class="abutton"/></td>-->

                </form>

<hr>

 <?php            

        // Untuk filter file size

        // temporary file
        // $uploadedfile = $_FILES['uploadfile']['tmp_name'];

        // capture the original size of the uploaded image
        // list($width,$height) = getimagesize($uploadedfile);


        if(isset($_POST['ok2'])){

            if (isset($_FILES['file']['name']) && $_FILES['file']['name']!=''){
                $size = getimagesize($_FILES['file']['tmp_name']);
            //echo "<pre>";print_r($size);echo "</pre>";
            $image_width = $size[0];
            $image_height = $size[1];
            //echo "Image width : ".$image_width.'<br>';
            //echo "Image height: ".$image_height;

                }else{
                echo "No files uploaded!";
                }



            //print_r($_POST['location'], 1);


            if (empty($_GET['image_id']))
                {

                // Picture Upload

                $allowedExts = array("gif", "jpeg", "jpg", "png");
                //$temp = explode(".", $_FILES["file"]["name"]);


                $extension = pathinfo($_FILES["file"]["name"],PATHINFO_EXTENSION);  
                //$extension = end($temp);

                if ((($_FILES["file"]["type"] == "image/gif")
                || ($_FILES["file"]["type"] == "image/jpeg")
                || ($_FILES["file"]["type"] == "image/jpg")
                || ($_FILES["file"]["type"] == "image/pjpeg")
                || ($_FILES["file"]["type"] == "image/x-png")
                || ($_FILES["file"]["type"] == "image/png"))
                && ($_FILES["file"]["size"] < 41943040)  //40MB
                && in_array($extension, $allowedExts)) {

                if ($_FILES["file"]["error"] > 0) {
                echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                } else {

                echo "Successfully upload pictures";
                //echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                //echo "Type: " . $_FILES["file"]["type"] . "<br>";
                //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                if (file_exists("upload/" . $_FILES["file"]["name"]))
                {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $ii = (rand());
                $iii = (rand());
                $newfilename = $ii.$iii.$i.$filename;

                //echo $_FILES["file"]["name"] . " new file name is $newfilename. ";
                } else {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $newfilename = $i.$filename;

                move_uploaded_file($_FILES["file"]["tmp_name"],
                "images/" . $newfilename);
                //echo "Stored in: " . "upload/" . $newfilename;
                }


                } 

                /*$filename = $_FILES["file"]["name"];

                $image_info = getimagesize($_FILES["file"]["name"]);
                $image_width = $image_info[0];
                $image_height = $image_info[1];

                echo "image info : ".$image_info[0];
                echo "image info : ".$image_info;
                echo "image width : ".$image_width;
                echo "image height : ".$image_height;*/

                /*if($_FILES)
                {
                $tmp = $_FILES['file']['tmp_name'];
                $data = getimagesize($tmp);
                print_r($data);
                }*/


                //$username = substr($stu_fname, 0, 1).$stu_lname;
                //$username = strtolower($username);

                // default password for new student
                $encrypteddefaultpassword = MD5('squprime');

                $image_id = $_GET['image_id'];
                $image = $_FILES["file"]["name"];

                // counter mysql injection              
                $image_id = mysql_real_escape_string($image_id);
                $image = mysql_real_escape_string($image);
                //$location = mysql_real_escape_string($location);

                $result2 = mysql_query("SELECT * FROM image_upload");

                $data2 = mysql_fetch_array($result2);

                if($image_width > $data2['maxwidth_bn'] || $image_height > $data2['maxheight_bn'])
                    {
                    echo '<br>'."Image banner is too big".'<br>';
                    echo $image_width.'>'.$data2['maxwidth_bn'].'<br>';
                    echo $image_height.'>'.$data2['maxheight_bn'];
                    exit();
                    }       
                elseif($image_width < $data2['minheight_bn'] || $image_height < $data2['minheight_bn'])
                    {
                    echo "Image is too small";
                    exit();
                    }
                else    
                    {
                    $sqlstr = "INSERT INTO image_upload(image_bn, newfilename_bn, location_bn, minwidth_bn, maxwidth_bn, minheight_bn, maxheight_bn) VALUES('".$image."', '".$newfilename."', '".$location."', '990px', '1000px', '220px', '240px')";
                    }
                    // minwidth, maxwidth, minheight, maxheight
                }
            }
        else
            {   

            // Picture Upload 

            $allowedExts = array("gif", "jpeg", "jpg", "png");
            $temp = explode(".", $_FILES["file"]["name"]);
            $extension = end($temp);

            if ((($_FILES["file"]["type"] == "image/gif")
            || ($_FILES["file"]["type"] == "image/jpeg")
            || ($_FILES["file"]["type"] == "image/jpg")
            || ($_FILES["file"]["type"] == "image/pjpeg")
            || ($_FILES["file"]["type"] == "image/x-png")
            || ($_FILES["file"]["type"] == "image/png"))
            && ($_FILES["file"]["size"] < 41943040)  //40MB
            && in_array($extension, $allowedExts)) {
            if ($_FILES["file"]["error"] > 0) {
                echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                } else {
                //echo "Successfully upload pictures";
                //echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                //echo "Type: " . $_FILES["file"]["type"] . "<br>";
                //echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                //echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                if (file_exists("upload/" . $_FILES["file"]["name"]))
                {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $ii = (rand());
                $iii = (rand());
                $newfilename = $ii.$iii.$i.$filename;

                //echo $_FILES["file"]["name"] . " new file name is $newfilename. ";
                } else {

                $filename = $_FILES["file"]["name"];
                $i = (rand());
                $newfilename_bn = $i.$filename;

                move_uploaded_file($_FILES["file"]["tmp_name"],
                "images/" . $newfilename_bn);
                //echo "Stored in: " . "upload/" . $newfilename;
                }
                }
            } /*else {
                echo "No picture uploaded";
            } */

            //$filename = $_FILES["file"]["name"];

            //$username = substr($stu_fname, 0, 1).$stu_lname;
            //$username = strtolower($username);

            $image_id = $_REQUEST['image_id'];

            // Query to get student picture filename
            $result = mysql_query("SELECT * FROM image_upload WHERE image_id =".$image_id) or die(mysql_error());
            $data1 = mysql_fetch_assoc($result);
            $pic_filename = $data1['newfilename'];

            if($result){
                unlink('images/'.$pic_filename);
            }


            //LOAD IMAGE TABLE

            $image_bn = $_FILES["file"]["name"];

            //echo $_POST['location'];die();
            //$location_bn = $_POST['location_bn'];
            //$location = $_GET['location'];

            $image_id = $_GET['image_id'];

            //counter mysql injection           

            $image_bn = mysql_real_escape_string($image_bn);

            $result2 = mysql_query("SELECT * FROM image_upload WHERE image_id=".$_GET['image_id']);

                $data2 = mysql_fetch_array($result2);

                /*
                if( $_FILES['file'][size] > $data2['maxwidth'] ){
                        echo $_FILES['file'][error];
                        exit;
                }
                else    
                    {
                    $sqlstr = "UPDATE image_upload SET image_id='".$image_id."', image='".$image."', newfilename='".$newfilename."', location='".$location."' WHERE image_id='".$image_id."'";
                    }
                */


                if($image_width > $data2['maxwidth_bn'] || $image_height > $data2['maxheight_bn'])
                    {
                    echo $image_width.' '.$data2['maxwidth_bn'].'<br>';
                    echo $image_height.' '.$data2['maxheight_bn'];
                    echo "Image banner is too big2";
                    exit();
                    }       
                elseif($image_width < $data2['minheight_bn'] || $image_height < $data2['minheight_bn'])
                    {
                    echo "Image is too small";
                    exit();
                    }
                else    
                    {
                    $sqlstr = "UPDATE image_upload SET image_id='".$image_id."', image_bn='".$image_bn."', newfilename_bn='".$newfilename_bn."', location_bn='".$location_bn."' WHERE image_id='".$image_id."'";
                    echo $sqlstr;
                    }

            echo $sqlstr;   
            } 

        $result = mysql_query($sqlstr) or die(mysql_error());

        //Jika mode edit, maka tidak akan dikirimkan konfirmasi kepada subscriber
        //if (empty($_REQUEST['id']))   kirimEmail($idKategori, $judul, $news);
        $confirmation = ($result) ? "Data has been saved." : "Fail to save data.";



        }


        ?>          



  <!-- end extra --> 



<br><br><br><br>    

                <?php
                //LOAD IMAGE TABLE

                if (!empty($_GET['image_id'])){
                $result = mysql_query("SELECT * FROM image_upload WHERE image_id='".$_GET['image_id']."'") or die(mysql_error());

                $data = mysql_fetch_array($result);

                $image_id = $_GET['image_id'];
                $newfilename = $data['newfilename_bn'];
                $location_bn = $data['location_bn'];
                $minwidth_bn = $data['minwidth_bn'];
                $maxwidth_bn = $data['maxwidth_bn'];
                $minheight_bn = $data['minheight_bn'];
                $maxheight_bn = $data['maxheight_bn'];
                }
                else {
                    //echo "unable to select data".'<br>';
                    //echo "package_id is empty";
                    $image_id = "";
                    $newfilename_bn = "";
                    $location_bn = "";
                    $minwidth_bn = "990";
                    $maxwidth_bn = "1000";
                    $minheight_bn = "220";
                    $maxheight_bn = "240";

                }
                ?>

                <form method="post" action="<?php echo $_SERVER['PHP_SELF'] .'?image_id='. $image_id;?>" enctype="multipart/form-data">

                            <?php
                            //echo '<div id="location"><b>Location: <input type="text" size="50px" name="location_bn" value="'.$location_bn.'" disabled></b></div><br><br><br>';

                            //echo '<input type="text" size="30px" name="location_bn" value="'.$location_bn.'" hidden>';

                            echo '<div id="size"><b>min width: '. $minwidth_bn.'px</b></div><br><br><br>';

                            echo '<div id="size"><b>max width: '.$maxwidth_bn.'px</b></div><br><br><br>';

                            echo '<div id="size"><b>min height: '.$minheight_bn.'px</b></div><br><br><br>';

                            echo '<div id="size"><b>max height: '.$maxheight_bn.'px</b></div><br><br><br>';
                            //echo $data['image_bn'];

                            //echo '<div id="updateimage"><img src="images/'.$data['newfilename_bn'].'" height="250px"></updateimage>';

                            if(isset($data['image_bn']) && isset( $data['newfilename_bn'])) {
                            echo $data['image_bn'];
                            echo '<div id="updateimage"><img src="images/'.$data['newfilename_bn'].'" height="250px"></div>';
                            }

                            echo '<br><br><br>.<input type="file" value="upload" name="file"/><br><br>';

                            ?>

                <td><br><input type="submit" name="ok2" value="Save" class="abutton"/></td>

                </form>

<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>



<p>&nbsp;</p>

</body>
</div>


                <!-- End Insert -->  

                <div class="clear"></div>
            </div>
            <!-- // #container -->
        </div>   
        <!-- // #containerHolder -->

        <p id="footer"></p>
    </div>
    <!-- // #wrapper -->
</body>
</html>

testSuccessfully upload pictures
Image is too big
995>650
229>450

I wonder why there is error when I try to upload these two image at the same time.

597 x 424 px

995 x 229 px

Member Avatar for diafol

Did you really mean to just dump 1500 lines of markup/code here or was it a mistake?

I sure as hell won't read 1,500+ lines of messy code.
Give us what is broken or don't get help.

Member Avatar for diafol

Suggestion: please take note of the advice numerous members have given you over the years and separate your markup and php. I honestly feel that helping you is a complete waste of my and other contibutors' time. If you were a 11 year old kid, perhaps you'd have an excuse, but you list your job as being a web developer. Please, for the sanity of all of use on this forum, take heed of the advice given. I'm sure I've suggested this link before, but I'd highly recommend that you read it this time:

http://bit.ly/Dwebphp

commented: Personally, I think he should be banned from posting questions. +4
commented: I like your comments ,they are funny and have wisdom +2
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.