PDA

View Full Version : HotLink Protection Mini Script - Wikid enit



TheProtege
06-09-2008, 08:46 AM
Okai ladies and gents, and little scripters (you 1337 *****)

Here's some PHP & Lil Apache rewrite for you

Basically, I got bored and coded this up. It allows people to hotlink for a period of time, say 1 minute, or 50 hours?

Its not the best way to do it and could probably changed > alot <

Heres the main part of it...


<?php
mysql_connect( 'localhost', 'dev_hotLink', 'hottie' ) or die( 'Error Mysql DB' );
mysql_select_db( 'dev_hotLinks' );

function createImg( $i )
{
$f = @file_get_contents( $i );
$iS = imagecreatefromstring( $f );
header( 'content-type: image/png' );
imagepng( $iS );
imagedestroy( $iS );
}

function hotLink( $i, $t, $a )
{
if( $i != '' && $t != '' )
{
if( is_numeric( $t ) )
{
$iS = rand() . '-imageHotlink-' . rand();
if( $q = mysql_query( 'INSERT INTO `hotlinks` (`id`, `img`, `session`, `timeout`, `time`) VALUES (NULL, "' . mysql_real_escape_string( $i ) . '", "' . $iS . '", "' . ( $t * 60 ) . '", "' . time() . '");' ) )
{
echo( '<img src="images/' . $iS . '" alt="' . $a . '" />' );
}
}
else
{
echo( '<img src="error.jpg" alt="' . $a . '" />' );
}
}
else
{
echo( '<img src="error.jpg" alt="' . $a . '" />' );
}
}

function findImage( $s )
{
if( $s != '' )
{
if( $q = mysql_query( 'SELECT * FROM `hotlinks` WHERE `session` = "' . mysql_real_escape_string( $s ) . '"' ) )
{
if( mysql_num_rows( $q ) >= 1 )
{
if( $f = mysql_fetch_array( $q ) )
{
if( abs( ( time() - $f[ 'time' ] ) ) <= $f[ 'timeout' ] )
{
createImg( $f[ 'img' ] );
}
else
{
mysql_query( 'DELETE FROM `hotlinks` WHERE `hotlinks`.`id` = "' . $f[ 'id' ] . '" LIMIT 1' );
createImg( 'hotlink.jpg' );
}
}
}
else
{
createImg( 'hotlink.jpg' );
}
}
else
{
createImg( 'error.jpg' );
}
}
else
{
createImg( 'error.jpg' );
}
}
?>

I'ma post the folder here, so you can see how it all works alltogether, if ur interested.

Heres the SQL => http://dev.e-mx.co.uk/dev_hotLinks.sql
Heres the ZIP => http://dev.e-mx.co.uk/hotlink.zip

FLAME FLAME FLAME :eusa_danc

xxxxxxx
Protege

Flisker
06-09-2008, 12:12 PM
very nice of you to rlease :)

Meti
06-09-2008, 12:33 PM
nice of you giving this out.

TheProtege
06-09-2008, 12:55 PM
http://dev.e-mx.co.uk/hotLink

For a live preview, that image times out 1minute :P

Excellent
06-09-2008, 01:02 PM
http://dev.e-mx.co.uk/hotLink

For a live preview, that image times out 1minute :PIs it cool to have your trousers pulled down like that? I'm confused.

TheProtege
06-09-2008, 01:04 PM
Nuh I dont think it is, but it was like in my music folder and it was the folder open at the time :P

Dentafrice
06-09-2008, 01:40 PM
This wasn't a necessary post at all. You're trying to "troll", and you're not very good at it.

----

On topic, it looks nice :) I might have a play with it later. Thanks for releasing it.

Excellent
06-09-2008, 01:42 PM
This wasn't a necessary post at all. You're trying to "troll", and you're not very good at it.

----

On topic, it looks nice :) I might have a play with it later. Thanks for releasing it.Okay.. okay.. just because your dummy is too sour to taste don't start spitting it out. I wasn't insulting Theprotege, merely making a comment on the CD cover he chose.

