title image


Smiley Re: php header und session Variablen
Hier der code








session_start();



include_once "../includes/config.php";

include_once $pfad."/webshop/includes/db.php";

include_once $pfad."/webshop/includes/mysql_db.php";



if (isset($_SESSION['user']))

{



$result = mysql_query('select * from tabelle');

$count = mysql_num_fields($result);



for ($i = 0; $i < $count; $i++)

{

$header .= mysql_field_name($result, $i)."\t";

}



while($row = mysql_fetch_row($result))

{

$line = '';

foreach($row as $value)

{

if(!isset($value) || $value == "")

{

$value = "\t";

}

else

{

$value = str_replace('"', '""', $value);

$value = '"' . $value . '"' . "\t";

}

$line .= $value;

}

$data .= trim($line)."\n";

}



$data = str_replace("\r", "", $data);



if ($data == "") {

$data = "\nno matching records found\n";

}



header("Content-type: application/x-msdownload");

header("Content-Disposition: attachment; filename=liste.xls");

header("Pragma: no-cache");

header("Expires: 0");

print "$header\n$data";



}

else

{

echo "";

echo "";

echo "Sie sind nicht angemeldet.";

echo "";

echo "";

}



?>





geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: