Tengo un código PHP que me funciona en local perfectamente pero al subirlo al servidor no me funciona. Alguien me podría ayudar? Me estoy volviendo loco!! Gracias.
el código es el siguiente:
archivo: carritocliente.php
<?php
session_start();
require_once('Connections/ibiza.php');
if(isset($_SESSION['carrito'])){
if(isset($_GET['id'])){
$arreglo=$_SESSION['carrito'];
$encontro=false;
$numero=0;
for($i=0;$i<count($arreglo);$i++){
if($arreglo[$i]['idProduct']==$_GET['id']){
$encontro=true;
$numero=$i;
}
}
if($encontro==true){
$arreglo[$numero]['Cantidad']=$arreglo[$numero]['Cantidad']+1;
$_SESSION['carrito']=$arreglo;
}else{
$nombre="";
$precio=0;
$imagen="";
$var=$_GET['id'];
$re=mysql_query("select * from tblproduct where idProduct=".$_GET['id']);
while ($f=mysql_fetch_array($re)) {
$nombre=$f['strProduct'];
$precio=$f['dblOffprice'];
$imagen=$f['strImage'];
}
$datosNuevos=array('idProduct'=>$_GET['id'],
'strProduct'=>$nombre,
'dblOffprice'=>$precio,
'strImage'=>$imagen,
'Cantidad'=>1);
array_push($arreglo, $datosNuevos);
$_SESSION['carrito']=$arreglo;
}
}
}
else{
if(isset($_GET['id'])){
$nombre="";
$precio=0;
$imagen="";
$re=mysql_query("select * from tblproduct where idProduct=".$_GET['id']);
while ($f=mysql_fetch_array($re)) {
$nombre=$f['strProduct'];
$precio=$f['dblOffprice'];
$imagen=$f['strImage'];
}
$arreglo[]=array('idProduct'=>$_GET['id'],
'strProduct'=>$nombre,
'dblOffprice'=>$precio,
'strImage'=>$imagen,
'Cantidad'=>1);
$_SESSION['carrito']=$arreglo;
}
}
?>
<!DOCTYPE html>
<html lang="es"><!-- InstanceBegin template="/Templates/plantillaibiza.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="head" -->
<title>Tu carrito en ibizaenelcorazon.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Pinchos y raciones, tapas, ensaladas y la mejor cocina mediterránea de todo Chamberí en su bar, salón o terraza">
<meta name="keywords" content="pinchos, raciones, tapas, ensaladas, restaurante, cafetería, ginebras, cócteles, Chamberí">
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/camera.css" rel="stylesheet">
<link href="css/icons.css" rel="stylesheet">
<link href="css/skin-orange.css" rel="stylesheet">
<link href="css/videocarta.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="img/ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="img/ico/icoibizaheart.png">
<?php $menuseleccionado = 3;?>
<?php include("includes/funciones.php");?>
<!-- InstanceEndEditable -->
</head>
<body class="boxed">
<div class="body">
<!-- Navigation -->
<header>
<div class="container clearfix">
<div class="row-fluid">
<div class="span12">
<h1 class="brandlogo"><a href="index.php"><img src="img/logo.png" alt="logo ibiza en el corazón"></a></h1>
<div class="topinfo">
<ul class="social-icons list-soc">
<li><a href="#"><i class="icon-facebook"></i></a></li>
<li><a href="#"><i class="icon-twitter"></i></a></li>
<li><a href="#" rel="publisher"><i class="icon-google-plus"></i></a></li>
</ul>
<div class="Reservas" style="color:#105175;">
<STRONG></STRONG> <i class="icon-phone"></i> <strong>Tel: 609 643 098</strong>
</div>
<div class="infoaddress">
<strong>[email protected]</strong>
</div>
</div>
<div class="clearfix">
</div>
<div class="row-nav navbar">
<div class="navbar-inner">
<ul id="nav" class="nav">
<li class="divider-vertical"></li>
<li <?php if ($menuseleccionado == 0) {?> class="active selected"<?php }?>><a href="admin/indexadmin.php">Admin</a></li>
<li <?php if ($menuseleccionado == 1) {?> class="active selected"<?php }?>><a href="index.php">Tienda online</a></li>
<li class="divider-vertical"></li>
<li <?php if ($menuseleccionado == 2) {?> class="active selected"<?php }?>><a href="designibizaheart.php">Diseñadora</a></li>
<li class="divider-vertical"></li>
<li <?php if ($menuseleccionado == 3) {?> class="active selected"<?php }?>><a href="carritocliente.php">Carrito</a></li>
<li class="divider-vertical"></li>
<li <?php if ($menuseleccionado == 4) {?> class="active selected"<?php }?>><a href="contacto.php">Contacto</a></li>
<li class="divider-vertical"></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</header>
<div class="text-center">
<img src="img/sha.png" class="slidershadow" alt="slider">
</div>
<!-- /end header -->
<!-- InstanceBeginEditable name="contenido" -->
<div class="container">
<div class="row-fluid text-center intro">
<div class="span12">
<br><br><br>
<h1>Tu carrito en ibizaenelcorazon.com</h1>
<p class="featured lead bottom10"> Estos son los productos que has seleccionado en tu carrito. Puedes modificar las cantidades o confirmarlo para formalizar tu pedido. </p> <br><br>
<br>
</div>
</div>
<div class="row-fluid text-center intro">
<div data-role="content"> <br>
<br>
<?php
$total=0;
if(isset($_SESSION['carrito'])){
$datos=$_SESSION['carrito'];
$total=0;
for($i=0;$i<count($datos);$i++){
?>
<div class="producto">
<center>
<img src="img/demo/tienda/<?php echo $datos[$i]['strImage'];?>" width="50%" heigth="auto"><br>
<h3><?php echo $datos[$i]['strProduct'];?></h3><br>
<h3>Precio: <?php echo $nombre_format_francais = number_format($datos[$i]['dblOffprice'], 2, ',', '. ');?> euros</h3><br>
<h3>Cantidad:
<input type="text" value="<?php echo $datos[$i]['Cantidad'];?>"
data-precio="<?php echo $datos[$i]['dblOffprice'];?>"
data-id="<?php echo $datos[$i]['strProduct'];?>"
class="cantidad">
</h3><br>
<h3>Subtotal: <?php echo $nombre_format_francais = number_format($datos[$i]['Cantidad']*$datos[$i]['dblOffprice'], 2, ',', '. ');?> euros</h3><br>
<a href="#" class="eliminar" data-id="<?php echo $datos[$i]['idProduct']?>">Eliminar</a>
<br><br>
</center>
</div>
<?php
$total=$nombre_format_francais = number_format(($datos[$i]['Cantidad']*$datos[$i]['dblOffprice'])+$total, 2, ',', '. ');
}
}else{
echo '<center><h2>No has añadido ningún producto</h2></center><br><br>';
}
echo '<br><br><br><center><h2 id="total">Total: '.$total.' euros</h2><br><h5>IVA incluido</h5></center><br><br>';
if($total!=0){
//echo '<center><a href="./compras/compras.php" class="aceptar">Comprar</a></center>';
?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="formulario">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="currency_code" value="MXN">
<?php
for($i=0;$i<count($datos);$i++){
?>
<input type="hidden" name="item_name_<?php echo $i+1;?>" value="<?php echo $datos[$i]['strProduct'];?>">
<input type="hidden" name="amount_<?php echo $i+1;?>" value="<?php echo $datos[$i]['dblOffprice'];?>">
<input type="hidden" name="quantity_<?php echo $i+1;?>" value="<?php echo $datos[$i]['Cantidad'];?>">
<?php
}
?>
<center><input type="submit" value="comprar" class="aceptar" style="width:200px"></center>
</form>
<?php
}
?>
<br><br>
<center><a href="index.php">Seguir comprando</a></center>
<br>
<br>
</div>