jiggens Posted July 6, 2007 Share Posted July 6, 2007 I am having trouble getting a image or file to upload. I was wondering if someone could take a look at my code and help me out and fix what is wrong with it. I have been trying to fix this a couple of times. Heres what i have done already i used a generic code to make sure that it wasn't a server configuration or permissions issue and it uploads fine using the generic code. The problem i am having is getting the code below to upload a file correctly. There is is a couple of parts that are done first. I first have a session start than login to my MySQL database, I am not using BLOB or anything like that its just storing the binary in mysql. Its not a server configuration. I am trying to upload one file below 2 MB where i got 20 MB my max size in php.ini file. than i am resizing the file and creating 2 files from one, one maxed size another thumbnail size. I get the function to create the 2 files but when they are created they are 0 KB does anyone have a clue what i am doing wrong. This is on windows server with IIS 6.0 and using PHP 5.0 and MySQL 5 as well. I cant get this file to upload correctly even though i have it setup in my code to say echo if it is uploaded or not. Is there a way to have it output and error file or something, if so would someone give me direction on how to do so. I don't want a link to php manuals i have read them and am still having problems. Please help anyone Code <?php #Start the PHP session session_start(); #Variables set to log into SQL database $SQLusername = 'xxxx'; $SQLpassword = 'xxxx'; $SQLdbname = 'xxxx'; $db = mysql_connect("localhost", $SQLusername, $SQLpassword) or print mysql_error (); mysql_select_db($SQLdbname) or print mysql_error (); #Checks to see if user is logged in if($_SESSION['sesLogIn'] != 1) { header("Location: http://www.domainscene.com/admin/"); exit(); } $ID = $_GET['ID']; $siteID = $_GET['siteID']; $uploaddir = '/homes/html/images/temp/'; $uploadfile = $uploaddir . basename($_FILES['newMap']['name']); $uploadfile2 = $uploaddir . basename($_FILES['newLogo']['name']); $uploadfile3 = '/homes/html/browse/brochures/' . basename($_FILES['newBrochure']['name']); $uploadfile4 = '/homes/html/images/browse/banners/' . $ID . ".jpg"; $uploadfile5 = '/homes/html/browse/features/' . basename($_FILES['newFeatures']['name']); #upload image function function createImage($imgname,$maxh,$maxw,$newname) { list($width, $height) = getimagesize($imgname); if ($width < $maxw && $height < $maxh) { $new_height = $height; $new_width = $width; } else { $ratio = ($width/$height); $new_height = sqrt(10000/$ratio); $new_width = $width * ($new_height / $height); } $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($imgname); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); //Grab new image ob_start(); ImageJPEG($image_p); $image_buffer = ob_get_contents(); ob_end_clean(); ImageDestroy($image_p); //Create temporary file and write to it $fp = tmpfile(); fwrite($fp, $image_buffer); rewind($fp); //Upload new image $conn_id = ftp_connect('64.73.246.139'); $login_result = ftp_login($conn_id,'xxxx','xxxx_domain'); if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to server "; exit; } else { echo "Connected "; } //set PASV mode if(!ftp_pasv($conn_id,TRUE)){ echo "Could not enter PASV mode!"; } $upload = ftp_fput($conn_id,$newname, $fp, FTP_BINARY); if (!$upload) { echo "FTP UPLOAD HAS FAILED!"; } else { echo "Uploaded Complete"; } fclose($fp); } #Resize Image based on maximum width and maximum height function resizeBoth($imgname,$maxh,$maxw,$newname) { list($width, $height) = getimagesize($imgname); if ($width < $maxw && $height < $maxh) { $new_height = $height; $new_width = $width; } if ($width > $height) { $new_height = $height * ($maxw / $width); $new_width = $maxw; } else { $new_height = $maxh; $new_width = $width * ($maxh / $height); } $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($imgname); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); //Grab new image ob_start(); ImageJPEG($image_p); $image_buffer = ob_get_contents(); ob_end_clean(); ImageDestroy($image_p); //Create temporary file and write to it $fp = tmpfile(); fwrite($fp, $image_buffer); rewind($fp); //Upload new image $conn_id = ftp_connect('ftp.domain.com'); $login_result = ftp_login($conn_id,'xxxx','xxxx_domain'); if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to server "; exit; } else { echo "Connected "; } # Change Directory if (@ftp__chdir ($conn_id,$uploaddir)) { echo "Current Direcotry is now : ", ftp_pwd($conn_id), "\n"; } else { echo "Couldn't Change directory\n"; } # Set PASV mode if(!ftp_pasv($conn_id,TRUE)){ echo "Could not enter PASV mode!"; } $upload = ftp_fput($conn_id,$newname, $fp, FTP_BINARY); if (!$upload) { echo "FTP UPLOAD HAS FAILED!"; } else { echo "Uploaded Complete"; } fclose($fp); } #Checks to see if add/edit project has been submitted if(array_key_exists('submit', $_POST)) { if ($ID == "" || $ID == "new") { $query = "INSERT INTO psh_communities "; $query .= "(name,area,status,upcoming_description,current_description,current_details,completed_description)"; $query .= " VALUES ('" . $_POST['communityName'] . "','" . $_POST['communityArea'] . "','" . $_POST['communityStatus'] . "','" . addslashes($_POST['communityUpDesc']) . "','" . addslashes($_POST['communityCurrDesc']) . "','" . addslashes($_POST['communityCurrDet']) . "','" . addslashes($_POST['communityCompDesc']) . "')"; $result = mysql_query($query); $result = mysql_query("SELECT MAX(ID) from psh_communities"); $row = mysql_fetch_row($result); $newProjectID = $row[0]; $result = mysql_query("SELECT MAX(orderID) from psh_communities"); $row = mysql_fetch_row($result); $newOrderID = $row[0] + 1; $query = "UPDATE psh_communities SET orderID = '" . $newOrderID . "' WHERE ID = '" . $newProjectID . "'"; $result = mysql_query ($query); header("Location: " . $_SERVER['PHP_SELF'] . "?ID=" . $newProjectID); exit(); } else { $query = "UPDATE psh_communities SET name = '" . $_POST['communityName'] . "', area = '" . $_POST['communityArea'] . "', status = '" . $_POST['communityStatus'] . "', upcoming_description = '" . addslashes($_POST['communityUpDesc']) . "', current_description = '" . addslashes($_POST['communityCurrDesc']) . "', current_details = '" . addslashes($_POST['communityCurrDet']) . "', completed_description = '" . addslashes($_POST['communityCompDesc']) . "' WHERE ID = $ID"; $result = mysql_query($query); } } if(array_key_exists('deleteImage', $_POST)) { if ($_POST['deleteImage'] == "Delete Map") { unlink('/homes/html/images/browse/maps/'. $ID . '.jpg'); unlink('/homes/html/images/browse/maps/'. $ID . '-TH.jpg'); } elseif ($_POST['deleteImage'] == "Delete Logo") { unlink('/homes/html/images/browse/logos/'. $ID . '.jpg'); } elseif ($_POST['deleteImage'] == "Delete Features List") { $query = "SELECT * from psh_communities WHERE ID = $ID"; $result = mysql_query($query); $row = mysql_fetch_row ($result); $query = "UPDATE psh_communities SET features = 'NULL' WHERE ID = $ID"; $result = mysql_query($query); unlink('/homes/html/browse/features/'. $row[10]); } elseif ($_POST['deleteImage'] == "Delete Brochure") { $query = "SELECT * from psh_communities WHERE ID = $ID"; $result = mysql_query($query); $row = mysql_fetch_row ($result); $query = "UPDATE psh_communities SET brochure = 'NULL' WHERE ID = $ID"; $result = mysql_query($query); unlink('/homes/html/browse/brochures/'. $row[8]); } elseif ($_POST['deleteImage'] == "Delete Banner") { unlink('/homes/html/images/browse/banners/'. $ID . '.jpg'); } } if(array_key_exists('uploadNewMap', $_POST)) { if ($ID != "" && $ID != "new") { move_uploaded_file($_FILES['newMap']['tmp_name'], $uploadfile); resizeBoth($uploadfile,640,480,'/homes/html/images/browse/maps/' . $ID . '.jpg'); unlink($uploadfile); } } if(array_key_exists('uploadNewLogo', $_POST)) { if ($ID != "" && $ID != "new") { move_uploaded_file($_FILES['newLogo']['tmp_name'], $uploadfile2); createImage($uploadfile2,100,400,'/homes/html/images/browse/logos/' . $ID . '.jpg'); createImage($uploadfile2,100,160,'/homes/html/images/browse/logos/' . $ID . '-TH.jpg'); unlink($uploadfile2); } } if(array_key_exists('uploadNewFeatures', $_POST)) { if ($ID != "" && $ID != "new") { $query = "UPDATE psh_communities SET features = '" . $_FILES['newFeatures']['name'] . "' WHERE ID = $ID"; $result = mysql_query($query); move_uploaded_file($_FILES['newFeatures']['tmp_name'], $uploadfile5); } } if(array_key_exists('uploadNewBrochure', $_POST)) { if ($ID != "" && $ID != "new") { $query = "UPDATE psh_communities SET brochure = '" . $_FILES['newBrochure']['name'] . "' WHERE ID = $ID"; $result = mysql_query($query); move_uploaded_file($_FILES['newBrochure']['tmp_name'], $uploadfile3); } } if(array_key_exists('uploadNewBanner', $_POST)) { if ($ID != "" && $ID != "new") { move_uploaded_file($_FILES['newBanner']['tmp_name'], $uploadfile4); } } #Checks to see if update project has been submitted if(array_key_exists('edit_x', $_POST)) { header("Location: http://www.domainscene.com/admin/pshomes/edit-siteplan.php?communityID=" . $ID . "&ID=" . $siteID); exit(); } #Checks to see if delete project has been submitted if(array_key_exists('delete_x', $_POST)) { $query = "DELETE from psh_siteplans where ID = '$siteID'"; $result = mysql_query($query) or print mysql_error(); unlink('/homes/html/images/browse/renderings/'. $siteID . '.jpg'); unlink('/homes/html/images/browse/renderings/'. $siteID . '-TH.jpg'); unlink('/homes/html/images/browse/floorplans/'. $siteID . '.jpg'); } #Checks to see if move up project has been submitted if(array_key_exists('up_x', $_POST)) { if ($siteID != 1) { $result = mysql_query("SELECT orderID from psh_siteplans where ID = '$siteID'") or print mysql_error(); $row = mysql_fetch_row ($result); $oldID = $row[0]; $query = "UPDATE psh_siteplans SET orderID = '0' where orderID = '$oldID' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); $query = "UPDATE psh_siteplans SET orderID = '$oldID' where orderID = '" . ($oldID - 1) . "' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); $query = "UPDATE psh_siteplans SET orderID = '" . ($oldID - 1) . "' where orderID = '0' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); } } #Checks to see if move down project has been submitted if(array_key_exists('down_x', $_POST)) { $result = mysql_query("SELECT orderID from psh_siteplans where ID = '$siteID'") or print mysql_error(); $row = mysql_fetch_row ($result); $oldID = $row[0]; $query = "UPDATE psh_siteplans SET orderID = '0' where orderID = '$oldID' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); $query = "UPDATE psh_siteplans SET orderID = '$oldID' where orderID = '" . ($oldID + 1) . "' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); $query = "UPDATE psh_siteplans SET orderID = '" . ($oldID + 1) . "' where orderID = '0' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); } ?> <!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=iso-8859-1" /> <title>domain Scene Family of Companies</title> <link href="../../ps_main.css" rel="stylesheet" type="text/css" /> <script language="JavaScript" type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <script language="JavaScript" src="../../flash_detect.js" type="text/javascript"></script> </head> <body onload="MM_preloadImages('../../images/global/ps_homes-off.gif','../../images/global/ps_comm-on.gif','../../images/global/legacy-on.gif')"> <center><div id="container"> <div id="topbanner"><a href="../../index.html"><img src="../../images/main/logo.gif" width="172" height="100" border="0" /></a><img src="../../images/main/quote.gif" width="529" height="100" /></div> <div id="navbar_glob"><a href="http://homes.domainscene.com" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pshomes','','../../images/global/ps_homes-on.gif',1)"><img src="../../images/global/ps_homes-off.gif" alt="domain Scene Homes" name="pshomes" width="179" height="22" border="0" id="pshomes" /></a><a href="http://commercial.domainscene.com" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pscomm','','../../images/global/ps_comm-on.gif',1)"><img src="../../images/global/ps_comm-off.gif" alt="domain Scene Commercial" name="pscomm" width="217" height="22" border="0" id="pscomm" /></a><a href="http://www.legacybldg.com" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('legacy','','../../images/global/legacy-on.gif',1)"><img src="../../images/global/legacy-off.gif" alt="Legacy Building Services" name="legacy" width="209" height="22" border="0" id="legacy" /></a></div> <div id="bodycontainer"> <table width="701" border="0" cellspacing="0" cellpadding="0" summary="Content is provided here"> <tr> <td width="172" valign="top" bgcolor="#D5E4EF"> <div class="adminmenu"> <span class="menuheader">Edit Content For:</span> <a href="index.php" id="on" style="padding-left:15px; padding-right:8px;">domain Scene Homes</a> <br /> <a href="../pscomm/index.php" style="padding-left:15px; padding-right:8px;">domain Scene Commercial</a> <br /> <a href="../legacy/index.php" style="padding-left:15px; padding-right:8px;">Legacy Building Services</a> <br /> <br /> <span class="menuheader">domain Scene Homes:</span> <a href="testimonials.php"style="padding-left:15px; padding-right:8px;">Testimonials</a> <br /> <a href="team.php" style="padding-left:15px; padding-right:8px;">Executive Team</a> <br /> <a href="communities.php" id="on" style="padding-left:15px; padding-right:8px;">Communities</a> <br /> <a href="commlinks.php" style="padding-left:15px; padding-right:8px;">Community Links</a> <br /> <a href="press.php" style="padding-left:15px; padding-right:8px;">Press</a> <br /> <a href="banners.php" style="padding-left:15px; padding-right:8px;">Banners</a> <br /> <a href="jobs.php" style="padding-left:15px; padding-right:8px;">Job Opportunities</a> <br /> </div> </td> <td width="529"><div id="primarycontent"> <h1>Web Site Administration: domain Scene Homes</h1> <? $query = "SELECT * from psh_communities WHERE ID = $ID"; $result = mysql_query($query); $row = mysql_fetch_row ($result); ?> <p><strong><? if ($ID != "" && $ID != "new") { print "EDIT PROJECT - " . $row[1]; print "<p><a href='#siteplans'>View Site Plans</a><br />"; print "<br /><a href='communities.php'>Back to List of Communities</a></p>"; } else { print "ADD PROJECT"; print "<p><a href='communities.php'>Back to List of Communities</a></p>"; } ?> <form enctype="multipart/form-data" action="<? print $_SERVER['PHP_SELF'] . "?ID=" . $ID ?>" method="POST"> <table border="0" cellspacing="0" cellpadding="4"> <tr> <td align="right" valign="top"><div align="right">Community Name: </div></td> <td align="left" valign="top"><input name="communityName" type="text" size="30" value="<? print $row[1]; ?>" /></td> </tr> <tr> <td align="right" valign="top"><div align="right">Development Area: </div></td> <td align="left" valign="top"><select name="communityArea"> <option value="Inland Empire" <? if ($row[2] == "Inland Empire") { print "selected"; } ?>>Inland Empire</option> <option value="San Diego" <? if ($row[2] == "San Diego") { print "selected"; } ?>>San Diego</option> </select></td> </tr> <tr> <td align="right" valign="top"><div align="right">Project Status: </div></td> <td align="left" valign="top"><select name="communityStatus"> <option value="Inactive" <? if ($row[3] == "Inactive") { print "selected"; } ?>>Inactive</option> <option value="Upcoming" <? if ($row[3] == "Upcoming") { print "selected"; } ?>>Upcoming</option> <option value="Current" <? if ($row[3] == "Current") { print "selected"; } ?>>Current</option> <option value="Completed" <? if ($row[3] == "Completed") { print "selected"; } ?>>Completed</option> </select></td> </tr> <tr> <td align="right" valign="top"><div align="right"></div></td> <td align="left" valign="top"><strong><br /> Upcoming</strong></td> </tr> <tr> <td align="right" valign="top"><div align="right">Description:</div></td> <td align="left" valign="top"><textarea name="communityUpDesc" cols="40"><? print stripslashes($row[4]); ?></textarea></td> </tr> <tr> <td align="right" valign="top"><div align="right"></div></td> <td align="left" valign="top"><strong><br /> Current</strong></td> </tr> <tr> <td align="right" valign="top"><div align="right">Logo:</div></td> <td align="left" valign="top"><? if ($ID != "" && $ID != "new") { if (file_exists("/homes/html/images/browse/logos/" . $ID . ".jpg")) { print "<img src='http://homes.domainscene.com/images/browse/logos/" . $ID . ".jpg' />"; print "<input type='submit' name='deleteImage' value='Delete Logo' />"; print "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"30000\" />"; print "<br />"; } print "<input name='newLogo' type='file' size='40' /><input type='submit' name='uploadNewLogo' value='Upload' />"; } ?></td> </tr> <tr> <td align="right" valign="top">Description:</td> <td align="left" valign="top"><textarea name="communityCurrDesc" cols="40"><? print stripslashes($row[5]); ?></textarea></td> </tr> <tr> <td align="right" valign="top">Details: </td> <td align="left" valign="top"><textarea name="communityCurrDet" cols="40"><? print stripslashes($row[6]); ?></textarea></td> </tr> <? $query = "SELECT COUNT(*) from psh_siteplans WHERE communityID = '$ID'"; $result = mysql_query($query); $row2 = mysql_fetch_row($result); ?> <tr> <td align="right" valign="top">Site Plans: </td> <td align="left" valign="top"><? print $row2[0]; ?> - <a href="#siteplans">view/edit below</a> </td> </tr> <tr> <td align="right" valign="top">Location/Map: </td> <td align="left" valign="top"> <? if ($ID != "" && $ID != "new") { if (file_exists("/homes/html/images/browse/maps/" . $ID . ".jpg")) { print "<img src='http://homes.domainscene.com/images/browse/maps/" . $ID . ".jpg' />"; print "<input type='submit' name='deleteImage' value='Delete Map' />"; print "<br />"; } print "<input name='newMap' type='file' size='40' /><input type='submit' name='uploadNewMap' value='Upload' />"; } ?> </td> </tr> <tr> <td align="right" valign="top">Banner: </td> <td align="left" valign="top"><? // if ($ID != "" && $ID != "new") { // if (file_exists("/homes/html/images/browse/banners/" . $ID . ".jpg")) { // print "<img src='http://homes.domainscene.com/images/browse/banners/" . $ID . ".jpg' width='234' height='43' />"; // print "<input type='submit' name='deleteImage' value='Delete Banner' />"; // print "<br />"; // } // print "<input name='newBanner' type='file' size='40' /><input type='submit' name='uploadNewBanner' value='Upload' />"; // } // // ?></td> </tr> <tr> <td align="right" valign="top">Features List: </td> <td align="left" valign="top"><? // if ($ID != "" && $ID != "new") { // if (file_exists("/homes/html/browse/features/" . $row[10])) { // print "<a href='http://homes.domainscene.com/browse/features/" . $row[10] . "' target='_blank'>View Features List</a> "; // print "<input type='submit' name='deleteImage' value='Delete Features List' />"; // print "<br />"; // } // print "<input name='newFeatures' type='file' size='40' /><input type='submit' name='uploadNewFeatures' value='Upload' />"; // } // // ?></td> </tr> <tr> <td align="right" valign="top">Brochure: </td> <td align="left" valign="top"><? // if ($ID != "" && $ID != "new") { // if (file_exists("/homes/html/browse/brochures/" . $row[8])) { // print "<a href='http://homes.domainscene.com/browse/brochures/" . $row[8] . "' target='_blank'>View Brochure</a> "; // print "<input type='submit' name='deleteImage' value='Delete Brochure' />"; // print "<br />"; // } // print "<input name='newBrochure' type='file' size='40' /><input type='submit' name='uploadNewBrochure' value='Upload' />"; // } // ?> </td> </tr> <tr> <td align="right" valign="top"><div align="right"></div></td> <td align="left" valign="top"><strong><br /> Completed</strong></td> </tr> <tr> <td align="right" valign="top"><div align="right">Description:</div></td> <td align="left" valign="top"><textarea name="communityCompDesc" cols="40"><? print stripslashes($row[7]); ?></textarea></td> </tr> <tr> <td> </td> <td><br /> <input type="submit" name="submit" value="Submit" /></td> </tr> </table> </form> <? if ($ID != "" && $ID != "new") { print "<p><a name='siteplans' id='siteplans'></a><strong>SITE PLANS </strong></p>"; print "<p><a href='edit-siteplan.php?communityID=" . $ID . "&ID=new'>Add New Site Plan</a><br />"; print "<a href='edit-features.php?communityID=" . $ID . "'>Edit Features List</a>"; print "<br /><a href='communities.php'>Back to List of Communities</a></p>"; } else { print "<p><a href='communities.php'>Back to List of Communities</a></p>"; } $query = "SELECT * from psh_siteplans WHERE communityID = '$ID' ORDER BY orderID"; $result = mysql_query($query); while ($row = mysql_fetch_row($result)) { print "<form action=" . $_SERVER['PHP_SELF'] . "?ID=" . $ID . "&siteID=" . $row[0] . " method='POST'>"; print "<table border='0' cellspacing='0' cellpadding='5'><tr>"; $window = "'http://homes.domainscene.com/popup.php?type=renderings&ID=" . $row[0] . "','popUp','width=775,height=550'"; print "<td width='206' rowspan='8' valign='top'>"; if (file_exists("/homes/html/images/browse/renderings/" . $row[0] . "-TH.jpg")) { print '<a href="javascript:;"><img border="0" src="http://homes.domainscene.com/images/browse/renderings/' . $row[0] . '-TH.jpg" onclick="MM_openBrWindow(' . $window . ')" /></a>'; } print "</td>"; print "<td width='135'><strong>Model</strong></td>"; print "<td>" . $row[1] . "</td></tr>"; print "<tr><td><strong>Appx Sq. Ft</strong>.</td>"; print "<td>" . $row[2] . "</td></tr>"; print "<tr><td><strong>Stories</strong>.</td>"; print "<td>" . $row[3] . "</td></tr>"; print "<tr><td><strong>Bedrooms</strong>.</td>"; print "<td>" . $row[4] . "</td></tr>"; print "<tr><td><strong>Baths</strong>.</td>"; print "<td>" . $row[5] . "</td></tr>"; print "<tr><td><strong>Garage</strong>.</td>"; print "<td>" . $row[6] . "</td></tr>"; $window = "'http://homes.domainscene.com/popup.php?type=floorplans&ID=" . $row[0] . "','popUp','width=825,height=625'"; if (file_exists("/homes/html/images/browse/floorplans/" . $row[0] . ".jpg")) { print '<tr><td><a href="javascript:;" onclick="MM_openBrWindow(' . $window . ')">Floorplan</td></a>'; print "<td> </td></tr>"; } $window = "'http://homes.domainscene.com/popup.php?type=renderings&ID=" . $row[0] . "','popUp','width=775,height=550'"; if (file_exists("/homes/html/images/browse/renderings/" . $row[0] . "-TH.jpg")) { print '<tr><td><a href="javascript:;" onclick="MM_openBrWindow(' . $window . ')">Enlarged Rendering</td></a>'; print "<td> </td></tr>"; } print "<tr><td colspan='3' valign='top'><input name='edit' type='image' src='../../images/admin/edit.gif' value='" . $row[0] . "' /> "; print "<input name='delete' type='image' src='../../images/admin/delete.gif' value='" . $row[0] . "' /> "; print "<input name='up' type='image' src='../../images/admin/up.gif' value='" . $row[0] . "' /> "; print "<input name='down' type='image' src='../../images/admin/down.gif' value='" . $row[0] . "' /></td>"; print "</tr></table><br /></form>"; } ?> <p> </p> </div> </td> </tr> </table> </div> <div id="footer"> <div id="copyright">© 2005 domain Scene Homes</div> </div> </div> </center> </body> </html> Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 6, 2007 Share Posted July 6, 2007 Any chance you can edit your post and surround the code with the CODE tags? Quote Link to comment Share on other sites More sharing options...
jiggens Posted July 6, 2007 Author Share Posted July 6, 2007 Don't i have the code tags in there. Quote Link to comment Share on other sites More sharing options...
per1os Posted July 6, 2007 Share Posted July 6, 2007 No modify the post and put [ code ] before the start of the code and the [ /code ] after the last line. Also it would be nice of you to point out where you think the problem is, hardly anyone wants to sift through hundreds of lines of code, me being one of them. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 6, 2007 Share Posted July 6, 2007 No... this is what it'd like like if you did: <?php //PHP and HTML here ?> Usage: [code]...[/code] Quote Link to comment Share on other sites More sharing options...
jiggens Posted July 6, 2007 Author Share Posted July 6, 2007 I am new to the forum so how do i add code so it shows up in code format <?php #Start the PHP session session_start(); #Variables set to log into SQL database $SQLusername = 'xxxx'; $SQLpassword = 'xxxx'; $SQLdbname = 'xxxx'; $db = mysql_connect("localhost", $SQLusername, $SQLpassword) or print mysql_error (); mysql_select_db($SQLdbname) or print mysql_error (); #Checks to see if user is logged in if($_SESSION['sesLogIn'] != 1) { header("Location: http://www.domainscene.com/admin/"); exit(); } $ID = $_GET['ID']; $siteID = $_GET['siteID']; $uploaddir = '/homes/html/images/temp/'; $uploadfile = $uploaddir . basename($_FILES['newMap']['name']); $uploadfile2 = $uploaddir . basename($_FILES['newLogo']['name']); $uploadfile3 = '/homes/html/browse/brochures/' . basename($_FILES['newBrochure']['name']); $uploadfile4 = '/homes/html/images/browse/banners/' . $ID . ".jpg"; $uploadfile5 = '/homes/html/browse/features/' . basename($_FILES['newFeatures']['name']); #upload image function function createImage($imgname,$maxh,$maxw,$newname) { list($width, $height) = getimagesize($imgname); if ($width < $maxw && $height < $maxh) { $new_height = $height; $new_width = $width; } else { $ratio = ($width/$height); $new_height = sqrt(10000/$ratio); $new_width = $width * ($new_height / $height); } $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($imgname); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); //Grab new image ob_start(); ImageJPEG($image_p); $image_buffer = ob_get_contents(); ob_end_clean(); ImageDestroy($image_p); //Create temporary file and write to it $fp = tmpfile(); fwrite($fp, $image_buffer); rewind($fp); //Upload new image $conn_id = ftp_connect('64.73.246.139'); $login_result = ftp_login($conn_id,'xxxx','xxxx_domain'); if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to server "; exit; } else { echo "Connected "; } //set PASV mode if(!ftp_pasv($conn_id,TRUE)){ echo "Could not enter PASV mode!"; } $upload = ftp_fput($conn_id,$newname, $fp, FTP_BINARY); if (!$upload) { echo "FTP UPLOAD HAS FAILED!"; } else { echo "Uploaded Complete"; } fclose($fp); } #Resize Image based on maximum width and maximum height function resizeBoth($imgname,$maxh,$maxw,$newname) { list($width, $height) = getimagesize($imgname); if ($width < $maxw && $height < $maxh) { $new_height = $height; $new_width = $width; } if ($width > $height) { $new_height = $height * ($maxw / $width); $new_width = $maxw; } else { $new_height = $maxh; $new_width = $width * ($maxh / $height); } $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($imgname); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); //Grab new image ob_start(); ImageJPEG($image_p); $image_buffer = ob_get_contents(); ob_end_clean(); ImageDestroy($image_p); //Create temporary file and write to it $fp = tmpfile(); fwrite($fp, $image_buffer); rewind($fp); //Upload new image $conn_id = ftp_connect('ftp.domain.com'); $login_result = ftp_login($conn_id,'xxxx','xxxx_domain'); if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to server "; exit; } else { echo "Connected "; } # Change Directory if (@ftp__chdir ($conn_id,$uploaddir)) { echo "Current Direcotry is now : ", ftp_pwd($conn_id), "\n"; } else { echo "Couldn't Change directory\n"; } # Set PASV mode if(!ftp_pasv($conn_id,TRUE)){ echo "Could not enter PASV mode!"; } $upload = ftp_fput($conn_id,$newname, $fp, FTP_BINARY); if (!$upload) { echo "FTP UPLOAD HAS FAILED!"; } else { echo "Uploaded Complete"; } fclose($fp); } #Checks to see if add/edit project has been submitted if(array_key_exists('submit', $_POST)) { if ($ID == "" || $ID == "new") { $query = "INSERT INTO psh_communities "; $query .= "(name,area,status,upcoming_description,current_description,current_details,completed_description)"; $query .= " VALUES ('" . $_POST['communityName'] . "','" . $_POST['communityArea'] . "','" . $_POST['communityStatus'] . "','" . addslashes($_POST['communityUpDesc']) . "','" . addslashes($_POST['communityCurrDesc']) . "','" . addslashes($_POST['communityCurrDet']) . "','" . addslashes($_POST['communityCompDesc']) . "')"; $result = mysql_query($query); $result = mysql_query("SELECT MAX(ID) from psh_communities"); $row = mysql_fetch_row($result); $newProjectID = $row[0]; $result = mysql_query("SELECT MAX(orderID) from psh_communities"); $row = mysql_fetch_row($result); $newOrderID = $row[0] + 1; $query = "UPDATE psh_communities SET orderID = '" . $newOrderID . "' WHERE ID = '" . $newProjectID . "'"; $result = mysql_query ($query); header("Location: " . $_SERVER['PHP_SELF'] . "?ID=" . $newProjectID); exit(); } else { $query = "UPDATE psh_communities SET name = '" . $_POST['communityName'] . "', area = '" . $_POST['communityArea'] . "', status = '" . $_POST['communityStatus'] . "', upcoming_description = '" . addslashes($_POST['communityUpDesc']) . "', current_description = '" . addslashes($_POST['communityCurrDesc']) . "', current_details = '" . addslashes($_POST['communityCurrDet']) . "', completed_description = '" . addslashes($_POST['communityCompDesc']) . "' WHERE ID = $ID"; $result = mysql_query($query); } } if(array_key_exists('deleteImage', $_POST)) { if ($_POST['deleteImage'] == "Delete Map") { unlink('/homes/html/images/browse/maps/'. $ID . '.jpg'); unlink('/homes/html/images/browse/maps/'. $ID . '-TH.jpg'); } elseif ($_POST['deleteImage'] == "Delete Logo") { unlink('/homes/html/images/browse/logos/'. $ID . '.jpg'); } elseif ($_POST['deleteImage'] == "Delete Features List") { $query = "SELECT * from psh_communities WHERE ID = $ID"; $result = mysql_query($query); $row = mysql_fetch_row ($result); $query = "UPDATE psh_communities SET features = 'NULL' WHERE ID = $ID"; $result = mysql_query($query); unlink('/homes/html/browse/features/'. $row[10]); } elseif ($_POST['deleteImage'] == "Delete Brochure") { $query = "SELECT * from psh_communities WHERE ID = $ID"; $result = mysql_query($query); $row = mysql_fetch_row ($result); $query = "UPDATE psh_communities SET brochure = 'NULL' WHERE ID = $ID"; $result = mysql_query($query); unlink('/homes/html/browse/brochures/'. $row[8]); } elseif ($_POST['deleteImage'] == "Delete Banner") { unlink('/homes/html/images/browse/banners/'. $ID . '.jpg'); } } if(array_key_exists('uploadNewMap', $_POST)) { if ($ID != "" && $ID != "new") { move_uploaded_file($_FILES['newMap']['tmp_name'], $uploadfile); resizeBoth($uploadfile,640,480,'/homes/html/images/browse/maps/' . $ID . '.jpg'); unlink($uploadfile); } } if(array_key_exists('uploadNewLogo', $_POST)) { if ($ID != "" && $ID != "new") { move_uploaded_file($_FILES['newLogo']['tmp_name'], $uploadfile2); createImage($uploadfile2,100,400,'/homes/html/images/browse/logos/' . $ID . '.jpg'); createImage($uploadfile2,100,160,'/homes/html/images/browse/logos/' . $ID . '-TH.jpg'); unlink($uploadfile2); } } if(array_key_exists('uploadNewFeatures', $_POST)) { if ($ID != "" && $ID != "new") { $query = "UPDATE psh_communities SET features = '" . $_FILES['newFeatures']['name'] . "' WHERE ID = $ID"; $result = mysql_query($query); move_uploaded_file($_FILES['newFeatures']['tmp_name'], $uploadfile5); } } if(array_key_exists('uploadNewBrochure', $_POST)) { if ($ID != "" && $ID != "new") { $query = "UPDATE psh_communities SET brochure = '" . $_FILES['newBrochure']['name'] . "' WHERE ID = $ID"; $result = mysql_query($query); move_uploaded_file($_FILES['newBrochure']['tmp_name'], $uploadfile3); } } if(array_key_exists('uploadNewBanner', $_POST)) { if ($ID != "" && $ID != "new") { move_uploaded_file($_FILES['newBanner']['tmp_name'], $uploadfile4); } } #Checks to see if update project has been submitted if(array_key_exists('edit_x', $_POST)) { header("Location: http://www.domainscene.com/admin/pshomes/edit-siteplan.php?communityID=" . $ID . "&ID=" . $siteID); exit(); } #Checks to see if delete project has been submitted if(array_key_exists('delete_x', $_POST)) { $query = "DELETE from psh_siteplans where ID = '$siteID'"; $result = mysql_query($query) or print mysql_error(); unlink('/homes/html/images/browse/renderings/'. $siteID . '.jpg'); unlink('/homes/html/images/browse/renderings/'. $siteID . '-TH.jpg'); unlink('/homes/html/images/browse/floorplans/'. $siteID . '.jpg'); } #Checks to see if move up project has been submitted if(array_key_exists('up_x', $_POST)) { if ($siteID != 1) { $result = mysql_query("SELECT orderID from psh_siteplans where ID = '$siteID'") or print mysql_error(); $row = mysql_fetch_row ($result); $oldID = $row[0]; $query = "UPDATE psh_siteplans SET orderID = '0' where orderID = '$oldID' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); $query = "UPDATE psh_siteplans SET orderID = '$oldID' where orderID = '" . ($oldID - 1) . "' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); $query = "UPDATE psh_siteplans SET orderID = '" . ($oldID - 1) . "' where orderID = '0' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); } } #Checks to see if move down project has been submitted if(array_key_exists('down_x', $_POST)) { $result = mysql_query("SELECT orderID from psh_siteplans where ID = '$siteID'") or print mysql_error(); $row = mysql_fetch_row ($result); $oldID = $row[0]; $query = "UPDATE psh_siteplans SET orderID = '0' where orderID = '$oldID' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); $query = "UPDATE psh_siteplans SET orderID = '$oldID' where orderID = '" . ($oldID + 1) . "' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); $query = "UPDATE psh_siteplans SET orderID = '" . ($oldID + 1) . "' where orderID = '0' AND communityID = '$ID'"; $result = mysql_query($query) or print mysql_error(); } ?> <!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=iso-8859-1" /> <title>domain Scene Family of Companies</title> <link href="../../ps_main.css" rel="stylesheet" type="text/css" /> <script language="JavaScript" type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <script language="JavaScript" src="../../flash_detect.js" type="text/javascript"></script> </head> <body onload="MM_preloadImages('../../images/global/ps_homes-off.gif','../../images/global/ps_comm-on.gif','../../images/global/legacy-on.gif')"> <center><div id="container"> <div id="topbanner"><a href="../../index.html"><img src="../../images/main/logo.gif" width="172" height="100" border="0" /></a><img src="../../images/main/quote.gif" width="529" height="100" /></div> <div id="navbar_glob"><a href="http://homes.domainscene.com" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pshomes','','../../images/global/ps_homes-on.gif',1)"><img src="../../images/global/ps_homes-off.gif" alt="domain Scene Homes" name="pshomes" width="179" height="22" border="0" id="pshomes" /></a><a href="http://commercial.domainscene.com" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('pscomm','','../../images/global/ps_comm-on.gif',1)"><img src="../../images/global/ps_comm-off.gif" alt="domain Scene Commercial" name="pscomm" width="217" height="22" border="0" id="pscomm" /></a><a href="http://www.legacybldg.com" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('legacy','','../../images/global/legacy-on.gif',1)"><img src="../../images/global/legacy-off.gif" alt="Legacy Building Services" name="legacy" width="209" height="22" border="0" id="legacy" /></a></div> <div id="bodycontainer"> <table width="701" border="0" cellspacing="0" cellpadding="0" summary="Content is provided here"> <tr> <td width="172" valign="top" bgcolor="#D5E4EF"> <div class="adminmenu"> <span class="menuheader">Edit Content For:</span> <a href="index.php" id="on" style="padding-left:15px; padding-right:8px;">domain Scene Homes</a> <br /> <a href="../pscomm/index.php" style="padding-left:15px; padding-right:8px;">domain Scene Commercial</a> <br /> <a href="../legacy/index.php" style="padding-left:15px; padding-right:8px;">Legacy Building Services</a> <br /> <br /> <span class="menuheader">domain Scene Homes:</span> <a href="testimonials.php"style="padding-left:15px; padding-right:8px;">Testimonials</a> <br /> <a href="team.php" style="padding-left:15px; padding-right:8px;">Executive Team</a> <br /> <a href="communities.php" id="on" style="padding-left:15px; padding-right:8px;">Communities</a> <br /> <a href="commlinks.php" style="padding-left:15px; padding-right:8px;">Community Links</a> <br /> <a href="press.php" style="padding-left:15px; padding-right:8px;">Press</a> <br /> <a href="banners.php" style="padding-left:15px; padding-right:8px;">Banners</a> <br /> <a href="jobs.php" style="padding-left:15px; padding-right:8px;">Job Opportunities</a> <br /> </div> </td> <td width="529"><div id="primarycontent"> <h1>Web Site Administration: domain Scene Homes</h1> <? $query = "SELECT * from psh_communities WHERE ID = $ID"; $result = mysql_query($query); $row = mysql_fetch_row ($result); ?> <p><strong><? if ($ID != "" && $ID != "new") { print "EDIT PROJECT - " . $row[1]; print "<p><a href='#siteplans'>View Site Plans</a><br />"; print "<br /><a href='communities.php'>Back to List of Communities</a></p>"; } else { print "ADD PROJECT"; print "<p><a href='communities.php'>Back to List of Communities</a></p>"; } ?> <form enctype="multipart/form-data" action="<? print $_SERVER['PHP_SELF'] . "?ID=" . $ID ?>" method="POST"> <table border="0" cellspacing="0" cellpadding="4"> <tr> <td align="right" valign="top"><div align="right">Community Name: </div></td> <td align="left" valign="top"><input name="communityName" type="text" size="30" value="<? print $row[1]; ?>" /></td> </tr> <tr> <td align="right" valign="top"><div align="right">Development Area: </div></td> <td align="left" valign="top"><select name="communityArea"> <option value="Inland Empire" <? if ($row[2] == "Inland Empire") { print "selected"; } ?>>Inland Empire</option> <option value="San Diego" <? if ($row[2] == "San Diego") { print "selected"; } ?>>San Diego</option> </select></td> </tr> <tr> <td align="right" valign="top"><div align="right">Project Status: </div></td> <td align="left" valign="top"><select name="communityStatus"> <option value="Inactive" <? if ($row[3] == "Inactive") { print "selected"; } ?>>Inactive</option> <option value="Upcoming" <? if ($row[3] == "Upcoming") { print "selected"; } ?>>Upcoming</option> <option value="Current" <? if ($row[3] == "Current") { print "selected"; } ?>>Current</option> <option value="Completed" <? if ($row[3] == "Completed") { print "selected"; } ?>>Completed</option> </select></td> </tr> <tr> <td align="right" valign="top"><div align="right"></div></td> <td align="left" valign="top"><strong><br /> Upcoming</strong></td> </tr> <tr> <td align="right" valign="top"><div align="right">Description:</div></td> <td align="left" valign="top"><textarea name="communityUpDesc" cols="40"><? print stripslashes($row[4]); ?></textarea></td> </tr> <tr> <td align="right" valign="top"><div align="right"></div></td> <td align="left" valign="top"><strong><br /> Current</strong></td> </tr> <tr> <td align="right" valign="top"><div align="right">Logo:</div></td> <td align="left" valign="top"><? if ($ID != "" && $ID != "new") { if (file_exists("/homes/html/images/browse/logos/" . $ID . ".jpg")) { print "<img src='http://homes.domainscene.com/images/browse/logos/" . $ID . ".jpg' />"; print "<input type='submit' name='deleteImage' value='Delete Logo' />"; print "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"30000\" />"; print "<br />"; } print "<input name='newLogo' type='file' size='40' /><input type='submit' name='uploadNewLogo' value='Upload' />"; } ?> </td> </tr> <tr> <td align="right" valign="top">Description:</td> <td align="left" valign="top"><textarea name="communityCurrDesc" cols="40"><? print stripslashes($row[5]); ?></textarea></td> </tr> <tr> <td align="right" valign="top">Details: </td> <td align="left" valign="top"><textarea name="communityCurrDet" cols="40"><? print stripslashes($row[6]); ?></textarea></td> </tr> <? $query = "SELECT COUNT(*) from psh_siteplans WHERE communityID = '$ID'"; $result = mysql_query($query); $row2 = mysql_fetch_row($result); ?> <tr> <td align="right" valign="top">Site Plans: </td> <td align="left" valign="top"><? print $row2[0]; ?> - <a href="#siteplans">view/edit below</a> </td> </tr> <tr> <td align="right" valign="top">Location/Map: </td> <td align="left" valign="top"> <? if ($ID != "" && $ID != "new") { if (file_exists("/homes/html/images/browse/maps/" . $ID . ".jpg")) { print "<img src='http://homes.domainscene.com/images/browse/maps/" . $ID . ".jpg' />"; print "<input type='submit' name='deleteImage' value='Delete Map' />"; print "<br />"; } print "<input name='newMap' type='file' size='40' /><input type='submit' name='uploadNewMap' value='Upload' />"; } ?> </td> </tr> <tr> <td align="right" valign="top">Banner: </td> <td align="left" valign="top"><? if ($ID != "" && $ID != "new") { if (file_exists("/homes/html/images/browse/banners/" . $ID . ".jpg")) { print "<img src='http://homes.domainscene.com/images/browse/banners/" . $ID . ".jpg' width='234' height='43' />"; print "<input type='submit' name='deleteImage' value='Delete Banner' />"; print "<br />"; } print "<input name='newBanner' type='file' size='40' /><input type='submit' name='uploadNewBanner' value='Upload' />"; } ?> </td> </tr> <tr> <td align="right" valign="top">Features List: </td> <td align="left" valign="top"><? if ($ID != "" && $ID != "new") { if (file_exists("/homes/html/browse/features/" . $row[10])) { print "<a href='http://homes.domainscene.com/browse/features/" . $row[10] . "' target='_blank'>View Features List</a> "; print "<input type='submit' name='deleteImage' value='Delete Features List' />"; print "<br />"; } print "<input name='newFeatures' type='file' size='40' /><input type='submit' name='uploadNewFeatures' value='Upload' />"; } ?> </td> </tr> <tr> <td align="right" valign="top">Brochure: </td> <td align="left" valign="top"><? if ($ID != "" && $ID != "new") { if (file_exists("/homes/html/browse/brochures/" . $row[8])) { print "<a href='http://homes.domainscene.com/browse/brochures/" . $row[8] . "' target='_blank'>View Brochure</a> "; print "<input type='submit' name='deleteImage' value='Delete Brochure' />"; print "<br />"; } print "<input name='newBrochure' type='file' size='40' /><input type='submit' name='uploadNewBrochure' value='Upload' />"; } ?> </td> </tr> <tr> <td align="right" valign="top"><div align="right"></div></td> <td align="left" valign="top"><strong><br /> Completed</strong></td> </tr> <tr> <td align="right" valign="top"><div align="right">Description:</div></td> <td align="left" valign="top"><textarea name="communityCompDesc" cols="40"><? print stripslashes($row[7]); ?></textarea></td> </tr> <tr> <td> </td> <td><br /> <input type="submit" name="submit" value="Submit" /></td> </tr> </table> </form> <? if ($ID != "" && $ID != "new") { print "<p><a name='siteplans' id='siteplans'></a><strong>SITE PLANS </strong></p>"; print "<p><a href='edit-siteplan.php?communityID=" . $ID . "&ID=new'>Add New Site Plan</a><br />"; print "<a href='edit-features.php?communityID=" . $ID . "'>Edit Features List</a>"; print "<br /><a href='communities.php'>Back to List of Communities</a></p>"; } else { print "<p><a href='communities.php'>Back to List of Communities</a></p>"; } $query = "SELECT * from psh_siteplans WHERE communityID = '$ID' ORDER BY orderID"; $result = mysql_query($query); while ($row = mysql_fetch_row($result)) { print "<form action=" . $_SERVER['PHP_SELF'] . "?ID=" . $ID . "&siteID=" . $row[0] . " method='POST'>"; print "<table border='0' cellspacing='0' cellpadding='5'><tr>"; $window = "'http://homes.domainscene.com/popup.php?type=renderings&ID=" . $row[0] . "','popUp','width=775,height=550'"; print "<td width='206' rowspan='8' valign='top'>"; if (file_exists("/homes/html/images/browse/renderings/" . $row[0] . "-TH.jpg")) { print '<a href="javascript:;"><img border="0" src="http://homes.domainscene.com/images/browse/renderings/' . $row[0] . '-TH.jpg" onclick="MM_openBrWindow(' . $window . ')" /></a>'; } print "</td>"; print "<td width='135'><strong>Model</strong></td>"; print "<td>" . $row[1] . "</td></tr>"; print "<tr><td><strong>Appx Sq. Ft</strong>.</td>"; print "<td>" . $row[2] . "</td></tr>"; print "<tr><td><strong>Stories</strong>.</td>"; print "<td>" . $row[3] . "</td></tr>"; print "<tr><td><strong>Bedrooms</strong>.</td>"; print "<td>" . $row[4] . "</td></tr>"; print "<tr><td><strong>Baths</strong>.</td>"; print "<td>" . $row[5] . "</td></tr>"; print "<tr><td><strong>Garage</strong>.</td>"; print "<td>" . $row[6] . "</td></tr>"; $window = "'http://homes.domainscene.com/popup.php?type=floorplans&ID=" . $row[0] . "','popUp','width=825,height=625'"; if (file_exists("/homes/html/images/browse/floorplans/" . $row[0] . ".jpg")) { print '<tr><td><a href="javascript:;" onclick="MM_openBrWindow(' . $window . ')">Floorplan</td></a>'; print "<td> </td></tr>"; } $window = "'http://homes.domainscene.com/popup.php?type=renderings&ID=" . $row[0] . "','popUp','width=775,height=550'"; if (file_exists("/homes/html/images/browse/renderings/" . $row[0] . "-TH.jpg")) { print '<tr><td><a href="javascript:;" onclick="MM_openBrWindow(' . $window . ')">Enlarged Rendering</td></a>'; print "<td> </td></tr>"; } print "<tr><td colspan='3' valign='top'><input name='edit' type='image' src='../../images/admin/edit.gif' value='" . $row[0] . "' /> "; print "<input name='delete' type='image' src='../../images/admin/delete.gif' value='" . $row[0] . "' /> "; print "<input name='up' type='image' src='../../images/admin/up.gif' value='" . $row[0] . "' /> "; print "<input name='down' type='image' src='../../images/admin/down.gif' value='" . $row[0] . "' /></td>"; print "</tr></table><br /></form>"; } ?> <p> </p> </div> </td> </tr> </table> </div> <div id="footer"> <div id="copyright">© 2005 domain Scene Homes</div> </div> </div> </center> </body> </html> Quote Link to comment Share on other sites More sharing options...
mpharo Posted July 6, 2007 Share Posted July 6, 2007 If you are getting the file to show up but has a 0 size, I have found that to be a permissions error, where the person your grabbing the file as dosent have access to the file or only has read only access. I havent looked through your code yet, but be sure you have complete access to that file to grab it, and then to write it. Quote Link to comment Share on other sites More sharing options...
jiggens Posted July 6, 2007 Author Share Posted July 6, 2007 Permissions are fine. because i can upload with same username using different code. I tried using a more friendly code but had not luck with it. Quote Link to comment Share on other sites More sharing options...
jiggens Posted July 6, 2007 Author Share Posted July 6, 2007 <?php if(array_key_exists('uploadNewLogo', $_POST)) { if ($ID != "" && $ID != "new") { move_uploaded_file($_FILES['newLogo']['tmp_name'], $uploadfile2); createImage($uploadfile2,100,400,'homes/html/images/browse/logos/' . $ID . '.jpg'); createImage($uploadfile2,100,160,'homes/html/images/browse/logos/' . $ID . '-TH.jpg'); unlink($uploadfile2); } } Is where i think i am having the most problems because i am only testing this right now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.