php-general Digest 24 Dec 2004 11:02:21 -0000 Issue 3188
Topics (messages 205108 through 205134):
Re: Destroying session data
205108 by: Vail, Warren
205109 by: John Holmes
Re: Using create_function to create an object method
205110 by: Greg Donald
Re: Problem of varibles between webpages
205111 by: edwardspl.ita.org.mo
205112 by: Matthew Sims
205113 by: John Nichel
205114 by: edwardspl.ita.org.mo
205115 by: edwardspl.ita.org.mo
205116 by: John Holmes
205117 by: John Holmes
205118 by: Jason Wong
205119 by: edwardspl.ita.org.mo
205120 by: John Nichel
205121 by: edwardspl.ita.org.mo
205127 by: Matthew Sims
Re: Problem of varibles between webpages]
205122 by: edwardspl.ita.org.mo
205124 by: Jason Wong
205130 by: edwardspl.ita.org.mo
205132 by: Matthew Sims
Parse Flash File for URLs
205123 by: Jason Paschal
Re: PHP Exploit via phpBB?
205125 by: Chris Shiflett
Re: hackers?
205126 by: Chris Shiflett
Next page every second
205128 by: Greg Wardawy
205129 by: Jason Wong
205131 by: Sagar C Nannapaneni
filesize math
205133 by: Sebastian
205134 by: tg-php.gryffyndevelopment.com
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
>
> Okay, lemme see if I understand how it works. Even if it "sees" it as
> garbage, it will not destroy it until the session has ended? or will
> destroy when that time is reached? So can I set
> session.gc_maxlifetime
> to be a low number (e.g., 10 seconds) and it will still behave
> appropriately? Currently, it's set to the default - 1440.
>
Actually the way most garbage cleanup routines work, the session datastore
will be removed regardless of whether it is "in use" or not.
Here comes the tricky stuff, if php has sent a page to the browser and has
satisfied your browsers request, and your user is reviewing the contents of
the page to decide his next action, as far as apache and php are concerned,
that users session is no longer "in use". But, if in the process of
preparing that page, it was using sessions, it would have stamped the
session datastore with a new timestamp, so the garbage cleanup routine would
not consider it an old datastore and remove it. If the user waits a long
time (longer than gc_maxlifetime in seconds) before doing something, when
someone else requests a page, their session could trigger a cleanup process
and your session could be deleted.
If your script is running, fetches the session datastore, and has not
reached the end of it's processing where it rewrites the datastore with
updated data and a new timestamp, if during that time the file is deleted,
no harm done since the save session routine of your script will make sure
the datastore is created and write stuff back into if from it's memory
image. I guess that is what PHP would consider "in use", whereas your user
will consider the time he is mulling over his response as "in use", even if
he gets up to get a cup of coffee before responding.
Warren Vail
--- End Message ---
--- Begin Message ---
From: Philip Thompson <[EMAIL PROTECTED]>
> On Dec 23, 2004, at 2:59 PM, Matt M. wrote:
> > this might be coming into play:
> > http://us4.php.net/session
> >
> > session.gc_maxlifetime integer
> >
> > session.gc_maxlifetime specifies the number of seconds after which
> > data will be seen as 'garbage' and cleaned up.
>
> Okay, lemme see if I understand how it works. Even if it "sees" it as
> garbage, it will not destroy it until the session has ended? or will
> destroy when that time is reached? So can I set session.gc_maxlifetime
> to be a low number (e.g., 10 seconds) and it will still behave
> appropriately? Currently, it's set to the default - 1440.
The gc_maxlifetime setting controls how "old" files can be before the garbage
collection process deletes them, when it's actually started. This is why your
file system must support atime as mentioned before. If the file has not been
accessed in over 1440 seconds (by default) then if the garbage collection
process is started, it'll be deleted.
Like I said in my other post, though, there's only a 1% chance of the garbage
collection process being started (by default). These old files you see are
probably there because you don't have enough traffic to trigger garbage
collection or your using a file system that doesn't support atime.
---John Holmes...
UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html
--- End Message ---
--- Begin Message ---
On Thu, 23 Dec 2004 15:57:08 -0600, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> but I did not see anything in the manual that explicitly states that this will
> not work.
create_function -- Create an anonymous (lambda-style) function
The keyword here is anonymous, as in 'not named'. The anonymous
function you create will have a name but it's not a name you can use,
it's just a randomly generated string for preventing naming
collisions. That's why you must access anonymous functions with a
variable.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
--- End Message ---
--- Begin Message ---
Hello,
For table form format ( sample ),
<form method="" action="">
<table>
<tr><td>Your Name : </td><td><input name="name" size=30
maxlength="60"></td></tr>
<tr><td>Address:</td><td><input name="address" size=30
maxlength="60"></td></tr>
</table>
</form>
"name" and "address" is varible, so how can we pass these two varible without
register_globals function ( actually it is disable ) to another webpage ?
Many thank for your help !
Edward.
John Holmes wrote:
> > From: [EMAIL PROTECTED]
>
> > After disable the globals varibles function...
> > Then how to transfer varibles between webpages with the following ways ?
>
> register_globals has nothing to do with how you pass variables... you still
> use the URL or forms. It only changes how you access them in PHP scripts,
> i.e. using $_GET['var'] instead of $var.
>
> > 1, Table form format.
>
> wtf is this?
>
> > 2, Hyperlink ( click and go to another webpage ) format.
>
> The variables passed in a URL are available in $_GET and $_REQUEST.
I have ever try to use $_GET and $_REQUEST, but fail...
I will send my samples in here.
> > 3, upload file ( through php into database ).
>
> $_FILES
>
> ---John Holmes...
>
> UCCASS - PHP Survey System
> http://www.bigredspark.com/survey.html
--- End Message ---
--- Begin Message ---
> Hello,
>
> For table form format ( sample ),
>
> <form method="" action="">
> <table>
> <tr><td>Your Name : </td><td><input name="name" size=30
> maxlength="60"></td></tr>
> <tr><td>Address�G</td><td><input name="address" size=30
> maxlength="60"></td></tr>
> </table>
> </form>
>
> "name" and "address" is varible, so how can we pass these two varible
> without register_globals function ( actually it is disable ) to another
> webpage ?
>
> Many thank for your help !
>
> Edward.
Your method and action are blank.
<form method="post" action="whatever_page.php">
You need a submit button.
<input type="submit" name="add" value="Submit">
Submit will pass the vars to whichever page action is set to. The vars
will be in the $_POST array, basically $_POST['name'] and
$_POST['address'].
Whatever page action calls, you can have php check that the submit button
was executed like:
<?php
if (isset($_POST['add')):
// whatever you want to do with $_POST['name'] and $_POST['address']
endif;
?>
--
--Matthew Sims
--<http://killermookie.org>
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Hello,
For table form format ( sample ),
<form method="" action="">
<table>
<tr><td>Your Name : </td><td><input name="name" size=30
maxlength="60"></td></tr>
<tr><td>Addressï</td><td><input name="address" size=30 maxlength="60"></td></tr>
</table>
</form>
"name" and "address" is varible, so how can we pass these two varible without
register_globals function ( actually it is disable ) to another webpage ?
Many thank for your help !
Edward.
I guess you ignored the link I posted earlier.
RTFM
http://us4.php.net/manual/en/language.variables.external.php
PS 'Table form format'? No such animal. It's either a form or a
table. In your example, a form inside of a table.
--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
Matthew Sims wrote:
> > Hello,
> >
> > For table form format ( sample ),
> >
> > <form method="" action="">
> > <table>
> > <tr><td>Your Name : </td><td><input name="name" size=30
> > maxlength="60"></td></tr>
> > <tr><td>Address:</td><td><input name="address" size=30
> > maxlength="60"></td></tr>
> > </table>
> > </form>
> >
> > "name" and "address" is varible, so how can we pass these two varible
> > without register_globals function ( actually it is disable ) to another
> > webpage ?
> >
> > Many thank for your help !
> >
> > Edward.
>
> Your method and action are blank.
>
> <form method="post" action="whatever_page.php">
>
> You need a submit button.
>
> <input type="submit" name="add" value="Submit">
>
> Submit will pass the vars to whichever page action is set to. The vars
> will be in the $_POST array, basically $_POST['name'] and
> $_POST['address'].
>
> Whatever page action calls, you can have php check that the submit button
> was executed like:
>
> <?php
> if (isset($_POST['add')):
> ?// whatever you want to do with $_POST['name'] and $_POST['address']
> endif;
> ?>
Hello Matthew,
I have ever try to use $_POST functon, but fail...
May be I need to check the config of php (?ini file ) again , and I want to
know which setting must be enable and which setting must be disable ?
Many thank for your help !
Edward.
--- End Message ---
--- Begin Message ---
John Nichel wrote:
> [EMAIL PROTECTED] wrote:
> > Hello,
> >
> > For table form format ( sample ),
> >
> > <form method="" action="">
> > <table>
> > <tr><td>Your Name : </td><td><input name="name" size=30
> > maxlength="60"></td></tr>
> > <tr><td>Address嚗?/td><td><input name="address" size=30
> > maxlength="60"></td></tr>
> > </table>
> > </form>
> >
> > "name" and "address" is varible, so how can we pass these two varible
> > without register_globals function ( actually it is disable ) to another
> > webpage ?
> >
> > Many thank for your help !
> >
> > Edward.
>
> I guess you ignored the link I posted earlier.
>
> RTFM
>
> http://us4.php.net/manual/en/language.variables.external.php
>
> PS?'Table form format'??No such animal.?It's either a form or a
> table.?In your example, a form inside of a table.
Dear John,
I have just test a sample through the link, but fail...
So, I'm check my php config ( ini file ), and would you mind to tell me which
setting must be disabled / enabled ?
Thank for you help so much !
Edward.
--- End Message ---
--- Begin Message ---
> From: [EMAIL PROTECTED]
> For table form format ( sample ),
>
> <form method="" action="">
> <table>
> <tr><td>Your Name : </td><td><input name="name" size=30
> maxlength="60"></td></tr>
> <tr><td>Address?</td><td><input name="address" size=30
> maxlength="60"></td></tr>
> </table>
> </form>
>
> "name" and "address" is varible, so how can we pass these two varible without
> register_globals function ( actually it is disable ) to another webpage ?
Did you read what I wrote? register_globals has nothing to do with how you pass
variables. You create a form the same way with it ON or OFF... The difference
is in how you access the variables in the PHP script. In this instance, since
you haven't specified a method for your form, GET is assumed. So you can access
the form variables in $_GET['name'] and $_GET['address']. If you used POST in
your form method, then $_POST['name'] and $_POST['address'] can be used.
Regardless of the method, you can use $_REQUEST['name'] and
$_REQUEST['address']... catching on? ;)
---John Holmes...
UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html
--- End Message ---
--- Begin Message ---
> From: [EMAIL PROTECTED]
> Dear John,
>
> I have just test a sample through the link, but fail...
> So, I'm check my php config ( ini file ), and would you mind to tell me which
> setting must be disabled / enabled ?
John is very helpful and loves to dedicate his time to helping new users. If
you don't get a response within the next 10 minutes (he's always available),
just continue to write him and ask him for help. It's the Christmas season,
right???
Merry Christmas John,
---John Holmes...
UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html
--- End Message ---
--- Begin Message ---
On Friday 24 December 2004 11:27, [EMAIL PROTECTED] wrote:
> I have ever try to use $_POST functon, but fail...
HOW did it fail? Please be specific.
> May be I need to check the config of php (ï ini file ) again , and I want
> to know which setting must be enable and which setting must be disable ?
$_POST is only available from version 4.1.0 of PHP onwards, and is enabled by
default. If you're using any version older than that you *really* ought to
upgrade. All this and more are in the link that you had been given, read it.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I'd like to meet the guy who invented beer and see what he's working on now.
*/
--- End Message ---
--- Begin Message ---
John Holmes wrote:
> > From: [EMAIL PROTECTED]
> > Dear John,
> >
> > I have just test a sample through the link, but fail...
> > So, I'm check my php config ( ini file ), and would you mind to tell me
> > which setting must be disabled / enabled ?
>
> John is very helpful and loves to dedicate his time to helping new users. If
> you don't get a response within the next 10 minutes (he's always available),
> just continue to write him and ask him for help. It's the Christmas season,
> right???
>
> Merry Christmas John,
Dear John,
Merry Christmas too first,
I have tried to do the test about the varible ( transfer ) this morning ( China
Time ), but I don't know what happen about the result...
So, I hope you can help me to test and finish the result !
Thanks !
Edward.
--- End Message ---
--- Begin Message ---
John Holmes wrote:
From: [EMAIL PROTECTED]
Dear John,
I have just test a sample through the link, but fail...
So, I'm check my php config ( ini file ), and would you mind to tell me which
setting must be disabled / enabled ?
John is very helpful and loves to dedicate his time to helping new users. If
you don't get a response within the next 10 minutes (he's always available),
just continue to write him and ask him for help. It's the Christmas season,
right???
Merry Christmas John,
---John Holmes...
I will save you a spot next to me...in the firey pits of hell. ;)
Merry Xmas to you too.
--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
Jason Wong wrote:
> On Friday 24 December 2004 11:27, [EMAIL PROTECTED] wrote:
>
> > I have ever try to use $_POST functon, but fail...
>
> HOW did it fail? Please be specific.
The result of $_POST['vars'] is blank !
> > May be I need to check the config of php (嚙?ini file ) again , and I want
> > to know which setting must be enable and which setting must be disable ?
>
> $_POST is only available from version 4.1.0 of PHP onwards, and is enabled by
> default. If you're using any version older than that you *really* ought to
> upgrade. All this and more are in the link that you had been given, read it.
There is two servers for the test, one is using Fedora Core 2 Linux ( come with
php 4.x.x ), another is using W2k + php 5.xx !
So, I think may be the problem of php config...
But I don't know how to fix the problem ( setting of php config ) !
Edward.
--- End Message ---
--- Begin Message ---
> Jason Wong wrote:
>
>> On Friday 24 December 2004 11:27, [EMAIL PROTECTED] wrote:
>>
>> > I have ever try to use $_POST functon, but fail...
>>
>> HOW did it fail? Please be specific.
>
> The result of $_POST['vars'] is blank !
>
>> > May be I need to check the config of php (� ini file ) again , and I
>> want
>> > to know which setting must be enable and which setting must be disable
>> ?
>>
>> $_POST is only available from version 4.1.0 of PHP onwards, and is
>> enabled by
>> default. If you're using any version older than that you *really* ought
>> to
>> upgrade. All this and more are in the link that you had been given, read
>> it.
>
> There is two servers for the test, one is using Fedora Core 2 Linux ( come
> with
> php 4.x.x ), another is using W2k + php 5.xx !
>
> So, I think may be the problem of php config...
> But I don't know how to fix the problem ( setting of php config ) !
>
> Edward.
There's nothing in the php.ini file that would cause $_POST to not work
unless you did something yourself. $_POST is a superglobal var. It's
always available to all pages.
Is php even working for you?
If you just create a test.php with simply:
<?php
phpinfo();
?>
does anything show up in the web browser?
--
--Matthew Sims
--<http://killermookie.org>
--- End Message ---
--- Begin Message ---
?
--- Begin Message ---
Jason Wong wrote:
> On Friday 24 December 2004 11:27, [EMAIL PROTECTED] wrote:
>
> > I have ever try to use $_POST functon, but fail...
>
> HOW did it fail? Please be specific.
The result of $_POST['vars'] is blank !
> > May be I need to check the config of php (嚙?ini file ) again , and I want
> > to know which setting must be enable and which setting must be disable ?
>
> $_POST is only available from version 4.1.0 of PHP onwards, and is enabled by
> default. If you're using any version older than that you *really* ought to
> upgrade. All this and more are in the link that you had been given, read it.
There is two servers for the test, one is using Fedora Core 2 Linux ( come with
php 4.x.x ), another is using W2k + php 5.xx !
So, I think may be the problem of php config...
But I don't know how to fix the problem ( setting of php config ) !
Edward.
--- End Message ---
--- End Message ---
--- Begin Message ---
On Friday 24 December 2004 12:02, [EMAIL PROTECTED] wrote:
> The result of $_POST['vars'] is blank !
And this was the result of using the form that you originally had or the
corrected form that Matthew suggested? If you want the form values to be
available in $_POST then you need to specify method="POST" in your form. May
I suggest that you get a better understanding of HTML before attempting to
use PHP?
> There is two servers for the test, one is using Fedora Core 2 Linux ( come
> with php 4.x.x ), another is using W2k + php 5.xx !
And just what version is 4.x.x? If you want help you have to be *specific*.
Although in this case one can presume that Fedora Core 2 is recent enough to
be shipping with a version of PHP newer than 4.1.0.
> So, I think may be the problem of php config...
> But I don't know how to fix the problem ( setting of php config ) !
You don't need to change any of the default settings in php.ini to make this
work.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"An open mind has but one disadvantage: it collects dirt."
-- a saying at RPI
*/
--- End Message ---
--- Begin Message ---
Jason Wong wrote:
> On Friday 24 December 2004 12:02, [EMAIL PROTECTED] wrote:
> > The result of $_POST['vars'] is blank !
>
> And this was the result of using the form that you originally had or the
> corrected form that Matthew suggested? If you want the form values to be
> available in $_POST then you need to specify method="POST" in your form. May
> I suggest that you get a better understanding of HTML before attempting to
> use PHP?
$_POST['var'] or $_GET['var'] which I also ever tried...
But at this time, I'm vary hard to found out what happen !
Edward.
--- End Message ---
--- Begin Message ---
> Jason Wong wrote:
>
>> On Friday 24 December 2004 12:02, [EMAIL PROTECTED] wrote:
>> > The result of $_POST['vars'] is blank !
>>
>> And this was the result of using the form that you originally had or the
>> corrected form that Matthew suggested? If you want the form values to be
>> available in $_POST then you need to specify method="POST" in your form.
>> May
>> I suggest that you get a better understanding of HTML before attempting
>> to
>> use PHP?
>
> $_POST['var'] or $_GET['var'] which I also ever tried...
> But at this time, I'm vary hard to found out what happen !
>
> Edward.
That doesn't even answer his questions.
First, HTML forms:
http://www.w3.org/TR/REC-html40/interact/forms.html
particually
http://www.w3.org/TR/REC-html40/interact/forms.html#adef-action
--
--Matthew Sims
--<http://killermookie.org>
--- End Message ---
--- Begin Message ---
how might i accomplish this? phpAds does this when a flash banner is
uploaded, and asks if you want to change the URLs it finds. instead
of being diligent and scouring the phpAds code for what I'm looking
for, was hoping someone out there could offer some tips, suggestions,
pseudo-code, etc for how this could be done.
--- End Message ---
--- Begin Message ---
--- "Ashley M. Kirchner" <[EMAIL PROTECTED]> wrote:
> I'd be interested to know what other applications you suggest
> that compares to phpBB. Just for my own curiosity.
As far as I can tell, FUDforum seems to be better in every way except
design. It is substantially better in terms of performance and security.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming Soon http://httphandbook.org/
--- End Message ---
--- Begin Message ---
--- Sebastian <[EMAIL PROTECTED]> wrote:
> im looking for a person or a place that will check or try
> to "break" a site.
This is the least effective means of auditing an application. Letting an
experienced person review your code is much, much better.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming Soon http://httphandbook.org/
--- End Message ---
--- Begin Message ---
Ladies and gentlemen of PHP,
I'm quite new to PHP (coming from Perl) so please don't laugh too hard if
I'm missing something obvious.
My scenario is as follows:
Connect to the MySQL server->grab the data from the table->display the data
of the first row on the web page->sleep 1 second->display the data from the
next row->sleep 1 second... and so forth up to the last row of the table.
I'm able to get the next page displayed by using a link to it (a snippet
below) but I'm out of ideas how to have the next page displayed every
second. So far I'm getting tons of tables displayed on the page or tons of
the variables displayed in a single cell of the table. I could really use
your help here.
Happy Holidays to all of you and many thanks for any suggestions given.
Greg.
#########################################################################################
__SNIP__
<table width="420" height="12" border="3" cellpadding="6" cellspacing="4"
bordercolor="#9900CC">
<tr>
<th width="60" scope="col">Variable</th>
<th width="360" scope="col">Value</th>
</tr>
<?php do { ?>
<tr>
<th width="60">1</th>
<td width="360" nowrap="nowrap" bordercolor="#660066"
bgcolor="#FFFFFF"><div align="right" class="style8"> <?php echo
$row_gail_data['var1']; ?> </div></td>
<tr>
<th width="60">2</th>
<td width="360" nowrap="nowrap" bordercolor="#660066"
bgcolor="#FFFFFF"><div align="right" class="style9"> <?php echo
$row_gail_data['var2']; ?> </div></td>
</tr>
<tr>
<th width="60">3</th>
<td width="360" nowrap="nowrap" bordercolor="#660066"
bgcolor="#FFFFFF"><div align="right" class="style10"> <?php echo
$row_gail_data['var3']; ?> </div></td>
</tr>
<tr>
<th width="60">4</th>
<td width="360" nowrap="nowrap" bordercolor="#660066"
bgcolor="#FFFFFF"><div align="right" class="style7"> <?php echo
$row_gail_data['var4']; ?> </div></td>
</tr>
<?php } while ($row_gail_data = mysql_fetch_assoc($gail_data)); ?>
</table>
</p>
<p><a href="<?php printf("%s?pageNum_gail_data=%d%s", $currentPage,
min($totalPages_gail_data, $pageNum_gail_data + 1), $queryString_gail_data);
?>">Next</a>
</p>
__SNIP__
#########################################################################################
--- End Message ---
--- Begin Message ---
On Friday 24 December 2004 13:09, Greg Wardawy wrote:
> I'm quite new to PHP (coming from Perl) so please don't laugh too hard if
> I'm missing something obvious.
> My scenario is as follows:
> Connect to the MySQL server->grab the data from the table->display the data
> of the first row on the web page->sleep 1 second->display the data from the
> next row->sleep 1 second... and so forth up to the last row of the table.
> I'm able to get the next page displayed by using a link to it (a snippet
> below) but I'm out of ideas how to have the next page displayed every
> second.
Presumably you want the "next page displayed every second" bit to happen
automatically? And this "next page" is actually a whole new page? (ie you
want to display each record on a new page). The only way this can be done is
to use meta-refresh and construct the refresh URL appropriately (similar to
how you are currently doing the "next" link).
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Williams and Holland's Law:
If enough data is collected, anything may be proven by statistical
methods.
*/
--- End Message ---
--- Begin Message ---
If all you want to display each record one by one at a particular interval
of time
you could do this at one page itself...here is the procedure....
1. connect to mysql
2. grab the row you want
3. store the row number in a session variable
4. Add an autorefresh code to ur html..(lot of java scritps are there for
setting the time interval for the page refresh)
5. when the page again loads grab the row number from session and increment
it by one
hope that the logic will work out...
/sagar
----- Original Message -----
From: "Greg Wardawy" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, December 24, 2004 10:39 AM
Subject: [PHP] Next page every second
> Ladies and gentlemen of PHP,
>
> I'm quite new to PHP (coming from Perl) so please don't laugh too hard if
> I'm missing something obvious.
> My scenario is as follows:
> Connect to the MySQL server->grab the data from the table->display the
data
> of the first row on the web page->sleep 1 second->display the data from
the
> next row->sleep 1 second... and so forth up to the last row of the table.
> I'm able to get the next page displayed by using a link to it (a snippet
> below) but I'm out of ideas how to have the next page displayed every
> second. So far I'm getting tons of tables displayed on the page or tons of
> the variables displayed in a single cell of the table. I could really use
> your help here.
> Happy Holidays to all of you and many thanks for any suggestions given.
>
> Greg.
>
############################################################################
#############
> __SNIP__
> <table width="420" height="12" border="3" cellpadding="6" cellspacing="4"
> bordercolor="#9900CC">
> <tr>
> <th width="60" scope="col">Variable</th>
> <th width="360" scope="col">Value</th>
> </tr>
> <?php do { ?>
> <tr>
> <th width="60">1</th>
> <td width="360" nowrap="nowrap" bordercolor="#660066"
> bgcolor="#FFFFFF"><div align="right" class="style8"> <?php echo
> $row_gail_data['var1']; ?> </div></td>
> <tr>
> <th width="60">2</th>
> <td width="360" nowrap="nowrap" bordercolor="#660066"
> bgcolor="#FFFFFF"><div align="right" class="style9"> <?php echo
> $row_gail_data['var2']; ?> </div></td>
> </tr>
> <tr>
> <th width="60">3</th>
> <td width="360" nowrap="nowrap" bordercolor="#660066"
> bgcolor="#FFFFFF"><div align="right" class="style10"> <?php echo
> $row_gail_data['var3']; ?> </div></td>
> </tr>
> <tr>
> <th width="60">4</th>
> <td width="360" nowrap="nowrap" bordercolor="#660066"
> bgcolor="#FFFFFF"><div align="right" class="style7"> <?php echo
> $row_gail_data['var4']; ?> </div></td>
> </tr>
> <?php } while ($row_gail_data = mysql_fetch_assoc($gail_data)); ?>
> </table>
> </p>
> <p><a href="<?php printf("%s?pageNum_gail_data=%d%s", $currentPage,
> min($totalPages_gail_data, $pageNum_gail_data + 1),
$queryString_gail_data);
> ?>">Next</a>
> </p>
> __SNIP__
>
############################################################################
#############
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--- End Message ---
--- Begin Message ---
i made this function and want to know if i am doing the math correctly..
seems to be caculating ok.. $filesize is in bytes.. if the filesize is under
1MB i want to show KBs, if its under 1GB i want to show MB, if its over
1000MB i want to show GB, makes sense? ;)
function byte_format($filesize)
{
if ($filesize < 1000000)
{
return number_format($filesize / 1024, 2, '.', '') . ' KB';
}
else if($filesize > 1000000000)
{
return number_format($filesize / 1024 / 1024 / 1024, 2, '.', '') .
' GB';
}
else
{
return number_format($filesize / 1024 / 1024, 2, '.', '') . ' MB';
}
}
--- End Message ---
--- Begin Message ---
Well, depends on your definition of a kb, mb, gb, etc..
You seem to be mixing definitions here.
One school of thought is that...
1000 bytes = 1 kb
1000 kb = 1 mb
1000 mb = 1 gb
In reality...
1024 bytes = 1 kb
1024 kb = 1 mb
1024 mb = 1 gb
You're checking filesize against the '1000' method then you're returning a
number based on the '1024' method.
You should always be consistant across the board.
-TG
= = = Original message = = =
i made this function and want to know if i am doing the math correctly..
seems to be caculating ok.. $filesize is in bytes.. if the filesize is under
1MB i want to show KBs, if its under 1GB i want to show MB, if its over
1000MB i want to show GB, makes sense? ;)
function byte_format($filesize)
if ($filesize < 1000000)
return number_format($filesize / 1024, 2, '.', '') . ' KB';
else if($filesize > 1000000000)
return number_format($filesize / 1024 / 1024 / 1024, 2, '.', '') .
' GB';
else
return number_format($filesize / 1024 / 1024, 2, '.', '') . ' MB';
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---