php-general Digest 7 Oct 2008 07:54:01 -0000 Issue 5722

2008-10-07 Thread php-general-digest-help

php-general Digest 7 Oct 2008 07:54:01 - Issue 5722

Topics (messages 281504 through 281520):

Re: php framework vs just php?
281504 by: uaca man
281508 by: farid lópez

Re: The 'at' sign (@) variable prefix
281505 by: uaca man
281506 by: Daniel Brown
281507 by: mike
281515 by: Jochem Maas
281520 by: Aschwin Wesselius

Re: db_* = pg_*/my_*/ifx_* ?
281509 by: Ashley Sheridan
281517 by: Larry Garfield

Re: AJAX and PHP
281510 by: Ashley Sheridan

Re: How to capture origional client machine _directory_ and file name on 
uploads?
281511 by: Ashley Sheridan

Required files not being parsed properly...
281512 by: Stephen Johnson
281513 by: Jim Lucas
281514 by: Eric Butera

Re: Drupal 6
281516 by: Larry Garfield

Re: Best Search Algorithm for Millions of record
281518 by: Hemant Patel

Re: Prefered Method for User authetification on VHosts
281519 by: Per Jessen

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]


--
---BeginMessage---
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.

---End Message---
---BeginMessage---
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---
---BeginMessage---
Documentation  is at:
http://br.php.net/manual/en/language.operators.errorcontrol.php

Angelo

2008/10/6 Crash Dummy [EMAIL PROTECTED]:
 I learned through osmosis that I could use the '@' sign to prevent an
 error with an uncertain variable. For example, if there is no $_GET[]
 value in this line,

 $query=$_GET[q];

 I will get an error, but if I prefix the value with '@',

 [EMAIL PROTECTED]q];

 and no value is available, a null string is returned, and no error is
 generated.

 This is great, but I'd like to see it in writing. I can't find this
 feature in the documentation. Can someone steer me to it?
 --
 Dave




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


---End Message---
---BeginMessage---
On Mon, Oct 6, 2008 at 3:03 PM, Crash Dummy [EMAIL PROTECTED] wrote:
 I learned through osmosis that I could use the '@' sign to prevent an
 error with an uncertain variable. For example, if there is no $_GET[]
 value in this line,

 $query=$_GET[q];

 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.

Check it out:
http://php.net/manual/en/language.operators.errorcontrol.php

It's better to write clean, secure code, of course but
sometimes error control is a good thing, too.

-- 
/Daniel P. Brown
More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.
---End Message---
---BeginMessage---
 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 

php-general Digest 7 Oct 2008 21:57:53 -0000 Issue 5723

2008-10-07 Thread php-general-digest-help

php-general Digest 7 Oct 2008 21:57:53 - 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]


--
---BeginMessage---
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---
---BeginMessage---
 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---
---BeginMessage---
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---
---BeginMessage---

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, 

Re: [PHP] Prefered Method for User authetification on VHosts

2008-10-07 Thread Per Jessen
Michelle Konzack wrote:

 Currently I have
 [snip]


OK, so a plain file-password authentification. That's fine. 

 I like to know, whether this  is  good  enough  or  is  there  a 
 better solution?

Good enough depends entirely on your security requirements, i.e. how
safe do you need the authenticated access to be?  Are you protecting
something that is valuable to others? Etc etc.


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] The 'at' sign (@) variable prefix

2008-10-07 Thread Aschwin Wesselius

Jochem Maas wrote:

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.


--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other'/


Re: [PHP] How to use MySQL queries...?

2008-10-07 Thread Richard Heyes
 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



Re: [PHP] Question about date()

2008-10-07 Thread Richard Heyes
 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about date()

2008-10-07 Thread Stut

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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about date()

2008-10-07 Thread Stut

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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php framework vs just php?

2008-10-07 Thread uaca man
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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to use MySQL queries...?

2008-10-07 Thread Jignesh Thummar
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




[PHP] Re: The 'at' sign (@) variable prefix

2008-10-07 Thread Crash Dummy
 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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Required files not being parsed properly...

2008-10-07 Thread Jim Lucas
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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about date()

2008-10-07 Thread tedd

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Required files not being parsed properly...

2008-10-07 Thread Eric Butera
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.  ;)


Re: [PHP] Question about date()

2008-10-07 Thread Jason Pruim


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]





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Question about date()

2008-10-07 Thread Jason Pruim

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]






Re: [PHP] Question about date()

2008-10-07 Thread Jason Pruim


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]





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to use MySQL queries...?

2008-10-07 Thread Hemant Patel
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


Re: [PHP] $_SERVER[REMOTE_ADDR] returning ::1

2008-10-07 Thread Stut

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




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Required files not being parsed properly...

2008-10-07 Thread Stephen Johnson
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*
--



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about date()

2008-10-07 Thread Ashley Sheridan
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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php framework vs just php?

2008-10-07 Thread Ashley Sheridan
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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about date()

2008-10-07 Thread Richard Heyes
 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php framework vs just php?

2008-10-07 Thread Larry Garfield

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php framework vs just php?

2008-10-07 Thread Eric Butera
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


Re: [PHP] Question about date()

2008-10-07 Thread Ashley Sheridan
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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Prefered Method for User authetification on VHosts

2008-10-07 Thread Jochem Maas
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\\nfont 
 size=\+2\ color=\red\bError/b/fonthr 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\\nfont 
 size=\+2\ color=\red\bError/b/fonthr 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
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Missing Env. Variables when called by AT Scheduler

2008-10-07 Thread JJB
We regularly send out massive mail blasts to our customers. Recently 
several mail blasts failed to transmit. After a serious amount of 
research we found the snippet of code below to be the place where it was 
breaking down. The issue it seems is that the Environment Variables HOST 
and SERVER_NAME are sometimes not returning true when executed from the 
Linux AT scheduler. (using atq commands).  doing a php -i from the 
command line returns the correct values, as does putting in a php info 
command at the top of the script and opening it from a browser.


Does anyone have any clues about why a script called from the AT 
scheduler would be unable to detect what server it is on and behave 
appropriately?


