Bild einzeln hochladen

Brian Folte

Angesehenes Mitglied
Hallo. Nachdem ich nun drei Wochen hier dran sitzte und wirklich nicht weiter komme frag ich euch nun um hilfe. das problem was ich habe, sieht so aus: wenn man ein bild hochladen will wird es nicht angezeigt es kommt dann "kein bild verfügbar" lädt man aber zwei bilder hoch, dann gehen komischerweise beide bilder. nun möchte ich es gerne so haben, das man auch nur ein bild hochladen kann. wenn mir jemand hilft, den würde ich auch auf die seite mit einbinden das heißt ich würde dich dann verlinken. nur bitte helft mir.
CODE <?php

/*



Copyright (c), 1999, 2000 - phpauction



This program is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation (version 2 or later).



This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.



You should have received a copy of the GNU General Public License

along with this program; if not, write to the Free Software

Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.



*/


require('./includes/messages.inc.php');
require('./includes/config.inc.php');
require('./includes/auction_types.inc.php');
require('./includes/countries.inc.php');
require('./includes/datacheck.inc.php');

function generate_id()
{
global $title, $description;
$continue = true;

// Datenbankgestützte Artikel-Nummern-Verwaltung
$num_query = "select * from numbers where id='1'"; // 1 = Nummernkreis für Auktions-Nummern
$num_result = mysql_query($num_query);
$auction_id = mysql_result($num_result,0,"value");
$next_num = intval($auction_id) + 1;
mysql_query("update numbers set value='$next_num'");

return $auction_id;
}

if(empty($action))
{
$action = "login";
}

if (($REQUEST_METHOD=="GET" && $action=="login") && !$HTTP_COOKIE_VARS["$LOGGED_IN_COOKIE"])
{
include "header.php";
include "templates/template_sell_login_php.html";
include "footer.php";
exit;
}


// Keine Aktion gewählt / Erstaufruf ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

if ($action=="login")
$action = "";

if (empty($action))
{
// Preise für Features holen
$my_result = mysql_query("select * from features order by id");
$fett_preis = print_money(mysql_result($my_result,0,"value"));
$marker_preis = print_money(mysql_result($my_result,1,"value"));
$topkat_preis = print_money(mysql_result($my_result,2,"value"));

$bild2_preis = print_money(mysql_result($my_result,3,"value"));
$bild3_preis = print_money(mysql_result($my_result,4,"value"));
$TPL_fett_preis = $fett_preis;
$TPL_marker_preis = $marker_preis;
$TPL_topkat_preis = $topkat_preis;

$TPL_bild2_preis = $bild2_preis;
$TPL_bild3_preis = $bild3_preis;

if ($mode=="recall")
{
if (isset($sessionVars["SELL_file_uploaded"]))
{

if ($sessionVars["SELL_pict_url"] <> "")
{
$userfile = "none";
if (file_exists($image_upload_path.$sessionVars["SELL_pict_url"]))
{
unlink($image_upload_path.$sessionVars["SELL_pict_url"]);
}
}
if ($sessionVars["SELL_pict_url"] <> "")
{
$userfile = "none";
if (file_exists($image_upload_path.$sessionVars["SELL_pict_url"]))
{
unlink($image_upload_path.$sessionVars["SELL_pict_url"]);
}
}



if ($sessionVars["SELL_pict_url2"] <> "")
{
$userfile2 = "none";
if (file_exists($image_upload_path.$sessionVars["SELL_pict_url2"]))
{
unlink($image_upload_path.$sessionVars["SELL_pict_url2"]);
}
}

if ($sessionVars["SELL_pict_url3"] <> "")
{
$userfile3 = "none";
if (file_exists($image_upload_path.$sessionVars["SELL_pict_url3"]))
{
unlink($image_upload_path.$sessionVars["SELL_pict_url3"]);
}
}

unset($sessionVars["SELL_file_uploaded"]);
$sessionVars["SELL_pict_url"] = $sessionVars["SELL_pict_url_original"];
putSessionVars();
}


$title = $sessionVars["SELL_title"];
$description = $sessionVars["SELL_description"];
$pict_url = $sessionVars["SELL_pict_url_original"];
$atype = $sessionVars["SELL_atype"];
$iquantity = $sessionVars["SELL_iquantity"];
$minimum_bid = $sessionVars["SELL_minimum_bid"];
$with_reserve = ($sessionVars["SELL_with_reserve"])?"ja":"nein";
$payment = $sessionVars["SELL_payment"];
$duration = $sessionVars["SELL_duration"];
$country = $sessionVars["SELL_country"];
$location_zip = $sessionVars["SELL_location_zip"];
$shipping = $sessionVars["SELL_shipping"];
$international = ($sessionVars["SELL_international"])?"ja":"nein";
$category1 = $sessionVars["SELL_category"];
$imgtype = $sessionVars["SELL_imgtype"];
$zustand = $sessionVars["SELL_zustand"];
$fett = $sessionVars["SELL_fett"];
$marker = $sessionVars["SELL_marker"];
$topkat = $sessionVars["SELL_topkat"];

$bild2 = $sessionVars["SELL_bild2"];
$bild3 = $sessionVars["SELL_bild3"];
$artnr = $sessionVars["SELL_artnr"];
$fett_preis = $sessionVars["SELL_fettpreis"];
$marker_preis = $sessionVars["SELL_markerpreis"];
$topkat_preis = $sessionVars["SELL_topkatpreis"];
$bild2_preis = $sessionVars["SELL_bild2preis"];
$bild3_preis = $sessionVars["SELL_bild3preis"];
$buy_now = $sessionVars["SELL_buy_now"];
}
else
{
// auction type
reset($auction_types);
list($atype,) = each($auction_types);

// quantity of items
$iquantity = 1;


// country
// BM 28.2.
//reset($countries);
//list($country,) = each($countries);


// shipping
$shipping = 1;

// image type
$imgtype = 1;

$with_reserve = "nein";
}
}
// Oder Aktion = 'first' / Erstaufruf++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
elseif ($action=='first')
{
unset($auction_id);
$ERR = "ERR_".CheckSellData();

// if no other errors - handle upload here
if (!$$ERR)
{
unset($file_uploaded);

// Auktions-ID generieren
$auction_id = generate_id();

if ( $userfile <> "none" )
{
$inf = GetImageSize ( $userfile );
if ($userfile2 <> "none")
$inf2 = GetImageSize ( $userfile2 );
if ($userfile3 <> "none")
$inf3 = GetImageSize ( $userfile3 );

$er = false;
// make a check
if ($inf)
{

$inf[1] = intval($inf[1]); // check for uploaded file type
if ($userfile2 <> "none")
$inf2[2] = intval($inf2[2]);
if ($userfile3 <> "none")
$inf3[2] = intval($inf3[3]);



if ( ($inf[2]!=1) && ($inf[2]!=2) )
{
$er = true;

}
else
{
// check for file size
if ( intval($userfile_size)>$MAX_UPLOAD_SIZE )
{
$er = true;
$ERR = "ERR_603";
}
}

if ($userfile2 <> "none")
{
if ( ($inf2[2]!=1) && ($inf2[2]!=2) )
{
$er = true;

}
else
{
// check for file size
if ( intval($userfile2_size)>$MAX_UPLOAD_SIZE )
{
$er = true;
$ERR = "ERR_603_2";
}
}
}

if ($userfile3 <> "none")
{
if ( ($inf2[2]!=1) && ($inf2[2]!=2) )
{
$er = true;

}
else
{
// check for file size
if ( intval($userfile3_size)>$MAX_UPLOAD_SIZE )
{
$er = true;
$ERR = "ERR_603_3";
}
}
}

}
else
{

$er = true;
}

if (!$er)
{
// Bild 1 wirklich speichern
if ($userfile <> "none")
{
$ext = ($inf[2]==1)?".gif":".jpg";
$fname = $image_upload_path.$auction_id.$ext;

if (file_exists($fname))
unlink ($fname);
copy ($userfile, $fname);
$uploaded_filename = $auction_id.$ext;
$file_uploaded = true;
}

// Bild 2 wirklich speichern
if ($userfile2 <> "none")
{
$ext = ($inf[2]==1)?".gif":".jpg";
$fname = $image_upload_path.$auction_id."_2".$ext;

if ( file_exists($fname) )
unlink ($fname);
copy ( $userfile2, $fname );
$uploaded_filename2 = $auction_id."_2".$ext;
$file_uploaded = true;
}

// Bild 3 wirklich speichern
if ($userfile3 <> "none")
{
$ext = ($inf[2]==1)?".gif":".jpg";
$fname = $image_upload_path.$auction_id."_3".$ext;

if ( file_exists($fname) )
unlink ($fname);
copy ( $userfile3, $fname );
$uploaded_filename3 = $auction_id."_3".$ext;
$file_uploaded = true;

}
}
else
{
// Fehler!!
unset($file_uploaded);
$userfile2 = "none";
$userfile3 = "none";
}

}
else
{
unset($file_uploaded);
$userfile2 = "none";
$userfile3 = "none";
}


}
}

