ช่วยด้วยครับมัน Warning: fclose(): supplied argument is not a valid stream resource in /home/jkpra/domains/100yim.com/public_html/auction/new_item.php on line 79 แล้วเราจะแก้อย่างไรครับ
Warning: fopen(/home/jkpra/domains/100yim.com/public_html/auction/auction/pictures/5_2010-10-07-09-42-52.jpg) [function.fopen]: failed to open stream: No such file or directory in /home/jkpra/domains/100yim.com/public_html/auction/new_item.php on line 77
Warning: fputs(): supplied argument is not a valid stream resource in /home/jkpra/domains/100yim.com/public_html/auction/new_item.php on line 78
Warning: fclose(): supplied argument is not a valid stream resource in /home/jkpra/domains/100yim.com/public_html/auction/new_item.php on line 79
มีโค๊ตด้วครับCode (PHP)
<?php
/* $Id: new_item.php,v 1.3 2005-11-12 14:55:15-07 brian Exp brian $ */
// vim: expandtab sw=4 ts=4 sts=4:
########################################################################
## Built2Go PHP Auction v1.0 ##
## ---------------------------------------------------------------- ##
## Copyright © Big Resources, Inc. All Rights Reserved. ##
## This software must be used in accordance with its licensing ##
## terms and conditions at: http://www.built2go.com/faq.php ##
## ##
## This file may not be redistributed in whole or significant part. ##
## ---------------- BUILT2GO IS NOT FREE SOFTWARE ----------------- ##
########################################################################
session_start();
require("config.php");
include_once("$full_path_to_public_program/session.php");
include("templates/main.html.php");
if ($_COOKIE['id']){
// code for preview auction
$result1=mysql_query("SELECT userid, country,status FROM $usr_tbl where id = '{$_COOKIE['id']}' ") or die(mysql_error());
$getuserinfo = mysql_fetch_array($result1);
foreach ($ImageExtensions AS $ext){
$validext .= "$ext, ";
}
$validext = substr($validext,0,-2);
for ($i=0; $i<count($ship_method); $i++){
$item = "ship_method".$i; // sets up the variable we need to use.
// the actual variable will be $paymethod$i
$SameVar = '';
if ($_POST['ship_method']){
foreach ($_POST['ship_method'] AS $ShipMethod){
if ($ShipMethod == $ship_method[$i]){
$SameVar = $ship_method[$i];
break;
}
}
}
//echo "$PayMethod[$i],$SameVar,".str_replace("_"," ", $PayMethod[$i]).",".substr($PayMethod[$i],0,3).",\"pay_method[]\",\"browntext\"<br />";
${$item} = makeCheckbox($ship_method[$i],$SameVar,str_replace("_"," ", $ship_method[$i]),substr($ship_method[$i],0,3),"ship_method[]","bluetext");
}
for ($i=0; $i<count($PayMethod); $i++){
$item = "paymethod".$i; // sets up the variable we need to use.
// the actual variable will be $paymethod$i
$SameVar = '';
if ($_POST['pay_method']){
foreach ($_POST['pay_method'] AS $PostedMethod){
if ($PostedMethod == $PayMethod[$i]){
$SameVar = $PayMethod[$i];
break;
}
}
}
//echo "$PayMethod[$i],$SameVar,".str_replace("_"," ", $PayMethod[$i]).",".substr($PayMethod[$i],0,3).",\"pay_method[]\",\"browntext\"<br />";
${$item} = makeCheckbox($PayMethod[$i],$SameVar,str_replace("_"," ", $PayMethod[$i]),substr($PayMethod[$i],0,3),"pay_method[]","bluetext");
}
$imageerror= "";
if (is_uploaded_file($_FILES["imageup"]["tmp_name"]) AND !$_SESSION['image_name']){
$ext = substr(strrchr($_FILES['imageup']['name'],"."),1);
if(!in_array($_FILES["imageup"]["type"],$ImageFormat) OR (strstr($_FILES["imageup"]["name"],"..")!="")){
$imageerror= "<div class=\"error\">$WrongFileType</div>\n";
}elseif ($_FILES["imageup"]['size']==0){
$imageerror= "<div class=\"error\">$ToSmallUpload</div>\n";
} elseif ($_FILES["imageup"]["size"]>(MAXFILE_SIZE * 1000)) {
$imageerror= "<div class=\"error\">$ToBigUpload[0]</div>\n";
} else {
$fp = fopen($_FILES["imageup"]["tmp_name"], "rb");
$fcontents = fread ($fp, filesize ($_FILES["imageup"]["tmp_name"]));
$date=date("Y")."-".date("m")."-".date("d")."-".date("H")."-".date("i")."-".date("s");
$newname= $_COOKIE['id']."_".$date.".".$ext;
$file1=fopen($upload_dir."/".$newname,"w");
fputs($file1,$fcontents);
fclose($file1);
$size = @getimagesize("pictures/{$newname}");
if ($size[0]){
$scale = min(MAXIMAGE_W_SIZE/$size[0], MAXIMAGE_H_SIZE/$size[1]);
# If the image is larger than the max shrink it
if ($scale < 1) {
$size[0] = floor(.5*($scale*$size[0]));
$size[1] = floor(.5*($scale*$size[1]));
}
}
$UploadedImage = "<img src=\"$siteurl/pictures/{$newname}\" width=\"$size[0]\" height=\"$size[1]\" alt=\"\" title=\"\" />";
$_SESSION['image_name'] = $newname;
}
} elseif($_POST["url"]){
$_SESSION['image_name'] = basename($_POST["url"]);
$size = @getimagesize($_POST["url"]);
if ($size[0]){
$scale = min(MAXIMAGE_W_SIZE/$size[0], MAXIMAGE_H_SIZE/$size[1]);
# If the image is larger than the max shrink it
if ($scale < 1) {
$size[0] = floor(.5*($scale*$size[0]));
$size[1] = floor(.5*($scale*$size[1]));
}
}
$UploadedImage = "<img src=\"{$_POST["url"]}\" width=\"$size[0]\" height=\"$size[1]\" alt=\"\" title=\"\" />";
$extension = strtolower(substr(strrchr($_SESSION['image_name'],"."),1));
if(!in_array($extension,$ImageExtensions) OR (strstr($_SESSION['image_name'],"..")!="")){
$imageerror= "<div class=\"error\">$WrongFileType</div>\n";
}
} elseif ($_SESSION['image_name']){
$newname = $_SESSION['image_name'];
$size = @getimagesize("pictures/{$_SESSION['image_name']}");
if ($size[0]){
$scale = min(MAXIMAGE_W_SIZE/$size[0], MAXIMAGE_H_SIZE/$size[1]);
# If the image is larger than the max shrink it
if ($scale < 1) {
$size[0] = floor(.5*($scale*$size[0]));
$size[1] = floor(.5*($scale*$size[1]));
}
}
$UploadedImage = "<img src=\"$siteurl/pictures/{$_SESSION['image_name']}\" width=\"$size[0]\" height=\"$size[1]\" alt=\"\" title=\"\" />";
} else {
$N0image= TRUE;
}
if (count($_POST['ship_method']) > 1){
$psmethod = implode(":", $_POST['ship_method']);
} else {
$psmethod = $_POST['ship_method'][0];
}
if (count($_POST['pay_method']) > 1){
$pmethod = implode(":", $_POST['pay_method']);
} else {
$pmethod = $_POST['pay_method'][0];
}
$pmethod = str_replace("_"," ", $pmethod);
$psmethod = str_replace("_"," ", $psmethod);
if ($_POST['preview_x'] AND $_POST['preview_y']){
if (!empty($imageerror)){
echo $imageerror;
include("templates/new_item.html.php");
include("templates/footer.html.php");
exit;
} elseif($N0image) {
echo "<div class=\"error\">$noimageadded</div>";
include("templates/new_item.html.php");
exit;
}
$country = $getuserinfo['country'];
$start_time = date("M-d-y G:i");
$Days_till_closing = ($_POST['dayclose'] > 1)?"{$_POST['dayclose']} days":"{$_POST['dayclose']} day";
$ending_time = strtotime("+ $Days_till_closing");
$interval=$ending_time-time();
$ending_time = "Ends on " .date("M-d G:i", $ending_time);
$class = ($_POST['bold_listing'])?"purpletextbold":"purpletext";
$auctiontitle = $_POST['itemname'];
$timeleft = AuctionEnds($interval);
$descr = $_POST['descr'];
$price = $_POST['price'];
$descr = EscapeString($descr);
$descr = str_replace("(\r\n|\n|\r)", "<br />", $descr);
eval("\$Preview = \"".gettemplate("templates/preview")."\";");
}
if (($_POST['action'] == "add") AND !$_POST['preview_x']){
if (!checkSecurityImage($_POST['security_refid'], $_POST['security_try'])){
$error = "<div class=\"error\">$InvalidSecID</div>";
}
// do checks form checks
if (is_uploaded_file($_FILES["imageup"]["tmp_name"]) AND $_POST["url"]){
$error .= "<div class=\"error\">$OnlyOnePic</div>";
}
if ($_POST['dayclose'] > MAX_CLOSEDAYS OR $_POST['dayclose'] < 1){
$error .= "<div class=\"error\">$InvalidClosingDays</div>";
}
if (!$_POST['itemname']){
$error .= "<div class=\"error\">$NoItemName</div>";
}
if (!$_POST['sitecatid']){
$error .= "<div class=\"error\">$NoCategory</div>";
}
if ($_SESSION['newitem']){
if (array_key_exists($_POST['itemname'],$_SESSION['newitem'])){
$error .= "<div class=\"error\">$AlreadyUploaded</div>";
}
}
if (!$error){
if ($imageerror){
echo $imageerror;
include("templates/new_item.html.php");
include("templates/footer.html.php");
exit;
} elseif ($_SESSION['image_name']){
$local_pic = $_SESSION['image_name'];
$_SESSION['image_name'] = '';
} elseif($N0image) {
echo "<div class=\"error\">$noimageadded</div>";
include("templates/new_item.html.php");
exit;
}
$price = str_replace("\$", "", EscapeString($_POST['price']));
$reserve = str_replace("\$", "", EscapeString($_POST['resprice']));
$buyitnow = str_replace("\$", "", EscapeString($_POST['buyitnow']));
//$Days_till_closing = ($_POST['dayclose'] > 1)?"{$_POST['dayclose']} days":"{$_POST['dayclose']} day";
//$ending_time = strtotime("+ $Days_till_closing");
$descr = EscapeString($_POST['descr']);
$grabberprice = (!empty($_POST['grabber']))?GRABBER_PRICE:'0';
$boldprice = (!empty($_POST['bold_listing']))?BOLD_PRICE:'0';
$featureprice = (!empty($_POST['feature']))?FEATURE_PRICE:'0';
$descr = str_replace("\r\n|\n|\r", "<br />", $descr);
if ($SetPending == '1'){
$Days_till_closing = ($_POST['dayclose'] > 1)?"{$_POST['dayclose']} days":"{$_POST['dayclose']} day";
$ending_time = strtotime("+ $Days_till_closing");
$starttime = time();
}
$U = "INSERT into $ads_tbl (aid,userid, item_name,cat_feature,picture_url, picture,attentiongrabber, closing, start,end,
bold_listing, item_location,payment_method, descr,incat,price,reserve,buyitnow,ship_method, shipping_cost,status)
VALUES ('','{$_COOKIE['id']}','".EscapeString($_POST['itemname'])."','".$_POST['feature']."',
'".EscapeString($_POST['url'])."','".$newname."','".$_POST['grabber']."',
'".EscapeString($_POST['dayclose'])."','$starttime','$ending_time',
'".$_POST['bold_listing']."','".EscapeString($_POST['item_location'])."','$pmethod',
'$descr','{$_POST['sitecatid']}','$price','$reserve','$buyitnow',
'".$psmethod."','".EscapeString($_POST['shipping_cost'])."','2') ";
//echo $U;
$result1=mysql_query($U) or die(mysql_error());
$_SESSION['newitem'][$_POST['itemname']]++;
echo"<div class=\"error\">";
echo $upload_success;
$aid = mysql_insert_id();
$newprice = sprintf("%01.2f",AUCTION_PRICE + $grabberprice + $boldprice + $featureprice);
$UserPayNowText = str_replace("{NEW_PRICE}",$newprice,$UserPayNowText);
include("pay.php");
echo"</div></td></tr></table></td></tr>\n";
} else {
// error occured
$checkbold = ($_POST['bold_listing'])?"checked=\"checked\"":"";
$feature = ($_POST['feature'])?"checked=\"checked\"":"";
echo $error;
include("templates/new_item.html.php");
}
} else { // no post add
include("templates/new_item.html.php");
}
} else {
// not logged in, no cookie
include("templates/login.html.php");
}
include("templates/footer.html.php");
?>
Tag : PHP, HTML/CSS, JavaScript, VBScript, Action Script
ประวัติการแก้ไข 2010-10-07 13:09:15
Date :
2010-10-07 12:46:10
By :
jittapan
View :
1628
Reply :
1
คือว่ามานฟ้องว่า มอง part ของคุณไม่เห็น หรือไม่มี part ที่ คุณเรียกใช้อยู่ครับ ลอง เช็คตรงบรรทัดนี้หน่อยนะครับ
77 อะครับผมว่ามานไม่ถูกนะครับ
Date :
2010-10-07 13:28:44
By :
SOUL
Load balance : Server 00