Google Answers Logo
View Question
 
Q: dns error with php sessions redirect ( No Answer,   1 Comment )
Question  
Subject: dns error with php sessions redirect
Category: Computers > Internet
Asked by: isoundcom-ga
List Price: $60.00
Posted: 28 Sep 2004 09:02 PDT
Expires: 28 Oct 2004 09:02 PDT
Question ID: 407440
I am getting a DNS error (blank web browser) when using php sessions
to re-direct the user to another php page.

Here's how to replicate the problem:

Go to: http://www.isound.com:2082
Click cancel at the login box

Go to: http://www.isound.com
Login in the right side sign in box using:
User: isound2
Pass: test22

You'll then see the DNS error page/cannot find server page.

Now if you refresh this page, the session gets set and logs in.

This is the way I've been able to replicate the problem. The site
users are also getting the same problem. I'm not sure why/how they are
getting the problem, because the don't use http://www.isound.com:2082

I am using a linux server.

Apache 1.3.27
RedHat 7.3
PHP 4.3.1

Here's the php code i'm using:

<?
session_start();
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
header("Cache-control: private"); 

$userid=$HTTP_POST_VARS["user"];
$password=$HTTP_POST_VARS["password"];
$redir=$HTTP_POST_VARS["redir"];


###### MYSQL Connection data here##########

if ($userid && $password) {

	$query = "select `username`, `unsigned` from `user` where username =
'$userid' and password = '$password'";
	$result = mysql_query($query);
	$row = mysql_fetch_array($result);

	if (mysql_num_rows($result) >0 ) {

  		$unsignedsess = $row["unsigned"];

		if ($unsignedsess == 'y') {
			$query2 = "select `artistid` from `unsigned` where userid = '$userid'";
			$result2 = mysql_query($query2);
			if (mysql_num_rows($result2) > 1 ) {
				$multiple_artists = 'y';
			}
				$row2 = mysql_fetch_array($result2);
				$artistidsess = $row2["artistid"];

		}

		$useridsess = $userid;
		session_register("useridsess","unsignedsess","artistidsess");
		
		include('useronline/useronline.php');
	}
}

  if (session_is_registered("useridsess"))
  {
	if ($redir != '') {
		if ($redir == 'redir') {
			$urlrefer=getenv("HTTP_REFERER");

			
    			header("Location: $urlrefer");
		} else {

			session_write_close();
    			header("Location: $redir");
		}

	} elseif ($unsignedsess == '') {
		
    		header("Location: http://www.isound.com/member.php");

	} elseif ($unsignedsess == 'y') {

		if ($multiple_artists == 'y') {

    			header("Location: http://www.isound.com/member.php?i=admin");

		} else {
			session_write_close();
    			header("Location: http://www.isound.com/backstage.php");

		}
	} elseif ($unsignedsess == 'l') {
			
    			header("Location: http://www.isound.com/member.php?i=label");
	}

  } else {
	$feedback = "Your user name or password is incorrect.<BR>Remeber
passwords are caSe SensiTive. Please try again.<br><FORM
ACTION=http://www.isound.com/signin.php METHOD=post>
<b>You must sign in to view this page</b><br>
<font color=#ffffff>User Name:</font><BR>
<INPUT TYPE=text VALUE=\"\" SIZE=25 NAME=user><BR>
<font color=#ffffff>Password:</font><BR>
<INPUT TYPE=password VALUE=\"\" SIZE=25 NAME=password><BR>
<input type=hidden value=redir name=redir>
<INPUT type=submit VALUE=\"Sign In\">
</FORM><br><br>If you forgot your user name or password please type
your email address in the form below and it will be sent to
you.<br><form action=\"http://www.isound.com/retrieval.php\"
method=post><br>
	Email Address:<input type=text name=email value=\"\"><br>
	<input type=\"submit\" value=\"Get Info\"></form>";
	include("feedback.php");
	exit;
  }

?>

Request for Question Clarification by sgtcory-ga on 28 Sep 2004 10:15 PDT
Hello isoundcom,

Seems to be working correctly for me now. I spent a little time on it
- and noticed it was browser based - as it worked in Netscape , but
not in IE 6.

I thought it may be something to do with the P3P policy header, or the
order in which you have your current headers.

Are you still having the same issue, or did you get it resolved?

Thanks -
SgtCory

Clarification of Question by isoundcom-ga on 28 Sep 2004 11:34 PDT
I have tried it without the Privacy header so I don't think it's that.
I've also played with the order of the headers with no success.
(Maybe i'm missing something, though)

Yes, I thought it might just be an I.E. 6 problem too.

Request for Question Clarification by sgtcory-ga on 29 Sep 2004 10:05 PDT
Hello isoundcom,

I found something interesting enough to investigate. You can try one
of two things to test this theory out :

1) Set session.cache_limiter = private; (or = nocache if prefered) in
your PHP.ini file.

2) Add this to your pages before the start of the session :
   
   session_cache_limiter('private');
   OR
   session_cache_limiter('nocache');

Try that and let me know if the problem persists, as I have found many
cases of this setting causing session problems in Internet Explorer
5+.

You can read more about this here :
http://www.phpfreaks.com/phpmanual/page/function.session-cache-limiter.html

Thanks again,
SgtCory

Clarification of Question by isoundcom-ga on 29 Sep 2004 11:31 PDT
My php.ini was already set to nocache. I tried all three methods
(nocache, private, public) with no dice.
Here's the session section of my php.ini:

[Session]
session.save_handler      = files   ; handler used to store/retrieve data
session.save_path         = /tmp    ; argument passed to save_handler
                                    ; in the case of files, this is the
                                    ; path where data files are stored
session.use_cookies       = 1       ; whether to use cookies
session.name              = PHPSESSID
                                    ; name of the session
                                    ; is used as cookie name
session.auto_start        = 0       ; initialize session on request startup
session.cookie_lifetime   = 0       ; lifetime in seconds of cookie
                                    ; or if 0, until browser is restarted
session.cookie_path       = /       ; the path the cookie is valid for
session.cookie_domain     =         ; the domain the cookie is valid for
session.serialize_handler = php     ; handler used to serialize data
                                    ; php is the standard serializer of PHP
session.gc_probability    = 1       ; percentual probability that the
                                    ; 'garbage collection' process is started
                                    ; on every session initialization
session.gc_maxlifetime    = 1440    ; after this number of seconds, stored
                                    ; data will be seen as 'garbage' and
                                    ; cleaned up by the gc process
session.referer_check     =         ; check HTTP Referer to invalidate
                                    ; externally stored URLs containing ids
session.entropy_length    = 0       ; how many bytes to read from the file
session.entropy_file      =         ; specified here to create the session id
; session.entropy_length    = 16
; session.entropy_file      = /dev/urandom
session.cache_limiter     = nocache ; set to {nocache,private,public} to
                                    ; determine HTTP caching aspects
session.cache_expire      = 180     ; document expires after n minutes
session.use_trans_sid     = 1       ; use transient sid support if enabled
                                    ; by compiling with --enable-trans-sid
Answer  
There is no answer at this time.

Comments  
Subject: Re: dns error with php sessions redirect
From: sgtcory-ga on 28 Sep 2004 11:00 PDT
 
Hello again,

I was in fact able to repeat the problem. I'm still working on a
definitive answer, but I'll leave this open for other researchers
while I look further into the issue , as we have many field related
experts.

Thank you -
SgtCory

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy