php include

Status
Not open for further replies.

monsterm

New Member
Messages
44
Reaction score
0
Points
0
i wanted to put a password on my main page so ppl cant see what im doing untill im finish making the page but i get 3 lines of errors and i think its something has to do with my sites php version or something like that


Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/monsterm/public_html/main/home.php on line 2

Warning: include(http://monstermatt2.pcriot.com/scripts/password_protect.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/monsterm/public_html/main/home.php on line 2

Warning: include() [function.include]: Failed opening 'http://monstermatt2.pcriot.com/scripts/password_protect.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/monsterm/public_html/main/home.php on line 2


and this is the script i put on my page

PHP:
<?php
include("http://monstermatt2.pcriot.com/scripts/password_protect.php"); 
?>

any way i can fix this
 
Last edited:

adamparkzer

On Extended Leave
Messages
3,745
Reaction score
81
Points
0
Not quite sure what exactly the problem is - I tried visiting the page of the script and it appears to be loading fine. Try making it local (such as using "scripts/password_protect.php" instead of the absolute URL with the HTTP.
 
Last edited:

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
If URL fopen wrappers are disabled, you can't access URIs as files.

Including a remote page will execute the page remotely and include the result. If you want to import the source of password_protect.php, it won't work. If password_protect.php is actually on the same server, use a normal file path, not a URI. Read the PHP documentation for the include statement.

Better than writing your own script is to use Apache's built-in password protection. It's easy to set up using cPanel.
 

Hoobrum

Member
Messages
60
Reaction score
1
Points
8
do it locally instead of globally
Code:
<?php
include("scripts/password_protect.php"); 
?>
 
Last edited:

monsterm

New Member
Messages
44
Reaction score
0
Points
0
Try making it local

thx for that and then i had to put it in the same folder as my webpage cus i still got a error but now its all fixed

thx


Edit:
new error

after i login into my password protected page i get this message

Warning: Cannot modify header information - headers already sent by (output started at /home/monsterm/public_html/main/scripts/password_protect.php:1) in /home/monsterm/public_html/main/scripts/password_protect.php on line 128

what dos this mean i dont get it
 
Last edited:

moinkhan

New Member
Messages
21
Reaction score
0
Points
0
monsterm, my guess is you'll want to tweak your password protection script to work, but if you're open to other alternatives, try Apache's built-in password protection (via cPanel) as suggested by "mission". It worked for me.
 

zapzack

New Member
Messages
606
Reaction score
19
Points
0
thx for that and then i had to put it in the same folder as my webpage cus i still got a error but now its all fixed

thx


Edit:
new error

after i login into my password protected page i get this message

Warning: Cannot modify header information - headers already sent by (output started at /home/monsterm/public_html/main/scripts/password_protect.php:1) in /home/monsterm/public_html/main/scripts/password_protect.php on line 128

what dos this mean i dont get it

If you could paste the whole PHP file in code tags, I might be able to help you out.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
after i login into my password protected page i get this message

Warning: Cannot modify header information - headers already sent by (output started at /home/monsterm/public_html/main/scripts/password_protect.php:1) in /home/monsterm/public_html/main/scripts/password_protect.php on line 128

what dos this mean i dont get it

Did you try searching the forums or Google?
 
Status
Not open for further replies.
Top