Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   Web design and Programming (https://novahq.net/forum/forumdisplay.php?f=32)
-   -   PHP N00by question (https://novahq.net/forum/showthread.php?t=32087)

DevilDog#1 12-30-2005 06:15 PM

PHP N00by question
 
What's the difference b/w

PHP Code:

include('templates/header1.html'); 

and

PHP Code:

require('templates/header1.html'); 

Only relevant replies please ...

Lakie 12-30-2005 06:55 PM

the main difference is that upon an error (ie. the specified file isnt there) a require will give a fatal error and the script will stop there, a include will give a warning and continue with the script...

DevilDog#1 12-30-2005 06:58 PM

uh huh ... include be good, huh?

JonM 12-30-2005 07:03 PM

You use require when requiring files that are for sure needed for the script to work. For instance if you have a file like header.php which connects, sets variables, etc...if it doesn't work you need a fatal error. It could be dangerous to just include it. (i think). Include as mike said just gives a warning and continues on. so include files such as count.php which would count the hits of the site...that's it.

DevilDog#1 12-30-2005 08:17 PM

header () question
 
How common is the usage of hardcoding URL using header () ?

Something like

PHP Code:

header ('Location: [url]http://www.novahq.net/admin/banpage.php[/url]'); 


Edit: BTW THanks Elite. :D

JonM 12-30-2005 09:19 PM

it is common whenever you want to redirect with out a message on the page your redirecting from. If you want a thanks for posting, you will be transfere in 5 seconds META_REFRESH or whatever works better.

Umm i've never seen
PHP Code:

header('Location: <a href="" target="_blank">link</a>'); 

does that really work? if it does then hot dog lol, cuz i could use that.

DevilDog#1 12-30-2005 09:29 PM

I haven't tried refresh yet ... but was just wondering if it be used. Let me know if it actually works ;)

Edit:

Following code works for Refreshing in PURE PHP Environment.

PHP Code:

header ('Location: welcomepage.php');
exit(); 



All times are GMT -5. The time now is 04:14 AM.

Powered by vBulletin®