A Digital Age Deserves A Digital Leader

PhpBB problem

PhpBB problem

Postby OutlawTorn » Wed Apr 28, 2004 4:46 am

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.
PRO Level 2
Posts: 25
Joined: Mon Mar 22, 2004 5:13 am
Location: North Canton. Ohio

Postby imnuts » Wed Apr 28, 2004 5:10 am

i don't get anything like that and i never did so it could be something with your browser or settings
Image
PRO SUPREME
User avatar
Posts: 7457
Joined: Wed Mar 24, 2004 5:19 am
Location: Boothwyn, Pennsylvania
Real Name: Mark

Re: PhpBB problem

Postby Weaver » Wed Apr 28, 2004 5:15 am

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... :)

-Weaver
Last edited by Weaver on Wed Apr 28, 2004 5:19 am, edited 2 times in total.
Public Keys

The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change.
-- FORTRAN manual for Xerox Computers
PROfessional Member
User avatar
Posts: 1967
Joined: Wed Jun 19, 2002 12:05 am
Location: /home/weaver/

Postby OutlawTorn » Wed Apr 28, 2004 5:15 am

Its not browser, its either the code or the domain info, cuz everyone is having the problem when they visit the forum
PRO Level 2
Posts: 25
Joined: Mon Mar 22, 2004 5:13 am
Location: North Canton. Ohio

Postby OutlawTorn » Wed Apr 28, 2004 5:17 am

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
PRO Level 2
Posts: 25
Joined: Mon Mar 22, 2004 5:13 am
Location: North Canton. Ohio

Postby OutlawTorn » Wed Apr 28, 2004 5:28 am

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: Select all
 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;
}
PRO Level 2
Posts: 25
Joined: Mon Mar 22, 2004 5:13 am
Location: North Canton. Ohio

Postby Weaver » Wed Apr 28, 2004 5:33 am

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: Select all
 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?

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
Public Keys

The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change.
-- FORTRAN manual for Xerox Computers
PROfessional Member
User avatar
Posts: 1967
Joined: Wed Jun 19, 2002 12:05 am
Location: /home/weaver/

Postby OutlawTorn » Wed Apr 28, 2004 5:48 am

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.
PRO Level 2
Posts: 25
Joined: Mon Mar 22, 2004 5:13 am
Location: North Canton. Ohio

Postby Injunfarian » Wed Apr 28, 2004 6:18 pm

and 100% google?

heh i joke
<a href="http://www.secretsofwar.net/index.asp?referer=injunfarian" target=_blank>Good Webbased Game</a>

<a href="http://selectaz.com" target=_blank><img src="http://selectaz.com/popup/stats.php" border=0></a>
PRO Level 3
User avatar
Posts: 63
Joined: Sat Jan 18, 2003 8:15 pm

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 7 guests

cron
cron