[Phpug] Help with PHP script

Stephen McGuinness smcguinness at gmail.com
Tue Sep 4 11:07:38 IST 2007


Hi Gordon,

The lines:

$ref = $_SERVER['HTTP_REFERER'];
if (strpos($ref,$mosConfig_live_site) === 0 || strpos($ref, 'http') !== 0) {

Assign the referring URL to the variable $ref and then if your
$mosConfig_live_site value is not contained within the $ref value, or
'http' is not in the $ref value the hotlink image will be given out.

Changing the line:

if (strpos($ref,$mosConfig_live_site) === 0 || strpos($ref, 'http') !== 0) {

To

if (1==1 || strpos($ref,$mosConfig_live_site) === 0 || strpos($ref,
'http') !== 0) {

Will always give out your image instead of the hotlink image (1 == 1
will always be true)

Stephen


On 04/09/07, ghooton <ghooton at ue.ucc.ie> wrote:
> Thanks Stephen,
>
> Ok that works, but, I need to have both http and https and it now fails
> for http.  I need http for normal users and https for registered and
> back-end admin. Is there any way to set $mosConfig_live_site
> dynamically ?
>
>
> //Ger
>
> On Tue, 2007-09-04 at 10:16 +0100, Stephen McGuinness wrote:
> > Hi Gerard,
> >
> > What is the value of  $mosConfig_live_site in your configuration.php file?
> >
> > if (strpos($ref,$mosConfig_live_site) === 0 || strpos($ref, 'http') !== 0) {
> >
> >
> > } else {
> >     echo header("Content-Type: image/png");
> >     $img = $mosConfig_live_site."/components/com_zoom/www/images/hotlink.png";
> >     @readfile($img);
> > }
> >
> >
> > You may just need to enter your URL in that variable.
> >
> > Stephen
> >
> >
> > On 04/09/07, ghooton <ghooton at ue.ucc.ie> wrote:
> > >
> > > I have uploaded to http://phpfi.com/260599
> > > The site is:
> > > https://www.john-hooton.com/component/option,com_zoom/Itemid,34/
> > >
> > >
> > > Regards
> > > //Ger
> > >
> > >
> > > On Tue, 2007-09-04 at 09:55 +0100, Ken Guest wrote:
> > > > On Tue, Sep 04, 2007 at 09:24:31AM +0100, ghooton wrote:
> > > > > Hello all,
> > > > > Attached is a php script.
> > > > > I do not know any PHP.
> > > > > When I connect to the site which is running this scrip over SSL
> > > > > I get hotlink.png instead of the thumbnails
> > > > >
> > > > > If anyone can help me (or help me to help myself ) to understand
> > > > > what this script is doing I would be grateful.
> > > > > I see references to  // SSL check and hotlink.png in the script.
> > > > >
> > > > > How can I see what values vars like $type are set to, can I have them
> > > > > written to a log file ?
> > > > >
> > > >
> > > > Gerald,
> > > > your attachment seems to have been stripped out from your email - if you
> > > > uploaded it to http://phpfi.com/ and tell us the URL for viewing it we
> > > > might be able to help.
> > > >
> > > > k.
> > > >
> > > --
> > > Gerard Hooton.
> > > Department of Microelectronic Engineering U.C.C.
> > > Butler Building,
> > > Enterprise Centre,
> > > North Mall.
> > > Cork.
> > >
> > > Tel: +353 21 4904576
> > > Fax: +353 21 4904573
> > > http://www.ue.ucc.ie/
> > >
> > >
> > > _______________________________________________
> > > Phpug mailing list
> > > Phpug at lists.iephpug.org
> > > http://lists.iephpug.org/mailman/listinfo/phpug
> > > Member Map http://www.frappr.com/irishphpusersgroup/
> > > Membership Planner Calendar: http://tinyurl.com/opjd5
> > >
> > _______________________________________________
> > Phpug mailing list
> > Phpug at lists.iephpug.org
> > http://lists.iephpug.org/mailman/listinfo/phpug
> > Member Map http://www.frappr.com/irishphpusersgroup/
> > Membership Planner Calendar: http://tinyurl.com/opjd5
> --
> Gerard Hooton.
> Department of Microelectronic Engineering U.C.C.
> Butler Building,
> Enterprise Centre,
> North Mall.
> Cork.
>
> Tel: +353 21 4904576
> Fax: +353 21 4904573
> http://www.ue.ucc.ie/
>
>
> _______________________________________________
> Phpug mailing list
> Phpug at lists.iephpug.org
> http://lists.iephpug.org/mailman/listinfo/phpug
> Member Map http://www.frappr.com/irishphpusersgroup/
> Membership Planner Calendar: http://tinyurl.com/opjd5
>


More information about the Phpug mailing list