/*
Erstaufruf oder Fehler in den Daten -> Eingabemaske nochmal anzeigen
*/
if ( empty($action) || (($action=='first')&&($$ERR)) )
{
include "header.php";

$titleH = htmlspecialchars($title);
$descriptionH = htmlspecialchars($description);
$pict_urlH = htmlspecialchars($pict_url);

// ------------------------------------- auction type
$T= "<SELECT NAME=\"atype\">\n";
reset($auction_types); while(list($key,$val)=each($auction_types)){
$T.=
" <OPTION VALUE=\"".
$key.
"\" ".
(($key==$atype)?"SELECTED":"")
.">".$val."</OPTION>\n";
}
$T.="</SELECT>\n";
$TPL_auction_type = $T;

// ------------------------------------- duration

//--
$query = "select * from durations order by days";
$res_durations = mysql_query($query);
if(!$res_durations)
{
print $ERR_001." - ".mysql_error();
}
$num_durations = mysql_num_rows($res_durations);
$i = 0;
$T= "<SELECT NAME=\"duration\">\n";
while($i < $num_durations){

$days = mysql_result($res_durations,$i,"days");
$duration_descr = mysql_result($res_durations,$i,"description");
$T.= " <OPTION VALUE=\"$days\"";

if($days == $duration)
{
$T .= " SELECTED";
}
$T .= ">$duration_descr</OPTION>";

$i++;
}
$T.="</SELECT>\n";
$TPL_durations_list = $T;

// eigentlich der Ort
// -------------------------------------- country

$T = "<Input Type=\"Text\" Name=\"country\" value=\"$country\"";
$TPL_countries_list = $T;

// -------------------------------------- payment

$qurey = "select * from payments";
$res_payment = mysql_query($qurey);
if(!$res_payment)
{
print $ERR_001." - ".mysql_error();
exit;
}
$num_payments = mysql_num_rows($res_payment);
$T= "";

$i = 0;
while($i < $num_payments)
{
$payment_descr = mysql_result($res_payment,$i,"description");

$T.="<INPUT TYPE=CHECKBOX NAME=\"payment[]\" VALUE=\"$payment_descr\"";

//print "Desc.: ".$payment_descr." / Array: ".$payment[$i]."<br>";

if($payment_descr == $payment[$i])
{
$T .= " CHECKED";
}

$T .= "> $std_font $payment_descr</FONT><BR>";

$i++;
}
$TPL_payments_list = $T;


// -------------------------------------- category
$T= "<SELECT NAME=\"category\">\n";
$result = mysql_query("SELECT * FROM categories_plain");
if($result):
while($row=mysql_fetch_array($result)){
$T.=
" <OPTION VALUE=\"".
$row[cat_id].
"\" ".
(($row[cat_id]==$category)?"SELECTED":"")
.">".$row[cat_name]."</OPTION>\n";
}
endif;
$T.="</SELECT>\n";
$TPL_categories_list = $T;

// -------------------------------------- shipping
if ( intval($shipping)==1 )
$TPL_shipping1_value = "CHECKED";

if ( intval($shipping)==2 )
$TPL_shipping2_value = "CHECKED";

if ( !empty($international) )
$TPL_international_value = "CHECKED";

// -------------------------------------- reserved price
if ( $with_reserve=="ja" )
$TPL_with_reserve_selected = "CHECKED";
else
$TPL_without_reserve_selected = "CHECKED";

// -------------------------------------- photo source
if ( intval($imgtype)==1 )
$TPL_imgtype2_SELECTED = "CHECKED";
else
$TPL_imgtype1_SELECTED = "CHECKED";

// bm 05.12.2001 --------------------
// -------------------------------------- features

if ( !empty($fett) )
$TPL_fett_value = "CHECKED";

if ( !empty($marker) )
$TPL_marker_value = "CHECKED";

if ( !empty($topkat) )
$TPL_topkat_value = "CHECKED";

// ------------------------------------

$my_result = mysql_query("select * from features order by id");
$fett_preis = print_money(mysql_result($my_result,0,"value"));
$marker_preis = print_money(mysql_result($my_result,1,"value"));
$topkat_preis = print_money(mysql_result($my_result,2,"value"));
$bild2_preis = print_money(mysql_result($my_result,3,"value"));
$bild3_preis = print_money(mysql_result($my_result,4,"value"));

$TPL_fett_preis = $fett_preis;
$TPL_marker_preis = $marker_preis;
$TPL_topkat_preis = $topkat_preis;
$TPL_bild2_preis = $bild2_preis;
$TPL_bild3_preis = $bild3_preis;

$TPL_error_value = $$ERR;

// update current session
if ( isset($sessionVars["SELL_DATA_CORRECT"]) )
unset($sessionVars["SELL_DATA_CORRECT"]);
putSessionVars();

$user_nick = $HTTP_COOKIE_VARS["$LOGGED_IN_NICK"];
$user_query = "SELECT * FROM users WHERE nick='$user_nick'";
$user_result = mysql_query($user_query);
if ($user_result)
{
$location_zip = mysql_result($user_result,0,"zip");
$country = mysql_result($user_result,0,"city");
$frei = mysql_result($user_result,0,"suspended");
}

if ($frei == 1)
$TPL_suspended = "Achtung!<BR>Sie haben Ihren Account noch nicht <a href=\"./help.php?topic=Verkaufen\">freigeschaltet</a> oder er wurde gesperrt.";
else
$TPL_suspended = "";


// include corresponding templates/template and exit
include "templates/template_sell_php.html";
include "footer.php";
exit;
}

