Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/04/2005, 13:01
Gux
 
Fecha de Ingreso: octubre-2003
Mensajes: 58
Antigüedad: 20 años, 6 meses
Puntos: 0
envio de datos de sesion por mail

Buenas a todos.

Necesito que alguien me eche un capote porque me estoy volviendo tarumba para enviar unos datos incluidos en una variable de sesion por mail.

Tengo un archivo librería con varias funciones, entre ellas la de mostrar datos:

lib_carrito.php

<?php
//Muestra el contenido del carrito de la compra
//ademas pone los enlaces para eliminar un producto del carrito
function imprime_carrito(){
$suma = 0;
echo("<table cellspacing='0' cellpadding='0' border='0'>
<tr>
<td width='711' bgcolor='#164D89' height='1' class='px' colspan='9'>
</td>
</tr>
<tr>
<td class='t9bl' bgcolor='#557FD7' height='20' width='110'>Familia
</td>
<td class='t9bl' bgcolor='#557FD7' height='20' width='90'>Producto
</td>
<td class='t9bl' bgcolor='#557FD7' height='20' width='80'>Referencia
</td>
<td class='t9bl' bgcolor='#557FD7' height='20' width='177'>Artículo
</td>
<td class='t9bl' bgcolor='#557FD7' height='20' width='70' align='center'>Precio
</td>
<td class='t9bl' bgcolor='#557FD7' height='20' width='30' align='center'>Cantidad
</td>
<td class='t9bl' bgcolor='#557FD7' height='20' width='80' align='center'>Importe
</td>
<td class='t9bl' bgcolor='#557FD7' height='20' width='20' align='center'>Eliminar
</td>
</tr>
<tr>
<td width='711' bgcolor='#164D89' height='1' class='px' colspan='9'>
</td>
</tr>
<tr>
<td height='10' class='px' colspan='8'>
</td>
</tr>
<tr>
<td width='711' bgcolor='#164D89' height='1' class='px' colspan='9'>
</td>
</tr>");


for ($i=0;$i<$this->num_productos;$i++){
if($this->array_id_prod[$i]!=0){

echo '<tr>';
echo "<td class='txt3p' height='30'>" . $this->array_familia_prod[$i] . "</td>";
echo "<td class='txt3p' height='30'>" . $this->array_producto_prod[$i] . "</td>";
echo "<td class='txt3p' height='30'>" . $this->array_referencia_prod[$i] . "</td>";
echo "<td class='txt3p' height='30'>" . $this->array_articulo_prod[$i] . "</td>";
echo "<td class='txt3p' height='30' align='center'>" . $this->array_precio_prod[$i] . "</td>";
echo "<td class='txt3p' height='30' align='center'>" . $this->array_cantidad_prod[$i] . "</td>";

if($this->array_familia_prod[$i]=='Material Oficina')
{

$importe = round($this->array_precio_prod[$i]*$this->array_cantidad_prod[$i]-$desc,2);


echo "<td class='txt3p' height='30'><center>$importe €</center></td>";
echo "<td class='txt3p' height='30'><a href='eliminar_producto.php?linea=$i' class='lkng'>Eliminar</td>";
echo '</tr>';
echo'<tr>';
echo"<td height='10' class='px' colspan='9'>";
echo"</td>";
echo'</tr>';
echo'<tr>';
echo"<td width='545' bgcolor='#164D89' height='1' class='px' colspan='9'>";
echo"</td>";
echo'</tr>';

$suma = $suma+$importe;

}
}

echo"<tr>
<td height='20' class='px' colspan='9'>
</td>
</tr>";
//muestro el total
echo "<tr>
<td class='txt3'><b>TOTAL:</b></td>
<td class='txt3'> <b>$suma €</b></td>
<td>&nbsp;</td>
</tr>";
//total más IVA

$totaliva=round($suma * 1.16, 2);

echo "<tr>
<td class='txt3'><b>TOTAL + IVA (16%):</b></td>
<td class='txt3'><b>$totaliva €</b></td>
<td>&nbsp;</td>
</tr>";
echo "</table>";
}
?>


En la página que muestro el estado del pedido no tengo ningún problema para mostrar los datos utilizando la siguiente llamada:

$_SESSION["ocarrito"]->imprime_carrito();

Pero cuando quiero enviar estos datos por mail no lo consigo. He probado miles de cosas pero no hay manera. Os adjunto la página de envios por si me pudierais decir cómo he de poner el código para que funcione. Es lo último que me falta para terminar el trabajo que estoy haciendo y ya tengo la cabeza como un bombo

envio.php

<?php
include("lib_carrito.php");

if(!$_SESSION[auth])
{
header("Location: index.php");
}

$sfrom="$email"; //cuenta que envia
$sdestinatario="[email protected]"; //cuenta destino
$ssubject="Pedido desde la página web"; //subject
$shtml="<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<title>Pedido desde la página web</title>
<style>
.txt{
font-family: arial;
font-size: 9px;
color: '#444444';
}
.tit{
font-family: arial;
font-size: 11px;
color: '#444444';
font-weight: bold;
padding-left: 5px;
padding-right: 5px;
}
</style>
<link rel='stylesheet' href='estilos.css' type='text/css'>
</head>
<body bgcolor='#E0E4EC' marginwidth='0' marginheight='0' topmargin='40' leftmargin='0'>
<table align='center' bgcolor='ffffff' width='771' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td colspan='2' class='a11gr' height='80'><center><font color='#357EB5'><u>HA RECIBIDO EL SIGUIENTE PEDIDO DESDE LA PÁGINA WEB</u></font></center>
</td>
</tr>
<tr>
<td valign='top' width='40%' height='200' align='center'><img src='http://www.uvedoblestudio.com/img/cereza.jpg' width='150' height='200'>
</td>
<td valign='top' class='tit'><u>ENVÍA:</u><br><br><br><span class='txt'><b>Empresa:</b> $empresa<br><br><b>CIF:</b> $cif<br><br><b>Nombre:</b> $nombre<br><br><b>Dirección:</b> $direccion - $municipio [ $provincia ]<br><br><b>Tlfno.:</b> $telefono - <b>Fax:</b> $fax<br><br><b>E-mail:</b> $email</span><br><br><br><u>PEDIDO:</u><br><br>
</td>
</tr>
<tr>
<td valign='top' colspan='2'>"

AQUÍ DEBERÍA IR EL PEDIDO

echo"</td>
</tr>
<tr>
<td valign='top' colspan='2' height='30'>
</td>
</tr>
</table>
</body>
</html>
"; //mensaje
$sheader="From:".$sfrom."\nReply-To:".$sfrom."\n";
$sheader=$sheader."X-Mailer:PHP/".phpversion()."\n";
$sheader=$sheader."Mime-Version: 1.0\n";
$sheader=$sheader."Content-Type: text/html";
mail($sdestinatario,$ssubject,$shtml,$sheader);


if(mail)
{

echo" El mensaje se ha enviado correctamente";

session_destroy();

}
else
{
echo("Atención! Ocurrió un error, si éste persiste comuniquelo a los responsables del web. Gracias<br /><a href='home.php'>Salir</a>");
}
?>



Muchas gracias.