php

This is a discussion on "php" within the PHP Forum section. This forum, and the thread "php are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 19th, 2007, 18:48
acrikey's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
php

how do I redirect to a secrete page after a php login? at he moment it just hovers in the welcome page

online link

U N: PHP

Pw: webforumz
Reply With Quote

  #2 (permalink)  
Old Apr 19th, 2007, 20:56
Junior Member
Join Date: Jun 2006
Location: Wisconsin
Age: 30
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php

the code to redirect using php is

Code: Select all
header ("Location: page_to_go_to.php");
To use this though, you can't send any header information to the browser. Normally what people do is, put the page that will handle the form in the action of your form. Once the form is submitted, it'll goto this page, make a decision whether to send them back to the form page or use the header to redirect them to another page.
Reply With Quote
  #3 (permalink)  
Old Apr 20th, 2007, 16:53
acrikey's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php

Ok after placing my location code in my script nothing happens. Where should it be place? I just want to move on with my life!!!!
Reply With Quote
  #4 (permalink)  
Old Apr 20th, 2007, 17:34
JustinStudios's Avatar
SuperMember

SuperMember
Join Date: Mar 2007
Location: USA
Posts: 406
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to JustinStudios
Re: php

Code: Select all
<?php
header ("Location: page_to_go_to.php");
?>
Very first thing in the document or it won't work. As a matter of fact, most people just put this and only this in the document, so save this to a php file and submit the form to it. Then check to see if successful and based on its success submit it to the correct page.

Code: Select all
if ($_POST['user'] == "Tom")
    header ("Location: Tom.php");
else
    header ("Location: notTom.php");
Thats just a sample to give you an idea, Its not the best coding for security.
Reply With Quote
  #5 (permalink)  
Old Apr 20th, 2007, 17:49
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: php

just a note :

Allthough u cannot send any header information before using the header(location""); command... you can run sql queries and any other php as long as it doesnt output anything to the screen
Reply With Quote
  #6 (permalink)  
Old Apr 23rd, 2007, 13:32
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: php

or with javascript -> doesn't matter where in the page

Code: Select all
$content="<script type='text/javascript'>document.location.href='tom.php';</script>";
Reply With Quote
Reply

Tags
login, php, redirect

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:32.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43