Exemplo n.º 1
0
/**
 * Sets a cookie both in the browser cookies and in $_SESSION[]
 *
 * @param string $name The 'cookie' name
 * @param string $value The value to be stored
 * @param timestamp $time The time delta until the cookie expires
 * @param string $path The path on the server in which the cookie will be available on
 * @param bool $secure true if secure cookie
 */
function zp_setCookie($name, $value, $time = NULL, $path = NULL, $secure = false)
{
    if (empty($value)) {
        $cookiev = '';
    } else {
        $cookiev = zp_cookieEncode($value);
    }
    if (is_null($time)) {
        $time = COOKIE_PESISTENCE;
    }
    if (is_null($path)) {
        $path = WEBPATH;
    }
    if (substr($path, -1, 1) != '/') {
        $path .= '/';
    }
    if (DEBUG_LOGIN) {
        debugLog("zp_setCookie({$name}, {$value}, {$time}, {$path})::album_session=" . GALLERY_SESSION . "; SESSION=" . session_id());
    }
    if ($time < 0 || !GALLERY_SESSION) {
        setcookie($name, $cookiev, time() + $time, $path, "", $secure);
    }
    if ($time < 0) {
        if (isset($_SESSION)) {
            unset($_SESSION[$name]);
        }
        if (isset($_COOKIE)) {
            unset($_COOKIE[$name]);
        }
    } else {
        $_SESSION[$name] = $value;
        $_COOKIE[$name] = $cookiev;
    }
}
Exemplo n.º 2
0
							<form name="cookie_form" class="dirtychyeck" method="post" action="?page=develpment&amp;tab=cookie">
								<table class="compact">
									<?php 
        foreach ($_COOKIE as $cookie => $cookiev) {
            ?>
										<tr>
											<td><input type="checkbox" name="delete_cookie[<?php 
            echo html_encode(postIndexEncode($cookie));
            ?>
]" value="1"></td>
											<td><?php 
            echo html_encode($cookie);
            ?>
 </td>
											<td><?php 
            echo html_encode(zp_cookieEncode($cookiev));
            ?>
</td>
										</tr>
										<?php 
        }
        ?>
								</table>
								<p class="buttons">
									<button type="submit">
										<img src="<?php 
        echo WEBPATH . '/' . ZENFOLDER;
        ?>
/images/pass.png" alt="" />
										<strong><?php 
        echo gettext("Delete");