DPChallenge: A Digital Photography Contest You are not logged in. (log in or register
 

DPChallenge Forums >> Tips, Tricks, and Q&A >> PHP Include - or something similar
Pages:  
Showing posts 1 - 10 of 10, (reverse)
AuthorThread
06/04/2006 07:38:55 AM · #1
I am trying to include the page:
//www.samchadwickphoto.com/mailshot/?p=subscribe&id=1
created by the program phplist for newsletter subscriptions
into the page:
//www.samchadwickphoto.com/subscribe.htm
instead of just having the link I have there today.

I have tried using the code:

but it doesn't seem to work.

Can anyone tell me what I am doing wrong? Or if there is a better way to pull in the code.
06/04/2006 07:56:19 AM · #2
Take a look at this comment from the PHP manual:

/* This example assumes that www.example.com is configured to parse .php
* files and not .txt files. Also, 'Works' here means that the variables
* $foo and $bar are available within the included file. */

// Won't work; file.txt wasn't handled by www.example.com as PHP
include '//www.example.com/file.txt?foo=1&bar=2';

// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
// local filesystem.
include 'file.php?foo=1&bar=2';

// Works.
include '//www.example.com/file.php?foo=1&bar=2';

$foo = 1;
$bar = 2;
include 'file.txt'; // Works.
include 'file.php'; // Works.

Hope this helps.

Nermi
06/04/2006 08:15:32 AM · #3
So I tried this, but it still didn't work

$p = subscribe;
$id = 1;
include '//www.samchadwickphoto.com/mailshot/index.php';
?>

Also tried this, which also didn't work



Message edited by author 2006-06-04 12:31:33.
06/04/2006 08:41:24 AM · #4
URL fopen wrappers have to be enabled. Look for allow_url_fopen in your php.ini if you have access to it, and make sure it's set to 1. This is usually enabled by default, so it all depends on what version of PHP you're using, and which platform. If your server is Windows and PHP is version less than 4.3, you're out of luck, because include doesn't support fopen wrappers on that platform and in that version.
06/04/2006 08:55:29 AM · #5
I'm on Apache 1.3.34 (Unix) and PHP 4.3.11.
I don't think I have access to php.ini but say that it is set to 1, am I doing anything wrong?

Just tried this also, but that's not working either

06/04/2006 10:09:11 AM · #6
Originally posted by samchad:

I'm on Apache 1.3.34 (Unix) and PHP 4.3.11.
I don't think I have access to php.ini but say that it is set to 1, am I doing anything wrong?

Just tried this also, but that's not working either

Well, that's SSI as I'm sure you know, and not PHP, and your server has to support that as well to work. As far as the include thing goes, you're not really saying what the problem is, just that it doesn't work. I assume you just aren't seeing the included file, and you're not getting any error messages.

In a test file, add this code:



Load the test file into your browser. You'll see the PHP enviornment information. Search for allow_url_fopen (should be right near the top). If it is off, trying to include URLs with the "include" directive won't work. It is indeed a security issue, so I wouldn't be surprised if your host has turned it off.
06/18/2006 10:17:37 AM · #7
Louis, if you're still around I've just got around to revisiting this.
Created a test file:
//www.samchadwickphoto.com/test.htm
but you'll see that the page is blank.

Code used:


Untitled Document






06/18/2006 10:48:33 AM · #8
I don't know PHP well but have you tried the require or require_once verbs instead of include? The include could be authority or it might also be that you don't have the full server path correct (hard to say without any errors). The require_once verb I used just required a relative position from the public htmp folder (default root) - not the path.
06/18/2006 07:38:59 PM · #9
technically all you have to do is

phpinfo();
?>

in a text editor, name it like info.php, upload and then point your browser to it. Not sure if all the rest of that html is messing it up.

Message edited by author 2006-06-18 23:39:57.
06/18/2006 07:42:54 PM · #10
when trying to mess with my page (phpNuke) when adding certain things in php in an html page I have to use a " \ " (no quotes) before any "statements."

Message edited by author 2006-06-18 23:43:29.
Pages:  
Current Server Time: 04/09/2025 05:46:04 PM

Please log in or register to post to the forums.


Home - Challenges - Community - League - Photos - Cameras - Lenses - Learn - Help - Terms of Use - Privacy - Top ^
DPChallenge, and website content and design, Copyright © 2001-2025 Challenging Technologies, LLC.
All digital photo copyrights belong to the photographers and may not be used without permission.
Current Server Time: 04/09/2025 05:46:04 PM EDT.