Webseite – die neusten Beiträge

Website lädt Datei nicht hoch, warum?

Moin, kennt sich vielleicht jemand mit PHP und Html aus und weiß warum beim Upload der Datei nicht das Script "upload.php" ausgeführt wird? Versuche mich gerade beim Scripten, stehe allerdings gerade voll auf dem Schlauch... Danke!

<?php include 'header.php'; ?>
<?php
if(!isset($_SESSION['email'])){
  header('location:login.php');
  $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
}
 ?>
      <div class="breadcrumb">
        <div class="container">
            <a class="breadcrumb-item" href="index.php">Home</a>
            <span class="breadcrumb-item active">Welecome <?php echo $_SESSION['email'] ?></span>
            <span class="breadcrumb-item active">Upload Video</span>
        </div>
    </div>
    <section class="static about-sec">
        <div class="container">
            <h1>Upload Video</h1>
            <div class="form">
                <form class="" action="videoUpload.php" method="post">
                    <div class="row">
                        <div class="col-md-6">
                            <input type="hidden" name="id" value="">
                            <label for="name">Name of Video:</label>
                            <input type="text" name="name" value="" placeholder="Fantasy World" required>
                            <label for="video_url">Video URL</label>
                            <input type="file" name="video_url" required>
                            <label for="description">Description</label>
                            <input type="text" name="description" value="" placeholder="">
                            <label for="category">Category</label>
                            <select name="category">
                              <option value="Classic">Classic</option>
                              <option value="Adventerous">Adventerous</option>
                              <option value="Nature">Nature</option>
                              <option value="Others">Others</option>
                            </select>
                          </div>
                        </div>
							<div class="col-lg-8 col-md-12">
							<form action="upload.php" method="post" enctype="multipart/form-data">
							<input type="submit" class="btn black" value="Upload Image" name="submit">
							</form>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </section>


    <?php include 'footer.php';?>
HTML, Webseite, HTML5, Code, Datenbank, MySQL, PHP, Programmiersprache, Webdesign, Webentwicklung

Wie verbessere ich die Darstellung auf mobilen Geräten?

<?php
session_start();
?>


<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Warenkorb</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f9;
            display: flex;
            flex-direction: column;
            align-items: center; 
            padding: 20px;
        }


        .cart-container {
            width: 100%;
            max-width: 600px;
            background-color: #fff;
            border: 1px solid #ddd;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            padding: 20px;
            text-align: left;
        }


        .cart-item {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
        }


        .cart-item p {
            margin: 0;
        }


        .total {
            font-weight: bold;
            font-size: 1.2em;
            color: #333;
            margin-top: 20px;
            text-align: right;
        }


        
        .checkout-button {
            background-color: #2a9d8f;
            color: #fff;
            padding: 10px 20px;
            border: none;
            border-radius: 25px;
            font-size: 1em;
            font-weight: bold;
            cursor: pointer;
            margin-top: 20px;
            text-align: center;
            transition: background 0.3s ease;
        }


        .checkout-button:hover {
            background-color: #21867a;
        }
    </style>
</head>
<body>
    <h1>Warenkorb</h1>
    <div class="cart-container">
        <?php if (!empty($_SESSION['cart'])): ?>
            <?php $total = 0; ?>
            <?php foreach ($_SESSION['cart'] as $item): ?>
                <div class="cart-item">
                    <p><?= htmlspecialchars($item['product_name']) ?> (x<?= htmlspecialchars($item['quantity']) ?>)</p>
                    <p>€<?= htmlspecialchars(number_format($item['price'] * $item['quantity'], 2)) ?></p>
                </div>
                <?php $total += $item['price'] * $item['quantity']; ?>
            <?php endforeach; ?>
            <p class="total">Gesamt: €<?= htmlspecialchars(number_format($total, 2)) ?></p>


      
            <form action="checkout.php" method="post">
                <button type="submit" class="checkout-button">Zur Kasse</button>
            </form>


            <form action="index.php" method="post">
                <button type="submit" class="checkout-button">weitershoppen</button>
            </form>


        <?php else: ?>
            <p>Ihr Warenkorb ist leer.</p>
        <?php endif; ?>
    </div>
