PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 27th, 2002, 03:02 AM
alsaffar alsaffar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 58 alsaffar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Problem: Redirecting

Hi guys,

I have a problem of redirecting, and this is part of my script where the error occurs:

<?

if ($login == 'Ok')
{
?>
<HTML><HEAD><TITLE>You're Logged In!</TITLE></HEAD>
<BODY><CENTER>Congratulation You're logged in</CENTER></BODY></HTML>
<?
}

header ("Location: UserControlPanel.php");

?>

It gave me the following error:

Warning: Cannot add header information - headers already sent by (output started at /path/to/the/file/login.php:120) in /path/to/the/file/login.php on line 182

I want it to work just like how it's working in any forum when you login to the forum, it redirect to a temp page telling you "Thank you for login" and then redirect to the forum sections or your control panel. How can I do something like this?

Reply With Quote
  #2  
Old August 27th, 2002, 03:27 AM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: Problem: Redirecting

Use a meta tag instead. The header function in php can't be used if you want to display something to the screen and then redirect...

php Code:
Original - php Code
  1. <?
  2.  
  3. if ($login == 'Ok')
  4. {
  5. ?>
  6. <HTML>
  7. <HEAD>
  8. <TITLE>You're Logged In!</TITLE>
  9. <META HTTP-EQUIV=Refresh CONTENT="5; URL=http://www.yoursite.com/UserControlPanel.php">
  10. </HEAD>
  11. <BODY>
  12. <CENTER>Congratulation You're logged in</CENTER>
  13. </BODY>
  14. </HTML>
  15. <?
  16. }
  17. ?>

Reply With Quote
  #3  
Old August 27th, 2002, 05:25 AM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Problem: Redirecting

just to mentione:

(i am not shure about this, but i think i so smth like this on one page.)

u can use "delay" paramether to the header() function just as in <meta http-equiv tag...

so, this could be ok, and u could echo smth to the user, and redirect him with redirect header, 5 secs later:

header("Location: 5;url.php");

i think i so this in phpBB code, and only to bi used with IIS server.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Problem: Redirecting


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway