Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-30-2009, 10:20 AM   #1 (permalink)
jnich104
Monkey N00B
 
jnich104's Avatar
 
Join Date: Jun 2008
Location: Nailsea
Posts: 108
jnich104 is on a distinguished road
Send a message via MSN to jnich104
header

how do i say in php

If header = hewparg then go to test
??
Any one help?
__________________
Jamie Nicholls - Feel Free To Ask Questions
jnich104 is offline   Reply With Quote
Old 06-30-2009, 07:43 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,706
sde is on a distinguished road
what is header? in php, you can set header values, .. but in the case are you just usign header as a variable?

i.e.
Code:
if ($header == 'hewpart') {
  // go test something
}
__________________
Mike
sde is offline   Reply With Quote
Old 07-02-2009, 01:36 PM   #3 (permalink)
jnich104
Monkey N00B
 
jnich104's Avatar
 
Join Date: Jun 2008
Location: Nailsea
Posts: 108
jnich104 is on a distinguished road
Send a message via MSN to jnich104
header as in
PHP Code:

header
('location: index.php'); 

so like

PHP Code:

if(header == '') {

header('location: index.php?homepage');

}; 
__________________
Jamie Nicholls - Feel Free To Ask Questions
jnich104 is offline   Reply With Quote
Old 07-02-2009, 01:40 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,706
sde is on a distinguished road
well you know how to set the header, so your problem is you need to get the header info.

check out this function: PHP: headers_list - Manual
__________________
Mike
sde is offline   Reply With Quote
Old 07-02-2009, 04:06 PM   #5 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 841
DJMaze is on a distinguished road
headers_list is pretty buggy in some PHP versions.

Which specific header are you looking for?
Because, most of them have easy access thru $_SERVER['HTTP_*'] (* is wildcard)
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Old 07-03-2009, 03:21 AM   #6 (permalink)
jnich104
Monkey N00B
 
jnich104's Avatar
 
Join Date: Jun 2008
Location: Nailsea
Posts: 108
jnich104 is on a distinguished road
Send a message via MSN to jnich104
I want to be able to locate my header already as URL and be able to do something like

PHP Code:
if(header_location == 'index.php')
  {
      
header('location: index.php?homepage');
      exit();
  } 
But i cant get a script which will read the URL already inplace
__________________
Jamie Nicholls - Feel Free To Ask Questions
jnich104 is offline   Reply With Quote
Old 07-03-2009, 06:28 AM   #7 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,706
sde is on a distinguished road
you don't need to access the header for that, .. just use this

PHP Code:
if ($_SERVER["REQUEST_URI"] == 'index.php') {
  
header('location: index.php?homepage');
  exit();

why are you using just 'homepage' after the '?' .. usually it would be a key/value pair .. i.e. index.php?page=homepage.

and in that case, since both scripts are index.php, then i would just add something like this at the top of index.

PHP Code:
if (!$_GET['page']) {
  
$_GET['page'] == 'homepage';

you don't need to really bother with a redirect.
__________________
Mike
sde is offline   Reply With Quote
Old 07-04-2009, 03:35 AM   #8 (permalink)
jnich104
Monkey N00B
 
jnich104's Avatar
 
Join Date: Jun 2008
Location: Nailsea
Posts: 108
jnich104 is on a distinguished road
Send a message via MSN to jnich104
Thank you, And the reason it is only

PHP Code:
index.php?homepage 
is because i am using a php script which looks for homepage in the url like a server infomation get.

PHP Code:
if (isset($_GET['homepage']))
        {
            echo 
'<span class="header1">Welcome to Hewparg</span>';
            exit();
        }; 
__________________
Jamie Nicholls - Feel Free To Ask Questions
jnich104 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
header files soniw23 Standard C, C++ 2 08-14-2005 02:34 PM
warning cannot create pre compiled header: initialized data in header Nielszz Platform/API C++ 2 06-28-2005 01:06 PM
Including Header Files and their cpp counterparts Rafkin Standard C, C++ 5 02-06-2005 09:48 PM
header not working the way i want it too Imon Fyre PHP 10 02-26-2004 12:46 PM
header gone berserk Hrqls Feedback 8 03-02-2003 12:08 PM


All times are GMT -8. The time now is 06:22 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting