php-general Digest 11 Mar 2007 08:51:24 -0000 Issue 4670
Topics (messages 250194 through 250216):
Re: looking for two remote functions
250194 by: Németh Zoltán
250195 by: Riyadh S. Alshaeiq
250196 by: Riyadh S. Alshaeiq
250197 by: Németh Zoltán
250199 by: Tijnema !
250202 by: Myron Turner
Re: DB_DataContainer
250198 by: Tijnema !
Variable variables and references
250200 by: Dave Goodchild
250201 by: Tijnema !
250204 by: Matt Carlson
250205 by: Tijnema !
250207 by: M.Sokolewicz
Re: $35 to the first person who can do this XML-parsing PHP script
250203 by: tedd
Re: Joke of the day problem
250206 by: tedd
Back to security
250208 by: Alain Roger
250209 by: Tijnema !
250215 by: Steve Edberg
Re: php, oci8 and oracle
250210 by: buFka
250211 by: buFka
Separating HTML code from PHP code
250212 by: Don Don
250213 by: Robert Cummings
250214 by: Martin Marques
Array mysteries
250216 by: Otto Wyss
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 ---
I'm afraid I don't understand what you want. The size of a file is its
size in bytes, that is its size on the disk. So what else?
greets
Zoltán Németh
2007. 03. 10, szombat keltezéssel 06.07-kor Riyadh S. Alshaeiq ezt írta:
> Thank you Mickey, but I have already looked in there and the function posted
> in the notes is working just fine for getting the size on disk which I am
> not interested in..
>
> Riyadh
>
> -----Original Message-----
> From: Mikey [mailto:[EMAIL PROTECTED]
> Sent: 9/Mar/2007 2:57 PM
> To: [email protected]
> Subject: Re: looking for two remote functions
>
> Riyadh S. Alshaeiq wrote:
> > Hello everybody,
> >
> > I am looking for an HTTP function for getting remote filesizes. Keeping
> in
> > mind that I am NOT interested in getting the "size on disk" figure, I need
> > the actual size of the files when downloaded to a local machine. Please
> let
> > me know if there are any..
> >
> > Another thing, I also need a remote function that gets the created date
> and
> > last modified separately, if possible..
> >
> > Best regards
> >
> >
> >
> >
>
> Try looking here:
>
> http://uk.php.net/manual/en/function.filesize.php
>
> If the function itself isn't of use to you, look further down in the
> notes and I am sure you will find something useful.
>
> Mikey
>
--- End Message ---
--- Begin Message ---
Actually if right click on any file or folder on a machine you will see that
there are two values (Size on disk & Size). Files and folders are stored on
the disk in what is called clusters (a group of disk sectors). Size on disk
refers to the amount of cluster allocation a file is taking up, compared to
file size which is an actual byte count.
As I mentioned before what I want is a function for getting the result for
the Size no for Size on Disk
Riyadh
-----Original Message-----
From: Németh Zolt?n [mailto:[EMAIL PROTECTED]
Sent: 10/Mar/2007 12:27 PM
To: Riyadh S. Alshaeiq
Cc: [email protected]
Subject: Re: [PHP] FW: looking for two remote functions
I'm afraid I don't understand what you want. The size of a file is its
size in bytes, that is its size on the disk. So what else?
greets
Zolt?n Németh
2007. 03. 10, szombat keltezéssel 06.07-kor Riyadh S. Alshaeiq ezt ?rta:
> Thank you Mickey, but I have already looked in there and the function
posted
> in the notes is working just fine for getting the size on disk which I am
> not interested in..
>
> Riyadh
>
> -----Original Message-----
> From: Mikey [mailto:[EMAIL PROTECTED]
> Sent: 9/Mar/2007 2:57 PM
> To: [email protected]
> Subject: Re: looking for two remote functions
>
> Riyadh S. Alshaeiq wrote:
> > Hello everybody,
> >
> > I am looking for an HTTP function for getting remote filesizes. Keeping
> in
> > mind that I am NOT interested in getting the "size on disk" figure, I
need
> > the actual size of the files when downloaded to a local machine. Please
> let
> > me know if there are any..
> >
> > Another thing, I also need a remote function that gets the created date
> and
> > last modified separately, if possible..
> >
> > Best regards
> >
> >
> >
> >
>
> Try looking here:
>
> http://uk.php.net/manual/en/function.filesize.php
>
> If the function itself isn't of use to you, look further down in the
> notes and I am sure you will find something useful.
>
> Mikey
>
--- End Message ---
--- Begin Message ---
Thank you Mickey, but I have already looked in there and the function posted
in the notes is working just fine for getting the size on disk which I am
not interested in, I need the actual size that when you download a file to a
machine you will get..
Riyadh
-----Original Message-----
From: Mikey [mailto:[EMAIL PROTECTED]
Sent: 9/Mar/2007 2:57 PM
To: [email protected]
Subject: Re: looking for two remote functions
Riyadh S. Alshaeiq wrote:
> Hello everybody,
>
> I am looking for an HTTP function for getting remote filesizes. Keeping
in
> mind that I am NOT interested in getting the "size on disk" figure, I need
> the actual size of the files when downloaded to a local machine. Please
let
> me know if there are any..
>
> Another thing, I also need a remote function that gets the created date
and
> last modified separately, if possible..
>
> Best regards
>
>
>
>
Try looking here:
http://uk.php.net/manual/en/function.filesize.php
If the function itself isn't of use to you, look further down in the
notes and I am sure you will find something useful.
Mikey
--- End Message ---
--- Begin Message ---
2007. 03. 10, szombat keltezéssel 12.42-kor Riyadh S. Alshaeiq ezt írta:
> Actually if right click on any file or folder on a machine you will see that
> there are two values (Size on disk & Size). Files and folders are stored on
> the disk in what is called clusters (a group of disk sectors). Size on disk
> refers to the amount of cluster allocation a file is taking up, compared to
> file size which is an actual byte count.
>
> As I mentioned before what I want is a function for getting the result for
> the Size no for Size on Disk
okay then what about this?
function real_filesize_linux($file) {
@exec("filesize $file",$out,$ret);
if ( $ret <> '0' ) return FALSE;
else return($out[0]);
}
if you want it on a remote machine, you should use something like
ssh2_exec() instead of exec()
hope that helps
Zoltán Németh
>
> Riyadh
>
> -----Original Message-----
> From: Németh Zolt?n [mailto:[EMAIL PROTECTED]
> Sent: 10/Mar/2007 12:27 PM
> To: Riyadh S. Alshaeiq
> Cc: [email protected]
> Subject: Re: [PHP] FW: looking for two remote functions
>
> I'm afraid I don't understand what you want. The size of a file is its
> size in bytes, that is its size on the disk. So what else?
>
> greets
> Zolt?n Németh
>
> 2007. 03. 10, szombat keltezéssel 06.07-kor Riyadh S. Alshaeiq ezt ?rta:
> > Thank you Mickey, but I have already looked in there and the function
> posted
> > in the notes is working just fine for getting the size on disk which I am
> > not interested in..
> >
> > Riyadh
> >
> > -----Original Message-----
> > From: Mikey [mailto:[EMAIL PROTECTED]
> > Sent: 9/Mar/2007 2:57 PM
> > To: [email protected]
> > Subject: Re: looking for two remote functions
> >
> > Riyadh S. Alshaeiq wrote:
> > > Hello everybody,
> > >
> > > I am looking for an HTTP function for getting remote filesizes. Keeping
> > in
> > > mind that I am NOT interested in getting the "size on disk" figure, I
> need
> > > the actual size of the files when downloaded to a local machine. Please
> > let
> > > me know if there are any..
> > >
> > > Another thing, I also need a remote function that gets the created date
> > and
> > > last modified separately, if possible..
> > >
> > > Best regards
> > >
> > >
> > >
> > >
> >
> > Try looking here:
> >
> > http://uk.php.net/manual/en/function.filesize.php
> >
> > If the function itself isn't of use to you, look further down in the
> > notes and I am sure you will find something useful.
> >
> > Mikey
> >
>
--- End Message ---
--- Begin Message ---
On 3/10/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
2007. 03. 10, szombat keltezéssel 12.42-kor Riyadh S. Alshaeiq ezt írta:
> Actually if right click on any file or folder on a machine you will see
that
> there are two values (Size on disk & Size). Files and folders are stored
on
> the disk in what is called clusters (a group of disk sectors). Size on
disk
> refers to the amount of cluster allocation a file is taking up, compared
to
> file size which is an actual byte count.
>
> As I mentioned before what I want is a function for getting the result
for
> the Size no for Size on Disk
okay then what about this?
function real_filesize_linux($file) {
@exec("filesize $file",$out,$ret);
if ( $ret <> '0' ) return FALSE;
else return($out[0]);
}
if you want it on a remote machine, you should use something like
ssh2_exec() instead of exec()
hope that helps
Zoltán Németh
He was interested on using it over HTTP, not over SSH...
I don't know if there are faster ways, but you could open a socket to the
host on port 80, get the file, and only read the header where it says
content-length: 400 for example, then you know the file is 400bytes when you
download it.
something like:
$socket = fsockopen($host,$port);
$size = 0;
while($size == 0)
{
$line = fgets($socket);
if(strlen($line) >= 17)
{
if(substr(strtolower($line),0,14) == "content-length")
{
$size = substr($line,16)
}
}
Now your remote file size is in $size.
It is not too fast, but everything in PHP is fast and so is this.
Tijnema
>
> Riyadh
>
> -----Original Message-----
> From: Németh Zolt?n [mailto:[EMAIL PROTECTED]
> Sent: 10/Mar/2007 12:27 PM
> To: Riyadh S. Alshaeiq
> Cc: [email protected]
> Subject: Re: [PHP] FW: looking for two remote functions
>
> I'm afraid I don't understand what you want. The size of a file is its
> size in bytes, that is its size on the disk. So what else?
>
> greets
> Zolt?n Németh
>
> 2007. 03. 10, szombat keltezéssel 06.07-kor Riyadh S. Alshaeiq ezt ?rta:
> > Thank you Mickey, but I have already looked in there and the function
> posted
> > in the notes is working just fine for getting the size on disk which I
am
> > not interested in..
> >
> > Riyadh
> >
> > -----Original Message-----
> > From: Mikey [mailto:[EMAIL PROTECTED]
> > Sent: 9/Mar/2007 2:57 PM
> > To: [email protected]
> > Subject: Re: looking for two remote functions
> >
> > Riyadh S. Alshaeiq wrote:
> > > Hello everybody,
> > >
> > > I am looking for an HTTP function for getting remote filesizes.
Keeping
> > in
> > > mind that I am NOT interested in getting the "size on disk" figure,
I
> need
> > > the actual size of the files when downloaded to a local machine.
Please
> > let
> > > me know if there are any..
> > >
> > > Another thing, I also need a remote function that gets the created
date
> > and
> > > last modified separately, if possible..
> > >
> > > Best regards
> > >
> > >
> > >
> > >
> >
> > Try looking here:
> >
> > http://uk.php.net/manual/en/function.filesize.php
> >
> > If the function itself isn't of use to you, look further down in the
> > notes and I am sure you will find something useful.
> >
> > Mikey
> >
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Tijnema ! wrote:
On 3/10/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
2007. 03. 10, szombat keltezéssel 12.42-kor Riyadh S. Alshaeiq ezt írta:
> Actually if right click on any file or folder on a machine you will
see
that
> there are two values (Size on disk & Size). Files and folders are
stored
on
> the disk in what is called clusters (a group of disk sectors). Size on
disk
> refers to the amount of cluster allocation a file is taking up,
compared
to
> file size which is an actual byte count.
>
> As I mentioned before what I want is a function for getting the result
for
> the Size no for Size on Disk
okay then what about this?
function real_filesize_linux($file) {
@exec("filesize $file",$out,$ret);
if ( $ret <> '0' ) return FALSE;
else return($out[0]);
}
if you want it on a remote machine, you should use something like
ssh2_exec() instead of exec()
hope that helps
Zoltán Németh
He was interested on using it over HTTP, not over SSH...
I don't know if there are faster ways, but you could open a socket to the
host on port 80, get the file, and only read the header where it says
content-length: 400 for example, then you know the file is 400bytes
when you
download it.
something like:
$socket = fsockopen($host,$port);
$size = 0;
while($size == 0)
{
$line = fgets($socket);
if(strlen($line) >= 17)
{
if(substr(strtolower($line),0,14) == "content-length")
{
$size = substr($line,16)
}
}
Now your remote file size is in $size.
It is not too fast, but everything in PHP is fast and so is this.
Tijnema
>
> Riyadh
>
> -----Original Message-----
> From: Németh Zolt?n [mailto:[EMAIL PROTECTED]
> Sent: 10/Mar/2007 12:27 PM
> To: Riyadh S. Alshaeiq
> Cc: [email protected]
> Subject: Re: [PHP] FW: looking for two remote functions
>
> I'm afraid I don't understand what you want. The size of a file is its
> size in bytes, that is its size on the disk. So what else?
>
> greets
> Zolt?n Németh
>
> 2007. 03. 10, szombat keltezéssel 06.07-kor Riyadh S. Alshaeiq ezt
?rta:
> > Thank you Mickey, but I have already looked in there and the
function
> posted
> > in the notes is working just fine for getting the size on disk
which I
am
> > not interested in..
> >
> > Riyadh
> >
> > -----Original Message-----
> > From: Mikey [mailto:[EMAIL PROTECTED]
> > Sent: 9/Mar/2007 2:57 PM
> > To: [email protected]
> > Subject: Re: looking for two remote functions
> >
> > Riyadh S. Alshaeiq wrote:
> > > Hello everybody,
> > >
> > > I am looking for an HTTP function for getting remote filesizes.
Keeping
> > in
> > > mind that I am NOT interested in getting the "size on disk"
figure,
I
> need
> > > the actual size of the files when downloaded to a local machine.
Please
> > let
> > > me know if there are any..
> > >
> > > Another thing, I also need a remote function that gets the created
date
> > and
> > > last modified separately, if possible..
> > >
> > > Best regards
> > >
> > >
> > >
> > >
> >
> > Try looking here:
> >
> > http://uk.php.net/manual/en/function.filesize.php
> >
> > If the function itself isn't of use to you, look further down in the
> > notes and I am sure you will find something useful.
> >
> > Mikey
> >
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
This question has come up before, and out of curiosity I did some
checking. If you use firefox liveheaders, it turns out that the file
size on the linux file system is exactly the size shown in the
content-length header. This is also the same size as returned by php's
filesize() and by the php stat() in its size element. Linux reports the
actual file size, not the storage size, which you can get by asking to
see the number of blocks used to store the file (ls -ls).
I wrote a small perl script which returns the bytes read when a file is
read from the disk and it, too, agrees with the filesize and header
sizes. In Windows, the actual filesize is also returned by filesize and
stat, not the size on disk (filesize uses stat). Also, in the PHP
manual, the fread example uses filesize to set the number of bytes to read:
| contents = fread($handle, filesize($filename));
|The point of this is to read in the exact number of bytes for the file,
not the entire size of the file's storage on disk which would contain
garbage. This has to work on both windows and linux.
Here's the perl script:
use strict;
use Fcntl;
sysopen (FH, "index.htm", O_RDONLY);
my $buffer;
my $len = sysread(FH, $buffer, 8192,0);
print $len,"\n";
If you are really anxious about size you can exec out to this script and
get the file size.
--
_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
--- End Message ---
--- Begin Message ---
In PHP 5 some things changed, and that's why they first check if PHP version
is 5 or greater, if so, it constructs this class and function in PHP5 style,
else it uses older syntax.
You might want to take a look at this manual page:
http://www.php.net/manual/en/migration5.php
Tijnema
On 3/10/07, php trainer <[EMAIL PROTECTED]> wrote:
Could someone explain what this does and why it's beneficial?
Thanks,
Ed
--------------------------------------------------
if (version_compare(phpversion(), '5.0.0', 'ge')) {
class DB_DataContainer_Overload {
function __call($method,$args) {
$retval = null;
$this->___call($method,$args,$retval);
return($retval);
}
}
} else {
eval('
class DB_DataContainer_Overload {
function __call($method,$args,&$retval) {
return($this->___call($method,$args,$retval));
}
}
');
}
--- End Message ---
--- Begin Message ---
Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think
it's a great book, I am confused about variable variables and references -
not the mechanics, just where you would use them.
The subject of variable variables is explained but no examples are given as
to why and where you would utilise them.
As for references, the examples given with regard to passing and returning
by reference in functions is clear, but no real examples are given as to
when this would be a preferred approcah - in fact, the authors stress that
due to PHP's copy-on-write mechanism, it is not a frequently-used approcah.
So my question - are there any 'classic' situations in which either should
be used, and where and when do you guys use them in your real-world efforts?
--
http://www.web-buddha.co.uk
--- End Message ---
--- Begin Message ---
I must say, in all the years i am programming with PHP (about 5-6 years) i
NEVER used references.
So i don't find it useful, but well, if you want to give your variable
content more than one name, you can :)
I think you just need to start programming now, keeping in mind they are
available, but don't use them if it isn't needed.
Tijnema
On 3/10/07, Dave Goodchild <[EMAIL PROTECTED]> wrote:
Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I
think
it's a great book, I am confused about variable variables and references -
not the mechanics, just where you would use them.
The subject of variable variables is explained but no examples are given
as
to why and where you would utilise them.
As for references, the examples given with regard to passing and returning
by reference in functions is clear, but no real examples are given as to
when this would be a preferred approcah - in fact, the authors stress that
due to PHP's copy-on-write mechanism, it is not a frequently-used
approcah.
So my question - are there any 'classic' situations in which either should
be used, and where and when do you guys use them in your real-world
efforts?
--
http://www.web-buddha.co.uk
--- End Message ---
--- Begin Message ---
I've used variable variables probably 5 times in 2 years. They are great when
you need them, but don't usually have a day-to-day use for them.
Here is some sample code of the last time I used it.
if(isset($$key))
{
print($$key);
continue;
} else {
$iquery = "SELECT * FROM `".ROSTER_ITEMSTABLE."` WHERE
`item_name` = '".$iname."' AND `member_id` = '".$row['member_id']."'";
$iresult = $wowdb->query($iquery);
$idata = $wowdb->fetch_assoc($iresult);
$item = new item($idata);
$$key = $item->out();
print $$key;
}
Basically, this is in a for-each loop, that steps through a list of keys for
certain dungeons in World of Warcraft. Instead of putting the data into an
array, I used variable variables to stick the data into a single variable. The
way it works is $key = 'DM'; $$key = $data; The literal translation for $$key
is $DM once the code executes.
Hope this helps.
----- Original Message ----
From: Dave Goodchild <[EMAIL PROTECTED]>
To: PHP-General <[email protected]>
Sent: Saturday, March 10, 2007 5:28:57 AM
Subject: [PHP] Variable variables and references
Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think
it's a great book, I am confused about variable variables and references -
not the mechanics, just where you would use them.
The subject of variable variables is explained but no examples are given as
to why and where you would utilise them.
As for references, the examples given with regard to passing and returning
by reference in functions is clear, but no real examples are given as to
when this would be a preferred approcah - in fact, the authors stress that
due to PHP's copy-on-write mechanism, it is not a frequently-used approcah.
So my question - are there any 'classic' situations in which either should
be used, and where and when do you guys use them in your real-world efforts?
--
http://www.web-buddha.co.uk
--- End Message ---
--- Begin Message ---
On 3/10/07, Matt Carlson <[EMAIL PROTECTED]> wrote:
I've used variable variables probably 5 times in 2 years. They are great
when you need them, but don't usually have a day-to-day use for them.
Here is some sample code of the last time I used it.
if(isset($$key))
{
print($$key);
continue;
} else {
$iquery = "SELECT * FROM `".ROSTER_ITEMSTABLE."` WHERE
`item_name` = '".$iname."' AND `member_id` = '".$row['member_id']."'";
$iresult = $wowdb->query($iquery);
$idata = $wowdb->fetch_assoc($iresult);
$item = new item($idata);
$$key = $item->out();
print $$key;
}
Basically, this is in a for-each loop, that steps through a list of keys
for certain dungeons in World of Warcraft. Instead of putting the data into
an array, I used variable variables to stick the data into a single
variable. The way it works is $key = 'DM'; $$key = $data; The literal
translation for $$key is $DM once the code executes.
Hope this helps.
In this case i should use an array, i think it's easier to use an array...
Array in an array in an array :)
But ofcourse sometimes you might (think you) need it.
Tijnema
----- Original Message ----
From: Dave Goodchild <[EMAIL PROTECTED]>
To: PHP-General <[email protected]>
Sent: Saturday, March 10, 2007 5:28:57 AM
Subject: [PHP] Variable variables and references
Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I
think
it's a great book, I am confused about variable variables and references -
not the mechanics, just where you would use them.
The subject of variable variables is explained but no examples are given
as
to why and where you would utilise them.
As for references, the examples given with regard to passing and returning
by reference in functions is clear, but no real examples are given as to
when this would be a preferred approcah - in fact, the authors stress that
due to PHP's copy-on-write mechanism, it is not a frequently-used
approcah.
So my question - are there any 'classic' situations in which either should
be used, and where and when do you guys use them in your real-world
efforts?
--
http://www.web-buddha.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'd agree with Tijnema! here, variable variables aren't really of any
use here. However, a classic snippet of code is where one emulates
register_globals functionality in a non-register_globals environment
(not a good idea to do this btw, unless you know what you're doing and
don't have any other way around it):
foreach($_POST as $key=>$val) {
$$key = $val;
}
thus creating all
$image,$whatever,$and,$some,$more variables magically for you.
- tul
Tijnema ! wrote:
On 3/10/07, Matt Carlson <[EMAIL PROTECTED]> wrote:
I've used variable variables probably 5 times in 2 years. They are great
when you need them, but don't usually have a day-to-day use for them.
Here is some sample code of the last time I used it.
if(isset($$key))
{
print($$key);
continue;
} else {
$iquery = "SELECT * FROM `".ROSTER_ITEMSTABLE."` WHERE
`item_name` = '".$iname."' AND `member_id` = '".$row['member_id']."'";
$iresult = $wowdb->query($iquery);
$idata = $wowdb->fetch_assoc($iresult);
$item = new item($idata);
$$key = $item->out();
print $$key;
}
Basically, this is in a for-each loop, that steps through a list of keys
for certain dungeons in World of Warcraft. Instead of putting the
data into
an array, I used variable variables to stick the data into a single
variable. The way it works is $key = 'DM'; $$key = $data; The literal
translation for $$key is $DM once the code executes.
Hope this helps.
In this case i should use an array, i think it's easier to use an array...
Array in an array in an array :)
But ofcourse sometimes you might (think you) need it.
Tijnema
----- Original Message ----
From: Dave Goodchild <[EMAIL PROTECTED]>
To: PHP-General <[email protected]>
Sent: Saturday, March 10, 2007 5:28:57 AM
Subject: [PHP] Variable variables and references
Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I
think
it's a great book, I am confused about variable variables and
references -
not the mechanics, just where you would use them.
The subject of variable variables is explained but no examples are given
as
to why and where you would utilise them.
As for references, the examples given with regard to passing and
returning
by reference in functions is clear, but no real examples are given as to
when this would be a preferred approcah - in fact, the authors stress
that
due to PHP's copy-on-write mechanism, it is not a frequently-used
approcah.
So my question - are there any 'classic' situations in which either
should
be used, and where and when do you guys use them in your real-world
efforts?
--
http://www.web-buddha.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
At 10:16 PM -0500 3/8/07, Rob Gould wrote:
I have to say this is the most helpful listserve I've ever joined!
Such friendly people and such good information.
What?!?
That's the first time I've heard that -- we're slipping guys. We've
got to stamp out that image before it gets rooted.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
At 2:30 PM +0100 3/8/07, Delta Storm wrote:
Hi,
again me with the silly questions...
I need a script that will take data from MySQL database and display
one row each day.
I have googled, but with no luck.
The database retrieving mechanism is of course clear but I really
dont know how to do a 24h delay before the next row is displayed.
If you're going to do that, then I suspect that you have at least 365 jokes.
If that's the case, then just use the data(z) function to pull of the
joke who's id is the same as the day of the year. Simple enough. See:
http://hu2.php.net/manual/en/function.date.php
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hi,
I'm continuing to work on securing my administration part of the website.
based on previous posts and reading materials, I was thinking to use the
following process :
1. user has to logon through a standard "http://" web page
2. login and encrypted password are compared with what is stored in
database, if it is the same, the user reach point 3. if not, an error
message is displayed.
3. after successful authentication, user is redirected to https:// pages, a
session is opened in PHP and the sessionID is stored in database with user
data.
4. sessions holds encrypted password and every time that users do an action,
sessionID is compared with the one in DB, as session encrypted password is
compared with the one stored in DB. if everything match, action is
performed. if not sessions is ended and user is redirected to logon page.
A. do you think is enough secured like that ?
B. i still do not understand how to be sure that user still use https (SSL
protocol) ?
for point B, my first task in PHP page, is to check if port is 443. But i'm
not sure that it is correct.
thanks a lot for your feedback.
--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5.1.1
--- End Message ---
--- Begin Message ---
On 3/10/07, Alain Roger <[EMAIL PROTECTED]> wrote:
Hi,
I'm continuing to work on securing my administration part of the website.
based on previous posts and reading materials, I was thinking to use the
following process :
1. user has to logon through a standard "http://" web page
2. login and encrypted password are compared with what is stored in
database, if it is the same, the user reach point 3. if not, an error
message is displayed.
3. after successful authentication, user is redirected to https:// pages,
a
session is opened in PHP and the sessionID is stored in database with user
data.
4. sessions holds encrypted password and every time that users do an
action,
sessionID is compared with the one in DB, as session encrypted password is
compared with the one stored in DB. if everything match, action is
performed. if not sessions is ended and user is redirected to logon page.
A. do you think is enough secured like that ?
To be even more secure, do the login part also through SSL (https://)
B. i still do not understand how to be sure that user still use https (SSL
protocol) ?
for point B, my first task in PHP page, is to check if port is 443. But
i'm
not sure that it is correct.
It looks like it is correct, but maybe some silly webserver would allow
http:// over port 443.
thanks a lot for your feedback.
--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5.1.1
--- End Message ---
--- Begin Message ---
At 6:47 PM +0100 3/10/07, Tijnema ! <[EMAIL PROTECTED]> wrote:
On 3/10/07, Alain Roger <[EMAIL PROTECTED]> wrote:
Hi,
I'm continuing to work on securing my administration part of the website.
based on previous posts and reading materials, I was thinking to use the
following process :
1. user has to logon through a standard "http://" web page
2. login and encrypted password are compared with what is stored in
database, if it is the same, the user reach point 3. if not, an error
message is displayed.
3. after successful authentication, user is redirected to https:// pages,
a
session is opened in PHP and the sessionID is stored in database with user
data.
4. sessions holds encrypted password and every time that users do an
action,
sessionID is compared with the one in DB, as session encrypted password is
compared with the one stored in DB. if everything match, action is
performed. if not sessions is ended and user is redirected to logon page.
A. do you think is enough secured like that ?
To be even more secure, do the login part also through SSL (https://)
Indeed; there's little point securing the house (the admin website)
if you leave the keys outside (transmit the password in plaintext via
standard HTTP).
B. i still do not understand how to be sure that user still use https (SSL
protocol) ?
for point B, my first task in PHP page, is to check if port is 443. But
i'm
not sure that it is correct.
It looks like it is correct, but maybe some silly webserver would allow
http:// over port 443.
Under Apache, you can check the Apache environment variable HTTPS
(eg; via $_SERVER['HTTPS']). If it exists and equals 'on' you're ok
regardless of port. Also would suggest using Apache mod_ssl
SSLRequireSSL for the directories that should be SSL-secured.
steve
--
+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg http://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center [EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+
--- End Message ---
--- Begin Message ---
must Oracle Instant Client be installed anyway? do you know hot to set the
variables for www-data?
--
View this message in context:
http://www.nabble.com/php%2C-oci8-and-oracle-tf3374589.html#a9413831
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
must be installed anyway the Oracle Instant Client? do you know hot to set
the variables for www-data?
--
View this message in context:
http://www.nabble.com/php%2C-oci8-and-oracle-tf3374589.html#a9413831
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
Hi all, i am building a system using php and am trying to separate the html
codes from the php codes (i.e. placing them in separate files), I am from the
java struts/spring background and seem to be finding it difficult doing that at
the moment with php.
I've got a registration form in html with the action pointing to a separate
php file that will process the form when submitted. when i want to output
errors or messages, its currently being outputed in the resulting code
generated by the php file. What i would like is to return to the html page and
display the messages there.
Can someone help me with ways of doing this pls ?
Cheers
---------------------------------
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
--- End Message ---
--- Begin Message ---
On Sat, 2007-03-10 at 11:47 -0800, Don Don wrote:
> Hi all, i am building a system using php and am trying to separate
> the html codes from the php codes (i.e. placing them in separate
> files), I am from the java struts/spring background and seem to be
> finding it difficult doing that at the moment with php.
Just because they're in separate files doesn't mean they need to be in
separate requests.
> I've got a registration form in html with the action pointing to a
> separate php file that will process the form when submitted.
You have it ass backwards. You generally want an registration form in
html that has an action targetting itself and upon submission the
handling code is called.
> when i > want to output errors or messages, its currently being
> outputed in the resulting code generated by the php file. What i
> would like is to return to the html page and display the messages
> there.
This is why you want to submit to the same page as the form is
displayed, in the event of an error you just redisplay the form and the
errors are already populated for you to print.
On the other hand if the form is submitted correctly then you redirect
to a nice little success page. This way you won't need to do error
message juggling via the session data.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Don Don escribió:
Hi all, i am building a system using php and am trying to separate the html
codes from the php codes (i.e. placing them in separate files), I am from the
java struts/spring background and seem to be finding it difficult doing that at
the moment with php.
I've got a registration form in html with the action pointing to a separate php file that will process the form when submitted. when i want to output errors or messages, its currently being outputed in the resulting code generated by the php file. What i would like is to return to the html page and display the messages there.
Can someone help me with ways of doing this pls ?
Use a template engine, like HTML_Template_IT, or if you want some
compleity in your system chack smarty.
--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
---------------------------------------------------------
Martín Marqués | Programador, DBA
Centro de Telemática | Administrador
Universidad Nacional
del Litoral
---------------------------------------------------------
--- End Message ---
--- Begin Message ---
I want to convert weekdays with a simple function like
$wdays = array
(0 => "Sonntag"
,1 => "Montag"
,2 => "Dienstag"
,3 => "Mittwoch"
,4 => "Donnerstag"
,5 => "Freitag"
,6 => "Samstag"
);
function convert_from_weekday ($weekday) {
return $wdays[$weekday];
}
but this doesn't work while
$wdays[$weekday];
outside of the function works correct. Has anybody an idea where's my
mistake? I'd like to use a function so I may return substrings of the
weekday.
O. Wyss
--- End Message ---