// Erstaufruf und KEIN Fehler! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

if ($action=="first" && !$$ERR)
{
$sessionVars["SELL_title"] = stripslashes($title);
$sessionVars["SELL_description"] = stripslashes($description);

// image URL
if (!isset($file_uploaded))
{
$sessionVars["SELL_pict_url"] = $pict_url;
unset($sessionVars["SELL_original_filename"]);
}
else
{
// the URL is uploaded image
$sessionVars["SELL_pict_url"] = $uploaded_filename;
$sessionVars["SELL_pict_url2"] = $uploaded_filename2;
$sessionVars["SELL_pict_url3"] = $uploaded_filename3;

$sessionVars["SELL_original_filename"] = $userfile_name;
}

// data from "picture URL" input field
$sessionVars["SELL_pict_url_original"] = $pict_url;

// flag if file is uploaded
if (!isset($file_uploaded))
unset($sessionVars["SELL_file_uploaded"]);
else
$sessionVars["SELL_file_uploaded"] = true;

// auction type
$sessionVars["SELL_atype"] = $atype;

// quantity of items for sale
$sessionVars["SELL_iquantity"] = $iquantity;

// minimum bid
$sessionVars["SELL_minimum_bid"] = $minimum_bid;

// reserved price flag
$sessionVars["SELL_with_reserve"] = ($with_reserve=="ja")?true:false;

// reserved price value
$sessionVars["SELL_reserve_price"] = $reserve_price;

// auction duration
$sessionVars["SELL_duration"] = $duration;

// country
$sessionVars["SELL_country"] = $country;

// zip code
$sessionVars["SELL_location_zip"] = $location_zip;

// shipping method
$sessionVars["SELL_shipping"] = $shipping;

// international shipping
$sessionVars["SELL_international"] = (strlen($international)==0)?false:true;

// payment methods: text and index
reset($payment);
while(list($key,$val) = each($payment))
{
$sessionVars["SELL_payment".$key] = $payment[$key];
//print "Session_var: ".$sessionVars["SELL_payment".$key]."<br>";
}

// category ID
$sessionVars["SELL_category"] = $category1;

// auction id
if (isset($auction_id))
$sessionVars["SELL_auction_id"] = $auction_id;
else
$sessionVars["SELL_auction_id"] = generate_id();

// image type
$sessionVars["SELL_imgtype"] = $imgtype;

// set that first step is passed
$sessionVars["SELL_DATA_CORRECT"] = true;

// bm 05.12.2001 ----------

// fett
$sessionVars["SELL_fett"] = (strlen($fett)==0)?false:true;

// marker
$sessionVars["SELL_marker"] = (strlen($marker)==0)?false:true;

// topkat
$sessionVars["SELL_topkat"] = (strlen($topkat)==0)?false:true;

// bild2
$sessionVars["SELL_bild2"] = ($userfile2 <> "none")?true:false;

// bild3
$sessionVars["SELL_bild3"] = ($userfile3 <> "none")?true:false;

// zustand
$sessionVars["SELL_zustand"] = $zustand;

// Art.-Nr.
$sessionVars["SELL_artnr"] = $artnr;

$sessionVars["SELL_fettpreis"] = $fett_preis;

$sessionVars["SELL_markerpreis"] = $marker_preis;

$sessionVars["SELL_topkatpreis"] = $topkat_preis;

$sessionVars["SELL_bild2preis"] = $bild2_preis;

$sessionVars["SELL_bild3preis"] = $bild3_preis;

// Einstellgebühren ermitteln
$my_query = "SELECT * FROM insertfees WHERE".
"((min_val<=$minimum_bid AND max_val>=$minimum_bid) OR".
"(min_val<$minimum_bid AND max_val<$minimum_bid)) ORDER BY id DESC";
$my_result = mysql_query($my_query);

$sessionVars["SELL_fee_value"] = $fee_value;

// ------------------------

$sessionVars["SELL_buy_now"] = $buy_now;

putSessionVars();
# print "Sessions vars are put";
}

// Preview wurde angezeigt -> Auktion jetzt einstellen +++++++++++++++++++++++++++++++++++++++++++++++++++++

// Login und Passwort prüfen
if ( $action=="second")
{
$nickH = htmlspecialchars($nick);

$result = mysql_query("SELECT * FROM users WHERE nick='".AddSlashes($nick)."'");
if ($result)
$num = mysql_num_rows($result);
else
$num = 0;

if ($num==0)
$ERR = "ERR_025";

if ($num>0)
{
$pass = mysql_result ($result,0,"password");
$user_id = mysql_result ($result,0,"id");
if (md5($MD5_PREFIX.$password) != $pass)
{
$ERR = "ERR_026";
}
else
{
if(mysql_result($result,0,"suspended") > 0)
{
$ERR = "ERR_618";
}
}
}
}

// Erstaufruf und KEIN Fehler oder Fehler nach dem Preview absenden ++++++++++++++++++++++++++++++++++++++++++++++++++++

if ( ($action=="first" && !$$ERR) || ($action=="second" && $$ERR) )
{

// Fehlertext
$TPL_error = $$ERR;

// Titel
$TPL_title_value = htmlspecialchars($sessionVars["SELL_title"]);

// description text
$TPL_description_shown_value = stripslashes(nl2br($sessionVars["SELL_description"]));

// picture URL
if( intval($sessionVars["SELL_imgtype"])==0 )
{
// print "URL";
// URL specified
 
sorry, aber die link-leiste, die sonst ganz links im fenster ist, liegt genau über deinem text, sodasss ich dein problem nicht richtig erkennen kann. bei allen anderen forenbeiträgen ist sie an ihrem platz, nur bei dir nicht.
 
Zurück
Oben