Foros del Web » Programando para Internet » PHP »

Mensaje de error: No tiene una cookie establecida para esta pagina

Estas en el tema de Mensaje de error: No tiene una cookie establecida para esta pagina en el foro de PHP en Foros del Web. En esta parte me arroja esto: You do not have a style cookie set for this page porfavor ayuda, que quiere decir ese error... ? ...
  #1 (permalink)  
Antiguo 16/02/2010, 15:17
 
Fecha de Ingreso: julio-2009
Mensajes: 32
Antigüedad: 14 años, 8 meses
Puntos: 1
Mensaje de error: No tiene una cookie establecida para esta pagina

En esta parte me arroja esto: You do not have a style cookie set for this page
porfavor ayuda, que quiere decir ese error... ?
Como puedo saber si se crearon las cookies?



<?php
if($ss->styleCookieSet()){ print "<p>You currently have a style cookie for this page.</p>"; }
else { print "<p>You do not have a style cookie set for this page.</p>"; }
?>


No se si se puede pero dejaré la pagina para que vean: http://robballou.com/switcher/v2/example.php



example.php
Código PHP:
<?php
error_reporting
(E_ALL E_STRICT);
ini_set('display_errors'true);
ini_set('error_log''/home/.becker/anarion/php.log');
ini_set('log_errors'true);
ob_start('ob_gzhandler');
date_default_timezone_set('America/Chicago');
?>

<html >
<head>
 <title>PHP Styleswitcher, version 2</title>


 <?php
 
// BEGIN STYLESWITCHER CODE
 
if(!isset($reqPath)){ $reqPath "./"; }
 require_once(
$reqPath ."Styleswitcher.php");
 
$ss = new Styleswitcher();
 
$ss->addStyle("basic""basic.css"""""true);
 
 
$ss->addStyle("blue""blue.css");
 
$ss->addStyle("green""green.css");
 
$ss->addStyle("large""large.css");
 
$ss->addStyle("normal""small.css");

 
$ss->createSet("fonts");
 
$ss->addStyleToSet("fonts""large");
 
$ss->addStyleToSet("fonts""normal"true);

 
$ss->createSet("style");
 
$ss->addStyleToSet("style""blue"true);
 
$ss->addStyleToSet("style""green");

$ss->cookieDomain "."$_SERVER['HTTP_HOST'];
 
$ss->cookieName "cwStyle";
 
 
$ss->printStyles();
 
// End Styleswitcher code
 
?>

</head>
<body>
 <div>
  <h1>PHP Styleswitcher, version 2</h1>
 
  <h2>Example page</h2>
  

 
  <p>This page shows how the styleswitcher works, as well as giving an example for how multiple styles can be changed. This page has <strong>five</strong> stylesheets. They break done like this:</p>
  
  <ol>
   <li> <strong>basic.css</strong> - This stylesheet is set up as "static" which means it is always present.</li>
   <li> <strong>blue.css</strong> - The first of the "visual" aspects of this page (the default blue theme).</li>
   <li> <strong>green.css</strong> - The second theme.</li>
   <li> <strong>small.css</strong> - The default font size.</li>
   <li> <strong>large.css</strong> - A larger font stylesheet.</li>
  </ol>
  
  <p>The stylesheets, except for the "basic.css" file, are broken into two sets: fonts and style.</p>
 
  <?php
  
if($ss->styleCookieSet()){ print "<p>You currently have a style cookie for this page.</p>"; }
  else { print 
"<p>You do not have a style cookie set for this page.</p>"; } 
  
?>
  

  
  <hr />
  
  <form action="switcher.php" method="post">
   <!-- Automatically redirect to the referer -->
   <input type="hidden" name="referer" id="referer" value="<?php print $_SERVER['PHP_SELF']; ?>" />
   <input type="hidden" name="inputStyle1" id="inputStyle1" value="fonts" />
   <input type="hidden" name="inputStyle2" id="inputStyle2" value="style" />
   
   <p>Use this form to change the style of this page:</p>
   
   <strong>Font Style:</strong><br />
   <input type="radio" name="fonts" id="fontStyle1" value="normal" <?php $ss->printSetInputChecked("fonts""normal"); ?>/> <label for="fontStyle1">Normal text (smaller)</label>
   <input type="radio" name="fonts" id="fontStyle2" value="large" <?php $ss->printSetInputChecked("fonts""large"); ?>/> <label for="fontStyle2">Large text</label><br />
   
   <br />
   
   <strong>Page Style:</strong><br />
   <input type="radio" name="style" id="pageStyle1" value="blue" <?php $ss->printSetInputChecked("style""blue"); ?>/> <label for="pageStyle1">Blue</label>
   <input type="radio" name="style" id="pageStyle2" value="green" <?php $ss->printSetInputChecked("style""green"); ?>/> <label for="pageStyle2">Green</label><br />
   
   <br />
   
   <input type="submit" name="setChanges" value="Change styles" />
  </form>
  
  <hr />
  



 </div>
</body>
</html>

swhitcher.php
Código PHP:
<?php
require_once("Styleswitcher.php");

$ss = new Styleswitcher('/switcher/');

$ss->addStyle("blue""blue.css");
$ss->addStyle("green""green.css");
$ss->addStyle("large""large.css");
$ss->addStyle("normal""small.css");

$ss->createSet("fonts");
$ss->addStyleToSet("fonts""large");
$ss->addStyleToSet("fonts""normal"true);

$ss->createSet("style");
$ss->addStyleToSet("style""blue"true);
$ss->addStyleToSet("style""green");

$ss->cookieDomain "."$_SERVER['HTTP_HOST'];
$ss->cookieName "cwStyle";

$ss->start();
?>

Styleswitcher.php tienen que descargarlo
http://robballou.com/switcher/v2/download.php

styleswitcher.v203.php5.zip

Última edición por humberto81; 17/02/2010 a las 10:53
  #2 (permalink)  
Antiguo 17/02/2010, 10:55
 
Fecha de Ingreso: julio-2009
Mensajes: 32
Antigüedad: 14 años, 8 meses
Puntos: 1
Respuesta: No tiene un style cookie establecida para esta pagina

Otra pregunta para que sirve esta parte ... swhitcher.php $ss = new Styleswitcher('/switcher/');

porfavor no me borren el post.

vi un ejemplo de crear cookie y lo crea satisfactoriamente. Entonces no es que no se pueda es algo en el codigo... que se pierde la cookie

Código PHP:
Ver original
  1. <?php
  2. /* /////////////////////////////////////////////////////////
  3.  * <!-- Cap07/envio_cookie.php -->
  4.  * Este script envía una cookie llamada Cap07
  5.  * ////////////////////////////////////////////////////// */
  6.  
  7.    // Generamos los valores que se van a especificar para la cookie
  8.    $nombre = 'Cap07';                  // Nombre de la cookie
  9.    $valor = 404;                       // Un valor cualquiera
  10.    $fecha_expiracion = time() + 600;   // Expira en 10 minutos
  11.    $path = dirname($HTTP_SERVER_VARS['REQUEST_URI']);  // El path actual
  12.  
  13.    // Enviamos la cookie
  14.    setcookie($nombre, $valor, $fecha_expiracion, $path, '', 0);
  15.  
  16.    // Escribimos algo (para que no aparezca una página en blanco :)
  17.    echo "Cookie enviada: $nombre, $valor, $fecha_expiracion, $path n";
  18. ?>

Última edición por humberto81; 17/02/2010 a las 11:15

Etiquetas: cookie, establecida, mensaje
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:03.