CronJob-Service
bei SELFPHP mit ...
|
+ minütlichen Aufrufen
+ eigenem Crontab Eintrag
+ unbegrenzten CronJobs
+ Statistiken
+ Beispielaufrufen
+ Control-Bereich
Führen Sie mit den CronJobs von
SELFPHP zeitgesteuert Programme
auf Ihrem Server
aus. Weitere Infos
|
:: Anbieterverzeichnis ::
Globale Branchen
Informieren Sie sich über ausgewählte Unternehmen im Anbieterverzeichnis von SELFPHP
:: Newsletter ::
Abonnieren Sie hier den kostenlosen
SELFPHP Newsletter!
|
PHP Grundlagen Hier kann über grundlegende Probleme oder Anfängerschwierigkeiten diskutiert werden |
24.02.2012, 20:45:45
|
Anfänger
|
|
Registriert seit: Feb 2012
Alter: 38
Beiträge: 3
|
|
Bild Upload einbinden
Hallo zusammen,
im Rahmen einer Projektarbeit bei der Gestaltung eines Webshops versuche ich eine Bilduploadfunktion einzufügen.
Der Webshop basiert auf oSCommerce 2.3.1, genutzte PHP-Version ist 5.2.6
Mein Problem ist: ich habe selber ein Script geschrieben und ausprobiert, jedoch funktioniert der Upload nicht, ich bekomme allerdings auch keine Fehlermeldung, obwohl in der upload.php auch Textmeldungen programmiert wurden, sondern nach dem Abschicken springt die Seite in den Warenkorb mit +1 für das Produkt.
Um Syntaxfehler oder ähnliches auszuschließen, habe ich das Ganze auch mit einem vorgefertigtem Script probiert, gleiches Ergebnis.
Ich glaube der Fehler liegt in der product_info.php, dass jegliche Aktion zum Ablegen in den Warenkorb führt.
Hier die vorgefertigte Upload.php:
PHP-Code:
<?php // Configuration - Your Options $allowed_filetypes = array('.jpg','.gif','.bmp','.png'); // These will be the types of file that will pass the validation. $max_filesize = 524288; // Maximum filesize in BYTES (currently 0.5MB). $upload_path = '/images/user/'; // The place the files will be uploaded to (currently a 'images/user/' directory).
$filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.
// Check if the filetype is allowed, if not DIE and inform the user. if(!in_array($ext,$allowed_filetypes)) die('The file you attempted to upload is not allowed.');
// Now check the filesize, if it is too large then DIE and inform the user. if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize) die('The file you attempted to upload is too large.');
// Check if we can upload to the specified path, if not DIE and inform the user. if(!is_writable($upload_path)) die('You cannot upload to the specified directory, please CHMOD it to 777.');
// Upload the file to your specified path. if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename)) echo 'Your file upload was successful, view the file <a href="' . $upload_path . $filename . '" title="Your File">here</a>'; // It worked. else echo 'There was an error during the file upload. Please try again.'; // It failed :(.
?>
Siehe Beitrag 2!
Geändert von DonaldFD (24.02.2012 um 21:04:02 Uhr)
Grund: Nachtrag zum besseren Verständnis/PHP Version
|
24.02.2012, 20:47:28
|
Anfänger
|
|
Registriert seit: Feb 2012
Alter: 38
Beiträge: 3
|
|
AW: Bild Upload einbinden
Und hier die product_info.php aus dem Hauptverzeichnis:
PHP-Code:
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_check = tep_db_fetch_array($product_check_query);
require(DIR_WS_INCLUDES . 'template_top.php');
if ($product_check['total'] < 1) {
?>
<div class="contentContainer">
<div class="contentText">
<?php echo TEXT_PRODUCT_NOT_FOUND; ?>
</div>
<div style="float: right;">
<?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
</div>
</div>
<?php
} else {
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);
tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
$products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}
if (tep_not_null($product_info['products_model'])) {
$products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>';
} else {
$products_name = $product_info['products_name'];
}
?>
<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>
<div>
<h1 style="float: right;"><?php echo $products_price; ?></h1>
<h1><?php echo $products_name; ?></h1>
</div>
<div class="contentContainer">
<div class="contentText">
<?php
if (tep_not_null($product_info['products_image'])) {
$pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");
if (tep_db_num_rows($pi_query) > 0) {
?>
<div id="piGal" style="float: right;">
<ul>
<?php
$pi_counter = 0;
while ($pi = tep_db_fetch_array($pi_query)) {
$pi_counter++;
$pi_entry = ' <li><a href="';
if (tep_not_null($pi['htmlcontent'])) {
$pi_entry .= '#piGalimg_' . $pi_counter;
} else {
$pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image']);
}
$pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';
if (tep_not_null($pi['htmlcontent'])) {
$pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>';
}
$pi_entry .= '</li>';
echo $pi_entry;
}
?>
</ul>
</div>
<script type="text/javascript">
$('#piGal ul').bxGallery({
maxwidth: 300,
maxheight: 200,
thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>,
thumbcontainer: 300,
load_image: 'ext/jquery/bxGallery/spinner.gif'
});
</script>
<?php
} else {
?>
<div id="piGal" style="float: right;">
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), null, null, 'hspace="5" vspace="5"') . '</a>'; ?>
</div>
<?php
}
?>
<script type="text/javascript">
$("#piGal a[rel^='fancybox']").fancybox({
cyclic: true
});
</script>
<?php
}
?>
<?php echo stripslashes($product_info['products_description']); ?>
<?php
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
?>
<p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>
<p>
<?php
$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
$products_options_array = array();
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
while ($products_options = tep_db_fetch_array($products_options_query)) {
$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
if ($products_options['options_values_price'] != '0') {
$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
}
}
if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
} else {
$selected_attribute = false;
}
?>
<strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br />
<?php
}
?>
</p>
<?php
}
?>
<p>
<?php if ($product_info['products_model']=="P004" )
{
echo '<form action="/upload.php" method="post" enctype="multipart/form-data">
<p>
<label for="file">Dateiauswahl:</label> <input type="file" name="userfile" id="file"> <br />
<button>Datei hochladen</button>
<p>
</form>';}
?>
</p>
<div style="clear: both;"></div>
<?php
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
<p style="text-align: center;"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></p>
<?php
}
?>
</div>
<?php
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and reviews_status = 1");
$reviews = tep_db_fetch_array($reviews_query);
?>
<div class="buttonSet">
<span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>
<?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?>
</div>
<?php
if ((USE_CACHE == 'true') && empty($SID)) {
echo tep_cache_also_purchased(3600);
} else {
include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
?>
</div>
</form>
<?php
}
require(DIR_WS_INCLUDES . 'template_bottom.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Wie gesagt, ich habe es mit einem selbstgeschriebenen und mehreren vorgefertigen Scripten versucht, leider ohne Erfolg und ohne Fehlermeldungen.
Falls Informationen fehlen bitte ich dies zu entschuldigen, einfach Bescheid sagen, ich werde Sie dann umgehend nachreichen.
Ich hoffe jemand kann mir helfen =)
LG
DonaldFD
|
25.02.2012, 00:05:12
|
|
Administrator
|
|
Registriert seit: Jul 2004
Beiträge: 3.707
|
|
AW: Bild Upload einbinden
Hallo und willkommen hier im Forum.
Hast Du es schon mal beim Hersteller im Forum versucht? Sie sollten doch als erste wissen wie man ihr Produkt erweitert. Oder?
PS: Hast Du überhaupt die Fehleranzeige aktiviert? Kann diesbezüglich nichts entdecken/erkennen.
__________________
Gruss vt1816
Erwarte nicht, dass sich jemand mehr Mühe mit der Antwort gibt als Du Dir mit der Frage.
. . . . . Feedback wäre wünschenswert
Ich werde keinen privaten 1:1 Support leisten, außer ich biete ihn ausdrücklich an.
Ansosnten gilt: Hilfe ausserhalb dieses Thread (PN, WhatsApp, Skype, Mail, ICQ, etc...) nur per Barzahlung oder Vorauskasse!
Wenn man sich selbst als "Noob" bezeichnet, sollte man die Finger davon lassen.
Wenn man gewillt ist daran etwas zu ändern, lernt man Grundlagen!
|
25.02.2012, 10:14:35
|
Anfänger
|
|
Registriert seit: Feb 2012
Alter: 38
Beiträge: 3
|
|
AW: Bild Upload einbinden
Also in dem upload.php
sind doch durch die DIE und echo befehle Fehlerausgaben, oder generell auf dem Server?
Ich hab ne phpinfo Seite, wo würd ich den Eintrag finden, wenns serverseitig wäre?
|
25.02.2012, 14:07:58
|
|
Administrator
|
|
Registriert seit: Jul 2004
Beiträge: 3.707
|
|
AW: Bild Upload einbinden
Dies an den Anfang Deines Scripts
PHP-Code:
error_reporting(-1);
ini_set('display_errors', TRUE);
__________________
Gruss vt1816
Erwarte nicht, dass sich jemand mehr Mühe mit der Antwort gibt als Du Dir mit der Frage.
. . . . . Feedback wäre wünschenswert
Ich werde keinen privaten 1:1 Support leisten, außer ich biete ihn ausdrücklich an.
Ansosnten gilt: Hilfe ausserhalb dieses Thread (PN, WhatsApp, Skype, Mail, ICQ, etc...) nur per Barzahlung oder Vorauskasse!
Wenn man sich selbst als "Noob" bezeichnet, sollte man die Finger davon lassen.
Wenn man gewillt ist daran etwas zu ändern, lernt man Grundlagen!
|
27.02.2012, 10:12:07
|
Member
|
|
Registriert seit: Nov 2007
Beiträge: 843
|
|
AW: Bild Upload einbinden
Hi
Hier gehts um eigengeschriebenes(selfphp), davon seh ich nichts...
Zitat:
Der Webshop basiert auf oSCommerce 2.3.1,
|
Zitat:
sondern nach dem Abschicken springt die Seite in den Warenkorb mit +1 für das Produkt.
|
Was dafür spricht das die Applikation das Routing übernimmt, und da können dir
wohl nur andere User helfen die tiefere einblicke haben also ab ins oSC forum ;)
mfg
CKaos
__________________
"Wenn die Leute Häuser so bauen würden, wie wir Programme schreiben, würde der erstbeste Specht unsere Zivilisation zerhacken."
In den allermeisten Fällen sitzt der Bug etwa 40 cm vor dem Monitor!
|
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
|
|
Forumregeln
|
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
HTML-Code ist aus.
|
|
|
Alle Zeitangaben in WEZ +2. Es ist jetzt 13:56:37 Uhr.
|