php-general Digest 7 Oct 2008 21:57:53 -0000 Issue 5723
Topics (messages 281521 through 281543):
How to use MySQL queries...?
281521 by: Hemant Patel
281522 by: Richard Heyes
281523 by: Jignesh Thummar
Question about date()
281524 by: Jason Pruim
281525 by: Stut
281526 by: Jason Pruim
281527 by: Richard Heyes
281528 by: Jason Pruim
281530 by: Stut
281531 by: tedd
281537 by: Ashley Sheridan
281539 by: Richard Heyes
281542 by: Ashley Sheridan
Re: The 'at' sign (@) variable prefix
281529 by: \"Crash\" Dummy
Re: $_SERVER["REMOTE_ADDR"] returning ::1
281532 by: Stut
Re: php framework vs just php?
281533 by: uaca man
281538 by: Ashley Sheridan
281540 by: Larry Garfield
281541 by: Eric Butera
Re: Required files not being parsed properly...
281534 by: Jim Lucas
281535 by: Eric Butera
281536 by: Stephen Johnson
Re: Prefered Method for User authetification on VHosts
281543 by: Jochem Maas
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 ---
Hello All, I am here with one more doubt....
Now I want to minimize my response time for a query..Can anybody tell me
...,
Is there any big difference to use PROPEL or any other ORM mapping
against basic
functions provided by MySQL Extension...?
And is there any effective way to calculate the statistics of comparison of
query execution timings...?
With Regards,
Hemant Patel
--- End Message ---
--- Begin Message ---
> Is there any big difference to use PROPEL or any other ORM mapping
> against basic
> functions provided by MySQL Extension...?
If it's MySQL you're looking to optimise, then you could also try
asking on the MySQL discussion list. On the PHP side, the MySQL
functions are long-winded at best, try simple abstraction. This could
be as simple as using a small object or set of functions that does a
lot of the grunt work for, eg:
$results = $db->getAll("SELECT * FROM mysql.user");
Much quicker to write than the equivalent using the PHP functions.
This does also make switching to another db far easier.
--
Richard Heyes
HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph
--- End Message ---
--- Begin Message ---
>>And is there any effective way to calculate the statistics of comparison
of
>>query execution timings..
For query execution statistics, you need to log slow queries. To do so,
enable following two directives in my.cnf file
long_query_time = 2
log-slow-queries = /var/log/mysql/mysql_slow_query.log
This configuration will log all queries that take more than 2 sec in the
file /var/log/mysql/mysql_slow_query.log
And monitor the logs.
Parsing the logs from human eyes is bit trivial. You can user this
http://www.mysqlperformanceblog.com/files/utils/mysql_slow_log_parser perl
script to parse slow-queries.
- Jignesh
On Tue, Oct 7, 2008 at 10:24 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:
> > Is there any big difference to use PROPEL or any other ORM mapping
> > against basic
> > functions provided by MySQL Extension...?
>
> If it's MySQL you're looking to optimise, then you could also try
> asking on the MySQL discussion list. On the PHP side, the MySQL
> functions are long-winded at best, try simple abstraction. This could
> be as simple as using a small object or set of functions that does a
> lot of the grunt work for, eg:
>
> $results = $db->getAll("SELECT * FROM mysql.user");
>
> Much quicker to write than the equivalent using the PHP functions.
> This does also make switching to another db far easier.
>
> --
> Richard Heyes
>
> HTML5 Graphing for FF, Chrome, Opera and Safari:
> http://www.phpguru.org/RGraph
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Good morning all!
I am trying to track down an error and can't seem to figure it out...
Here is the error out of my log:
[Tue Oct 7 07:31:43 2008] [error] PHP Warning: date() expects
parameter 2 to be long, string given in /Volumes/RAIDer/webserver/
Documents/dev/stimecard/timecard.php on line 57
Here is line 57:
$timeout = date("m/d/y h:i:s A", $row['timeout']);
And the info that is trying to grab from the database is:
+------------+------------+-------+--------+-------------------+
| timein | timeout | empID | record | Name |
+------------+------------+-------+--------+-------------------+
| 1222354037 | 1222382837 | 1 | 107 | Jason Pruim |
+------------+------------+-------+--------+-------------------+
Now... the error only happens on line 57... On line 56 there is the
same command except: $timein = date("m/d/y h:i:s A", $row['timein']);
And that doesn't cause any errors so I'm at a bit of a loss as to what
to do? I know I can redirect the warning to an error message, but I
don't want to do that... I am trying real hard to write clean code...
And this is my last error...
It's a total cosmetic thing since it still displays everything right...
Any ideas? :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On 7 Oct 2008, at 12:38, Jason Pruim wrote:
I am trying to track down an error and can't seem to figure it
out... Here is the error out of my log:
[Tue Oct 7 07:31:43 2008] [error] PHP Warning: date() expects
parameter 2 to be long, string given in /Volumes/RAIDer/webserver/
Documents/dev/stimecard/timecard.php on line 57
Here is line 57:
$timeout = date("m/d/y h:i:s A", $row['timeout']);
And the info that is trying to grab from the database is:
+------------+------------+-------+--------+-------------------+
| timein | timeout | empID | record | Name |
+------------+------------+-------+--------+-------------------+
| 1222354037 | 1222382837 | 1 | 107 | Jason Pruim |
+------------+------------+-------+--------+-------------------+
Now... the error only happens on line 57... On line 56 there is the
same command except: $timein = date("m/d/y h:i:s A", $row['timein']);
And that doesn't cause any errors so I'm at a bit of a loss as to
what to do? I know I can redirect the warning to an error message,
but I don't want to do that... I am trying real hard to write clean
code... And this is my last error...
It's a total cosmetic thing since it still displays everything
right...
Any ideas? :)
Do a var_dump($row['timeout']) on the line before the one giving the
warning to check that it contains what you think it does.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
On Oct 7, 2008, at 7:41 AM, Stut wrote:
On 7 Oct 2008, at 12:38, Jason Pruim wrote:
I am trying to track down an error and can't seem to figure it
out... Here is the error out of my log:
[Tue Oct 7 07:31:43 2008] [error] PHP Warning: date() expects
parameter 2 to be long, string given in /Volumes/RAIDer/webserver/
Documents/dev/stimecard/timecard.php on line 57
Here is line 57:
$timeout = date("m/d/y h:i:s A", $row['timeout']);
And the info that is trying to grab from the database is:
+------------+------------+-------+--------+-------------------+
| timein | timeout | empID | record | Name |
+------------+------------+-------+--------+-------------------+
| 1222354037 | 1222382837 | 1 | 107 | Jason Pruim |
+------------+------------+-------+--------+-------------------+
Now... the error only happens on line 57... On line 56 there is the
same command except: $timein = date("m/d/y h:i:s A", $row['timein']);
And that doesn't cause any errors so I'm at a bit of a loss as to
what to do? I know I can redirect the warning to an error message,
but I don't want to do that... I am trying real hard to write clean
code... And this is my last error...
It's a total cosmetic thing since it still displays everything
right...
Any ideas? :)
Do a var_dump($row['timeout']) on the line before the one giving the
warning to check that it contains what you think it does.
Hey Stut,
Thanks for the quick response... You were right... I did a var_dump
both on $row['timein'] and $row['timeout'] and the error was because
of the way that I update the records. for time in, I insert a new
record, for time out, I update the record where timeout= NULL and THAT
is what was causing the issue... I guess I can just redirect that
error, ignore it, or come up with a different way to update the
current record without having to use NULL, or maybe, write a timeout
timestamp for like midnight on January 1 1955 or something like that...
Thanks again Stut!
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
> I am trying real hard to write clean code...
Print it out and stick it in the washing machine... :-)
--
Richard Heyes
HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph
--- End Message ---
--- Begin Message ---
On Oct 7, 2008, at 7:49 AM, Richard Heyes wrote:
I am trying real hard to write clean code...
Print it out and stick it in the washing machine... :-)
The way I used to write code I'd have to soak it in bleach for a week
before having a chance of it coming out clean! :P
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On 7 Oct 2008, at 12:48, Jason Pruim wrote:
On Oct 7, 2008, at 7:41 AM, Stut wrote:
On 7 Oct 2008, at 12:38, Jason Pruim wrote:
I am trying to track down an error and can't seem to figure it
out... Here is the error out of my log:
[Tue Oct 7 07:31:43 2008] [error] PHP Warning: date() expects
parameter 2 to be long, string given in /Volumes/RAIDer/webserver/
Documents/dev/stimecard/timecard.php on line 57
Here is line 57:
$timeout = date("m/d/y h:i:s A", $row['timeout']);
And the info that is trying to grab from the database is:
+------------+------------+-------+--------+-------------------+
| timein | timeout | empID | record | Name |
+------------+------------+-------+--------+-------------------+
| 1222354037 | 1222382837 | 1 | 107 | Jason Pruim |
+------------+------------+-------+--------+-------------------+
Now... the error only happens on line 57... On line 56 there is
the same command except: $timein = date("m/d/y h:i:s A",
$row['timein']);
And that doesn't cause any errors so I'm at a bit of a loss as to
what to do? I know I can redirect the warning to an error message,
but I don't want to do that... I am trying real hard to write
clean code... And this is my last error...
It's a total cosmetic thing since it still displays everything
right...
Any ideas? :)
Do a var_dump($row['timeout']) on the line before the one giving
the warning to check that it contains what you think it does.
Hey Stut,
Thanks for the quick response... You were right... I did a var_dump
both on $row['timein'] and $row['timeout'] and the error was because
of the way that I update the records. for time in, I insert a new
record, for time out, I update the record where timeout= NULL and
THAT is what was causing the issue... I guess I can just redirect
that error, ignore it, or come up with a different way to update the
current record without having to use NULL, or maybe, write a timeout
timestamp for like midnight on January 1 1955 or something like
that...
Try "is null" rather than "= null".
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
At 1:08 PM +0100 10/7/08, Stut wrote:
On 7 Oct 2008, at 12:48, Jason Pruim wrote:
Thanks for the quick response... You were right... I did a var_dump
both on $row['timein'] and $row['timeout'] and the error was
because of the way that I update the records. for time in, I insert
a new record, for time out, I update the record where timeout= NULL
and THAT is what was causing the issue... I guess I can just
redirect that error, ignore it, or come up with a different way to
update the current record without having to use NULL, or maybe,
write a timeout timestamp for like midnight on January 1 1955 or
something like that...
Try "is null" rather than "= null".
-Stut
Yes, if I remember correctly, NULL is a different critter for MySQL
as compared to php. You can't directly test (i.e., make comparisons)
for it like you can in php.
As far as updating the time of the record, why not use current date
or 1/1/1970 -- the beginning of the world according to Unix. You
never know if you might have to update your dB to Unix time at some
time in the future.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Tue, 2008-10-07 at 07:54 -0400, Jason Pruim wrote:
> On Oct 7, 2008, at 7:49 AM, Richard Heyes wrote:
>
> >> I am trying real hard to write clean code...
> >
> > Print it out and stick it in the washing machine... :-)
>
> The way I used to write code I'd have to soak it in bleach for a week
> before having a chance of it coming out clean! :P
>
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 11287 James St
> Holland, MI 49424
> www.raoset.com
> [EMAIL PROTECTED]
>
>
>
>
>
Believe it or not, I've actually done that before... I had a load of
code backed up onto a USB pen drive, forgot it was in my pocket, and put
my jeans in the wash. Luckily for me it all still worked afterwards!
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
> Luckily for me it all still worked afterwards!
The pen drive or the code? :-)
--
Richard Heyes
HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.phpguru.org/RGraph
--- End Message ---
--- Begin Message ---
On Tue, 2008-10-07 at 19:47 +0100, Richard Heyes wrote:
> > Luckily for me it all still worked afterwards!
>
> The pen drive or the code? :-)
>
> --
> Richard Heyes
>
> HTML5 Graphing for FF, Chrome, Opera and Safari:
> http://www.phpguru.org/RGraph
>
Both!
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
>> mike schreef:
>>> Mon, Oct 6, 2008 at 12:17 PM, Daniel Brown <[EMAIL PROTECTED]
>>> wrote:
>>>>> I will get an error, but if I prefix the value with '@',
>>>>> [EMAIL PROTECTED]"q"];
>>>> The @ is an error control operator, used to buffer the output
>>>> and store it in a variable - $php_errormsg. It's better to
>>>> write clean, secure code, of course.... but sometimes error
>>>> control is a good thing, too. why not just use:
>>> $query = isset($_GET['q']) ? $_GET['q'] : '';
>>> that way it's always set.
>>> or even better (what I recommend):
>>> $query = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
>>> and get an empty string or a sanitized string, depending on if
>>> something exists.
>> Mike's ways are both better than suppressing the error not only
>> because error suppression in general sucks but because it's
>> actually less performant to trigger this kind of error.
> I second that. The @ symbol actually does this:
> @action();
> Becomes:
> $old = ini_set("error_reporting", 0);
> action();
> ini_set("error_reporting", $old);
> So, if you put that a hundred times all over your code, the errors
> might be suppressed but your app is slow too.
Thank you all. As I said, I learned this by osmosis, applying other
people's code. I am not fluent in PHP. That is why I wanted a
reference in the documents. I do not sprinkle the @ symbol through my
code to avoid careful construction, I used it in a specific instance
to deal with an empty query string, over which I had no control. I
will study the alternatives offered here and do some recoding.
--
Dave
--- End Message ---
--- Begin Message ---
Please keep the discussion on the list.
On 7 Oct 2008, at 06:11, David Rocks wrote:
Your work around worked fine for me but I just had some time to
revisit this and wanted to see how hard it would be to rewrite this
test. But I ran into a question. The test that was failing compared
the clients IP address. It looks like transparent proxies are used
for caching web server pages and shouldn't affect this test. I saw
the problem because I was accessing the web server locally via
localhost. What technology would raise the possibility that a remote
clients IP address wouldn't be the same from one access of the web
server to another?
Proxies do not necessarily cache web pages - this is an optional
feature of the technology. At the most basic level in most
implementations they provide a protected bridge between two networks.
Proxies can be implemented as shared clusters such that any request
going through the cluster could appear to come from one of a number of
IPs (i.e. the client is not tied to a single proxy appliance). In this
instance you cannot rely on a client always coming from the same IP.
In addition it's pretty standard practice for a lot of ISPs to have
relatively short leases on their IP pool. This means that a client
could move between different IPs between requests. This is unlikely
however because I believe most ISPs will do everything they can to
issue a connection with the same IP when the lease expires but it's
not something you can rely on.
In any case you cannot rely on the user not disconnecting their laptop
from a wired connection and then connecting to a wireless connection
that runs through a different router. This would also change their IP.
At the end of the day it's well understood that IP addresses should
not be used for authentication or continuity purposes. I've not come
across a session implementation that uses them for a very long time.
-Stut
--
http://stut.net/
Stut wrote:
On 18 Sep 2008, at 16:37, David Rocks wrote:
Stut wrote:
On 18 Sep 2008, at 05:57, David Rocks wrote:
I am running a test PHP web app on my local machine that uses
REMOTE_ADDR and most of the time ::1 is returned as the IP addr
and sometimes it is 127.0.0.1 . I am on OS X 10.5.5 and using
APACHE 2. PHPINFO always returns ::1 for REMOTE_ADDR. Is this a
PHP or a APACHE 2 thing?
It's coming from Apache and is correct. ::1 is the same as
127.0.0.1 in IPv6. Which you get will depend on how you request
the page and how your DNS/hosts file is set up. Request it with
an IPv6 domain/IP and REMOTE_ADDR will also be IPv6.
You should be able to disable IPv6 in your system settings, but
from a future-proof point of view you should be able to handle
both.
-Stut
This app uses this test to insure that the page being processed
came from the same machine as was used to login to the app. The
app is intended for broad use so I can't control the use of IPv6.
Is localhost the only case where the value returned might have
different values? Can you point to a reference where I might
figure out a better future proof test?
Using the IP is not a reliable way to check for this. Some ISPs use
transparent proxies which can cause each subsequent request to come
from a different IP, regardless of whether it's v4 or v6. You'd be
better off using a cookie, although that would be a bit less secure.
If you really need to use IP then you can probably rely on it not
switching between v4 and v6 if you're not using localhost. For
testing use the machine's real IP or hostname instead of localhost
and this problem should disappear.
-Stut
--- End Message ---
--- Begin Message ---
Farid,
I like to use PRADO(www.pradosoft.com), it is very easy to use for
those who are coming from Microsoft .Net platform as it uses the same
architecture. I did not like symfony, too much to read before the
first example.
Angelo
2008/10/6 farid lópez <[EMAIL PROTECTED]>:
> what is your framework??? uacaman.
>
> i'm using symfony, but i'm reading the book. it's hard but there are so many
> things you can do easily with symfony!
>
> 2008/10/7 uaca man <[EMAIL PROTECTED]>
>
>> To be or not to be dump it your choice.
>>
>> My framework it not just awesome it is super awesome.
>>
>> Angelo
>>
>> 2008/10/6 Dan Joseph <[EMAIL PROTECTED]>:
>> > On Mon, Oct 6, 2008 at 1:01 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>> >
>> >>
>> >> But... Which framework is better? :P
>> >>
>> >>
>> >>
>> >>
>> > Oh my.. now we're gonna get all those guys popping back up telling us how
>> > dumb we are and how awesome their frameworks are again!
>> >
>> > --
>> > -Dan Joseph
>> >
>> > www.canishosting.com - Plans start @ $1.99/month.
>> >
>> > "Build a man a fire, and he will be warm for the rest of the day.
>> > Light a man on fire, and will be warm for the rest of his life."
>> >
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Atte
> Farid H. López Durán
>
> "La naturaleza del hombre es tal que puede conseguir la perfección
> únicamente cuando
> trabaja para el bienestar y la dignidad de sus conciudadanos". Karl Marx
>
--- End Message ---
--- Begin Message ---
On Tue, 2008-10-07 at 11:20 -0300, uaca man wrote:
> Farid,
>
> I like to use PRADO(www.pradosoft.com), it is very easy to use for
> those who are coming from Microsoft .Net platform as it uses the same
> architecture. I did not like symfony, too much to read before the
> first example.
>
> Angelo
>
> 2008/10/6 farid lópez <[EMAIL PROTECTED]>:
> > what is your framework??? uacaman.
> >
> > i'm using symfony, but i'm reading the book. it's hard but there are so many
> > things you can do easily with symfony!
> >
> > 2008/10/7 uaca man <[EMAIL PROTECTED]>
> >
> >> To be or not to be dump it your choice.
> >>
> >> My framework it not just awesome it is super awesome.
> >>
> >> Angelo
> >>
> >> 2008/10/6 Dan Joseph <[EMAIL PROTECTED]>:
> >> > On Mon, Oct 6, 2008 at 1:01 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
> >> >
> >> >>
> >> >> But... Which framework is better? :P
> >> >>
> >> >>
> >> >>
> >> >>
> >> > Oh my.. now we're gonna get all those guys popping back up telling us how
> >> > dumb we are and how awesome their frameworks are again!
> >> >
> >> > --
> >> > -Dan Joseph
> >> >
> >> > www.canishosting.com - Plans start @ $1.99/month.
> >> >
> >> > "Build a man a fire, and he will be warm for the rest of the day.
> >> > Light a man on fire, and will be warm for the rest of his life."
> >> >
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
> > --
> > Atte
> > Farid H. López Durán
> >
> > "La naturaleza del hombre es tal que puede conseguir la perfección
> > únicamente cuando
> > trabaja para el bienestar y la dignidad de sus conciudadanos". Karl Marx
> >
>
Don't frameworks introduce a lot more overhead to projects though?
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Tue, 07 Oct 2008 19:47:54 +0100, Ashley Sheridan <[EMAIL PROTECTED]> wrote:
> Don't frameworks introduce a lot more overhead to projects though?
>
>
> Ash
> www.ashleysheridan.co.uk
Any generic code library adds overhead. How much and whether or not it's
acceptable depends on the framework and on your use case. In *most* use cases,
PHP execution time is not your bottleneck. Disk IO, database traffic, and
network traffic are a much bigger problem. If you can, throw an Opcode cache
at it (whether it's a framework or not) to get a nice speed boost.
I find I produce much better quality results with much less effort when using a
good framework than when writing from scratch.
--Larry Garfield
--- End Message ---
--- Begin Message ---
On Tue, Oct 7, 2008 at 2:47 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> On Tue, 2008-10-07 at 11:20 -0300, uaca man wrote:
>> Farid,
>>
>> I like to use PRADO(www.pradosoft.com), it is very easy to use for
>> those who are coming from Microsoft .Net platform as it uses the same
>> architecture. I did not like symfony, too much to read before the
>> first example.
>>
>> Angelo
>>
>> 2008/10/6 farid lópez <[EMAIL PROTECTED]>:
>> > what is your framework??? uacaman.
>> >
>> > i'm using symfony, but i'm reading the book. it's hard but there are so
>> > many
>> > things you can do easily with symfony!
>> >
>> > 2008/10/7 uaca man <[EMAIL PROTECTED]>
>> >
>> >> To be or not to be dump it your choice.
>> >>
>> >> My framework it not just awesome it is super awesome.
>> >>
>> >> Angelo
>> >>
>> >> 2008/10/6 Dan Joseph <[EMAIL PROTECTED]>:
>> >> > On Mon, Oct 6, 2008 at 1:01 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>> >> >
>> >> >>
>> >> >> But... Which framework is better? :P
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> > Oh my.. now we're gonna get all those guys popping back up telling us
>> >> > how
>> >> > dumb we are and how awesome their frameworks are again!
>> >> >
>> >> > --
>> >> > -Dan Joseph
>> >> >
>> >> > www.canishosting.com - Plans start @ $1.99/month.
>> >> >
>> >> > "Build a man a fire, and he will be warm for the rest of the day.
>> >> > Light a man on fire, and will be warm for the rest of his life."
>> >> >
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>
>> >>
>> >
>> >
>> > --
>> > Atte
>> > Farid H. López Durán
>> >
>> > "La naturaleza del hombre es tal que puede conseguir la perfección
>> > únicamente cuando
>> > trabaja para el bienestar y la dignidad de sus conciudadanos". Karl Marx
>> >
>>
> Don't frameworks introduce a lot more overhead to projects though?
>
>
> Ashhttp://mail.google.com/mail/?shva=1#label/php-general/11975743c3279e0f
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Yep. But there is always that balance between developer time versus
computing time. Usually we can start with the quick developer win and
slowly attack slower areas. Of course all of this is subjective and
every case requires a unique look.
Look at this:
http://paul-m-jones.com/?p=315
--- End Message ---
--- Begin Message ---
Eric Butera wrote:
> On Mon, Oct 6, 2008 at 7:28 PM, Stephen Johnson
> <[EMAIL PROTECTED]> wrote:
>> OK .. I am upgrading to PHP5 on a clients box, and after doing so I have
>> run into the problem that files that get brought in by a require statement,
>> or include, end up just getting dumped to the browser as text..
>>
>> For instance :
>>
>> require("/home/tnr/incs/tnr_db.php");
>> $db = new mysql();
>>
>> Produces what you see here :
>>
>> http://www.thumbnailresume.com/index.html?allow=1
>>
>> Any one have any thoughts on what is going on?
>>
>> --
>> Stephen Johnson c | eh
>> The Lone Coder
>>
>> office: 562.366.4433
>> fax: 562.278.0133
>>
>> http://www.thelonecoder.com
>> continuing the struggle against bad code
>>
>> http://www.fortheloveofgeeks.com
>> I¹m a geek and I¹m OK!
>> --
>>
>>
>>
>>
>
>
>
> $user_id = $_COOKIE['user_id'];
>
> $logFile = "/home/tnr/query_logs/tnr.".$user_id.".query.log";
>
> uh oh...
Did you scare the OP or something? The page isn't available any longer... :)
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--- End Message ---
--- Begin Message ---
On Tue, Oct 7, 2008 at 10:32 AM, Jim Lucas <[EMAIL PROTECTED]> wrote:
> Eric Butera wrote:
>> On Mon, Oct 6, 2008 at 7:28 PM, Stephen Johnson
>> <[EMAIL PROTECTED]> wrote:
>>> OK .. I am upgrading to PHP5 on a clients box, and after doing so I have
>>> run into the problem that files that get brought in by a require statement,
>>> or include, end up just getting dumped to the browser as text..
>>>
>>> For instance :
>>>
>>> require("/home/tnr/incs/tnr_db.php");
>>> $db = new mysql();
>>>
>>> Produces what you see here :
>>>
>>> http://www.thumbnailresume.com/index.html?allow=1
>>>
>>> Any one have any thoughts on what is going on?
>>>
>>> --
>>> Stephen Johnson c | eh
>>> The Lone Coder
>>>
>>> office: 562.366.4433
>>> fax: 562.278.0133
>>>
>>> http://www.thelonecoder.com
>>> continuing the struggle against bad code
>>>
>>> http://www.fortheloveofgeeks.com
>>> I¹m a geek and I¹m OK!
>>> --
>>>
>>>
>>>
>>>
>>
>>
>>
>> $user_id = $_COOKIE['user_id'];
>>
>> $logFile = "/home/tnr/query_logs/tnr.".$user_id.".query.log";
>>
>> uh oh...
>
> Did you scare the OP or something? The page isn't available any longer... :)
>
> --
> Jim Lucas
>
> "Some men are born to greatness, some achieve greatness,
> and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
> by William Shakespeare
>
>
I hope not, but I also hope it's fixed. After sending that I kicked
myself since it should have been off-list. ;)
--- End Message ---
--- Begin Message ---
Hey hey hey ... LOL This is all VERY old code...I admit that...
The site needed to be closed since it was completely broken.
I figured out the reason .. The new php.ini file had the use short tags
turned off... So I turned that on and it works now.
On 10/7/08 7:32 AM, "Jim Lucas" <[EMAIL PROTECTED]> wrote:
> Eric Butera wrote:
>> On Mon, Oct 6, 2008 at 7:28 PM, Stephen Johnson
>> <[EMAIL PROTECTED]> wrote:
>>> OK .. I am upgrading to PHP5 on a clients box, and after doing so I have
>>> run into the problem that files that get brought in by a require statement,
>>> or include, end up just getting dumped to the browser as text..
>>>
>>> For instance :
>>>
>>> require("/home/tnr/incs/tnr_db.php");
>>> $db = new mysql();
>>>
>>> Produces what you see here :
>>>
>>> http://www.thumbnailresume.com/index.html?allow=1
>>>
>>> Any one have any thoughts on what is going on?
>>>
>>> --
>>> Stephen Johnson c | eh
>>> The Lone Coder
>>>
>>> office: 562.366.4433
>>> fax: 562.278.0133
>>>
>>> http://www.thelonecoder.com
>>> continuing the struggle against bad code
>>>
>>> http://www.fortheloveofgeeks.com
>>> I¹m a geek and I¹m OK!
>>> --
>>>
>>>
>>>
>>>
>>
>>
>>
>> $user_id = $_COOKIE['user_id'];
>>
>> $logFile = "/home/tnr/query_logs/tnr.".$user_id.".query.log";
>>
>> uh oh...
>
> Did you scare the OP or something? The page isn't available any longer... :)
--
Stephen Johnson
The Lone Coder
http://www.ouradoptionblog.com
*Join us on our adoption journey*
[EMAIL PROTECTED]
http://www.thelonecoder.com
*Continuing the struggle against bad code*
--
--- End Message ---
--- Begin Message ---
Michelle Konzack schreef:
> Hello,
>
> I have at my hosting provider only 1 GByte of Diskspace and can install
> VHosts as much as I want. The problem is, that I have "no access" to
> the OS for OS-Level autentification.
>
> Currently I have
>
> ${CUSTOMERPATH}/htdocs/index.php
>
> which handel all VHosts and get ist config from directories like
>
> ${CUSTOMERPATH}/CONFIG_<vhost>.tamay-dogan.net/...
>
> in which I currently use files like
>
> <user>:<shadow_passwd>
>
> and then I use:
>
> ----[ STDIN ]-----------------------------------------------------------
> function login($user, $pass, $redirect) {
>
> if ($user != '' and $pass != '') {
>
> $SHADOW=exec("grep \"^$user:\" " . DIR_HOST . "/.shadow |cut -d: -f2");
> if (empty($SHADOW)) {
> header("Content-Type: text/html");
> die("<meta http-equiv=\"refresh\" content=\"5;$redirect\">\n<font
> size=\"+2\" color=\"red\"><b>Error</b></font><hr size=\"3\"
> noshade=\"noshade\">The username \"$user\" does not exist.");
> }
>
> $SALT=exec("grep \"^$user:\" " . DIR_HOST . "/.shadow |cut -d: -f2 |cut
> -d$ -f1-3");
> $ENCRYPTED=crypt($pass, $SALT);
seems like a lot of pain to go through, what with all that shell'ing out to
grep data.
I'd personally go for a simple DB table and use/store sha1() hashes.
> if ($SHADOW != $ENCRYPTED) {
> header("Content-Type: text/html");
text/html is the default content-type why bother with this line?
> die("<meta http-equiv=\"refresh\" content=\"5;$redirect\">\n<font
> size=\"+2\" color=\"red\"><b>Error</b></font><hr size=\"3\"
> noshade=\"noshade\">Wrong password for user \"$user\".");
I'm not a fan of die()ing in this fashion. I would argue the function should
either
return true or false and let the caller decide what to do (e.g. show a login
form again
or something)
I'm not a fan of meta-refreshes either.
> }
> $TIME_NOW=date("U");
> $SESSID=exec("echo \"${user}${TIME_NOW}\" |md5sum |sed 's| .*||'");
> setcookie('TDSESSION', "$SESSID");
> setcookie('USER', $user);
> exec("echo '" . date("U") . " " . $user . "' >" . DIR_SESSIONS . "/" .
> $SESSID);
I smell a race condition or something ... also why go to all this trouble when
you
could just use session_start() (and stick $TIME_NOW, $user, etc in $_SESSION) ?
> }
> if (empty($redirect)) {
> $redirect="/";
> }
> header("Content-Type: text/html");
> die("<meta http-equiv=\"refresh\" content=\"0;$redirect\">");
> }
> ------------------------------------------------------------------------
>
> which is working properly...
>
> I like to know, whether this is good enough or is there a better
> solution?
>
there is always a better way ;-) ... the only real problem I envisage might be
related to file permissions on files in the DIR_SESSIONS dir ... given that this
stuff is in use, working, probably not protecting very sensitive data and the
fact that
you're probably not going to get paid to change it ... I'd leave it be and go
have a
beer or something :-)
> Thanks, Greetings and nice Day/Evening
> Michelle Konzack
> Systemadministrator
> 24V Electronic Engineer
> Tamay Dogan Network
> Debian GNU/Linux Consultant
>
>
--- End Message ---