Attention: PROnetworks has upgraded our forum from phpbb2 to phpbb3!!

Please head over to our new converted forum at: http://www.pronetworks.org/forums/

This old forum will remain 'read-only' until approximately February 2009. We look forward to seeing you at the new forum!
Author Message
OutlawTorn
PostPosted: Wed Apr 28, 2004 12:46 am Reply with quote

PRO Level 2
 
 


Joined: 22 Mar 2004
Posts: 48
Location: North Canton. Ohio
Alright since this board is running a modified version of phpbb i will ask my question.

Ok when someone goes to login, they enter thier login info and then press login. Now the login page will hang untill you either get a 404 error or "recieved no data from host". But when the user would press refresh or click back, poof thier logged it. Now why is it that the login hangs and goes to a 404 error like the login failed or something but yet when u refresh to the main index or click back thier logged in.
 
Back to top
imnuts
PostPosted: Wed Apr 28, 2004 1:10 am Reply with quote

Support Team
 
 


Joined: 24 Mar 2004
Posts: 14585
Location: Boothwyn, Pennsylvania
i don't get anything like that and i never did so it could be something with your browser or settings
 
Back to top
Weaver
PostPosted: Wed Apr 28, 2004 1:15 am Reply with quote

PROfessional Member
 
 


Joined: 18 Jun 2002
Posts: 2587
Location: /home/weaver/
OutlawTorn wrote:
Alright since this board is running a modified version of phpbb i will ask my question.

Ok when someone goes to login, they enter thier login info and then press login. Now the login page will hang untill you either get a 404 error or "recieved no data from host". But when the user would press refresh or click back, poof thier logged it. Now why is it that the login hangs and goes to a 404 error like the login failed or something but yet when u refresh to the main index or click back thier logged in.


This person is using Internet Explorer aren't they? Here is what is most likely happening: The browser (probably IE) is incorrectly detecting a 404 (which happens often with IE). The header from the server is being sent, IE is parsing the Set-Cookie header and "setting" the cookie. As just mentioned, even though the cookie is set, IE still "senses" a 404 or something for some unknown reason. Thus, even though a proper header was sent from the server and the cookie was set, you still get a 404. When you hit refresh, the cookie has been set, so IE sends it in the request. The server receives the request with the cookie that IE set before. This cookie contains the PHP Session ID, and the server thinks the user has logged in, thus you are redirected to a page and logged in.

An understanding of HTTP and cookies definitely helps to understand the process.

Oh yeah, I could be wrong... smile

-Weaver
 
Back to top
OutlawTorn
PostPosted: Wed Apr 28, 2004 1:15 am Reply with quote

PRO Level 2
 
 


Joined: 22 Mar 2004
Posts: 48
Location: North Canton. Ohio
Its not browser, its either the code or the domain info, cuz everyone is having the problem when they visit the forum
 
Back to top
OutlawTorn
PostPosted: Wed Apr 28, 2004 1:17 am Reply with quote

PRO Level 2
 
 


Joined: 22 Mar 2004
Posts: 48
Location: North Canton. Ohio
ahh so it may be the cookies that is sent from the server to the host user. Ill have to look at the code in phpbb and see how cookies are sent/handled

Oh and it happens in IE or Mozilla
 
Back to top
OutlawTorn
PostPosted: Wed Apr 28, 2004 1:28 am Reply with quote

PRO Level 2
 
 


Joined: 22 Mar 2004
Posts: 48
Location: North Canton. Ohio
Okay, I think I may have got it, I had to do a whole rewrite in /includes/functions.php; the entire code section from "function redirect($url)" to the final "}" with the code below:

Code:

 function redirect($url)
{
   global $db, $board_config;
   
           if (!empty($db))
           {
                   $db->sql_close();
           }

   $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
   $server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
   $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
   $script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path']));
   $script_name = ($script_name == '') ? $script_name : '/' . $script_name;
   //$url = preg_replace('#^\/?(.*?)\/?$#', '/\1', trim($url));

   // Redirect via an HTML form for PITA webservers
   if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
   {
      header('Refresh: 0; URL=' . $server_protocol . $server_name . $server_port . $script_name . $url);
      echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $server_protocol . $server_name . $server_port . $script_name . $url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $server_protocol . $server_name . $server_port . $script_name . $url . '">HERE</a> to be redirected</div></body></html>';
      exit;
   }

   // Behave as per HTTP/1.1 spec for others
   //header('Location: ' . $server_protocol . $server_name . $server_port . $script_name . $url);
   header('Location: ' . $url);
   exit;
}
 
Back to top
Weaver
PostPosted: Wed Apr 28, 2004 1:33 am Reply with quote

PROfessional Member
 
 


Joined: 18 Jun 2002
Posts: 2587
Location: /home/weaver/
OutlawTorn wrote:
Okay, I think I may have got it, I had to do a whole rewrite in /includes/functions.php; the entire code section from "function redirect($url)" to the final "}" with the code below:

Code:

 function redirect($url)
{
   global $db, $board_config;
   
           if (!empty($db))
           {
                   $db->sql_close();
           }

   $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
   $server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
   $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
   $script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path']));
   $script_name = ($script_name == '') ? $script_name : '/' . $script_name;
   //$url = preg_replace('#^\/?(.*?)\/?$#', '/\1', trim($url));

   // Redirect via an HTML form for PITA webservers
   if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
   {
      header('Refresh: 0; URL=' . $server_protocol . $server_name . $server_port . $script_name . $url);
      echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $server_protocol . $server_name . $server_port . $script_name . $url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $server_protocol . $server_name . $server_port . $script_name . $url . '">HERE</a> to be redirected</div></body></html>';
      exit;
   }

   // Behave as per HTTP/1.1 spec for others
   //header('Location: ' . $server_protocol . $server_name . $server_port . $script_name . $url);
   header('Location: ' . $url);
   exit;
}


You rewrote that function from scratch in 11 minutes?

Quote:

Posted: Tue Apr 27, 2004 11:17 pm
Posted: Tue Apr 27, 2004 11:28 pm


Note: Hours may be different depending on your timezone settings.

-Weaver
 
Back to top
OutlawTorn
PostPosted: Wed Apr 28, 2004 1:48 am Reply with quote

PRO Level 2
 
 


Joined: 22 Mar 2004
Posts: 48
Location: North Canton. Ohio
lol its 1:46am here, No I didnt do it all myself, I had some help with a friend who is also good with php, and some bits of code off the phpbb knowledge base.

Its basically Me @ 25% my work , friend @ 25% his work and knowledgebase @ 25% thier work and the other 25% is luck. lolol all in 11 mins.
 
Back to top
Injunfarian
PostPosted: Wed Apr 28, 2004 2:18 pm Reply with quote

PRO Level 3
 
 


Joined: 18 Jan 2003
Posts: 79
and 100% google?

heh i joke
 
Back to top
Back to top
Index >> Webmaster Domain & Code Room >> PhpBB problem

Page 1 of 1

 


Tired of the Ads? Registered users have 80% less adverts.