设置ASP会话从PHP [英] Set ASP Session From PHP

查看:118
本文介绍了设置ASP会话从PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我有一个名为与ASP检查,并有它自己的登录系统。

访问会议

是否有可能对我来说,使用PHP脚本看到访问会话,这样它会自动设置?

如果这是不可能的,没有人知道我怎样才能在ASP等价于:

 < PHP
    在session_start();
    如果($ _ POST ['XXXXX'] ==YYYYY){
        $ _SESSION ['身份证'] = 1;
        标题(位置:管理/ manage_admin.php');
    }    如果(使用isset($ _ GET ['注销'])){
        session_destroy();
        头('?地点:login.php中注销');
    }
?>


解决方案

做在ASP类似的一个方法是

 <%
如果的Request.Form(XXXXX)=YYYYY,那么
会议(ID)= 1
的Response.Redirect(管理/ manage_admin.asp)
万一如果的Request.QueryString(注销)= 1,则
Session.Abandon
的Response.Redirect(的login.asp)
万一
%GT;

不同的技术之间共享会话变量是困难的。你可能会需要看的就是将它们存储在数据库中的一种方式。有其中讨论如何与传统的ASP和ASP.net,这可能会帮助你理解这个概念做这MSDN文章。

https://msdn.microsoft.com/en-us/library/ aa479313.aspx

通常黑客绕过这虽然是一种语言的网页或者通过Ajax调用或无形的iFrame

将变量传递到另一个页面

Lets say I have a session called "access" that is checked for with ASP and has it's own login system.

Is it possible for me to use a PHP script to see that "access" session so it is automatically set?

If this isn't possible does anyone know how I can get the ASP equivalent to:

<?php
    session_start();
    if($_POST['xxxxx'] == "yyyyy"){
        $_SESSION['id'] = 1;
        header('Location: admin/manage_admin.php');
    }

    if(isset($_GET['logout'])){
        session_destroy();
        header('Location: login.php?logout');
    }
?>

解决方案

A way to do something similar in asp would be

<%
If Request.Form("xxxxx") = "yyyyy" then
Session("id") = 1
Response.Redirect("admin/manage_admin.asp")
End If

If Request.Querystring("logout") = 1 then
Session.Abandon
Response.Redirect("login.asp")
End If
%>

Sharing session variables between different technologies is difficult. What you would probably need to look at is a way of storing them in a database. There's a MSDN article which discusses how to do this with Classic ASP and ASP.net, which might help you understand the concept.

https://msdn.microsoft.com/en-us/library/aa479313.aspx

The usual hack to get around this though is for a page in one language to pass variables to a page in another via either an ajax call or an invisible iFrame

这篇关于设置ASP会话从PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