Using an absolute URL in PHP "require" and "include"

9 posts by 2 authors in: Forums > CMS Builder
Last Post: August 12, 2010   (RSS)

Re: [gkornbluth] Using an absolute URL in PHP "require" and "include"

By Chris - August 11, 2010

Hi Jerry,

A require statement is PHP code and not a link. The require will be evalutated by PHP and will never make it into any web pages. I'm not sure how your client will be emailing their web pages, but as long as they're not emailing the PHP source code, no one will ever see the require path.

Does this help?
All the best,
Chris

Re: [chris] Using an absolute URL in PHP "require" and "include"

Hi Chris,

It's not that I'm concerned about seeing the require path.

It's that the "require" path is broken when the page is sent by e-mail, because relative paths don't mean anything in that context.

The client is using the "File">"Send">"Page By Email" feature in IE 7 and 8 to send some pre-formatted eblasts to members.

All the other links/scripts/styles/etc. on their pages are referred to through absolute URLs, but since the "required" path is a path and is relative, it can not resolve.

I was hoping to use either the idea in the post above, or another approach to solve the issue.

Hope that clears up the confusion.

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [chris] Using an absolute URL in PHP "require" and "include"

Followup:

I just purchased your Spambot Email Protector hoping that would be a plugin and eliminate the issue (at least for now). But it also seems to rely on an "include", and so the issue remains.

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Using an absolute URL in PHP "require" and "include"

By Chris - August 11, 2010

Hi Jerry,

IE 7/8 doesn't get to see the require path either. Nor does the mail client.

I have IE 8 here and tried the Send Page by Email option. It seems to work fine except for two things:

1. The flash apps don't show up. This is expected.

2. The CSS is slightly off. I see some JavaScript in the source code which does something with CSS, maybe that's the culprit.

Are you getting different results? What makes you think that the "require path is broken?"
All the best,
Chris

Re: [chris] Using an absolute URL in PHP "require" and "include"

Chris,

Sorry for so much confusion.

I've put together a test page at http://thecmsbcookbook.com/include_test.php to demonstrate the problem.

I have been encrypting the e-mail addresses that are included on any of my client's web pages. The encryption schemes are called by a PHP "include".

I'm using both an older scheme as well as your "Spambot Protector".

One client has been e-mailing some pre-formatted web pages to their membership, and some of those pages have encrypted email addresses embedded in them.

When emailed, the encrypted emails either do not show at all in the e-mail messages, or in the case of spambot protector, do not resolve correctly.

Hope that make this simpler to understand.

Best,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Using an absolute URL in PHP "require" and "include"

By Chris - August 12, 2010

Hi Jerry,

While you're calling the encryption scripts via PHP includes, the problem only exists because the included PHP generates JavaScript, and JavaScript doesn't run in emails.

Basically, it won't be possible to send encrypted email addresses in emails. Alternately, you could have the email address links act like regular links in emails which would take readers to pages where the email address would be available. I can imagine three options:

1. A single static link to a contact page (obviously this is only useful if there are a small number of email addresses.)

2. A link to the web version of the page (where the email link would work correctly, but the user would need to find it again.)

3. A link to a small custom script which simply asks you to click a link to email the email address you've selected. The encrypted code would be sent in the query string.

An example of (1) above would be:

<a
href="http://mywebsite.com/contact"
onclick="window.location='mailto:&#106;&#x65;&#x72;\u0072&#x79;\u0040%6a%6b\u0077&#x65;\u0062\u0064%65%73&#105;\u0067&#x6e;%73%2e&#x63;&#111;&#109;';return false;"
>EMAIL JERRY</a>


Does this help at all?
All the best,
Chris

Re: [chris] Using an absolute URL in PHP "require" and "include"

By Chris - August 12, 2010

Correction:

There are lots of ways to send encrypted emails WITHOUT JavaScript. I believe there's a JavaScript option you can turn off in Spambot Protector. That should work!

Does that help more? :)
All the best,
Chris

Re: [chris] Using an absolute URL in PHP "require" and "include"

Wow. Seems to be a perfect, easy solution.

Thanks to your explanation, it seems that all I needed to do in the spambot email protector was to change the encoding option on the line $GLOBALS['SEP_ENCODING_METHODS']['jsLocation'] = true; to$GLOBALS['SEP_ENCODING_METHODS']['jsLocation'] = false; and it works perfectly, at least when I use Outlook 2010 as the mail client. The Email addresses are still encoded on the web page in both Firefox and IE, but they work in the received email.

I don't know if it will make any difference, but I'm going to run a few more tests with web mail, a few other email clients, and AOL, before releasing this to my client.

But I think you've done it again.

Thank you for solving this one.

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php