CD Col example question

Problems with the Windows version of XAMPP, questions, comments, and anything related.

CD Col example question

Postby mywirelesskit » 01. January 2011 21:28

Hi All,
I have a question on the "CD Col" Example that comes with XAMPP software. Its the program that displays the data from CD Col Datababse. I have displayed the code below. As you can see that the headers of the columns are displayed by the variables 'cds-attrib1' , 'cds-attrib2' , 'cds-attrib3', 'cds-attrib4'

It will be great if anyone can explain as to where the values are popuplated for these variables. Obviously its not in the cds.php .


include "langsettings.php";

list($partwampp, $directorwampp) = preg_split('|\\\htdocs\\\xampp|', dirname(__FILE__));
$mypasswdtxt = "mysqlrootpasswd.txt";
$mypasswdtxtdir = $partwampp."\security\\".$mypasswdtxt;

if (file_exists($mypasswdtxtdir)) {
$mypasswd = file_get_contents($mypasswdtxtdir);
preg_match('/mysql password = (.*)/', $mypasswd, $mypasswd);
$mypasswd = trim($mypasswd[1]);
} else {
$mypasswd = "";

if ($_REQUEST['action'] == "getpdf") {
mysql_connect("localhost", "root", $mypasswd);

include ('fpdf/fpdf.php');
$pdf = new FPDF();

$pdf->SetFont('Helvetica', '', 14);
$pdf->Write(5, 'CD Collection');

$pdf->Write(5, '© 2002/2003 Kai Seidler,, GPL');


$pdf->SetFont('Helvetica', 'B', 10);
$pdf->Cell(40 ,7, $TEXT['cds-attrib1'], 1);
$pdf->Cell(100 ,7, $TEXT['cds-attrib2'], 1);
$pdf->Cell(20 ,7, $TEXT['cds-attrib3'], 1);

$pdf->SetFont('Helvetica', '', 10);

$result=mysql_query("SELECT titel,interpret,jahr FROM cds ORDER BY interpret");

while ($row = mysql_fetch_array($result)) {
$pdf->Cell(40, 7, $row['interpret'], 1);
$pdf->Cell(100, 7, $row['titel'], 1);
$pdf->Cell(20, 7, $row['jahr'], 1);

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta name="author" content="Kai Oswald Seidler, Kay Vogelgesang, Carsten Wiedmann">
<link href="xampp.css" rel="stylesheet" type="text/css">
<title><?php echo $TEXT['cds-head-fpdf']; ?></title>

<br><h1><?php echo $TEXT['cds-head-fpdf']; ?></h1>

<p><?php echo $TEXT['cds-text1']; ?></p>
<p><?php echo $TEXT['cds-text2']; ?></p>

// Copyright (C) 2002/2003 Kai Seidler,
// 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; either version 2 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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.

if(!@mysql_connect("localhost", "root", $mypasswd)) {
echo "<h2>".$TEXT['cds-error']."</h2>";

<h2><?php echo $TEXT['cds-head1']; ?></h2>

<table border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#f87820">
<td><img src="img/blank.gif" alt="" width="10" height="25"></td>
<td class=tabhead><img src="img/blank.gif" alt="" width="200" height="6"><br><b><?php echo $TEXT['cds-attrib1']; ?></b></td>
<td class=tabhead><img src="img/blank.gif" alt="" width="200" height="6"><br><b><?php echo $TEXT['cds-attrib2']; ?></b></td>
<td class=tabhead><img src="img/blank.gif" alt="" width="50" height="6"><br><b><?php echo $TEXT['cds-attrib3']; ?></b></td>
<td class=tabhead><img src="img/blank.gif" alt="" width="50" height="6"><br><b><?php echo $TEXT['cds-attrib4']; ?></b></td>
<td><img src="img/blank.gif" alt="" width="10" height="25"></td>

if ($_REQUEST['interpret'] != "") {
if ($_REQUEST['jahr'] == "") {
$jahr = "NULL";
} else {
$jahr = intval($_REQUEST['jahr']);
$titel = mysql_real_escape_string($_REQUEST['titel']);
$interpret = mysql_real_escape_string($_REQUEST['interpret']);
mysql_query("INSERT INTO cds (titel,interpret,jahr) VALUES('$titel','$interpret',$jahr)");

if ($_REQUEST['action'] == "del") {
$id = intval($_REQUEST['id']);
mysql_query("DELETE FROM cds WHERE id=$id");

$result = mysql_query("SELECT id,titel,interpret,jahr FROM cds ORDER BY interpret");

$i = 0;
while ($row = mysql_fetch_array($result)) {
if ($i > 0) {
echo "<tr valign='bottom'>";
echo "<td bgcolor='#ffffff' colspan='6' style='background-image:url(img/strichel.gif)'><img src='img/blank.gif' alt='' width='1' height='1'></td>";
echo "</tr>";
echo "<tr valign='middle'>";
echo "<td class='tabval'><img src='img/blank.gif' alt='' width='10' height='20'></td>";
echo "<td class='tabval'><b>".htmlspecialchars($row['interpret'])."</b>&nbsp;</td>";
echo "<td class='tabval'>".htmlspecialchars($row['titel'])."&nbsp;</td>";
echo "<td class='tabval'>".$row['jahr']."&nbsp;</td>";

echo "<td class='tabval'><a onclick=\"return confirm('".$TEXT['cds-sure']."');\" href='cds.php?action=del&amp;id=".$row['id']."'><span class='red'>[".$TEXT['cds-button1']."]</span></a></td>";
echo "<td class='tabval'></td>";
echo "</tr>";

echo "<tr valign='bottom'>";
echo "<td bgcolor='#fb7922' colspan='6'><img src='img/blank.gif' alt='' width='1' height='8'></td>";
echo "</tr>";

<h2><?php echo $TEXT['cds-head2']; ?></h2>

<form action="<?php echo basename($_SERVER['PHP_SELF']); ?>" method="get">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td><?php echo $TEXT['cds-attrib1']; ?>:</td><td><input type="text" size="30" name="interpret"></td></tr>
<tr><td><?php echo $TEXT['cds-attrib2']; ?>:</td><td> <input type="text" size="30" name="titel"></td></tr>
<tr><td><?php echo $TEXT['cds-attrib3']; ?>:</td><td> <input type=text size="5" name="jahr"></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="<?php echo $TEXT['cds-button2']; ?>"></td></tr>
<?php include 'showcode.php'; ?>
Posts: 1
Joined: 01. January 2011 21:20

Re: CD Col example question

Postby Altrea » 01. January 2011 21:49

The $TEXT Variables are setted language depended.
The file \xampp\htdocs\xampp\langsettings.php includes another file for the choosen language (for example the file \xampp\htdocs\xampp\lang\en.php) and THERE are setted the variables.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
AF Moderator
Posts: 8244
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 63 guests