</body>
</html>


Webseite, Webentwicklung

Paypal SDK von USD auf EUR umstellen funktioniert nicht?

Ich habe beide Stellen im Code geändert:

script.src = `https://www.paypal.com/sdk/js?client-id=${clientId}&currency=EUR`;

und

currency_code: 'EUR',

Bekomme jedoch den folgenden Fehler https://pastebin.com/6eNUSdX9

Wichtigster Ausschnitt:

Error: Unexpected currency: EUR passed to order.create. Please ensure you are passing /sdk/js?currency=EUR in the paypal script tag. 

Der Fehler tritt auf, wenn ich USD auf EUR ändere. Hier ist meine

/app/paypal/page.tsx

https://pastebin.com/9GM500eR die ganze datei

Wichtigster Ausschnitt: der mit USD funktioniert:

<PayPalScriptProvider options={{ clientId }}>
            <div className="flex justify-center">
              <PayPalButtons
                style={{
                  layout: 'vertical',
                  color: 'blue',
                  shape: 'rect',
                  label: 'paypal',
                }}
                createOrder={(data, actions) => {
                  if (!actions || !actions.order) {
                    console.error('Fehler: actions.order ist nicht definiert');
                    return Promise.reject('Fehler bei der Erstellung der Bestellung');
                  }
 
                  return actions.order.create({
                    purchase_units: [
                      {
                        amount: {
                          currency_code: 'USD',
                          value: '100.00',
                        },
                      },
                    ],
                    intent: 'CAPTURE'
                  });
                }}
                onApprove={(data, actions) => {
                  if (!actions || !actions.order) {
                    console.error('Fehler: actions.order ist nicht definiert');
                    return Promise.reject('Fehler bei der Genehmigung der Bestellung');
                  }
 
                  return actions.order.capture().then((details) => {
                    console.log('Zahlung erfolgreich abgeschlossen:', details);
                    setPaymentSuccess(true);  // Zeigt die Erfolgsmeldung an
                    setErrorMessage('');  // Setzt die Fehlermeldung zurück
                    return Promise.resolve();
                  });
                }}
                onError={(err) => {
                  console.error('Fehler bei der PayPal-Zahlung:', err);
                  setErrorMessage('Es gab ein Problem bei Ihrer Zahlung. Bitte versuchen Sie es erneut.'); // Zeigt die Fehlermeldung an
                  setPaymentSuccess(false); // Setzt den Zahlungserfolgsstatus zurück
                }}
              />
            </div>
          </PayPalScriptProvider>

Meine

env Datei ist folgendermaßen konfiguriert:
makefile
Code kopieren
NEXT_PUBLIC_PAYPAL_CLIENT_ID = "12345"
PAYPAL_CLIENT_ID = "12345"
PAYPAL_CLIENT_SECRET = "ABCDEF"
PAYPAL_WEBHOOK_SECRET="XYZ123"

Ich habe den currency_code von 'USD' auf 'EUR' geändert und auch die URL des PayPal-Skripts angepasst:

script.src = `https://www.paypal.com/sdk/js?client-id=${clientId}&currency=EUR`;

Trotzdem bekomme ich den Fehler, dass EUR nicht als Währung erkannt wird.

Ich habe die Dokumentation auf PayPal Developer überprüft, und laut dieser ist

EUR

der richtige Währungscode.

  • Ich benutze Next.js 15 und habe auf React 18 downgraden müssen, da React 19 nicht mit
@paypal/react-paypal-js
  • kompatibel ist aber spielt eigentlich keiner olle und sowohl im sandbox oder live modus dasselbe das man nach dem klick auf dem button mit EUR einen fehler bekommt.

Kann mir jemand helfen, was hier das Problem ist?

PC, Computer, Internet, App, Technik, IT, Webseite, JavaScript, Code, Informatik, PayPal, Programmiersprache, sdk, Webentwicklung, node.js

Problem mit falscher Darstellung des Euro-Zeichens (€) in FPDF (erscheint als "â")?

