Limiting Bandwidth Per File Or Directory

windows

Guest
I have a feeling this isn't possible without having some type of root access, but here goes.<br /><br />Does anyone know of any script or program that can track number of file views (such as views from hotlinking images) or track the amount of bandwidth said image is consuming based on the number of views? Is it possible to even track these types of stats without having access to some backend process? <br /><br />The reason I was asking is I have a small site that hosts images for people to use as a signature in forums. Was wondering if its possible to track image usage. Thanks.<!--content-->
Have you looked at your AwStats in your cPanel?<!--content-->
<!--QuoteBegin-TCH-Bruce+Jan 22 2005, 07:17 PM--><div class='quotetop'>QUOTE(TCH-Bruce @ Jan 22 2005, 07:17 PM)</div><div class='quotemain'><!--QuoteEBegin-->Have you looked at your AwStats in your cPanel?<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=109217"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br />sorry, I should have mentioned that I'd seen awstats tracking this type of information, but was curious as to whether or not this would be information I could track in a database of my own, like every time the file is viewed remotely (or locally) it could insert a flag into a database with image information tied to a user account. Awstats does that type of thing (showing bandwidth per file/image, etc....) but I wasn't sure if I could access the same data that Awstats does without having a higher level access. <br /><br />Hope that clears up my question <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Sorry, I wasn't sure what you were asking. You could try <!-- w --><a class="postlink" href="http://www.hotscripts.com">www.hotscripts.com</a><!-- w --> and see if you can find a script that tracks downloads. I think that would be what you are looking for.<!--content-->
I think I may have found something that I can use. Thanks for the suggestion.<!--content-->
You're welcome. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
<!--QuoteBegin-Shannon+Jan 22 2005, 02:53 PM--><div class='quotetop'>QUOTE(Shannon @ Jan 22 2005, 02:53 PM)</div><div class='quotemain'><!--QuoteEBegin-->I think I may have found something that I can use. Thanks for the suggestion.<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=109231"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />Hey, don't hold out! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> If you get it working let the rest of us know how you did it.<!--content-->
Will do. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Its not so much a script that I discovered but a process for doing it (looking at source code, but I don't use their code, I like to use a way of doing something in my own way - my own code rather). You would do <a href="http://www.something.com/your_image.php?id=xxxx" target="_blank">http://www.something.com/your_image.php?id=xxxx</a> and along mod_rewrite somehow in there it somehow servers up the image, but i'm still working on that part. <br /><br />But linking to your image that way, you can update a database record each time the file is accesed (using code inside the php page), even if the image is included in a page somewhere like a forum. If you know the file size, you can get a rough estimate of how much bandwidth the file has used by multiplying the number of times accessed by size as well as the number of times each image has been viewed. <br /><br />I'll have to remember this post and update you on how it worked if I can ever get it working on the revised site that i'm working on.<!--content-->
I hate double posting, but heres a quick example of what I've done with this since a few of you were interested in how it would work.....<br /><br />Here is a few lines of code i put in a test.php file to opening the image and tossing it into a buffer.....<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?<br />$img = $_GET['img'];<br />$img = preg_replace('/[^a-z0-9A-Z.]/', '_', $img);<br />Header("Content-type: image/x-png");<br />$fn=fopen("/home/your_account/public_html/imagehost/$img","r");<br />fpassthru($fn);<br />?><!--c2--></div><!--ec2--><br /><br />Here is a quick demonstration that I threw up as a test....<br /><a href="http://www.reversedreality.com/imagehost/TCH_forums.php" target="_blank">http://www.reversedreality.com/imagehost/TCH_forums.php</a><br /><br />inside the actual test php is where you can track views, etc... since each time that file is viewed or looked at, it has to hit that page where you can do various neat and fun stuff.<br /><br />Hope this helps out anybody who has similar ideas for a image hosting site.<!--content-->
That's great. Thanks Shannon! And now it's memorialized for all who follow and search the forums. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />(Memorialized - a term a lawyer friend of mine uses to mean CYA.)<!--content-->
 
Back
Top