OT: The script is actually great, would stop idiots from claiming bandwidth ;) Well done.

TheProtege
06-09-2008, 01:48 PM
Thank you :) xxxx

Dentafrice
06-09-2008, 01:48 PM
Okay.. okay.. just because your dummy is too sour to taste don't start spitting it out. I wasn't insulting Theprotege, merely making a comment on the CD cover he chose.

OT: The script is actually great, would stop idiots from claiming bandwidth ;) Well done.

Okay.. okay.. just because your dummy is too sour to taste don't start spitting it out. I wasn't insulting Theprotege, merely making a comment on the CD cover he chose.

Aww.. "my dummy is too sour", where did you get that from, "Insults for Dummies" (ISBN: 011EXCELLENT011).

There was no need to make a comment on his "cd cover", if you haven't noticed.. this thread is about a HotLink Protection Script, not the CD cover in his link.

If you wanted to talk to him about that, you could have PMed him.

Excellent
06-09-2008, 01:50 PM
Aww.. "my dummy is too sour", where did you get that from, "Insults for Dummies" (ISBN: 011EXCELLENT011).

There was no need to make a comment on his "cd cover", if you haven't noticed.. this thread is about a HotLink Protection Script, not the CD cover in his link.

If you wanted to talk to him about that, you could have PMed him.I'm not going to respond to that as I think you're just trying to score childish points. If you wish to continue this dentafrice PM me and don't wreck the thread eh? ;)

Protege: Isn't there a way of just stopping hotlinking fullstop with that script?

Dentafrice
06-09-2008, 01:53 PM
Ha, you took my idea of the "PM" and decided to turn it around, doesn't work that way buddy.


I'm not going to respond to that as I think you're just trying to score childish points.

Yet you constantly try to start an e-argument in almost every thread I post it? That doesn't sound childish to me :rolleyes:

Excellent
06-09-2008, 01:54 PM
Ha, you took my idea of the "PM" and decided to turn it around, doesn't work that way buddy.



Yet you constantly try to start an e-argument in almost every thread I post it? That doesn't sound childish to me :rolleyes:No no I just feel it's not right to hijack a thread that is useful unlike others..;) Shh now sonny ;)

Dentafrice
06-09-2008, 01:57 PM
Yet you hijack almost every thread you visit. Don't tell me what to do.

Excellent
06-09-2008, 02:02 PM
Yet you hijack almost every thread you visit. Don't tell me what to do.Says the guy who in almost every thread feels the need to act like a big boy? Ooo, touched a nerve? Come on, you're wiser than this dentafrice, take it to the private messaging system yeah?

Dentafrice
06-09-2008, 02:04 PM
I don't need to act like a big boy, I am a big boy, and am quite older then you.

Quit stooping down to levels of a 13 year old. You're not going to "touch my nerve", you're like 12, why would I care about you?


Edited by Flisker (Forum Moderator): Posts merged due to forum lag.

TheProtege
06-09-2008, 02:07 PM
Reminds me of "LETS TAKE DIZ SHIZ OUTSIDE BLUD ENIT" anyway guys, I'm emotionally angered to see you needing to argue in a PM, its quite funny watching you get owned Exc so please, continue.

Anymore comments on it, plz.

Excellent
06-09-2008, 02:08 PM
I don't need to act like a big boy, I am a big boy, and am quite older then you.

Quit stooping down to levels of a 13 year old. You're not going to "touch my nerve", you're like 12, why would I care about you?The only thing big about you is the size of your head okay? You are 1-2 years older than me congratulations :eusa_clap Seems I already touched it don't it denta ;) Add 4 years.

Edit: I don't see how I'm being owned but if you want this to continue, sure, lets wreck the thread :)

Edited by SyrupyMonkey (Forum Super Moderator): Please do not insult other forum members, thanks.

Dentafrice
06-09-2008, 02:10 PM
Aww thanks! I do have a large head, I guess it is to cover my large brain.

No, you haven't touched my nerve, I just find it funny that you're still sitting here getting owned, as James said.

Excellent
06-09-2008, 02:12 PM
Aww thanks! I do have a large head, I guess it is to cover my large brain.

No, you haven't touched my nerve, I just find it funny that you're still sitting here getting owned, as James said.I meant the bubble contained around it that needs to be popped by a rather large pin but if you want to continue to insert your head further into your anus, carry on :) I don't get how I'm getting owned? I'm basically slapping your *** on a forum? You couldn't own anything even if you purchased it Dentafrice.

Edited by SyrupyMonkey (Forum Super Mod.): Please do not insult other forum members, thanks.

Dentafrice
06-09-2008, 02:15 PM
I meant the bubble contained around it that needs to be popped by a rather large pin but if you want to continue to insert your head further into your anus, carry on :) I don't get how I'm getting owned? I'm basically slapping your *** on a forum? You couldn't own anything even if you purchased it Dentafrice.
You seem to have quite an obsession with my anus, you okay? You're not going to get any of it.


I don't get how I'm getting owned? I'm basically slapping your *** on a forum?

You're still not going to get any of me.. quit talking about slapping my body parts.. I'm straight.


You couldn't own anything even if you purchased it Dentafrice.

That was just.. pathetic.. again, been reading up on your "Insults for Dummies" book? Sounds like something that would be in there.

Look kid, you're making yourself look stupid.

Excellent
06-09-2008, 02:19 PM
You seem to have quite an obsession with my anus, you okay? You're not going to get any of it.



You're still not going to get any of me.. quit talking about slapping my body parts.. I'm straight.



That was just.. pathetic.. again, been reading up on your "Insults for Dummies" book? Sounds like something that would be in there.

Look kid, you're making yourself look stupid.No dentafrice I don't take everything as a sexual remark, you dirty little child. What other word could I use for your head being placed somewhere? Unless your head is contained in a sandbox I cannot use that. It was just as pathetic as your attempt at trying to make me out to be some homosexual, funny that isn't it :) Insults for dummies? Boy is there a book out there actually called that? I suppose you'd know though eh? ;)

TheProtege
06-09-2008, 02:22 PM
No dentafrice I don't take everything as a sexual remark, you dirty little child. What other word could I use for your head being placed somewhere? Unless your head is contained in a sandbox I cannot use that. It was just as pathetic as your attempt at trying to make me out to be some homosexual, funny that isn't it :) Insults for dummies? Boy is there a book out there actually called that? I suppose you'd know though eh? ;)

That was a pathetic come back.

Comments on the script plz.

Dentafrice
06-09-2008, 02:23 PM
No dentafrice I don't take everything as a sexual remark, you dirty little child. What other word could I use for your head being placed somewhere? Unless your head is contained in a sandbox I cannot use that. It was just as pathetic as your attempt at trying to make me out to be some homosexual, funny that isn't it :) Insults for dummies? Boy is there a book out there actually called that? I suppose you'd know though eh? ;)
Ahh this is even getting funnier, you're loosing your temper.

You don't have to take it as a sexual remark.. you just have some fascination with talking about my anus, in every thread.. kind of scares me to be honest.. :rolleyes:


It was just as pathetic as your attempt at trying to make me out to be some homosexual, funny that isn't it

It is quite funny, because you just feel to urge to talk about "slapping my ***" and talking about your fantasies with "my head up my anus".


Insults for dummies? Boy is there a book out there actually called that? I suppose you'd know though eh?

I'm not sure if there is, but I'm sure if there was.. you would have it in your library :rolleyes:

It's just that your insults are pathetic, I mean just look at it.. "you couldn't own anything if you purchased it". ha.

Excellent1
06-09-2008, 02:33 PM
*Removed*


