代码拉取完成,页面将自动刷新
<?php
/*******************************************************************
* Glype is copyright and trademark 2007-2016 UpsideOut, Inc. d/b/a Glype
* and/or its licensors, successors and assigners. All rights reserved.
*
* Use of Glype is subject to the terms of the Software License Agreement.
* http://www.glype.com/license.php
*******************************************************************
* This page displays a list of cookies that have been forwarded
* to the user and allows individual cookies to be deleted.
******************************************************************/
/*****************************************************************
* Initialize glype
******************************************************************/
require 'includes/init.php';
# Stop caching
sendNoCache();
# Start buffering
ob_start();
/*****************************************************************
* Create content
******************************************************************/
echo <<<OUT
<h2 class="first">管理Cookies</h2>
<p>您可以查看和删除通过我们的服务访问的站点在您的计算机上设置的cookie。你的cookie列在下面:</p>
<form action="includes/process.php?action=cookies" method="post">
<table cellpadding="2" cellspacing="0" align="center">
<tr>
<th width="33%">网站</th>
<th width="33%">名称</th>
<th width="33%">值</th>
<th> </th>
</tr>
OUT;
/*****************************************************************
* Find cookies
******************************************************************/
# Server side storage
if ( $CONFIG['cookies_on_server'] ) {
# Check cookie file exists
if ( file_exists($cookieFile = $CONFIG['cookies_folder'] . glype_session_id()) ) {
# Load into array
if ( $cookieLine = file($cookieFile, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES) ) {
# Process line by line
foreach ( $cookieLine as $line ) {
# Comment line?
if ( ! isset($line[0]) || $line[0] == '#' ) {
continue;
}
# Clear newlines
$line = rtrim($line);
# Split by tab
$details = explode("\t", $line);
# Check valid split, expecting 7 items
if ( count($details) != 7 ) {
continue;
}
# Save in array(domain, path, name value)
$showCookies[] = array($details[0], $details[2], $details[5], $details[6]);
}
}
}
} else if ( isset($_COOKIE[COOKIE_PREFIX]) ) {
# Cookies on client
# Encoded or unencoded?
if ( $CONFIG['encode_cookies'] ) {
# Encoded cookies stored client-side
foreach ( $_COOKIE[COOKIE_PREFIX] as $attributes => $value ) {
# Decode cookie to [domain,path,name]
$attributes = explode(' ', base64_decode($attributes));
# Check successful decoding and skip if failed
if ( ! isset($attributes[2]) ) {
continue;
}
# Extract parts
list($domain, $path, $name) = $attributes;
# Decode cookie value
$value = base64_decode($value);
# Secure cookies marked by !SEC suffix so remove the suffix
$value = str_replace('!SEC', '', $value);
# Add cookie
$showCookies[] = array($domain, $path, $name, $value);
}
} else {
# Unencoded cookies stored client-side
foreach ( $_COOKIE[COOKIE_PREFIX] as $domain => $paths ) {
# $domain holds the domain (surprisingly) and $path is an array
# of keys (paths) and more arrays (each child array of $path = one cookie)
# e.g. Array('domain.com' => Array('/' => Array('cookie_name' => 'value')))
foreach ( $paths as $path => $cookies ) {
foreach ( $cookies as $name => $value ) {
# Secure cookies marked by !SEC suffix so remove the suffix
$value = str_replace('!SEC', '', $value);
# Add cookie
$showCookies[] = array($domain, $path, $name, $value);
}
}
}
}
}
/*****************************************************************
* Print cookies
******************************************************************/
# Any to print?
if ( empty($showCookies) ) {
echo <<<OUT
<tr>
<td colspan="4" align="center">没有发现cookies</td>
</tr>
OUT;
} else {
# Loop through and print them
foreach ( $showCookies as $id => $cookie ) {
# Join domain & path to create "website"
$website = $cookie[0] . ( $cookie[1] == '/' ? '' : $cookie[1] );
# Cookie name
$name = htmlentities($cookie[2]);
# Get cookie value
$value = $cookie[3];
# Truncate value to avoid stretching page
if ( strlen($value) > 35 ) {
# Create a row ID
$rowID = 'cookieRow' . $id;
# Wrap the long value and escape ' so we can use it in javascript
$wrapped = str_replace("'", "\'", wordwrap($cookie[3], 30, ' ', true));
# Truncate the string
$truncated = substr($value, 0, 30);
# Replace the value with a shorten version that expands onclick
$value = <<<OUT
<span id="{$rowID}">{$truncated}<a style="cursor:pointer;" onclick="document.getElementById('{$rowID}').innerHTML='{$wrapped}';">...</a></span>
OUT;
}
echo <<<OUT
<tr>
<td>{$website}</td>
<td>{$name}</td>
<td>{$value}</td>
<td><input type="checkbox" name="delete[]" value="{$cookie[0]}|{$cookie[1]}|{$name}"></td>
</tr>
OUT;
}
}
/*****************************************************************
* Finish page
******************************************************************/
echo <<<OUT
<tr>
<th colspan="3" align="right"><input type="submit" value="删除"></th>
<th><input type="checkbox" name="checkall" onclick="selectAll(this)"></th>
</tr>
</table>
</form>
<script type="text/javascript">
function selectAll(checkbox) {
var theForm = checkbox.form;
for(var z=0; z<theForm.length;z++){
if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
theForm[z].checked = checkbox.checked;
}
}
}
</script>
OUT;
/*****************************************************************
* Send content wrapped in our theme
******************************************************************/
# Get buffer
$content = ob_get_contents();
# Clear buffer
ob_end_clean();
# Print content wrapped in theme
echo replaceContent($content);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。