page not redirecting - redirect2page('members.php');

Reply

Join Date: May 2006
Posts: 3
Reputation: Pixelate is an unknown quantity at this point 
Solved Threads: 0
Pixelate Pixelate is offline Offline
Newbie Poster

page not redirecting - redirect2page('members.php');

 
0
  #1
May 31st, 2006
Hello,

I have the same software installed on two servers:
works: http://developdesign.com/samples/modelagency/index.php
not working: http://killertalent.com/index.php

1 example - login as 'mat / matt'
One developdesign.com page you get directed to 'members.php' page if logged in, but one killertalent.com page you get error ( or if using Firefox you go to "http://killertalent.com/processors/login.php" page )

The processors/login.php page is supposed to redirect to either 'members.php' if logged in or 'index.php' if need to register.

Could it be that developedesign.com Server API is Apache, but killertalent.com Server API is CGI/FastCGI?

CODE for login.php page with redirect code:
[php]<?session_start();
require("../includes/vars.inc.php");
require("../includes/functions.inc.php");
require("../includes/templates.inc.php");
require("../includes/apt_functions.inc.php");

$topass=array();
if ($_SERVER['REQUEST_METHOD']=='POST') {
$user=addslashes_mq($_POST['username']);
$pass=addslashes_mq($_POST['password']);
if (isset($user) && !empty($user) && isset($pass) && !empty($pass)) {
db_connect();
$query="SELECT user_id,name,membership,is_approved FROM users WHERE user='$user' AND pass='$pass'";
if (!($res=mysql_query($query))) {error(mysql_error(),__LINE__,__FILE__);}
if (mysql_num_rows($res)) {
list($user_id,$name,$membership,$is_approved)=mysql_fetch_row($res);
$_SESSION['user_id']=$user_id;
$_SESSION['name']=$name;
$_SESSION['membership']=$membership;
$_SESSION['is_approved']=$is_approved;
$query="UPDATE users SET last_visit=now() WHERE user_id='$user_id'";
if (!($res=mysql_query($query))) {error(mysql_error(),__LINE__,__FILE__);}
if (defined('_PCPIN_CHAT_')) {
$is_admin='no';
if ($membership==_ADMINLEVEL_) {
$is_admin='yes';
}
@mysql_query("INSERT INTO pcpin_users SET user='$user',lastping='".time()."',ip='".getenv('REMOTE_ADDR')."',language='english',color='#000000',level='$is_admin',sid='".session_id()."'");
$date_time = date('YmdHis');
@mysql_query("INSERT into pcpin_logins SET date_time='$date_time',user='$user', ip='".getenv('REMOTE_ADDR')."', password='$pass'");
$date_time = date('d').".".date('m').".".date('Y')." ".date('H').":".date('i').":".date('s');
@mysql_query("UPDATE pcpin_registered_users SET last_visit='$date_time',last_ip='".getenv('REMOTE_ADDR')."' WHERE user='$user'");
}
redirect2page('members.php');
} else {
$topass['message']='Invalid user or pass. Please try again!';
}
} else {
$topass['message']='Invalid user or pass. Please try again!';
}
}
redirect2page("index.php",$topass);
?>
[/php] The server configuration info:
http://developdesign.com/phpinfo.php
http://killertalent.com/phpinfo.php
Is it that the Server API on developdesign.com is Apache and the Server API on killertalent.com is CGI/FastCGI?
Is it that developdesign.com uses Zend Optimizer and killertalent.com uses eAccelerator?

Software says important to have one important directive for the directory where your installation is:
AllowOverride All
How do I tell if this directive is setup?
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,075
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: page not redirecting - redirect2page('members.php');

 
0
  #2
Jun 1st, 2006
I dont believe the server side has anything to do with redirection problems since redirects used in PHP are normally the sending of the HTTP Redirect Header to the browser, or Document Moved Permanently etc. Header. This is the same across servers for which ever HTTP version being used. Its up the browser to follow the http protocol and implement the redirect.

However, most likely its to do with your login not working. I tested and the site http://killertalent.com/ worked fine, redirecting me to http://killertalent.com/members.php after login.

If you think its the redirect, then please post the contents of the redirect2page() function.

The login may not work because of session cookies problems or some server side error etc. So I'll bet the login is being written to the database and session, but when you were being redirected to members.php, your access (session) could not be verified. Maybe because the session cookie was not written?