Edited by ,Jess, (Forum Super Moderator): Please do not insult other forum members or cause arguments.

Dentafrice
06-09-2008, 02:36 PM
*Removed*



Edited by ,Jess, (Forum Super Moderator): Please do not argue with other forum members.

Excellent1
06-09-2008, 02:40 PM
*Removed*



Edited by ,Jess, (Forum Super Moderator): Please do not insult other forum members or cause arguments.

Dentafrice
06-09-2008, 02:45 PM
*Removed*



Edited by ,Jess, (Forum Super Moderator): Please do not argue with other forum members.

Excellent1
06-09-2008, 02:51 PM
*Removed*



Edited by ,Jess, (Forum Super Moderator): Please do not insult other forum members or cause arguments.

Dentafrice
06-09-2008, 02:54 PM
*Removed*



Edited by ,Jess, (Forum Super Moderator): Please do not argue with other forum members.

Excellent1
06-09-2008, 02:57 PM
*Removed*



Edited by ,Jess, (Forum Super Moderator): Please do not argue with other forum members.

Dentafrice
06-09-2008, 02:59 PM
*Removed*



Edited by ,Jess, (Forum Super Moderator): Please do not argue with other forum members.

TheProtege
06-09-2008, 03:52 PM
OKAY YOU BOTH DONE I WANT COMMENTS ON MY SCRIPT PLEASEEE NO MORE TROLLING PLZ THX UZ XXXX

Hypertext
06-09-2008, 06:02 PM
Good script, could be much better with a few tweaks, like not using parenthesis in language constructs, but overall it's good.

Agnostic Bear
06-09-2008, 08:54 PM
Okai ladies and gents, and little scripters (you 1337 *****)

Here's some PHP & Lil Apache rewrite for you

Basically, I got bored and coded this up. It allows people to hotlink for a period of time, say 1 minute, or 50 hours?

Its not the best way to do it and could probably changed > alot <

Heres the main part of it...


<?php
mysql_connect( 'localhost', 'dev_hotLink', 'hottie' ) or die( 'Error Mysql DB' );
mysql_select_db( 'dev_hotLinks' );

function createImg( $i )
{
$f = @file_get_contents( $i );
$iS = imagecreatefromstring( $f );
header( 'content-type: image/png' );
imagepng( $iS );
imagedestroy( $iS );
}

function hotLink( $i, $t, $a )
{
if( $i != '' && $t != '' )
{
if( is_numeric( $t ) )
{
$iS = rand() . '-imageHotlink-' . rand();
if( $q = mysql_query( 'INSERT INTO `hotlinks` (`id`, `img`, `session`, `timeout`, `time`) VALUES (NULL, "' . mysql_real_escape_string( $i ) . '", "' . $iS . '", "' . ( $t * 60 ) . '", "' . time() . '");' ) )
{
echo( '<img src="images/' . $iS . '" alt="' . $a . '" />' );
}
}
else
{
echo( '<img src="error.jpg" alt="' . $a . '" />' );
}
}
else
{
echo( '<img src="error.jpg" alt="' . $a . '" />' );
}
}

function findImage( $s )
{
if( $s != '' )
{
if( $q = mysql_query( 'SELECT * FROM `hotlinks` WHERE `session` = "' . mysql_real_escape_string( $s ) . '"' ) )
{
if( mysql_num_rows( $q ) >= 1 )
{
if( $f = mysql_fetch_array( $q ) )
{
if( abs( ( time() - $f[ 'time' ] ) ) <= $f[ 'timeout' ] )
{
createImg( $f[ 'img' ] );
}
else
{
mysql_query( 'DELETE FROM `hotlinks` WHERE `hotlinks`.`id` = "' . $f[ 'id' ] . '" LIMIT 1' );
createImg( 'hotlink.jpg' );
}
}
}
else
{
createImg( 'hotlink.jpg' );
}
}
else
{
createImg( 'error.jpg' );
}
}
else
{
createImg( 'error.jpg' );
}
}
?>I'ma post the folder here, so you can see how it all works alltogether, if ur interested.