function send_mail($subject, $subject_name, $from, $email, 
$customer_name, $html_message, $text_message, $customer_id=0) {
   if($_SERVER['HOST'] == 'domain.com' || 
$_SERVER['SERVER_NAME']=='customer.domain.com') {

   global $mail;
   if(!is_object($mail)) {
   $mail = create_mail();
   }
   } else {
   // If on staging server don't send emails to any address 
outside company

   if(!stristr($email, '@domain.com')) return true;
   $mail = Mail::factory('mail');



Thanks,

Joel

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP and getting part of URL

2008-10-07 Thread Jason ML

Hi PHP'ers,

PHP 4.4.8 and 5.

say I have a url like:

http://www.mydomain.tld/jason/index.php

In that index.php I want to have a piece of code that runs that tells  
me the 'jason' part of the URL so that I can run some custom read only  
queries for 'jason'


How can I do this? I know how to do everything except what PHP  
commands to run to get the info.


Thanks!

-Jason


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Missing Env. Variables when called by AT Scheduler

2008-10-07 Thread Chris

JJB wrote:
We regularly send out massive mail blasts to our customers. Recently 
several mail blasts failed to transmit. After a serious amount of 
research we found the snippet of code below to be the place where it was 
breaking down. The issue it seems is that the Environment Variables HOST 
and SERVER_NAME are sometimes not returning true when executed from the 
Linux AT scheduler. (using atq commands).  doing a php -i from the 
command line returns the correct values, as does putting in a php info 
command at the top of the script and opening it from a browser.


I doubt php -i does that at all.

$ php -i | grep 'SERVER_NAME'
$


$_SERVER['SERVER_NAME'] and $_SERVER['HOST'] are set by web servers, 
they are not available through php-cli.


--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and getting part of URL

2008-10-07 Thread Chris

Jason ML wrote:

Hi PHP'ers,

PHP 4.4.8 and 5.

say I have a url like:

http://www.mydomain.tld/jason/index.php

In that index.php I want to have a piece of code that runs that tells me 
the 'jason' part of the URL so that I can run some custom read only 
queries for 'jason'


How can I do this? I know how to do everything except what PHP commands 
to run to get the info.


print_r($_SERVER);

to see what you have available.

Then use http://php.net/parse_url on the right variable.

--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and getting part of URL

2008-10-07 Thread Micah Gersten
dirname($_SERVER['REQUEST_URI']);

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Jason ML wrote:
 Hi PHP'ers,

 PHP 4.4.8 and 5.

 say I have a url like:

 http://www.mydomain.tld/jason/index.php

 In that index.php I want to have a piece of code that runs that tells
 me the 'jason' part of the URL so that I can run some custom read only
 queries for 'jason'

 How can I do this? I know how to do everything except what PHP
 commands to run to get the info.

 Thanks!

 -Jason



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and getting part of URL

2008-10-07 Thread Jason ML

Hi Micah,


dirname($_SERVER['REQUEST_URI']);



I have tried that and I dont get the proper URI:

Example running 	print_r($_SERVER); I get: [REQUEST_URI] = /net1003/ 
people/jason/


But then doing:

$jason = dirname($_SERVER['REQUEST_URI']);

echo URL: ;
echo $jason;

I get: URL: /net1003/people

Thoughts on what I am doing wrong.

Jason


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Plotting Tool

2008-10-07 Thread Liz Kim
Hi,

Anyone have any suggestions on a plotting package for PHP?
Nothing too crazy and fancy - just easy to read plots/graphs.
We were using PHPlot on our old server but it's requiring too many
lib's/util's to install on a new server.

TIA.


Re: [PHP] PHP and getting part of URL

2008-10-07 Thread Daniel Brown
On Tue, Oct 7, 2008 at 7:57 PM, Jason ML [EMAIL PROTECTED] wrote:

 But then doing:

$jason = dirname($_SERVER['REQUEST_URI']);

echo URL: ;
echo $jason;

 I get: URL: /net1003/people

 Thoughts on what I am doing wrong.

Yeah.  Not R'ing TFM.  dirname() gives you the name of the
directory ABOVE what you pass.

http://php.net/dirname

-- 
/Daniel P. Brown
More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Plotting Tool

2008-10-07 Thread Thorsten Suckow-Homberg
Hey there,

 Anyone have any suggestions on a plotting package for PHP?
 Nothing too crazy and fancy - just easy to read plots/graphs.
 We were using PHPlot on our old server but it's requiring too many
 lib's/util's to install on a new server.

 

JPGraph:
http://www.aditus.nu/jpgraph/


HTH

Thorsten


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Plotting Tool

2008-10-07 Thread Daniel Brown
On Tue, Oct 7, 2008 at 8:04 PM, Liz Kim [EMAIL PROTECTED] wrote:
 Hi,

 Anyone have any suggestions on a plotting package for PHP?
 Nothing too crazy and fancy - just easy to read plots/graphs.
 We were using PHPlot on our old server but it's requiring too many
 lib's/util's to install on a new server.

I think Richard Heyes was working on some of these, actually.  Not
positive if it was plotting or just display, though.  If you check the
archives, you might find something.  I'm CC'ing him personally, too.

Here's one link of his I have from memory:

http://www.phpguru.org/RGraph_dev/examples/bar.html

-- 
/Daniel P. Brown
More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and getting part of URL

2008-10-07 Thread Jason ML

Daniel,


I get: URL: /net1003/people

Thoughts on what I am doing wrong.


   Yeah.  Not R'ing TFM.  dirname() gives you the name of the
directory ABOVE what you pass.

   http://php.net/dirname


Thanks for the pointer. You are indeed correct.

-Jason


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP and getting part of URL

2008-10-07 Thread Micah Gersten
Your original post has this as the URL:
 http://www.mydomain.tld/jason/index.php 

That's why I gave you that command.

If you want jason out of what you posted,
Check out the following commands:
http://us.php.net/array_pop
http://us.php.net/explode


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Jason ML wrote:
 Hi Micah,

 dirname($_SERVER['REQUEST_URI']);


 I have tried that and I dont get the proper URI:

 Example running print_r($_SERVER); I get: [REQUEST_URI] =
 /net1003/people/jason/

 But then doing:

 $jason = dirname($_SERVER['REQUEST_URI']);

 echo URL: ;
 echo $jason;

 I get: URL: /net1003/people

 Thoughts on what I am doing wrong.

 Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Login

2008-10-07 Thread Terry J Daichendt
I want to open a page if a login is correct and another if not. What is the 
function to open a page in PHP? Can you show me a simple example of the 
syntax? 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Login

2008-10-07 Thread Micah Gersten
What do you mean by open?
You can redirect to a new page:
http://us.php.net/header
or
You can include a file:
http://us.php.net/include/

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Terry J Daichendt wrote:
 I want to open a page if a login is correct and another if not. What
 is the function to open a page in PHP? Can you show me a simple
 example of the syntax?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Login

2008-10-07 Thread Kyle Terry
You can just use a header redirect. For example: if you are at  
login.php and the user is authorized, you could use if($auth === true) 
{ header(Location: authed_page.php);

} else { header(Location: denied.php); }


On Oct 7, 2008, at 5:44 PM, Terry J Daichendt  
[EMAIL PROTECTED] wrote:


I want to open a page if a login is correct and another if not. What  
is the function to open a page in PHP? Can you show me a simple  
example of the syntax?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Login

2008-10-07 Thread Nilesh Govindrajan
There is no such function! You have to write the code.


On Wed, Oct 8, 2008 at 6:14 AM, Terry J Daichendt
[EMAIL PROTECTED]wrote:

 I want to open a page if a login is correct and another if not. What is the
 function to open a page in PHP? Can you show me a simple example of the
 syntax?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Nilesh Govindrajan ([EMAIL PROTECTED])

iTech7 Site and Server Administrator

www.itech7.com


Re: [PHP] Login

2008-10-07 Thread Nilesh Govindrajan
On Wednesday 08 October 2008 06:14:33 am Terry J Daichendt wrote:
 I want to open a page if a login is correct and another if not. What is the
 function to open a page in PHP? Can you show me a simple example of the
 syntax?

There is no such function. You have many options like redirecting a user-

header('Location: newfile.php');

showing another file-

include('newfile.php');

or using fopen to open a HTML file and print it (this one is very rarely 
used!).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Selecting all records between a date range

2008-10-07 Thread Chris

Dan Joseph wrote:

On Thu, Oct 2, 2008 at 12:35 PM, Jason Pruim [EMAIL PROTECTED] wrote:


   SQLTEST: SELECT * FROM `timeStore` WHERE`timein` BETWEEN
1222315200 AND 122292
Could not perform query: Query was empty

[EMAIL PROTECTED]



Put a ' around your timestamp numbers.  I think that should fix that query.
Although I'll admitt, I have no way to test that on mysql, but that is how
MS SQL works...


Int's don't need quoting in mysql (or postgres, or oracle).. not sure 
why ms-sql would need that.


--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Manipulating strings

2008-10-07 Thread Ron Piggott
I have a series of questions.

How do I count the number of br / 's in a string?

How do I add text in the middle of a string, let's say after the 3rd
br /

Ron


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Manipulating strings

2008-10-07 Thread Micah Gersten
For the 1st question:
http://us.php.net/manual/en/function.substr-count.php

For the second question:
http://us.php.net/manual/en/function.strpos.php
http://us.php.net/manual/en/function.str-replace.php

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Ron Piggott wrote:
 I have a series of questions.

 How do I count the number of br / 's in a string?

 How do I add text in the middle of a string, let's say after the 3rd
 br /

 Ron


   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Manipulating strings

2008-10-07 Thread Ron Piggott

The first question was to find out how long the blog entry was (number
of paragraphs.)

I am wanting to put an ad in half way.  Consequently there are going to
be many br / 's before the one I am wanting to add text to.

How should I handle this?

Ron

On Tue, 2008-10-07 at 20:55 -0500, Micah Gersten wrote:
 For the second question:
 http://us.php.net/manual/en/function.strpos.php
 http://us.php.net/manual/en/function.str-replace.php
 
 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com
 
 
 
 Ron Piggott wrote:
  I have a series of questions.
 
  How do I count the number of br / 's in a string?
 
  How do I add text in the middle of a string, let's say after the 3rd
  br /
 
  Ron
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Manipulating strings

2008-10-07 Thread Micah Gersten
Then you'll need this as well:
http://us.php.net/manual/en/function.strlen.php

**strpos** ( $text , 'br /'
http://us.php.net/manual/en/language.pseudo-types.php#language.types.mixed,
strlen($text)/2 );

Will give you the position.

Use str_replace to insert your ad.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Ron Piggott wrote:
 The first question was to find out how long the blog entry was (number
 of paragraphs.)

 I am wanting to put an ad in half way.  Consequently there are going to
 be many br / 's before the one I am wanting to add text to.

 How should I handle this?

 Ron

 On Tue, 2008-10-07 at 20:55 -0500, Micah Gersten wrote:
   
 For the second question:
 http://us.php.net/manual/en/function.strpos.php
 http://us.php.net/manual/en/function.str-replace.php

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Ron Piggott wrote:
 
 I have a series of questions.

 How do I count the number of br / 's in a string?

 How do I add text in the middle of a string, let's say after the 3rd
 br /

 Ron


   
   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Plotting Tool

2008-10-07 Thread Warren Vail
You might check out JPGraph, I think it's available on source forge, very
little php code on your part can produce some pretty impressive results.

Warren Vail 

 -Original Message-
 From: paragasu [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 07, 2008 7:42 PM
 To: Daniel Brown
 Cc: Liz Kim; php-general@lists.php.net; Richard Heyes
 Subject: Re: [PHP] Plotting Tool
 
 i am not sure if this one can be counted as OT. but, i found 
 a JQuery extension you can use.
 it is a javascript http://code.google.com/p/flot/ and here is 
 the result example http://ajaxian.com/archives/plotting-in-jquery
 
 quite fancy ;)
 
 On 10/8/08, Daniel Brown [EMAIL PROTECTED] wrote:
  On Tue, Oct 7, 2008 at 8:04 PM, Liz Kim [EMAIL PROTECTED] wrote:
  Hi,
 
  Anyone have any suggestions on a plotting package for PHP?
  Nothing too crazy and fancy - just easy to read plots/graphs.
  We were using PHPlot on our old server but it's requiring too many 
  lib's/util's to install on a new server.
 
  I think Richard Heyes was working on some of these, 
 actually.  Not 
  positive if it was plotting or just display, though.  If 
 you check the 
  archives, you might find something.  I'm CC'ing him personally, too.
 
  Here's one link of his I have from memory:
 
  http://www.phpguru.org/RGraph_dev/examples/bar.html
 
  --
  /Daniel P. Brown
  More full-root dedicated server packages:
  Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
  Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
  Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
  Dedicated servers, VPS, and hosting from $2.50/mo.
 
  --
  PHP General Mailing List (http://www.php.net/) To 
 unsubscribe, visit: 
  http://www.php.net/unsub.php
 
 
 
 --
 PHP General Mailing List (http://www.php.net/) To 
 unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Plotting Tool

2008-10-07 Thread paragasu
i am not sure if this one can be counted as OT. but, i found a JQuery
extension you can use.
it is a javascript http://code.google.com/p/flot/
and here is the result example http://ajaxian.com/archives/plotting-in-jquery

quite fancy ;)

On 10/8/08, Daniel Brown [EMAIL PROTECTED] wrote:
 On Tue, Oct 7, 2008 at 8:04 PM, Liz Kim [EMAIL PROTECTED] wrote:
 Hi,

 Anyone have any suggestions on a plotting package for PHP?
 Nothing too crazy and fancy - just easy to read plots/graphs.
 We were using PHPlot on our old server but it's requiring too many
 lib's/util's to install on a new server.

 I think Richard Heyes was working on some of these, actually.  Not
 positive if it was plotting or just display, though.  If you check the
 archives, you might find something.  I'm CC'ing him personally, too.

 Here's one link of his I have from memory:

 http://www.phpguru.org/RGraph_dev/examples/bar.html

 --
 /Daniel P. Brown
 More full-root dedicated server packages:
 Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
 Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
 Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
 Dedicated servers, VPS, and hosting from $2.50/mo.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: php framework vs just php?

2008-10-07 Thread paragasu
 PHP framework vs just php ?
 http://paul-m-jones.com/?p=315

according to the benchmark.Just PHP win by more than 100%  to average framework.
even the fastest solar only manage to serve 154pages/sec compare to
just php 1320pages/sec

call me outdated. but i stay with just php!

On 10/8/08, Eric Butera [EMAIL PROTECTED] wrote:
 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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php