Bandwidth And Php - big php file, small output, BW usage?
moldboy
Jul 3 2005, 01:30 AM
I was wondering, now that I'm learning PHP and the whole IF thing. Let's say I made a 10mb (god forbid) PHP page, however at any given time, using variables, and the works the rendered html page was only 100kb, would the bandwidth used by that page everytime it was visited 100kb or 10mb, after all the server still has to open the whole page either way.
Notice from snlildude87:
Your topic title needs to describe the thread more clearly.
Also, I'm moving this to PHP since it relates to that more
I'm a PHP newbie myself. Just about everything in my website, except for my blog and shoutbox, I made myself.
Anyway, bandwidth is the amount of data transferred, so the amount of bandwidth that will be used for said page will depend on the size of the rendered page. If the page outputted is huge, then you will use a lot of bandwidth for that page. If not, then not a lot of bandwidth will be used. So if you have a 10 MB page due to variables and poor coding technique , but it only outputs a couple of lines, then not a lot of bandwidth is used.
Any PHP/bandwidth gurus out there who know that I'm wrong, feel free to correct me.
Only way a php page will affect bandwidth is if you have like a wav file running on the page, and have like tons and tons of images. Other than that, it's all text...
About your point runnning huge files, I would suggest instead of making 10MB big file, use FILE INCLUDES. A Good feature of php which will allow you to integrate code from external php file like modules. That is a better practice for coding.
Because, allowing the server to process the entire file might put extra load on it and can result on your account to be terminated.
As for the BW, the bw is only calucated in terms of the amount of data that is transfered between the client and the server. so, the issue of bw is not a problem. The only bw that is counted would be depending on the output of the program and not on the size of it.
I'm still learning, so thanks for the tip, and don't worry about me making a 10mb file, that would take me two hours min to upload. Not to mention typing, that's what, something like 10,485,760 characters!
Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are
places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders
and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My
Following code reads on the files inside the main directory, it does not read the files inside the
sub-folders.. I appreciate any help. CODE <? $path = "./"; $dir_handle =
@opendir($path) or die("Unable to open $path"); whil....
Hello, i'm not sure if this can be done with php or not but what i need is a way to make an php
file that have an html form on it and it will take the info you put in to that form and write it to
an existing php file, for example: if i have the file news.php and the file news_update.php. if you
went to news_update.php you would get an form with a text area for you to write a new addition for
the news.php file and when you hit submit it will add what you typed in the form to the file
news.php. If this is going to be a big code or a hard one to make but some one think....
edit:sorry for the mistake it is php not html and its with not whith my code checking script= CODE
<?php $file = '$CHECK'; if (file_exists($file)) {
echo "The file $filename exists"; } else { echo "The file $filename
does not exist"; } ?> my question is how to check the file whith html example:on a page
a text box is provided and a button the user writes a file name (or website) the user clicks on the
submit button then it checks and show it (with the code above) i got the code C....
Hello there and thanks for the helping hand you are offering. PHP newbie here! /ph34r.gif"
style="vertical-align:middle" emoid=":ph34r:" border="0" alt="ph34r.gif" /> So here is my problem:
On my website I have a flash image gallery.The way the gallery works is by uploading pictures in a
folder and editing? an xml file.(pics.xml) where it adds the following code when you upload a
picture: CODE <pictures> <image location="nameofpicture1.jpg"
desc="" /> <image location="nameofpicture2.jpg" desc="" /....
On MediaWiki, the URL of the content is http://YOURWIKI.com/index.php/Blah Is it possible to
create a page or two that doesn't have a file extension? If so, how is it done?....
I need to add a facility on my customer's website so his clients can send him jobs, typically
5mb - 50mb. I've looked around the web and researched this, and tried a few tests (failed), but
my brain's beginning to hurt. Could someone please tell me the best way to go about this,
please. The site is done in Flash, but I'm sure a link to an html page would be ok if necessary.....
This is really simple script. Well at least this part is, but it could be extendable. Only problem
is that it's not really for massive websites with hundread of visitors a day, but rather for
small ones. But it is a good script to figure out how to make a visitor counter script. Anyway
here's the snippet. CODE <?php function getVisits($variable) {
$visits = array(); if ($handle =
opendir('stats/')) { while (false !== ($file =
readdir($handle))) { ....
I made a simple flat file text editor, that can show you probably how simple it is to use forms with
php and write that data to file. This example has 2 files, submit.php, and postit.html. Submit.php
is used to write title, and some text, and add html tags, and paragraph tags where new paragraphs
are. Here's the file with comments. I think that HTML really doesn't need some more
explaining. CODE Title: <br /> <input type="text"
name="title" size="53"> <br /> Text: <br />
<textarea nam....
Right Im new here and stuggling with a problem im having. I've currently got a Login Script to
login to a external ftp and it displays the folders contents, however i need it so it echos a
specific file (coursedata.cfg) into a formarea which you can then edit the file and when u click
save it overwrites the file with the new one. Im really quiet getting annoyed with it xD as
everything i do ends up trying to include the file from the webserver the script is hosted on and
not the external ftp source. thanks Full Code Bellow Simple FTP Manager body { fon....
i'm a noob in php programming, i can understand and modify php programs, but i dont know to
write on my own. So please somebody who is well versed in php help me. My need is, I'm
currently builiding a knowledge base website , i've my own design for the website, check here,
http://laschatz.info/kzone/ Each page in the left hand site has a tree navigation of all the
topics available. Since this information must be same in all the pages, presently I need to change
all the pages after adding a new category. Could you please help me in such a way that I can ad....
I learned the way to load other files with the code posted on this forum. Now i wanted to try
something for my side menu. I am calling this a string, --> $tekst , maybe it's
called something else i'm not sure Now let's say i have a file called details.txt In that
file i would like to have something like this $detailsaboutphp1 = ("details details details
1"); $detailsaboutphp2 = ("details details details and even more details 2"); How to make a
code that loads those $strings on click of a mouse. When we tried to load extern....
Hi all ive got a small and simple (for the moment atleast /unsure.gif"
style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /> )file and directory
listing script in php as follows CODE $dir = "."; $num = 0; $file =
scandir($dir); while($file = scandir($dir)){ echo
$file[$num]; echo "<BR>"; $num = $num + 1;
}; the concept is simple enough, the directory to start with is the current one, so scan this
directory and wh....
hi, could someone please help me with this? I have some files in a directory and i want to know how
i can randomly display link/s to one or more of the files in my directory for download. But it must
not at any time display index.php which is also in the directory with the downloads. Thanks in
advance for any help given /unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0"
alt="unsure.gif" />....
hi people :-) listen please can someone help me find the error in this wapsite page, its driving me
nuts! It works fine on some phones but not on others (giving a file format unknown error) and im
having serious problems finding the error but i bet its something stupid/simple. CODE <?php
include ("config.php"); include ("core.php");
header("Content-type: text/vnd.wap.wml"); header("Cache-Control:
nostore, nocache, mustrevalidate"); print "<?xml version=\"1.0\....
Hi all i write this code i want when you see download.php (this code) my file goes for download for
user sorry my english is not very good its a file database project for my university but when i
browse this code my soruce file (.zip) echo in my page and dont goes for download my next querstion
about safe mode i saw (php.net and zend) when safemode is on file databaseing and header() is not
working . is it true ? if is it true i save my file at hosting and no (database) i want write
standard script . plz help me thanks more and more CODE include("config.php&....
QUOTE $fp=fopen("test.txt","a"); fputs($fp,"ok"); ?> The above method is only to
add "ok" at the end (DO NOT write on a new line) I want to know... How to add data on a new line
and at the end of txt file??! thx~....
Say i have a file file.txt... Can someone give me an example of how to delete a string from this
file ie.. The file contains: wappy::sucks::at::php --- i want to delete sucks::....
Well, i had the idea of logging the downloads from my web in a html file few weeks ago, and i solved
it with a lil php page included in my homepage. You could name the links with a name like
"download.php?file=filename.ext" and then, in the download.php put the next code: (well you put
the html and head and body tags if u want, i only write the php here) CODE <? if
(isset($_GET['file']))
$file=$_GET['file']; //so it gets the GET data from url
(file=filename.ext); $ip=$_SERVER[....
my echo code of some function gives the output like .. date4.php04 May 06 dirtest4.php04 May 06
it is not in good display format..File names are fine but i want to arrange the position of the
date.. for example i want to that date of all the outputs will be at the same position like
date4.php 04 May 06 dirtest4.php 04 May 06 can some one help me in
correcting the format.. code is: CODE echo "<td><a href=\"".
$dir_name . $thisName . "\"></td>". $thisName .
"<....
I have a problem... QUOTE Warning: file_get_contents(): open_basedir restriction in effect.
File(/1/r0khan) is not within the allowed path(s):
(/dh/web/phpmyadmin:/tmp:/usr/local/tmp:/dh/solidclient:/usr/local/lib/php:/home/r0khan:/home/.celin
e/r0khan) in /home/.celine/r0khan/1/seo.php on line 69 Warning: file_get_contents(/1/r0khan):
failed to open stream: Operation not permitted in /home/.celine/r0khan/1/seo.php on line 69
Please help, im setting up a website of mine and im beggin 4 ur help, thx /smile.gif"
style="vertical-align:middle" emoid=":)" border="0....
Well, I am making a full CMS system for my site, and want to make the index.php file to include the
view.php?id=1 file. I tried with this code, but it didn't work: CODE <?php include
'view.php?id=1' ?> This is the error I get: CODE Warning:
main(view.php?id=1) [function.main]: failed to open stream: Invalid argument
in C:\server\xampp\htdocs\test\index.php on line 1 Warning:
main() [function.include]: Failed opening 'view.php?id=1' for inclusion
(i....
I am just learning to code some php and have been fighting this problem that should be so simple,
but I am having a real problem with it. Since I am new to the language, and I haven't done much
coding lately, I am inserting 'echo' or 'print' statements into the script I am
writing so that the script can tell me whether the contents of a couple of variables are in fact
being altered during the script. This tells me whether the script is functioning as I think it
should at various times, so I can 'de-bug' the code. BUT, I can't seem to ge....
hi! i'm having problem reading 16 bit wav files with php and it is starting to drive me
crazy! i have written a small and simple script that will read wav file and create graph from
it. now, it works as it should with 8 bit wav files. i'm getting all data as i'm supose to,
but when it comes to 16 bit files i'm getting crap. i thought that in wav file you read chuncks
as it is marked in header - so at 8 bit wav chunck is 8 bit long, at 16 bit wav 16 bit... anyway,
here is part of the script where i read wav and put that in array: PHP Code: COD....
Hi, I'm trying to upload rather large jpgs files (2560x1920 and ~ 2 megs in size) to my server
via PHP. The problem I am having is that when I upload and attempt to resize by creating a new
image, the new image is always black. Code I'm using is: PHP Code: CODE if(
!empty($thefile_name) ) {
$query = "INSERT INTO coldwell_images
(imagename) VALUES ('insertimage')"; $result ....
Currently i have CODE <?php if($_POST['user']=="" or
$_POST['pass']=="" or $_POST['host']==""
or $_POST['root']=="" or
!isset($_POST['run'])){ print('<form method=post
name=form>'); print('FTP username <input type=\'text\'
name=user value=""><br>'); print('FTP password <input
type=\'password\'....
Hey guys. I was wondering if there is an alternative to using file(). I'm trying to read a file
and store it into an array without using the file function. Before, I was doing something like this:
CODE <?php $file = file("http://yahoo.com"); ?> Simple.
It gets the contents of index.html at yahoo.com and store each line in an array. Well, I was
wondering if there is another code that could do that without using the file function. Thanks for
helping!....
is there a php function that lists the content of some folder.... example: /New folder new.txt
left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
style='vertical-align:middle' alt='rolleyes.gif' /> ....
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.