Heres the SQL => http://dev.e-mx.co.uk/dev_hotLinks.sql
Heres the ZIP => http://dev.e-mx.co.uk/hotlink.zip

FLAME FLAME FLAME :eusa_danc

xxxxxxx
Protege

Why do you have


header( 'content-type: image/png' );when all the images are generated as .jpg?


Good script, could be much better with a few tweaks, like not using parenthesis in language constructs, but overall it's good.

Wow, when will you learn that using parenthesis is a preference, there is no "right or wrong" unless you're writing scripts for huge web sights, then there might be a benefit of not using them.

TheProtege
06-09-2008, 09:16 PM
png is a better quality format.

Agnostic Bear
06-09-2008, 09:26 PM
png is a better quality format.

Depends entirely on how you save the file.

TheProtege
06-09-2008, 09:55 PM
aw ur so cute awwhh when u go serious, come here cuddly big teddy bear!!

Hypertext
06-09-2008, 11:47 PM
Wow, when will you learn that using parenthesis is a preference, there is no "right or wrong" unless you're writing scripts for huge web sights, then there might be a benefit of not using them.
On php.net it actually says its bad. If your so worried I'm lying go find it.

png is a better quality format.
That totally depends on the image.

TheProtege
06-09-2008, 11:49 PM
On php.net it actually says its bad. If your so worried I'm lying go find it.

That totally depends on the image.
Jpeg -> A compression technique for color images that can reduce files sizes to about 5% of their normal size. Some detail is lost in the compression.

Dentafrice
06-09-2008, 11:51 PM
On the other hand, JPEG is not as well suited for line drawings and other textual or iconic graphics, where the sharp contrasts between adjacent pixels cause noticeable artifacts. Such images are better saved in TIFF format (for local usage) or in GIF or PNG format (for web usage).

yeah..

Hypertext
06-09-2008, 11:51 PM
Jpeg -> A compression technique for color images that can reduce files sizes to about 5% of their normal size. Some detail is lost in the compression.



Things have different reasons, for a totally blank white image thats 1000px by 1000px there will be no difference. For a complex image png should be used. For an animated image a gif should be used... all image types have different uses.

TheProtege
06-09-2008, 11:52 PM
yeh thats true, you can always add that.

Dentafrice
07-09-2008, 12:06 AM
Things have different reasons, for a totally blank white image thats 1000px by 1000px there will be no difference. For a complex image png should be used. For an animated image a gif should be used... all image types have different uses.
Yeah, but why would anyone upload a blank 1000x1000 image? Image quality doesn't matter then of course.. but you're just putting out a bad eaxmple.

Hypertext
07-09-2008, 05:51 AM
Your being pedantic, it was an easy example to think of, and there are better examples, but mine will suffice in order to prove concept.

Agnostic Bear
07-09-2008, 09:11 AM
Hurf durf lossless jpeg format.


Your being pedantic, it was an easy example to think of, and there are better examples, but mine will suffice in order to prove concept.

Up here it's pretty tight

lolwut
07-09-2008, 11:48 AM
Aww.. "my dummy is too sour", where did you get that from, "Insults for Dummies" (ISBN: 011EXCELLENT011).

There was no need to make a comment on his "cd cover", if you haven't noticed.. this thread is about a HotLink Protection Script, not the CD cover in his link.

If you wanted to talk to him about that, you could have PMed him.


Insults for Dummies... rofl.

TheProtege
07-09-2008, 07:31 PM
dont trollz my threads thx. be nice 4 some feedback if u reply.

Agnostic Bear
07-09-2008, 09:55 PM
dont trollz my threads thx. be nice 4 some feedback if u reply.
So uh, what's your user title about?

TheProtege
09-09-2008, 05:06 PM
cuz im the master, anymore comments plz.

Want to hide these adverts? Register an account for free!