ASP / PHP Referrer Sessions Cookies HELP!!!

  • dprichard
  • Beginner
  • Beginner
  • User avatar
  • Posts: 61
  • Loc: Clearwater Florida

Post 3+ Months Ago

Okay, I need some serious programming answers PLEASE!!!!. Here is the scenario:

Customer wants users to authenticate based on where they came from. They have several locations that the users will be coming from. They don't want anyone to be able to access their website from anywhere other than these locations. The locations ip addresses will be changing regularly. Is there a way to have a page on the INTRANET internally that the users will go to and it will start a session or place a cookie and pass them to the website. The website then looks for that session or cookie and lets them in or denies them based on the session or cookie. The sites that they will be coming from are ASP and .NET servers and it encrypts the URL that it is coming from. The website it is going to is on a PHP server and is built on PHP and MySQL. I have asked this in like every forum on the internet I can find and no one seems to have a solution. Any help would be greatly appreciated.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • dEfEndEr
  • Newbie
  • Newbie
  • dEfEndEr
  • Posts: 14

Post 3+ Months Ago

What's installed on the Intranet server ?


As if php was on that, you could then do a $HTTP_REFERRER and get the current IP, pass back a secret key, and then push them on to the internet server with the key they need (always best to use the $_POST to push keys about.

?
  • dprichard
  • Beginner
  • Beginner
  • User avatar
  • Posts: 61
  • Loc: Clearwater Florida

Post 3+ Months Ago

The servers the users will be coming from are ASP and .NET. They will be going to a server running PHP.
  • dEfEndEr
  • Newbie
  • Newbie
  • dEfEndEr
  • Posts: 14

Post 3+ Months Ago

Then you will need to set-up a cookie on the intranet server, then on the internet server look for the cookie and use the data in that.

I can't help you do the cookie bit, as i've not done them sorry.. If I get chance i'll look through my .NET documentation and let you know if I find anything.
  • dprichard
  • Beginner
  • Beginner
  • User avatar
  • Posts: 61
  • Loc: Clearwater Florida

Post 3+ Months Ago

I built two pages. One is on an ASP machine and the other one is on a PHP server. The first page has the following code:

Code: [ Select ]
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Response.Cookies("testcookie")="testcookievalue"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body><meta http-equiv="refresh" content="1;URL=http://www.leadershippinellas.com/test.php">
</body>
</html>
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <%
  3. Response.Cookies("testcookie")="testcookievalue"
  4. %>
  5. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  9. <title>Untitled Document</title>
  10. </head>
  11. <body><meta http-equiv="refresh" content="1;URL=http://www.leadershippinellas.com/test.php">
  12. </body>
  13. </html>


I am trying to pass this cookie from an ASP page to a PHP page. Here is the code I am using on the PHP page:

Code: [ Select ]

<html>
<body><?php
if (isset($_COOKIE["testcookie"]))
echo "Welcome " . $_COOKIE["testcookie"] . "!<br />";
else
echo "You are not logged in!<br />";
?></body>
</html>
  1. <html>
  2. <body><?php
  3. if (isset($_COOKIE["testcookie"]))
  4. echo "Welcome " . $_COOKIE["testcookie"] . "!<br />";
  5. else
  6. echo "You are not logged in!<br />";
  7. ?></body>
  8. </html>


I can't get it to see the cookie? Is this even possible?
  • dEfEndEr
  • Newbie
  • Newbie
  • dEfEndEr
  • Posts: 14

Post 3+ Months Ago

It is, BUT looking at the small code, I think your cookie has expired before moving on to the php server.


I was reading the secion last night, and for a cookie like this you need to set an expiry time, or as soon as the session with server 1 has ended, the cookie is lost.

Thus a tracking cookie is required.


If you need the code, then you will need to wait until Sat Night (now fri 2pm) as i'm not back home for a while.

Unless any-one else can help you build a tracking cookie :)
  • dprichard
  • Beginner
  • Beginner
  • User avatar
  • Posts: 61
  • Loc: Clearwater Florida

Post 3+ Months Ago

Okay, I changed the code for the first page to this:

Code: [ Select ]
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Response.Cookies("testcookie")="testcookievalue"
Response.Cookies("testcookie").Expires="8/01/2004"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body><meta http-equiv="refresh" content="1;URL=http://www.leadershippinellas.com/test.php">
</body>
</html>
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <%
  3. Response.Cookies("testcookie")="testcookievalue"
  4. Response.Cookies("testcookie").Expires="8/01/2004"
  5. %>
  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  10. <title>Untitled Document</title>
  11. </head>
  12. <body><meta http-equiv="refresh" content="1;URL=http://www.leadershippinellas.com/test.php">
  13. </body>
  14. </html>


And it still doesn't see the cookie.
  • dEfEndEr
  • Newbie
  • Newbie
  • dEfEndEr
  • Posts: 14

Post 3+ Months Ago

That quick expires = will still only keep it on the server it was issued, you need to build a tracking cookie. I'm sure the code is on the SAMS book site, as the book goes into great detail about tracking cookies :)

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 110 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.