禁用 php 自动添加 ?PHPSESSIONID=xxxx 到 url

发布于 2024-08-17 15:14:33 字数 1927 浏览 7 评论 0原文

我正在开发一个在其主页上使用 wp-cumulus 的网站

http://www.roytanck.com/2008/03/06/wordpress-plugin-wp-cumulus-flash-based-tag-cloud/

它是一个 flash 组件显示一个漂亮的云标签。

为了使用它,我发出:

<script type="text/javascript">
[...]
flashvars.tagcloud = "<tags><a href='/tag.php?tag=Marinetti'>Marinetti</a><a href='/tag.php?tag=lang'>Lang</a></tags>";
[...]
</script>

在主页(index.php)我发出一个重定向,

<?
header( 'Location: http://ludion.com.ar/home.php' );
exit;
?> 

问题是,当重定向时,php会自动向每个链接添加 &PHPSESSIONID=xxxx ,是的,包括 javascript 内容! !

结果:

<script type="text/javascript">
[...]
flashvars.tagcloud = "<tags><a href='/tag.php?tag=Marinetti&PHPSESSID=75f82a44003ee8c421dda3db52ad1f93'>Marinetti</a><a href='/tag.php?tag=lang&PHPSESSID=75f82a44003ee8c421dda3db52ad1f93'>Lang</a></tags>";
[...]
</script>

组件似乎不喜欢&符号,所以它不起作用...

我怎样才能阻止php添加这些东西?

我已经尝试过:

ini_set( 'session.use_cookies', true );
ini_set( 'session.use_trans_sid', false );

在index.php中,但它不起作用

我还尝试在根目录下创建具有以下内容的.htaccess文件:

php_value session.use_only_cookies 1 php_value session.use_trans_sid 0

php_flag session.use_only_cookies 1 php_flag session.use_trans_sid 0

但网站只是挂起,日志中出现以下错误

[Mon Jan 11 12:01:13 2010] [alert] [client 201.250.119.217] /www/docs/ludion.com.ar/public_html/.htaccess:无效命令“php_value”,可能拼写错误或定义为未包含在服务器配置中的模块 ...

[Mon Jan 11 12:11:27 2010] [alert] [client 201.250.119.217] /www/docs/ludion.com.ar/public_html/.htaccess:无效命令“php_flag”,可能拼写错误或定义为服务器配置中未包含的模块

有什么想法吗???

I'm developing a web site which uses wp-cumulus on its home

http://www.roytanck.com/2008/03/06/wordpress-plugin-wp-cumulus-flash-based-tag-cloud/

it's a flash component to show a nice cloud tag.

in order to use it I issue:

<script type="text/javascript">
[...]
flashvars.tagcloud = "<tags><a href='/tag.php?tag=Marinetti'>Marinetti</a><a href='/tag.php?tag=lang'>Lang</a></tags>";
[...]
</script>

and at the home page (index.php) I issue a redirect like

<?
header( 'Location: http://ludion.com.ar/home.php' );
exit;
?> 

the problem is that when redirected php automatically adds an &PHPSESSIONID=xxxx to every link, yes, included the javascript stuff!!!

resulting:

<script type="text/javascript">
[...]
flashvars.tagcloud = "<tags><a href='/tag.php?tag=Marinetti&PHPSESSID=75f82a44003ee8c421dda3db52ad1f93'>Marinetti</a><a href='/tag.php?tag=lang&PHPSESSID=75f82a44003ee8c421dda3db52ad1f93'>Lang</a></tags>";
[...]
</script>

and the componente doesn't seem to like ampersand, so it just doesn't work...

how can I prevent php from adding that stuff?

I've already tried with:

ini_set( 'session.use_cookies', true );
ini_set( 'session.use_trans_sid', false );

in index.php, but it didn't work

I also tried creating and .htaccess file at the root with the following content:

php_value session.use_only_cookies 1
php_value session.use_trans_sid 0

and with

php_flag session.use_only_cookies 1
php_flag session.use_trans_sid 0

but the sites just hangs-up, with the following errors in the log

[Mon Jan 11 12:01:13 2010] [alert] [client 201.250.119.217] /www/docs/ludion.com.ar/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
...

[Mon Jan 11 12:11:27 2010] [alert] [client 201.250.119.217] /www/docs/ludion.com.ar/public_html/.htaccess: Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration

any idea???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天涯沦落人 2024-08-24 15:14:33

您提到的 session.use_trans_sid 是合适的。

无效的命令“php_value”,可能拼写错误或由未包含在服务器配置中的模块定义错误消息表明 PHP 正在作为 CGI 而不是 Apache 模块运行。在这种情况下,您无法通过 Apache 配置文件配置 PHP。

通常,CGI 设置为每个客户提供自定义 php.ini 文件,您可以在其中更改允许的任何 PHP 设置。检查您的托管服务文档以了解详细信息。

当然,如果您是服务器管理员,您可以随时编辑主 php.ini 文件。

最后但并非最不重要的一点是,不要忘记运行 phpinfo() 来检查设置是否实际更改。

The session.use_trans_sid you mention is the appropriate one.

The Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration error message suggests that PHP is running as CGI rather than Apache module. In that case, you cannot configure PHP through Apache configuration files.

Normally, CGI setups offer custom php.ini files for each customer where you can change whatever PHP setting you're allowed to. Check your hosting service documentation for the details.

Of course, if you are the server admin you can always edit the main php.ini file.

Last but not least, don't forget to run phpinfo() to check whether the settings were actually changed.

左耳近心 2024-08-24 15:14:33

到目前为止,我能找到的唯一解决方法如下:

当我生成js代码时,我分割了href,以便php不会将其识别为url,如下所示:

而不是

flashvars.tagcloud = "<tags><a href='/tag.php?tag=Marinetti'>Marinetti</a><a href='/tag.php?tag=lang'>Lang</a></tags>";

我发出

flashvars.tagcloud = "<tags><a " + "href='/tag.php?tag=Marinetti'>Marinetti</a><a " + "href='/tag.php?tag=lang'>Lang</a></tags>";

非常讨厌的行为,但是它有效...

任何真正的解决方案都是告诉 php 不要乱搞我的网址...

so far, the only woraround I could find is the following:

when I generate the js code, I split the href, so that php doesn't recognize it as an url, like this:

instead of

flashvars.tagcloud = "<tags><a href='/tag.php?tag=Marinetti'>Marinetti</a><a href='/tag.php?tag=lang'>Lang</a></tags>";

I issue

flashvars.tagcloud = "<tags><a " + "href='/tag.php?tag=Marinetti'>Marinetti</a><a " + "href='/tag.php?tag=lang'>Lang</a></tags>";

very nasty in deed, but it works...

any the real solution would be to tell php to stop messing around with my urls...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文