PHPSESSID=8d6f9f7a734e3098abb4cddcadd61ab5有这些正常啊服务器怎么个不行法?有没出错提示

解决方案 »

  1.   

    给你看下程序<?php
    //index page use /template/index.htm as its HTML template
    require_once("config.inc.php");
    require_once("class/template.inc.php");
    require_once("class/mysql.inc.php");
    require_once("class/item.inc.php");
    require_once("class/member.inc.php");session_start();
    if (!isset($HTTP_SESSION_VARS["member"]))
    { // the user has not login and can't post message
    $msg  = "请您在发布信息之前先登录.";
    $msg .= "<br><br>如果您还没有注册,点击<a href='reg.php'><font color='red'>这里</font></a>注册";
    $tpl = new template($TEMPLATE_DIR);
    $tpl->set_file("error", "login.htm");
    $tpl->set_var("data", $msg);
    $tpl->pparse("out", "error");
    exit();
    }
    if (isset($HTTP_POST_VARS["action"]) && $HTTP_POST_VARS["action"] == "post")
    { //form has been submitted
    //initialize the class object
    $m       = $HTTP_SESSION_VARS['member'];
    $db      = & new mysql();
    $item    = & new item($db);
    $id      = "";
    $brand   = $HTTP_POST_VARS["brand"];
    $type    = $HTTP_POST_VARS["type"];
    $others  = $HTTP_POST_VARS["others"];
    $mode    = $HTTP_POST_VARS["mode"];
    $poster  = $m->user_name;
    $postime = date("Y-m-d H:i:s");
    $res     = $item->add($id, $brand, $type, $poster, $postime, $others, $mode);
    if ($res)
    { // add item success
    $msg  = "<b>发布成功!</b>.";
    $mode=='sale'?$info="供方信息":$info="求购信息";
    $msg .= "<br><br>您可以到".$info."里查看您刚才发表的信息.<br>";
    $msg .= "<br><a href='index.php'>返回首页</a>";
    $tpl  = new template($TEMPLATE_DIR);
    $tpl->set_file("error", "msg.htm");
    $tpl->set_var("msg", $msg);
    $tpl->pparse("out", "error");
    }
    else
    { // add item failed
    $msg  = "<b>发布失败!</b>.";
    $msg .= "<br><br>服务器在处理数据时出错,请重新发布您的信息.<br>";
    $msg .= "<br><a href='index.php'>返回首页</a>";
    $tpl  = new template($TEMPLATE_DIR);
    $tpl->set_file("error", "msg.htm");
    $tpl->set_var("data", $msg);
    $tpl->pparse("out", "error");
    }
    }
    else
    { // no submit ,echo the post form
    //output use template
    $tpl  = new template($TEMPLATE_DIR);
    $tpl->set_file('post', 'post.htm');
    $tpl->set_var(array('bulletin' => nl2br($BULLETIN_DATA),
    'help'     => nl2br($HELP_DATA),
    ));
    $tpl->pparse('output', 'post');
    }?>现在的问题是登录以后也不能显示发表文章的表单或者发表以后不显示成功信息,还是显示
    用户末登录的信息。
    你可以去printer.51.net/post.php 试一下
    给你个用户 stone  
    密码是format
      

  2.   

    解决了。
    把isset($HTTP_SESSION_VARS["member"])
    改成session_is_register("member")
    就行了。
    我还是不知道为什么
    是不是和register global 的设置有关?
    谁能讲一下这两用法的区别?
      

  3.   

    如果客户端关闭了cookie,PHP会通过url来实现session
      

  4.   

    是因为session_is_register()
    记下了session的值。