Hello all,

of late I have been using this php snippet to drive the email address of a link

info@<?php echo preg_replace('/^www./','',$_SERVER["HTTP_HOST"]); ?>

But now Im finding that if its used in a https (secure environment) I get an security messgae saying: The information you have entered on this page will be sent over an insecure connection and could be read by a third party. Are you sure you want to send this information?

what do I need to change the code to reflect the https variable so it does not throw the error, especially sibce it in a secure https location.

would there be a differenc if it were $_SERVER["HTTPS_HOST"] ?

TIA

I'm no PHP expert but shouldn't you be using SERVER_NAME, which is set in your webserver config?

It seems there is no issue in your existing code. The current warning may be comming due to use of http in your page. Kindly get this check.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.