Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
Anyone done anything to prevent the displaying of images within posts unless a user is logged in?

Sponsored Links
Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
Josh's inline images mod has the option to turn them on or off for registered users but nothing for the IMG tag itself that I am aware of.

Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
Yes, I don't allow attachments in the forum; but I'm running around 500-600 online during the day now and some of the sites that have images linked off are upset about the bandwidth being consumed from the people who read those posts.

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
You would have to strip the image tags from the $Body variable if the user is not logged in.... an easy mod, just a line or 2 in the showflat.php and showthreaded.php .
What will make it a bit more complicated is to make it so that the internal links(to greamlins and stuff) are not affected.

Joined: Aug 2002
Posts: 100
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 100
[]PhotoPost said:
Yes, I don't allow attachments in the forum; but I'm running around 500-600 online during the day now and some of the sites that have images linked off are upset about the bandwidth being consumed from the people who read those posts. [/]

Sounds to me that those admins that are bitching need to install some kind of security on their servers to prevent leeching... Yes, it sucks when users "steal" bandwidth, but a simple mod_rewrite .htaccess file will keep their sites free of leeching, and is pretty much their problem if they sit there and let it continue...

Just my .02

Sponsored Links
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Got to agree with Deejay here - I know that I allow leeching of images on my server - so I am one of those 'guilty' ones - and I would imagine that 99% of other threads owners also allow their images to be leeched.


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
I had no idea how many leeches I had until I checked the logs after switching to vertex host. I fixed that up right away.. big drop in bandwidth

Joined: Aug 2002
Posts: 100
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 100
[]Smilesforu said:
I had no idea how many leeches I had until I checked the logs after switching to vertex host. I fixed that up right away.. big drop in bandwidth [/]

When you PAY for your extra bandwidth, you try to cut it down any way possible. I cut my off cause it was getting crazy.

I find mod_re-write to work awesome, and you can replace the linked images with a banner to your site for free advertising everywhere anyone linked to your pics! haha

Deej

Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
can someone explain how to do this?

Im sure I have many, many people linking ot my images. I have about about 2500 smileys.... you know they are all over the place....

Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
Actually, I was thinking that making the images appear would be a "benefit" of registering - a way of getting those 400+ unregsitered users to signup.

Sponsored Links
Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
I figured it out. I have hotlinking enabled now. I had to let some places access it, like here ;-p, but all is well now

Joined: Jun 2003
Posts: 1,025
Junior Member
Junior Member
Offline
Joined: Jun 2003
Posts: 1,025
[]PhotoPost said:
Actually, I was thinking that making the images appear would be a "benefit" of registering - a way of getting those 400+ unregsitered users to signup. [/]
It shouldn't be too hard to create. Threads already has a way to hide images on a user by user basis. It seems like it should be easy enough to convert...for someone with skillz. Maybe someday I will have skillz.

Joined: Mar 2004
Posts: 118
Journeyman
Journeyman
Offline
Joined: Mar 2004
Posts: 118
In showflat.php find
Code
<br />$postrow[$i]['Body'] = $Body;<br />

and replace with
Code
<br />        // cut the images out for anonymous<br />        if ($user['U_Number'] < 2){<br />            if (preg_match("/img src/", $Body)) {<br />                $Body = preg_replace("/<img src=/", "picture:", $Body);<br />            }<br />        }<br />        $postrow[$i]['Body'] = $Body;<br />


In showthreaded.php find
Code
<br />$PrintLastEdit = "";<br />

and replace with
Code
<br />// cut the images out for anonymous<br />if ($user['U_Number'] < 2){<br />    if (preg_match("/img src/", $Body)) {<br />        $Body = preg_replace("/<img src=/", "picture:", $Body);<br />    }<br />}<br /><br />$PrintLastEdit = "";<br />


Kind regards,
PaNTerSan
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Thanks Would be cool if you could trade the image for a simple graphic that says "You must be registered to view this image"


- Allen wavey
- What Drives You?
Joined: Mar 2004
Posts: 118
Journeyman
Journeyman
Offline
Joined: Mar 2004
Posts: 118
Yes - could somenone write preg_replace for:
[*]removal of whole img tag: bla <img src=*> bla => bla bla
[*]replacement /<img src=X[space] or >/ of X with Y => <img src=Y>

Last char after <img src=http://blabla border=1 width=500 > can be space or >


Kind regards,
PaNTerSan
Joined: Aug 2000
Posts: 1,290
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,290
What about a simple css tag for ubbt_reg and ubbt_unreg templates.

For un try:

<style type="text/css">
.post IMG {
display: none;
}
</style>

Works fine on mine.

And for reg try:

<style type="text/css">
.post IMG {
}
</style>


- Custom Web Development
http://www.JCSWebDev.com
Joined: Mar 2004
Posts: 118
Journeyman
Journeyman
Offline
Joined: Mar 2004
Posts: 118


Kind regards,
PaNTerSan
Joined: Aug 2000
Posts: 1,290
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,290


- Custom Web Development
http://www.JCSWebDev.com
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
I came up with adding this snippet to showflat.php just above the $postrow[$i]['Body'] line:

Code
         if ( $Board == "babes" && $user['U_Number'] < 2 ) { <br />          	$Body = preg_replace("/<img src=\"([^\>]*)\">/i","<a href=\"\\1\">click here to view image</a> (You must be registered to view images.)<br />",$Body); <br />         }


I haven't decided on the wording or if I want to even allow the link to the image being displayed; but this works (I only wanted this for a specific forum).

Last edited by PhotoPost; 06/14/2004 8:00 AM.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)