So maybe the contents of members.php could help, or the function which validates the users session.

I've noticed in some applications redirects would lead to a different domain (as far as the browser is concerned) because the redirect when to www.site.com instead of site.com. I dont think this happened here since the redirects are to relative urls, but thats good to note.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,075
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: page not redirecting - redirect2page('members.php');

 
0
  #3
Jun 2nd, 2006
I just found your other post:

Found
The document has moved here.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.34 Server at killertalent.com Port 80
so it is the server.... maybe posting the redirect function could help..
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 234
Reputation: cancer10 is an unknown quantity at this point 
Solved Threads: 0
cancer10's Avatar
cancer10 cancer10 is offline Offline
Posting Whiz in Training

Re: page not redirecting - redirect2page('members.php');

 
0
  #4
Jun 18th, 2006
Try

header("location: http://server-to-redirect.com");

pass this above any HTML tags or else it would show errors
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 494
Reputation: Puckdropper is an unknown quantity at this point 
Solved Threads: 21
Puckdropper Puckdropper is offline Offline
Posting Pro in Training

Re: page not redirecting - redirect2page('members.php');

 
0
  #5
Jun 18th, 2006
One other tip:

When sending headers and doing redirection, the full URL must be used. It will NOT accept a relative URL. (You can write a function that generates the full URL from a relative one with little difficulty.)
www.uncreativelabs.net

Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,075
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: page not redirecting - redirect2page('members.php');

 
0
  #6
Jun 18th, 2006
Originally Posted by Puckdropper
One other tip:

When sending headers and doing redirection, the full URL must be used. It will NOT accept a relative URL. (You can write a function that generates the full URL from a relative one with little difficulty.)
Good point there.

Also, when putting in the full url, you must be sure you use the same domain if you are using sessions.

Example:

http://www.example.com
http://example.com

Are not the same domain as far as the browser is concerned, even though they resolve to the same IP as far as the sever is concerned.

using the wrong domain breaks the users session, and thus the login does not work and needs to redirect again.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 494
Reputation: Puckdropper is an unknown quantity at this point 
Solved Threads: 21
Puckdropper Puckdropper is offline Offline
Posting Pro in Training

Re: page not redirecting - redirect2page('members.php');

 
0
  #7
Jun 20th, 2006
There's a more technical explanation why that works like it works. If interested, keep reading:

Both domains on and off the world wide web (www) can point to different places. An example of this is UNNA, the United Network of Newton Archives. (http://www.unna.org) Another site (which wasn't responding when I tried it) is located at (http://unna.org). Same domain name, but one's www and the other's not.

Also, sites can point to the same IP but have different domains hosted. My personal site, http://www.puckdroppers.us resolves to the same IP as Uncreative Labs (http://www.uncreativelabs.net).
www.uncreativelabs.net

Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 9
Reputation: skipbales is an unknown quantity at this point 
Solved Threads: 0
skipbales skipbales is offline Offline
Newbie Poster

Re: page not redirecting - redirect2page('members.php');

 
0
  #8
Aug 17th, 2009
I went through redirect Hell for several days. These may not be your issues but these were mine.
1. Most important: output buffering must be turned on in both php.ini files. Otherwise if anything, even white space, is sent before your header, it will fail It could be on at one server and off at the other.
2. The oddest of all: If I launched Firefox from Expression Web2 on my local host all my redirects failed. If I launched the same browser outside of Expression Web they all worked. As far as I knew the icon in Expression Web2 was no more than a shortcut which passed my current page but somehow there is a difference. All of my other navigation and urls worked fine but no redirects.

Good luck. I know how frustrating this can be.
Reply With Quote Quick reply to this message  
Join Date: Feb 2004
Posts: 10,003
Reputation: crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold 
Solved Threads: 757
Moderator
Featured Poster
crunchie's Avatar
crunchie crunchie is online now Online
Spyware Killer

Re: page not redirecting - redirect2page('members.php');

 
0
  #9
Aug 17th, 2009
I reckon after 3 years the OP has fixed the problem
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 9
Reputation: skipbales is an unknown quantity at this point 
Solved Threads: 0
skipbales skipbales is offline Offline
Newbie Poster

Re: page not redirecting - redirect2page('members.php');

 
0
  #10
Aug 17th, 2009
lol. Maybe I should look at the dates a little closer.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC