cookie setter设置为http://而不是https://

时间:2014-12-31 08:56:04

标签: php cookies

我已经通过这个脚本创建了一个cookie,它根据预期的方式正确设置了cookie,但cookie setter设置为http://而不是https://。你们中的任何人都知道如何将其设置为https

   <?php

    header('P3P: CP="NOI DSP COR CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT", policyref="http://ptvdomain.virtualstockexchange.com/w3c/p3p.xml"');
    $id = isset($_REQUEST["id"]) ? floatval($_REQUEST["id"]) : 0;
    $post_id = isset($_REQUEST["cid"]) ? intval($_REQUEST["cid"]) : 0;
    if (isset($_SERVER['HTTP_REFERER'])){
        $urlParts=parse_url($_SERVER['HTTP_REFERER']);
        if (isset($urlParts['query'])){
            $vars = parse_str($urlParts['query']);
            if (isset($vars['id']) && floatval($vars['id']) > 0 ){
                $id = floatval($vars['id']);
            }
        }
    }         
    if ($id) {
        if ( ! isset($_COOKIE["cookieid"])){
            $cookieid = ($post_id?"$post_id:$id":$id);
            setcookie("cookieid", $cookieid, time() + 60 * 60 * 24 * 365, "/", ".virtualstockexchange.com");
            header('Location: '.Config_File::readConfig('user')->base_url.'/success.php');
        }
    }

0 个答案:

没有答案