Die restlichen Inhalte werden korrekt dargestellt, aber das Euro-Zeichen scheint nicht richtig kodiert zu werden. Meine Vermutung ist, dass es an der Zeichenkodierung (UTF-8 oder ISO-8859-1) oder an der verwendeten Schriftart liegt.

Hat jemand eine Idee, wie ich dieses Problem beheben kann?

Vielen Dank im Voraus für eure Hilfe!


<?php


session_start();
include "db.php";


// Holen der Bestelldaten
$query = "SELECT 
            u.vorname, 
            u.nachname, 
            b.bestelldatum, 
            b.bestelladresse, 
            bp.anzahl, 
            bp.preis, 
            p.produktname 
          FROM 
            user u
          JOIN 
            bestellungen b ON u.id_user = b.id_user
          JOIN 
            bestellungen_products bp ON b.id_bestellung = bp.id_bestellung
          JOIN 
            products p ON bp.id_product = p.id_product 
          WHERE 
            b.id_bestellung = ?";


$id_order = $_GET["order_id"];
$stmt = $conn->prepare($query);
$stmt->bind_param("i", $id_order);
$stmt->execute();
$result = $stmt->get_result();


$order = $result->fetch_assoc();
$rechnungs_nummer = $id_order;
$rechnungs_datum = $order["bestelldatum"];
$lieferdatum = date("Y-m-d", strtotime($rechnungs_datum . " +2 weeks"));


// Neues PDF erstellen
require_once('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();


// Titel und Rechnungsinformationen
$pdf->SetFont('Helvetica', 'B', 16);
$pdf->Cell(190, 10, 'Rechnung', 0, 1, 'C');
$pdf->SetFont('Helvetica', '', 12);
$pdf->Cell(100, 10, 'Rechnungsnummer: ' . $rechnungs_nummer);
$pdf->Cell(90, 10, 'Rechnungsdatum: ' . $rechnungs_datum, 0, 1);
$pdf->Cell(100, 10, 'Lieferdatum: ' . $lieferdatum, 0, 1);


// Empfängerinformationen
$pdf->Ln(10);
$pdf->Cell(100, 10, 'Kunde:');
$pdf->Ln(5);
$pdf->Cell(100, 10, $order["vorname"] . " " . $order["nachname"]);
$pdf->Ln(5);
$pdf->Cell(100, 10, $order["bestelladresse"]);


// Postenübersicht
$pdf->Ln(15);
$pdf->SetFont('Helvetica', 'B', 12);
$pdf->Cell(90, 10, 'Produkt', 1);
$pdf->Cell(30, 10, 'Menge', 1);
$pdf->Cell(30, 10, 'Preis', 1);
$pdf->Cell(40, 10, 'Gesamt', 1, 1);
$pdf->SetFont('Helvetica', '', 12);


$gesamtpreis = 0;
do {
    $produktname = $order["produktname"];
    $anzahl = $order["anzahl"];
    $preis = $order["preis"];
    $gesamt = $anzahl * $preis;
    $gesamtpreis += $gesamt;


    $pdf->Cell(90, 10, $produktname, 1);
    $pdf->Cell(30, 10, $anzahl, 1, 0, 'C');
    $pdf->Cell(30, 10, number_format($preis, 2, ',', '') . ' €', 1, 0, 'R');
    $pdf->Cell(40, 10, number_format($gesamt, 2, ',', '') . ' €', 1, 1, 'R');
} while ($order = $result->fetch_assoc());


// Gesamtsumme
$pdf->SetFont('Helvetica', 'B', 12);
$pdf->Ln(5);
$pdf->Cell(150, 10, 'Gesamtsumme:', 0, 0, 'R');
$pdf->Cell(40, 10, number_format($gesamtpreis, 2, ',', '') . ' €', 0, 1, 'R');


// Ausgabe des PDFs
$pdf->Output('F', 'Rechnung_' . $rechnungs_nummer . '.pdf');


//header("location:mail.php?order_id=$id_order")
header("location:confirmation.php?order_id=$id_order")
?>


Webseite, PHP

Meistgelesene Beiträge zum Thema Webseite