Sindbad~EG File Manager
<?php
require_once 'config/config.php';
// Test the barcode and QR code generation
function generateBarcode($code) {
$svg = '<svg width="200" height="50" xmlns="http://www.w3.org/2000/svg">
<rect width="200" height="50" fill="white"/>
<g fill="black">
<rect x="10" y="5" width="2" height="30"/>
<rect x="15" y="5" width="1" height="30"/>
<rect x="18" y="5" width="3" height="30"/>
<rect x="24" y="5" width="1" height="30"/>
<rect x="27" y="5" width="2" height="30"/>
<rect x="32" y="5" width="1" height="30"/>
<rect x="36" y="5" width="2" height="30"/>
<rect x="41" y="5" width="1" height="30"/>
<rect x="45" y="5" width="3" height="30"/>
<rect x="52" y="5" width="1" height="30"/>
<rect x="56" y="5" width="2" height="30"/>
<rect x="61" y="5" width="1" height="30"/>
<rect x="65" y="5" width="2" height="30"/>
<rect x="70" y="5" width="1" height="30"/>
<rect x="74" y="5" width="3" height="30"/>
<rect x="80" y="5" width="2" height="30"/>
<rect x="85" y="5" width="1" height="30"/>
<rect x="89" y="5" width="2" height="30"/>
<rect x="94" y="5" width="1" height="30"/>
<rect x="98" y="5" width="2" height="30"/>
<rect x="103" y="5" width="1" height="30"/>
<rect x="107" y="5" width="3" height="30"/>
<rect x="113" y="5" width="1" height="30"/>
<rect x="117" y="5" width="2" height="30"/>
<rect x="122" y="5" width="1" height="30"/>
<rect x="126" y="5" width="2" height="30"/>
<rect x="131" y="5" width="1" height="30"/>
<rect x="135" y="5" width="3" height="30"/>
<rect x="141" y="5" width="2" height="30"/>
<rect x="146" y="5" width="1" height="30"/>
<rect x="150" y="5" width="2" height="30"/>
<rect x="155" y="5" width="1" height="30"/>
<rect x="159" y="5" width="2" height="30"/>
<rect x="164" y="5" width="1" height="30"/>
<rect x="168" y="5" width="3" height="30"/>
<rect x="174" y="5" width="2" height="30"/>
<rect x="179" y="5" width="1" height="30"/>
<rect x="183" y="5" width="2" height="30"/>
</g>
<text x="100" y="45" text-anchor="middle" font-family="monospace" font-size="8">' . htmlspecialchars($code) . '</text>
</svg>';
return "data:image/svg+xml;charset=utf-8," . rawurlencode($svg);
}
function generateQRCode($code) {
$svg = '<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
<rect width="100" height="100" fill="white"/>
<g fill="black">
<rect x="5" y="5" width="25" height="25"/>
<rect x="70" y="5" width="25" height="25"/>
<rect x="5" y="70" width="25" height="25"/>
<rect x="10" y="10" width="15" height="15" fill="white"/>
<rect x="75" y="10" width="15" height="15" fill="white"/>
<rect x="10" y="75" width="15" height="15" fill="white"/>
<rect x="15" y="15" width="5" height="5" fill="black"/>
<rect x="80" y="15" width="5" height="5" fill="black"/>
<rect x="15" y="80" width="5" height="5" fill="black"/>
<rect x="35" y="10" width="5" height="5"/>
<rect x="45" y="10" width="5" height="5"/>
<rect x="55" y="10" width="5" height="5"/>
<rect x="35" y="20" width="5" height="5"/>
<rect x="55" y="20" width="5" height="5"/>
<rect x="35" y="30" width="5" height="5"/>
<rect x="45" y="30" width="5" height="5"/>
<rect x="55" y="30" width="5" height="5"/>
<rect x="10" y="35" width="5" height="5"/>
<rect x="20" y="35" width="5" height="5"/>
<rect x="35" y="35" width="5" height="5"/>
<rect x="55" y="35" width="5" height="5"/>
<rect x="70" y="35" width="5" height="5"/>
<rect x="80" y="35" width="5" height="5"/>
<rect x="90" y="35" width="5" height="5"/>
<rect x="35" y="45" width="5" height="5"/>
<rect x="45" y="45" width="5" height="5"/>
<rect x="55" y="45" width="5" height="5"/>
<rect x="70" y="45" width="5" height="5"/>
<rect x="90" y="45" width="5" height="5"/>
<rect x="35" y="55" width="5" height="5"/>
<rect x="55" y="55" width="5" height="5"/>
<rect x="70" y="55" width="5" height="5"/>
<rect x="80" y="55" width="5" height="5"/>
<rect x="35" y="70" width="5" height="5"/>
<rect x="45" y="70" width="5" height="5"/>
<rect x="55" y="70" width="5" height="5"/>
<rect x="70" y="70" width="5" height="5"/>
<rect x="90" y="70" width="5" height="5"/>
<rect x="35" y="80" width="5" height="5"/>
<rect x="55" y="80" width="5" height="5"/>
<rect x="70" y="80" width="5" height="5"/>
<rect x="80" y="80" width="5" height="5"/>
<rect x="90" y="80" width="5" height="5"/>
<rect x="35" y="90" width="5" height="5"/>
<rect x="45" y="90" width="5" height="5"/>
<rect x="55" y="90" width="5" height="5"/>
<rect x="70" y="90" width="5" height="5"/>
<rect x="90" y="90" width="5" height="5"/>
</g>
</svg>';
return "data:image/svg+xml;charset=utf-8," . rawurlencode($svg);
}
$testCode = "MEM2025123456";
$barcode = generateBarcode($testCode);
$qrcode = generateQRCode($testCode);
?>
<!DOCTYPE html>
<html>
<head>
<title>Test Codes</title>
<style>
body { font-family: Arial, sans-serif; padding: 20px; }
.test-section { margin: 20px 0; padding: 20px; border: 1px solid #ddd; }
.code-display { margin: 10px 0; }
img { border: 1px solid #ccc; margin: 10px; }
</style>
</head>
<body>
<h1>Code Generation Test</h1>
<div class="test-section">
<h2>Test Code: <?php echo $testCode; ?></h2>
<div class="code-display">
<h3>Barcode:</h3>
<img src="<?php echo $barcode; ?>" alt="Barcode" style="max-width: 200px;">
<p>Data URL: <code><?php echo substr($barcode, 0, 100) . '...'; ?></code></p>
</div>
<div class="code-display">
<h3>QR Code:</h3>
<img src="<?php echo $qrcode; ?>" alt="QR Code" style="width: 100px; height: 100px;">
<p>Data URL: <code><?php echo substr($qrcode, 0, 100) . '...'; ?></code></p>
</div>
</div>
<div class="test-section">
<h2>Alternative Method - Base64 Encoded</h2>
<?php
$svg = '<svg width="200" height="50" xmlns="http://www.w3.org/2000/svg">
<rect width="200" height="50" fill="white"/>
<g fill="black">
<rect x="10" y="5" width="2" height="30"/>
<rect x="15" y="5" width="1" height="30"/>
<rect x="18" y="5" width="3" height="30"/>
<rect x="24" y="5" width="1" height="30"/>
<rect x="27" y="5" width="2" height="30"/>
</g>
<text x="100" y="45" text-anchor="middle" font-family="monospace" font-size="8">' . $testCode . '</text>
</svg>';
$base64Barcode = "data:image/svg+xml;base64," . base64_encode($svg);
?>
<div class="code-display">
<h3>Base64 Barcode:</h3>
<img src="<?php echo $base64Barcode; ?>" alt="Base64 Barcode" style="max-width: 200px;">
</div>
</div>
<div class="test-section">
<h2>Simple PNG Method</h2>
<?php
// Create a simple colored rectangle as PNG
$width = 200;
$height = 50;
$image = imagecreate($width, $height);
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
// Draw some bars
for ($i = 0; $i < 20; $i++) {
$x = 10 + ($i * 8);
$w = ($i % 3) + 1;
imagefilledrectangle($image, $x, 5, $x + $w, 35, $black);
}
// Add text
imagestring($image, 2, 50, 37, $testCode, $black);
ob_start();
imagepng($image);
$imageData = ob_get_contents();
ob_end_clean();
imagedestroy($image);
$pngBarcode = "data:image/png;base64," . base64_encode($imageData);
?>
<div class="code-display">
<h3>PNG Barcode:</h3>
<img src="<?php echo $pngBarcode; ?>" alt="PNG Barcode" style="max-width: 200px;">
</div>
</div>
<p><a href="modules/membership/codes.php">← Back to Codes Page</a></p>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists