duanmeng1950 2012-12-05 15:16
浏览 49
已采纳

PrestaShop函数中的致命错误isLogged()

Well, im developing a CMS based form with a copy-center-system (this is the form), but i need the $cookie->id_customer. But i get an error:

Fatal error: Call to a member function isLogged() on a non-object in /home/papelari/public_html/modules/mymodule/submit.php on line 13

<?php 
/*
 $con = mysql_connect("localhost","papelari","509494218");
 if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

 mysql_select_db("papelari_Veloso", $con); */

 global $cookie;

if(!$cookie->isLogged())
{
 echo 'Please login';
 exit;
}
else
{
 echo 'Hi, ' . $cookie->customer_firstname. ' ' .$cookie->customer_lastname . '<br/>';
 echo 'We contact to you: '. $cookie->email;
}

/* $sql="INSERT INTO ps_copias (id_customer, file, cor, copias, pags, papel, gramagem,       flag) VALUES('$cookie-            >id_customer','$_POST[file]','$_POST[cor]','$_POST[copias]','$_POST[pags]','$_POST[papel]','$_POST[gramagem]', 0)";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Enviado com sucesso!"; 

mysql_close($con); */
?>
  • 写回答

3条回答 默认 最新

  • dousi3362 2012-12-05 15:31
    关注

    Your problem is that $cookie is not defined. Paste this at the beginning of your script :

    <?php
    include("../config/config.inc.php");
    $cookie = new Cookie("ps");
    
    if ($cookie->isLogged()) {
        // your code
    }
    

    You may have to adapt config.inc.php include path depending on your own script

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?