[PHP] FW: No Subject

2013-03-16 Thread Ryan S
http://www.coachholidays.co.uk/ramlm/hfoqauyyvomdvio.kaxkucbebccxpzq



Re: [PHP] Wrong time being displayed by PHP!

2012-10-22 Thread Richard S. Crawford
On Thu, Oct 18, 2012 at 2:12 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote:

  From: underp...@gmail.com [mailto:underp...@gmail.com] On Behalf Of
  Richard S. Crawford
  Sent: 17 October 2012 19:29
  To: PHP-General
 
  You can see the current output of the above code here:
 
  http://projectbench.extensiondlc.net

 Can I ask what the fix for this was? Because that URL is currently
 showing the following for me:

 02:09:27 am America/Los_Angeles
 America/Los_Angeles
 Thu, 18 Oct 2012 02:09:27 -0700
 Thu, 18 Oct 2012 09:09:27 +
 1350551367 (-25200)
 Thu Oct 18 02:09:27 PDT 2012


 Cheers!

 Mike


Hi Mike,

Sorry I took so long to answer. I've been out sick, and didn't have access
to the resolution information until this morning.

The server administrators wound up reinstalling the tzdata package and
enabled time synchronization.



-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


Re: [PHP] Wrong time being displayed by PHP!

2012-10-17 Thread Richard S. Crawford
On Tue, Oct 16, 2012 at 3:16 PM, Daniel Brown danbr...@php.net wrote:

  With regard to debugging your issue, it's extremely unlikely that
  it's PHP's fault, since no one else has the same issue.  However, it
  does indeed sound as though there's a configuration mismatch or a bad
  setting of the system clock (as suggested earlier by myself and
  others).  What's the output when you run the code below?
 
  ?php
 
  if (php_sapi_name() == 'cli') {
  define('NL',PHP_EOL);
  } else {
  define('NL','br/'.PHP_EOL);
  }
 
  echo date_default_timezone_get().NL;
 
  echo date('r').NL;
 
  echo gmdate('r').NL;
 
  echo time().' ('.date('Z').')'.NL;
 
  echo trim(`date`).NL;
 
  ?
 
 
  This is the output:
 
  America/Los_Angeles
  Tue, 16 Oct 2012 17:22:09 -0400
  Tue, 16 Oct 2012 21:22:09 +
  1350422529 (-14400)
  Tue Oct 16 17:22:09 EDT 2012

 Is this a shared server, Rich? As shown, the admin configured the
 timezone of the machine to be EDT and set the clock right, but php.ini must
 be set to PDT. You can easily override this with a local php.ini file, an
 .htaccess directive, or by placing date_default_timezone_set() near the top
 of the code.


You can see the current output of the above code here:

http://projectbench.extensiondlc.net

I've confirmed that the server is set to PDT. The value of date.timezone in
php.ini is America/Los_Angeles, which should be (currently) -8 hours from
UTC, but it looks like the PDT offset is only set to -4. Does that even
make sense?

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


[PHP] Wrong time being displayed by PHP!

2012-10-16 Thread Richard S. Crawford
The value of date.timezone in php.ini is set to America/Los_Angeles.

The local time is 11:02 a.m. Yet the output of date(h:i a e) is:

02:02 pm America/Los_Angeles

which is three hours ahead of the real time.

Why is this? What's going on?

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com) http://www.underpope.com
Twitter: http://twitter.com/underpope
Facebook: http://www.facebook.com/underpope
Google+: http://gplus.to/underpope


Re: [PHP] Wrong time being displayed by PHP!

2012-10-16 Thread Richard S. Crawford
I double checked the server time. It is set to America/Los_Angeles as
well.


On Tue, Oct 16, 2012 at 11:07 AM, Adam Richardson simples...@gmail.comwrote:

 On Tue, Oct 16, 2012 at 2:02 PM, Richard S. Crawford
 rich...@underpope.com wrote:
  The value of date.timezone in php.ini is set to America/Los_Angeles.
 
  The local time is 11:02 a.m. Yet the output of date(h:i a e) is:
 
  02:02 pm America/Los_Angeles
 
  which is three hours ahead of the real time.
 
  Why is this? What's going on?

 The server's time could be wrong. Or, code somewhere could be
 (re)setting the timezone.

 Adam

 --
 Nephtali:  A simple, flexible, fast, and security-focused PHP framework
 http://nephtaliproject.com

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




-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


Re: [PHP] Wrong time being displayed by PHP!

2012-10-16 Thread Richard S. Crawford
On Tue, Oct 16, 2012 at 12:42 PM, Enrico Lamperti z...@irken.com.ar wrote:

 You could try using
 date_default_timezone_set
 http://php.net/manual/en/function.date-default-timezone-set.php()
 in your script, instead.

 And if you don't need to care about DST, you can define a specific GMT
 offset http://www.php.net/manual/en/timezones.others.php.

 Hope it helps :)


Hi Enrico,

Thanks for the suggestion. Unfortunately the problem seems to be that PHP
thinks the America/Los_Angeles timezone is the same as EDT. I'm not sure
how to approach this issue.

Richard



 On Tue, Oct 16, 2012 at 3:56 PM, Richard S. Crawford 
 rscrawf...@mossroot.com wrote:

  I double checked the server time. It is set to America/Los_Angeles as
  well.
 
 
  On Tue, Oct 16, 2012 at 11:07 AM, Adam Richardson simples...@gmail.com
  wrote:
 
   On Tue, Oct 16, 2012 at 2:02 PM, Richard S. Crawford
   rich...@underpope.com wrote:
The value of date.timezone in php.ini is set to
 America/Los_Angeles..
   
The local time is 11:02 a.m. Yet the output of date(h:i a e) is:
   
02:02 pm America/Los_Angeles
   
which is three hours ahead of the real time.
   
Why is this? What's going on?
  
   The server's time could be wrong. Or, code somewhere could be
   (re)setting the timezone.
  
   Adam
  
   --
   Nephtali:  A simple, flexible, fast, and security-focused PHP framework
   http://nephtaliproject.com
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
  --
  Sláinte,
  Richard S. Crawford (rich...@underpope.com)
  http://www.underpope.com
  Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com
 )
 



 --
 Enrico




-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


Re: [PHP] Wrong time being displayed by PHP!

2012-10-16 Thread Richard S. Crawford
On Tue, Oct 16, 2012 at 2:05 PM, Daniel Brown danbr...@php.net wrote:

 On Tue, Oct 16, 2012 at 4:19 PM, Richard S. Crawford
 rscrawf...@mossroot.com wrote:
 
  Thanks for the suggestion. Unfortunately the problem seems to be that PHP
  thinks the America/Los_Angeles timezone is the same as EDT. I'm not sure
  how to approach this issue.

 Per list rules, just a gentle reminder: please don't top-post.


Sorry about that. I was getting very frustrated with the issue, and I
forgot. I'll be sure to keep it in mind.



 With regard to debugging your issue, it's extremely unlikely that
 it's PHP's fault, since no one else has the same issue.  However, it
 does indeed sound as though there's a configuration mismatch or a bad
 setting of the system clock (as suggested earlier by myself and
 others).  What's the output when you run the code below?

 ?php

 if (php_sapi_name() == 'cli') {
 define('NL',PHP_EOL);
 } else {
 define('NL','br/'.PHP_EOL);
 }

 echo date_default_timezone_get().NL;

 echo date('r').NL;

 echo gmdate('r').NL;

 echo time().' ('.date('Z').')'.NL;

 echo trim(`date`).NL;

 ?
  http://www.php.net/unsub.php


This is the output:

America/Los_Angeles
Tue, 16 Oct 2012 17:22:09 -0400
Tue, 16 Oct 2012 21:22:09 +
1350422529 (-14400)
Tue Oct 16 17:22:09 EDT 2012





-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


Re: [PHP] Friday - Return of Brain Teasers

2012-10-05 Thread Richard S. Crawford
Christopher Walken? Is that you?

On Fri, Oct 5, 2012 at 10:43 AM, Daniel Brown danbr...@php.net wrote:

 About five-and-a-half years ago, we had a brainteasers thread
 going on[1].  Last year it was briefly resurrected[2], and both times
 got some good content and dialogue going.  So I'd like to reprise the
 thread in 2012, as well.  Those of you connected to me on Facebook
 (parasane) or Twitter (@oidk) might already have seen it, but a simple
 one to get things rolling:

 ?php require ++$cowbell; ?

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

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




-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


[PHP] get question

2012-08-27 Thread Jack S
Hello All,

Trying to figure out why when I include the page that contains this
code, I'm not able to get the $calling_page populated with any values.
Any help appreciated...


?
# Dynamic Content based in page
$calling_page = $_GET['page'];

# Home Page 
--
if(!($calling_page)) {
$title = Title 1 - $calling_page;
$body = body /;

} elseif ($calling_page == index) {
$title = Title 2 - $calling_page;
$body = body /;

# Non Specified Page
--
} else {
$title = Title 3 - $calling_page;
$body = body /;

}

echo title.$title./title;
?


-- 
Thanks!
Joey

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



Re: [PHP] Re: MySQL and PHP weirdness - RESOLVED

2012-02-15 Thread Richard S. Crawford
This has been resolved. A previous programmer had snuck in a function that
would convert the value of the description field to a date value if it
contained the word Date. This has been fixed.


On Tue, Feb 14, 2012 at 5:44 PM, David Robley robl...@aapt.net.au wrote:

 Richard S. Crawford wrote:

  Bear with me here. I have a problem with PHP and MySQL that's been
  stumping me for a couple of days now. I'm not even sure how to describe
  it, so I'll just do my best.
 
  There's a row in our bugs database that looks like every other row in the
  table, but when it's pulled from the database and displayed in PHP, the
  description field -- which is defined as a mediumtext field -- is
  displayed as a date field with a value of 12/31/1969. Moreoever, when I
  use PHPMyAdmin to look at the row directly, the description field has
  the data that I expect it to.
 
  Just for fun, here's the text in question:
  
  Quarterly Course Set Up - Spring 2012 (114)
  Section  Course titleCourse Start
 Date
  114MHI214 The Internet and the Future of Patient Care 04/02/2012
  114MHI212 Health Information Systems Analysis and Design  04/02/2012
  Program administrator 2 users; Laurel Aroner - Susan Catron - Jennifer
  Kremer
  Instructors;
  MHI214; Peter Yellowlees
  MHI212; Robert Balch
  Per instructions from Rita Smith-Simms - I'm creating this task for
 myself
  and based on instructions given which are that all listed courses are now
  to be backed-up and restored sooner (original course set up time-frame
 was
  a month before course starts).
  Adding instructions - Follow the 52-step quarterly course set up process
  and information from the course matrix; if matrix incomplete, input
  information during this set up
  As you track your time each day, please include in the notes which
 courses
  (use project code) you worked on and indicate either working on or
  completed.
  Create and notify by 2/15/2012
  
 
  I've made sure there are no odd characters that would mess up how PHP is
  displaying the text. I've tried changing the field type from mediumtext
  to text but this didn't work.
 
  If anyone has any ideas as to why this might be happening -- or if I just
  wasn't clear -- please let me know.
 
 

 If phpmyadmin gives expected results and _your_ code doesn't, I'd be
 suspicious of your code :-)

 It might be helpful for you to post relevant part(s) ofthe actual code you
 are using.



 Cheers
 --
 David Robley

 Man who run behind car get exhausted.
 Today is Sweetmorn, the 46th day of Chaos in the YOLD 3178.


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




-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


[PHP] MySQL and PHP weirdness

2012-02-14 Thread Richard S. Crawford
Bear with me here. I have a problem with PHP and MySQL that's been stumping
me for a couple of days now. I'm not even sure how to describe it, so I'll
just do my best.

There's a row in our bugs database that looks like every other row in the
table, but when it's pulled from the database and displayed in PHP, the
description field -- which is defined as a mediumtext field -- is
displayed as a date field with a value of 12/31/1969. Moreoever, when I use
PHPMyAdmin to look at the row directly, the description field has the
data that I expect it to.

Just for fun, here's the text in question:

Quarterly Course Set Up - Spring 2012 (114)
Section  Course titleCourse Start Date
114MHI214 The Internet and the Future of Patient Care 04/02/2012
114MHI212 Health Information Systems Analysis and Design  04/02/2012
Program administrator 2 users; Laurel Aroner - Susan Catron - Jennifer
Kremer
Instructors;
MHI214; Peter Yellowlees
MHI212; Robert Balch
Per instructions from Rita Smith-Simms - I'm creating this task for myself
and based on instructions given which are that all listed courses are now
to be backed-up and restored sooner (original course set up time-frame was
a month before course starts).
Adding instructions - Follow the 52-step quarterly course set up process
and information from the course matrix; if matrix incomplete, input
information during this set up
As you track your time each day, please include in the notes which courses
(use project code) you worked on and indicate either working on or
completed.
Create and notify by 2/15/2012


I've made sure there are no odd characters that would mess up how PHP is
displaying the text. I've tried changing the field type from mediumtext
to text but this didn't work.

If anyone has any ideas as to why this might be happening -- or if I just
wasn't clear -- please let me know.


-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com) http://www.underpope.com
Twitter: http://twitter.com/underpope
Facebook: http://www.facebook.com/underpope
Google+: http://gplus.to/underpope


[PHP] Hi!

2011-11-24 Thread Jay S
Hi,

Hope you are doing awesome!

My name is Jay and I am the Affiliate Account
Manager at InstallMonetizer.

I wanted to connect with you and show you
how you can make more money by using our
services to monetize your install path. :)

Currently, I see you are offering your
software on Download.com.

Our payouts will far exceed that.

Below are our sample payouts (eCPM):
**1000 USA offer screens displayed: $380.00
**1000 European offer screens displayed: $230.00
NOTE - We monetize all countries :)

Most publishers run a test with us and
quickly see that we payout 3-4x more
than their current advertiser.

I would love have you run a test on our network. :)

When would be a good time to chat?
Skype: jay.installmonetizer
Yahoo: dhaliwal.jasjeet

Thanks for your time!


-- 
Sincerely,
Jay S.
j...@installmonetizercorp.com j...@installmonetizer.com
Skype: jay.installmonetizer
Yahoo: dhaliwal.jasjeet


Re: [PHP] Upgrade or Die?

2011-06-24 Thread Richard S. Crawford
That is indeed frustrating. I upgraded to FF 4 a month ago or so, and it's
been nothing but a hassle. Out of frustration, I switched to Chrome, and I
haven't looked back.


On Fri, Jun 24, 2011 at 10:16 AM, ad...@buskirkgraphics.com wrote:

 In shifting gears to a faster pace of development and release, Mozilla has
 opted to abandon security support for Firefox 4 immediately upon the
 release
 of version 5, which came out this week.

 This could be a risky move, since many users neglect to update their
 browsers immediately for various reasons, despite the pop-up reminders
 Firefox periodically displays.

 I will never understand this mindset.



 Full story : http://www.technewsworld.com/edpick/72739.html







 Richard L. Buskirk






-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


Re: [PHP] WHERE field = a range of values (value

2011-05-25 Thread Paul S

On Tue, 24 May 2011 23:47:47 +0700, Paul S pau...@roadrunner.com wrote:

On Tue, 24 May 2011 21:09:34 +0700, Richard S. Crawford  
rscrawf...@mossroot.com wrote:



On Tue, May 24, 2011 at 6:51 AM, Paul S pau...@roadrunner.com wrote:

I'd like to check a table to retrieve rows for which one field equals  
one

of a set of values


#get products(fields) in category list
   while ($row = $db_connect-fetch_array($productsincategory_list)) {
  $product = $row ['selection'];
  $fields = $fields .  $product,;
   }
   $fields = substr($fields,'',-1);

## echo $fieldsbrbr;
## $fields = Prod1, ProD2, Prod3

This ...

$db_connect-fetch_array($sql_result);

$store_result = $db_connect-query(select * from $sql_usertable WHERE
(($sql_usertable.product1 = '($fields)')||( $sql_usertable.product2 =
'($fields)')||($sql_usertable.product3 = '($fields)')) order by id desc
limit $entry, $entries_per_page);

doesn't work. It selects nothing (obviously because no single field  
equals

' (Prod1, Prod2, Prod3) '). But it's the idea. Can I change the:

= '($fields)'

syntax I'm trying?

The actual select checks more fields for this or that and gets more
complicated so I'd like to keep this as simple
as possible. I would like to do this without UNIONS (in one pass) if
possible (my
dbsql.php doesn't seem to go beyond regular query).



Try in:

where productx in (Prod1, Prod2, Prod3)





THANKS. You saved me another day of frustration trying UNION! :-)

In addition your answer also got me here:
http://dev.mysql.com/doc/refman/4.1/en/comparison-operators.html



Except when $fields = '' (blank)  MySql error. Can put in if but leaves  
an undefined resource (warning). Any way to initialize a resourse?  
($store_result = $db_connect-query)?

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



[PHP] WHERE field = a range of values (value

2011-05-24 Thread Paul S

I'd like to check a table to retrieve rows for which one field equals one
of a set of values


#get products(fields) in category list
while ($row = $db_connect-fetch_array($productsincategory_list)) {
   $product = $row ['selection'];
   $fields = $fields .  $product,;
}
$fields = substr($fields,'',-1);

## echo $fieldsbrbr;
## $fields = Prod1, ProD2, Prod3

This ...

$db_connect-fetch_array($sql_result);

$store_result = $db_connect-query(select * from $sql_usertable WHERE
(($sql_usertable.product1 = '($fields)')||( $sql_usertable.product2 =
'($fields)')||($sql_usertable.product3 = '($fields)')) order by id desc
limit $entry, $entries_per_page);

doesn't work. It selects nothing (obviously because no single field equals
' (Prod1, Prod2, Prod3) '). But it's the idea. Can I change the:

= '($fields)'

syntax I'm trying?

The actual select checks more fields for this or that and gets more  
complicated so I'd like to keep this as simple
as possible. I would like to do this without UNIONS (in one pass) if  
possible (my

dbsql.php doesn't seem to go beyond regular query).




--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



Re: [PHP] WHERE field = a range of values (value

2011-05-24 Thread Richard S. Crawford
On Tue, May 24, 2011 at 6:51 AM, Paul S pau...@roadrunner.com wrote:

 I'd like to check a table to retrieve rows for which one field equals one
 of a set of values

 
 #get products(fields) in category list
while ($row = $db_connect-fetch_array($productsincategory_list)) {
   $product = $row ['selection'];
   $fields = $fields .  $product,;
}
$fields = substr($fields,'',-1);

 ## echo $fieldsbrbr;
 ## $fields = Prod1, ProD2, Prod3

 This ...

 $db_connect-fetch_array($sql_result);

 $store_result = $db_connect-query(select * from $sql_usertable WHERE
 (($sql_usertable.product1 = '($fields)')||( $sql_usertable.product2 =
 '($fields)')||($sql_usertable.product3 = '($fields)')) order by id desc
 limit $entry, $entries_per_page);

 doesn't work. It selects nothing (obviously because no single field equals
 ' (Prod1, Prod2, Prod3) '). But it's the idea. Can I change the:

 = '($fields)'

 syntax I'm trying?

 The actual select checks more fields for this or that and gets more
 complicated so I'd like to keep this as simple
 as possible. I would like to do this without UNIONS (in one pass) if
 possible (my
 dbsql.php doesn't seem to go beyond regular query).


Try in:

where productx in (Prod1, Prod2, Prod3)



-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


Re: [PHP] WHERE field = a range of values (value

2011-05-24 Thread Paul S
On Tue, 24 May 2011 21:09:34 +0700, Richard S. Crawford  
rscrawf...@mossroot.com wrote:



On Tue, May 24, 2011 at 6:51 AM, Paul S pau...@roadrunner.com wrote:

I'd like to check a table to retrieve rows for which one field equals  
one

of a set of values


#get products(fields) in category list
   while ($row = $db_connect-fetch_array($productsincategory_list)) {
  $product = $row ['selection'];
  $fields = $fields .  $product,;
   }
   $fields = substr($fields,'',-1);

## echo $fieldsbrbr;
## $fields = Prod1, ProD2, Prod3

This ...

$db_connect-fetch_array($sql_result);

$store_result = $db_connect-query(select * from $sql_usertable WHERE
(($sql_usertable.product1 = '($fields)')||( $sql_usertable.product2 =
'($fields)')||($sql_usertable.product3 = '($fields)')) order by id desc
limit $entry, $entries_per_page);

doesn't work. It selects nothing (obviously because no single field  
equals

' (Prod1, Prod2, Prod3) '). But it's the idea. Can I change the:

= '($fields)'

syntax I'm trying?

The actual select checks more fields for this or that and gets more
complicated so I'd like to keep this as simple
as possible. I would like to do this without UNIONS (in one pass) if
possible (my
dbsql.php doesn't seem to go beyond regular query).



Try in:

where productx in (Prod1, Prod2, Prod3)





THANKS. You saved me another day of frustration trying UNION! :-)

In addition your answer also got me here:
http://dev.mysql.com/doc/refman/4.1/en/comparison-operators.html

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



[PHP] Odd array_push issue

2011-05-11 Thread Richard S. Crawford
I'm encountering what appears to be a bug in array_push when I try using
that function to add objects to an array. For example...

A = Object 1
B = Object 2

If I execute the following code:

array_push(objectarray, A);
array_push(objectarray, B);

...I expect the contents of $objectarray to be:

[0] = A
[1] = B

Instead, the last object pushed onto the array is repeated throughout the
array. In other words, instead of the above, I get this:

[0] = B
[1] = B

Can anyone enlighten me as to why this is happening? I've looked through bug
reports but haven't found anything, which leads me to think that perhaps my
own code is at fault.

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com


Re: [PHP] Odd array_push issue

2011-05-11 Thread Richard S. Crawford
On Wed, May 11, 2011 at 1:30 PM, Peter Lind peter.e.l...@gmail.com wrote:

 On 11 May 2011 22:23, Richard S. Crawford rich...@underpope.com wrote:
  I'm encountering what appears to be a bug in array_push when I try using
  that function to add objects to an array. For example...
 
  A = Object 1
  B = Object 2
 
  If I execute the following code:
 
  array_push(objectarray, A);
  array_push(objectarray, B);
 
  ...I expect the contents of $objectarray to be:
 
  [0] = A
  [1] = B
 
  Instead, the last object pushed onto the array is repeated throughout the
  array. In other words, instead of the above, I get this:
 
  [0] = B
  [1] = B
 
  Can anyone enlighten me as to why this is happening? I've looked through
 bug
  reports but haven't found anything, which leads me to think that perhaps
 my
  own code is at fault.
 

 If you could post some more of your code, it would be easier to check
 if your code is at fault or not.

 Regards
 Peter


Here's some more sample code, then:


function retrieve_records ($where) {
 (Returns an array of objects which represent rows from a database
query)
}

$records = retrieve_records($condition);

$recordlist  = array();

foreach ($records as $record) {

 array_push ($recordlist, $record)

}


I know this code isn't very useful, but these are the conditions which cause
the issue I've mentioned.

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com


Re: [PHP] Custom function

2011-05-02 Thread Richard S. Crawford
On Mon, May 2, 2011 at 3:16 PM, Ron Piggott
ron.pigg...@actsministries.orgwrote:


 Is it possible to write a function with an optional flag?  What would the
 syntax look like?

 So far I have:

 function load_advertisement( $web_page_reference ,
 $web_advertising_sizes_reference ) {



Hi Ron:

I'm not sure what you mean by optional flag? Do you mean an optional
parameter?

Richard

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


[PHP] How to write a PHP coding to list out all files and directories as links to them?

2011-04-14 Thread Mikhail S
How to write a PHP coding to list out all files and directories as links to
them?

This is somewhat similar to some index pages. When new file or folder is
added to the directory, HTML page should display the newly created
file/folder together with previous ones after it is being refreshed. (prefer
in alphabatical order)

How to achieve this sort of functionality in PHP? Please provide sample
coding as well. (and any references)

Thanks.

--
Mike
http://jp.shopsloop.com/


Re: [PHP] newbie - function is undefined

2011-04-01 Thread Richard S. Crawford
On Fri, Apr 1, 2011 at 2:32 PM, Jim Giner jim.gi...@albanyhandball.comwrote:


 function. Try something like:
 ...
 echo 'heaading contains: scriptgetText(h2)/script';
 ...

 I tried it - no better.


Did you still get the function undefined error?

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


Re: [PHP] How is this possible???? (addslashes)

2011-02-17 Thread Paul S
On Thu, 17 Feb 2011 07:50:45 +0700, Daniel Brown paras...@gmail.com  
wrote:





No offense, but are you kidding me? The host disables phpinfo() for
security reasons, but keeps 4.4.4 running? Talk about running, Paul  
run

away from them. Fast.


AND they have a condition (this reported) that could cause (fail to  
prevent) SQL injection!


Legacy configurations remain when ISPs don't want to force customers to  
do the code changes that might be necessary to upgrade


It runs. I'd rather not do the changes necessary to go to PHP5 now. But I  
cannot add an edit HTML via forms feature to the administration until this  
is resolved. I want to get to the bottom of this. PLEASE!! ANYONE ???


HOW COULD THIS POSSIBLY HAPPEN. They must have something messed up in the  
PHP configuration. What is it?


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



[PHP] How is this possible???? (addslashes)

2011-02-16 Thread Paul S

Can anyone please tell me how the addslashes output (note = Everyone''s a
card on the \earth) in the following example is possible. It is
addslashes output but this result is consistent with the output from
post when runtime is set: 1): a single quote is inserted before a single
quote and nothing is added before  or \.

php: ...
---
?php
//error_reporting(E_ALL);
echo 'display_errors = ' . ini_get('display_errors') . br;
echo 'register_globals = ' . ini_get('register_globals') . br;
echo 'magic_quotes_gpc = ' . ini_get('magic_quotes_gpc') . br;
echo 'get_magic_quotes_gpc = ' . get_magic_quotes_gpc() . br;
echo 'get_magic_quotes_runtime = ' . get_magic_quotes_runtime() . br;
echo brbr;
echo br;
echo 'Current PHP version: ' . phpversion();
echo brbr;
?

?php
$note = Everyone's a card on the \earth;
echo br$notebr;
$note = addslashes($note);
echo brnote = $notebr;
?

?php
phpinfo();
?
-

output:

display_errors = 1
register_globals = 1
magic_quotes_gpc = 1
get_magic_quotes_gpc = 1
get_magic_quotes_runtime = 1



Current PHP version: 4.4.4


Everyone's a card on the \earth

note = Everyone''s a card on the \earth

Warning: phpinfo() has been disabled for security reasons in
---
--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



Re: [PHP] No SMTP server? Can't get mail()

2011-01-24 Thread Paul S
On Sun, 23 Jan 2011 12:40:25 +0700, David Robley robl...@aapt.net.au  
wrote:



Paul S wrote:

I'm a little new to PHP.


David starts:
Nobody seems to have mentioned it, but the SMTP info is only needed on a  
Win

system. The following is an extract from a default php.ini file:



Well, I have just RTF mail() Manual and you are ABSOLUTELY correct SMTP  
info is not needed for PHP mail(). SORRY for that confusion.


Where my confusion started, I guess, and why I was trying to get  
confirmation of the SMTP server name
and try mail() at the same time was the mention of both in a SMTP option  
in the default php config.php
file for the email list program that I am trying to get running, as  
follows ...


begin quote# If you want to use the PHPMailer class from  
phpmailer.sourceforge.net, set the following

# to 1. If you tend to send out html emails, it is recommended to do so.
define(PHPMAILER,1);

# To use a SMTP please give your server hostname here, leave it blank to  
use the standard

# PHP mail() command.
define(PHPMAILERHOST,'');end quote

I'm still confused! :-( I can't even put my confusion into words hahahaha.

Is it SMTP server that uses sendmail or sendmail uses an SMTP server???

PHPMAILER doesn't need an SMTP server name?

OK, I've just googled PHPMAILERHOST and see confusing a few times. I  
will follow it from here for now.


mail() should be functional; if mail() is returning true then your next  
step

in the debug process would be to check the mail logs, if they are
accessible to you.


Well, I am glad you agree!

no access that I know of.
No telnet.
and
no helpful replies from the staff, ever
and
No PHPINFO and no echo of even what Apache server version I am using (see  
blocked info in my post above)
RANT: I could put just this whole project aside by just using an old v.  
simple emaillist program that uses mail().! I'm about to give up here.




On the other hand, using an SMTP class will give you a bit more
functionality.



I'll check SMTP classes out. Thank you.


--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



Re: [PHP] No SMTP server? Can't get mail()

2011-01-22 Thread Paul S

On Fri, 21 Jan 2011 13:41:21 +0700, Peter Lind peter.e.l...@gmail.com
wrote:

Probably not the solution you were looking for, but I've always found  
mail()

very unstable and I tend to use a mail library instead. Like phpmailer or
swiftmailer. Easier to configure and figure out problems with.

Regards
Peter


Peter, that is warranted advice here.

I'm a little new to PHP. I'm set up to develop Apache/PHP/MySQL on my PC
uploading results to a unix server. My situation here is that I am trying
to get a PHP Mailing List program running for a friend's business web site
(on unix). That program has 2 options for mailing: 1) mail()/SMTP and
2) phpmailer options. Mail()/SMTP works, at least, on my PC. But I can't
get either of
the two emailing options to work on the UNIX server. (Whatever those mail
problems are, it is mangled with odd PHP/MySQL problems on unix).
I'm just 'back here' starting debugging with the mail()/SMTP option on
unix and my conclusion based on feedback above (thank you) is that email
IS reaching the unix SMTP server but is not being forwarded (and that's
unresolved now).

My mentioned SMTP server echo problem is irrelevant. Maybe they fixed it
last night, or maybe I was smoking something yesterday. It IS echoing
correctly.
I finally figured out that part of my problem was misunderstanding a
warning
message caused by my not single quoting SMTP (yikes!).

Or maybe I was just
enraged over my lack of success all day yesterday to confirm Apache server
information on the unix server (which would help me guarantee that I have
the same Apache/PHP/MySQL configurations between the PC and unix servers).
But today the SMTP server info IS echo'd on the unix server. From the Unix
server ...

---
?php
function apacheversion() {
  $ver = split([/ ],$_SERVER['SERVER_SOFTWARE']);
  $apver = $ver[1] $ver[2];
   return $apver;
}
echo br;
print ('Apache Version: ' . apacheversion());
echo br;
print ($_SERVER[SERVER_SIGNATURE]);
print ($_SERVER[SERVER_SOFTWARE]);
echo br;
?

?php
echo br;
echo PHP_OS;
$os = php_uname();
echo 'OS' . $os;
echo brbr;
?

?php
error_reporting(E_ALL);
echo 'display_errors = ' . ini_get('display_errors') . \n;
echo 'register_globals = ' . ini_get('register_globals') . \n;
echo brbr;
echo SMTP host:  . ini_get(SMTP);
echo br;
echo smtp_port:  . ini_get(smtp_port);
echo br;
echo sendmail_from:  . ini_get(sendmail_from);
echo brbr;
?

?php
// prints e.g. 'Current PHP version: 4.1.1'
echo 'Current PHP version: ' . phpversion();
echo brbr;
// prints e.g. '2.0' or nothing if the extension isn't enabled
echo phpversion('mysqli');
echo brbr;
?

?php
$link = mysql_connect('localhost', 'xx', 'xx');
if (!$link) {
  die('Could not connect: ' .
mysql_error());
}
printf(MySQL server version: %s\n, mysql_get_server_info());
echo brbr;
?

?php
phpinfo();
?


gets:


Apache Version:
Apache

LinuxOSLinux clientx.xx.com 2.4.33.2 #4 SMP Wed Aug 23 10:41:21 EDT
2006 i686

display_errors = 1 register_globals = 1

SMTP host: localhost
smtp_port: 25
sendmail_from:

Current PHP version: 4.4.4


MySQL server version: 5.0.67-community


Warning: phpinfo() has been disabled for security reasons in
/home/xxx/php/unameunix.php on line 57




--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



[PHP] Script mysteriously restarting

2011-01-21 Thread Richard S. Crawford
I've got a massive PHP script which takes nearly an hour to run. Sometimes,
when it comes close to the end, it mysterious restarts itself and I have to
wait for another hour for it to complete.

Is there any reason why a PHP script would restart itself like this?

FWIW, I'm running PHP5 with Apache 2 on a Linux server.

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com


Re: [PHP] Script mysteriously restarting

2011-01-21 Thread Richard S. Crawford
Ah, sorry. It's a browser-based script.


On Fri, Jan 21, 2011 at 1:28 PM, Jim Lucas li...@cmsws.com wrote:

 On 1/21/2011 12:37 PM, Richard S. Crawford wrote:
  I've got a massive PHP script which takes nearly an hour to run.
 Sometimes,
  when it comes close to the end, it mysterious restarts itself and I have
 to
  wait for another hour for it to complete.
 
  Is there any reason why a PHP script would restart itself like this?
 
  FWIW, I'm running PHP5 with Apache 2 on a Linux server.
 

 Clarification please.

 Is this cli or browser based?

 Jim

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




-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com


[PHP] No SMTP server? Can't get mail()

2011-01-20 Thread Paul S
I am having problems with mail(). The problem is that the email just never  
gets there. Mail appears to be working. To start, I am investigating the  
SMTP server. I can't understand some things.


1) I am sure that the smtp server is and is set to localhost, but I want  
to verify this ...


---
error_reporting(E_ALL);
echo 'display_errors = ' . ini_get('display_errors') . \n;
echo 'register_globals = ' . ini_get('register_globals') . \n;
echo brbr;
echo SMTP host:  . ini_get(smtp);
echo SMTP port:  . ini_get(smtp_port);
echo Sendmail From:  . ini_get(sendmail_from);

   gets:

1 1

SMTP host:
SMTP port: 25
Sendmail_from:
Notice: Use of undefined constant sendmail_from - assumed 'sendmail_from'  
in /home/


Obviously SMTP is defined (?? because it is not undefined?), but nothing  
is echo'd for SMTP. WHY?

---
---
then ...

ini_set( smtp, localhost );

gets:

Notice: Use of undefined constant smtp - assumed 'smtp' in /home/ ...
SMTP host:
SMTP port: 25
Sendmail_from:
---
Strange, SMTP was defined before , and it still won't echo.
---
---
  Both

error_reporting(E_ALL);
ini_set( sendmail_from, sendmailfrom@localhost );
echo SMTP host:  . ini_get(smtp);
echo SMTP port:  . ini_get(smtp_port);
echo Sendmail From:  . ini_get(sendmail_from);
$return = mail('another user@localhost', 'Test', 'Test');
var_dump($return);

 and

error_reporting(E_ALL);
ini_set( sendmail_from, sendmailfrom@localhost );
ini_set( smtp, localhost );
echo SMTP host:  . ini_get(smtp);
echo SMTP port:  . ini_get(smtp_port);
echo Sendmail From:  . ini_get(sendmail_from);
$return = mail('another user@localhost', 'Test', 'Test');
var_dump($return);

 return

no other errors

SMTP host:
SMTP port: 25
Sendmail_from: sendmailfrom@localhost

and

bool(true)

Yet NO EMAIL is ever received/returned at the local email address or when  
outside email addresses are used, and never when mail() is seemingly  
successfully used in a script.


WHY can't I echo the SMTP address being USED? What am I doing wrong?  
(Please note that phpinfo IS DISABLED ON MY SERVER BECAUSE IT IS A  
SECURITY THREAT)


How am I going to get this emailing straightened out?


--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



[PHP] 400 Cannot connect to NNTP server

2011-01-20 Thread Paul S
400 Cannot connect to NNTP server 76.75.200.58 (76.75.200.58:119), connect  
error 10060



I do not seem to be having any problems getting to this newsgroup :-) but  
this message keeps popping up. Just to let u know, no need for replies.


Thanks for a great resource!

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



Re: [PHP] No SMTP server? Can't get mail()

2011-01-20 Thread Paul S
On Fri, 21 Jan 2011 12:28:16 +0700, Paul M Foster  
pa...@quillandmouse.com wrote:



On Fri, Jan 21, 2011 at 10:45:46AM +0700, Paul S wrote:

I am having problems with mail(). The problem is that the email just  
never

gets there. Mail appears to be working. To start, I am investigating the
SMTP server. I can't understand some things.

1) I am sure that the smtp server is and is set to localhost, but I  
want

to verify this ...

---
error_reporting(E_ALL);
echo 'display_errors = ' . ini_get('display_errors') . \n;
echo 'register_globals = ' . ini_get('register_globals') . \n;
echo brbr;
echo SMTP host:  . ini_get(smtp);
echo SMTP port:  . ini_get(smtp_port);
echo Sendmail From:  . ini_get(sendmail_from);

   gets:

1 1

SMTP host:
SMTP port: 25
Sendmail_from:
Notice: Use of undefined constant sendmail_from - assumed  
'sendmail_from'

in /home/

Obviously SMTP is defined (?? because it is not undefined?), but nothing
is echo'd for SMTP. WHY?


Think CASE-SENSITIVE. Check instead for SMTP, not smtp.


YES! I started with SMTP. Same result. I then switched to smtp lower case.  
Switched back. Both same. I'm sorry, I should have indicated that I tried  
both.

Still. No result from echo.


sendmail_from is not defined on my machine either, for what it's worth.

No problem here either. I just would like to know so that I can be sure to  
define it. Get's time-consuming when you can't just type in php info.

---
---
then ...

ini_set( smtp, localhost );

gets:

Notice: Use of undefined constant smtp - assumed 'smtp' in /home/ ...
SMTP host:
SMTP port: 25
Sendmail_from:
---
Strange, SMTP was defined before , and it still won't echo.
---


Again, think case-sensitive. smtp is not a valid ini variable. SMTP is.


---
  Both

error_reporting(E_ALL);
ini_set( sendmail_from, sendmailfrom@localhost );
echo SMTP host:  . ini_get(smtp);
echo SMTP port:  . ini_get(smtp_port);
echo Sendmail From:  . ini_get(sendmail_from);
$return = mail('another user@localhost', 'Test', 'Test');


The above is not a valid email address, as it contains a space. Not to
mention, I'm not real sure about the brackets. Just use a regular email
address without all the other stuff, as: jim...@example.com.


var_dump($return);

 and

error_reporting(E_ALL);
ini_set( sendmail_from, sendmailfrom@localhost );
ini_set( smtp, localhost );
echo SMTP host:  . ini_get(smtp);
echo SMTP port:  . ini_get(smtp_port);
echo Sendmail From:  . ini_get(sendmail_from);
$return = mail('another user@localhost', 'Test', 'Test');
var_dump($return);

 return

no other errors

SMTP host:
SMTP port: 25
Sendmail_from: sendmailfrom@localhost

and

bool(true)


Although the documentation isn't entirely clear, I suspect that the
return of true from the mail() function only means that the smtp server
accepted the email for delivery. The smtp server on localhost still has
to connect with the remote server and the remote server has to accept
the mail for delivery. I suspect the return of true only means that the
origin/localhost mailserver accepts the email. It can still fail beyond
there.


YES YES. Same as on my PC with a windows mail server. There it DOES get to  
the SMTP server. My BIGGEST problem is, of course, how to figure out why  
it does not get to gmail.com or roadrunner.com or even my own UNIX  
server's email. It is the same email (text, recip, etc.). My PC server  
DOES forward the email to ALL addresses. My UNIX server I never get the  
SAME messages.


But on my PC is IS forwarded to all email servers.




Yet NO EMAIL is ever received/returned at the local email address or  
when

outside email addresses are used, and never when mail() is seemingly
successfully used in a script.

WHY can't I echo the SMTP address being USED? What am I doing wrong?
(Please note that phpinfo IS DISABLED ON MY SERVER BECAUSE IT IS A
SECURITY THREAT)

How am I going to get this emailing straightened out?


I haven't seen a real email address used yet in your examples. Use a
real address, and not a localhost one. A localhost address is likely
not a valid one.


The real addressses mentioned are in fact my personal email address at  
gmail.com and roadrunner.com and are coded here for obvious reasons. My  
localhost email addresses are at my unix server and are coded because  
I don't want to involve them specifucally. Trust me, I got those right.





Thanks for your feedback which is all warranted advice on this. I agree  
that I

[PHP] Stripping carriage returns

2011-01-11 Thread Richard S. Crawford
I'm retrieving CLOB data from an Oracle database, and cleaning up the HTML
in it. I'm using the following commands:

$content =
strip_tags($description-fields['CONTENT'],'polulli');
$content = preg_replace(/p.*/,p,$content);

The second line is necessary because the p tag frequently comes with class
or style descriptions that must be eliminated.

This works on the whole except where the p tag with the style definition
is broken up over two or more lines. In other words, something like:

p class = bullettext style = line-height: normal
border: 3;

In this case, the second line of my code does not strip the class or style
definitions from the paragraph tag. I've tried:

$content = nl2br($content)

and

$content = str_replace(chr(13),$content)

and

$content = preg_replace(/[.chr(10).|.chr(13).]/,,$content)
(I've read that Oracle uses chr(10) or chr(13) to represent line breaks
internally, so I decided to give those a try as well.)

and

$content = str_replace(array('\n','\r','\r\n'),$content)

all to no avail; these all leave the line break intact, which means my
preg_replace('/p.*/','p',$content) line still breaks.

Anyone have any ideas?

-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com


Re: [PHP] Stripping carriage returns

2011-01-11 Thread Richard S. Crawford
Strangely, when I use \n, or nl2br(), or PHP_EOL, or anything like that, it
strips out not just line breaks, but most of the rest of the text as well. I
suspect an encoding issue at this point.

Daniel, you were right when you said that neither of my str_replace lines
had repl.acement values; that was indeed a typo when I was copying the code
over into my email.

Ashley, I've already been using strip_tags to eliminate all but p, ol,
ul, and li tags.

On Tue, Jan 11, 2011 at 11:24 AM, David Harkness
davi...@highgearmedia.comwrote:

 On Tue, Jan 11, 2011 at 11:13 AM, Richard S. Crawford 
 rich...@underpope.com wrote:

 $content = preg_replace(/[.chr(10).|.chr(13).]/,,$content)


 This should be

 $content = preg_replace('/[\r\n]/','',$content)

 First, you can embed \r and \n directly in the regular expression as-is
 (not converted to chr(10) by PHP) by using single quotes. Second, you don't
 want the vertical bar inside []. That's only for ().

 David




-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com


Re: [PHP] PHPInfo disabled due to security

2010-12-16 Thread Paul S

On Thu, 16 Dec 2010 00:13:31 +0700, Daniel P. Brown
daniel.br...@parasane.net wrote:




Well, phpinfo() does, by default, divulge some things that could
be considered security concerns --- particularly in poorly-managed
environments.  Primarily, this is by giving a synopsis of versions and
paths of software, but some versions and configurations will also
broadcast information about the currently logged-in user (PTS/TTY) in
the $_ENV display.  Sure, you can display everything manually that
phpinfo() does automatically, but it's easier for some to vilify
something because they heard it was bad than to actually address the
greater issues.

In cases like this, I'd agree with Al's response; there are plenty
of other web hosts out there.



Well, I was hoping for stronger arguments to get that DONE. I would think
there be something in the PHP license
that would FORBID disabling functionality. After all, 'phpinfo' is
essential, really, to achieving secure
applications, isn't it? My setups are secure, I want to keep it that way.
Shouldn't hosters be required
to provide an alternative phpinfo, say behind the login control panel?

I can't see that anyone could upload a phpinfo command to a properly
configured server and execute it. I have
renamed my 'phpinfo.php' file to something innocuous.

Unfortunately I've found changing hosting companies to often result in a
lot of work for just as
obnoxious tech service as the last.

Thank you both for the feedback. It helps. I've had fetching issues past
couple days with my connection but
think I got that will straightened out soon.

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



[PHP] PHPInfo disabled due to security

2010-12-15 Thread Paul S


Warning: phpinfo() has been disabled for security reasons in
/home/.../php/phpinfo.php on line 2

My ISP has disabled phpinfo and has not answered my tech requests on this
for over a month.

They seem to never have a thing to do but play games with silly security
issues.

In a day some phone calls are going to be made. I need some help.

What brief arguments should I be giving to get this changed?




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



Re: [PHP] Formatting an ECHO statement.

2010-10-18 Thread Cris S

At 13:03 18 10 10, a...@ashleysheridan.co.uk wrote:
There's nothing wrong with using em as it indicates emphasised 
text, which is semantic. Use span tags with classes only when the 
content you're styling has no semantic alternative. 
strongimportant message/strong is much better for machines 
(including search engines, screen readers, etc) to infer a meaning 
for than span class=bold_textimportant message/span Thanks, 
Ash http://www.ashleysheridan.co.uk - Reply message - From: 
tedd tedd.sperl...@gmail.com Date: Mon, Oct 18, 2010 17:51 
Subject: [PHP] Formatting an ECHO statement. To: 
php-general@lists.php.net At 9:47 AM -0400 10/18/10, Steve Staples 
wrote: or create a style sheet, with a class definition for 
italic.  Steve. +1 The best practices way to do it. Don't style 
output in an echo statement, but rather put styling in a css sheet, 
It's much cleaner there. Cheers, tedd -- --- 
http://sperling.com/ -- PHP General Mailing List 
(http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Jesus H. Christ.

I'm on this list because I want to learn PHP, not how to parse
HTML mail or how to add italics to doltstupid text/dolt.

You add styles to text as a presentation effect. This list is
not supposed to be about the effing presentation.

Must I say it again, more rudely even? I know you guys like
to go on and on, but give it a rest on this one. Get your
asses back on topic - and on topical jokes. This topic is
neither.

Move on already.




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



Re: [PHP] Formatting an ECHO statement.

2010-10-18 Thread Cris S

At 15:12 18 10 10, Shreyas Agasthya wrote:

Thanks all for their input. Some of the learnings  from the thread :

1. i tag is getting deprecated.


Not in HTML5.


2. Use em and strong


Both? Read that shit again, buckwheat. And by that shit I
do mean the standards, not what Joe Bloe told you.


3. Have CSS used to do the kind of stuff I was trying.


Uhm, yeah. @@


 I must inform, this was already in place.


Then why the fuck are we discussing this?


4. Keep an eye on the SE monster.


and on the go fuck yourself monster too.

Holy fuck, I've been lurking for months. I turn away for
one day and this is the non-PHP crap that happens?

Someone needs to hire me now, to keep me busy and stop me
from taking this issue apart one piece at a time. Kee-rist.



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



Re: [PHP] Looking for open source Learning Management System suggestions

2010-08-31 Thread Richard S. Crawford
I'm late to this thread, so I don't know what's been mentioned here already.
However, I'd be remiss if I did not recommend Moodle (http://www.moodle.org)
as an open-source learning management system. The learning curve is a bit
steep, especially if you're going to mess around in the code, but it's
powerful and flexible.

On Tue, Aug 31, 2010 at 8:57 PM, Michael Shadle mike...@gmail.com wrote:



 On Aug 31, 2010, at 7:53 PM, Bastien Koert phps...@gmail.com wrote:

 
 
  Our company built one on top of wordpress. You can easily build most
  of it with stock plugins and it has UIs for idevices...worth
  considering

 Yeah - obviously anything can be built and a lot of things can be
 extended... But were on a tight deadline for the first pass and would like
 something a little more out of the box (ideally)


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




-- 
Sláinte,
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


[PHP] Database vs. Array

2010-03-16 Thread Richard S. Crawford
I have a script that connects to an external database to process about 4,000
records. Each record needs to be operated on pretty heavily, and the script
overall takes about half an hour to execute. We've hit a wall where the
script's memory usage exceeds the amount allocated to PHP. I've increased
the allotted memory to 32MB, but that's not ideal for our purposes.

So my thought is, would it be more efficient, memory-wise, to read the
database entries into an array and process the array records, rather than
maintain the database connection for the entire run of the script. This is
not an issue I've come across before, so any thoughts would be much
appreciated.

Thanks in advance.

-- 
Richard S. Crawford (rich...@underpope.com)
http://www.underpope.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)


Re: [PHP] pear for fedora 11

2010-03-09 Thread Edward. S. P. Leong
Ashley Sheridan wrote:

 On Tue, 2010-03-09 at 23:06 +0800, Edward. S. P. Leong wrote:

Ashley Sheridan wrote:

 On Mon, 2010-03-08 at 22:39 +0800, Edward. S. P. Leong wrote:

Ashley Sheridan wrote:

On Mon, 2010-03-08 at 01:07 +0800, Edward. S. P. Leong wrote:

  

Dear All,

Which can we download pear ann install into fc 11 system ?

Thank for your help !

Edward.





I'm not sure I understand your question. Do you mean what Pear
components can be installed on a Fedora 11 system? I'm running Fedora 11
on my desktop and laptop at the moment, and both systems are running
5.2.12, so any of the Pear modules that say they will run on that are
fine. If you need to check to see what version of PHP is running, in a
console or text login, type 'yum list php' and you'll get a line that
reads something like:

php.i5865.2.12-1.fc11@updates

Thanks,
Ash
http://www.ashleysheridan.co.uk
  

Dear Ash,

1, My means is where can we download the pear and install it into the
fedora 11 system ?
Due to our web server :
[pear]# pwd
/usr/share/pear
[pear]# dir
Archive data OS pearcmd.php peclcmd.php System.php XML
Console doc PEAR PEAR.php Structures test
[pear]#
So, it is not update ( pear ) ?

2, Would you mind to send me your php config ( php.ini ) and Web Server
config ( httpd.conf ) as sample ?
Due to our Web Server is problem :
After upload all of homepage data ( php format ) to Web Server, then
type http://ip or domain_name the result is blank page...

Thank for your help !

Edward.



 If you're getting a blank page, the first port of call is your error
 log. At a console type:

 sudo tail -f /var/log/httpd/error_log

 which should then continually update itself with a list of errors as
 and when they occur, which will be useful to you if you need to view
 the log while you're debugging. This file is only readable by the root
 user.

 My config files won't be that much help I don't think, as the setup of
 both our servers will be quite different.

 How did you try to install Pear on your Fedora 11 system? The package
 manager that comes with Fedora (I use KPackageKit on KDE) allows you
 install and remove Pear modules as you need.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



Dear Ash,

When I tried to install pear from the net into our server ( FC11 64Bit )
as the following cmd :
[root]# yum install pear
Loaded plugins: refresh-packagekit
Setting up Install Process
No package pear available.
Nothing to do
[root]#

So, I ask for the solution here ( for help )...

Hope anyone or you can help me...

Edward.



 By default yum matches the beginning of the package name. As there is
 no package called pear, it finds nothing.

 Instead, you can use:

 yum install php-pear*

 to install all the php-pear packages, or install them as you need by:

 yum install php-pear-subpackage

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



Dear Ash,

1, Thank for your technical support of the installation / update
operation
2, If your is FC11 System, so, would you mind to send me (
edwardspl...@gmail.com ) your php.ini ( config ) for reference ?

Thanks !


Re: [PHP] pear for fedora 11

2010-03-09 Thread Edward. S. P. Leong
Ashley Sheridan wrote:

 On Mon, 2010-03-08 at 22:39 +0800, Edward. S. P. Leong wrote:

Ashley Sheridan wrote:

On Mon, 2010-03-08 at 01:07 +0800, Edward. S. P. Leong wrote:

  

Dear All,

Which can we download pear ann install into fc 11 system ?

Thank for your help !

Edward.





I'm not sure I understand your question. Do you mean what Pear
components can be installed on a Fedora 11 system? I'm running Fedora 11
on my desktop and laptop at the moment, and both systems are running
5.2.12, so any of the Pear modules that say they will run on that are
fine. If you need to check to see what version of PHP is running, in a
console or text login, type 'yum list php' and you'll get a line that
reads something like:

php.i5865.2.12-1.fc11@updates

Thanks,
Ash
http://www.ashleysheridan.co.uk
  

Dear Ash,

1, My means is where can we download the pear and install it into the
fedora 11 system ?
Due to our web server :
[pear]# pwd
/usr/share/pear
[pear]# dir
Archive data OS pearcmd.php peclcmd.php System.php XML
Console doc PEAR PEAR.php Structures test
[pear]#
So, it is not update ( pear ) ?

2, Would you mind to send me your php config ( php.ini ) and Web Server
config ( httpd.conf ) as sample ?
Due to our Web Server is problem :
After upload all of homepage data ( php format ) to Web Server, then
type http://ip or domain_name the result is blank page...

Thank for your help !

Edward.



 If you're getting a blank page, the first port of call is your error
 log. At a console type:

 sudo tail -f /var/log/httpd/error_log

 which should then continually update itself with a list of errors as
 and when they occur, which will be useful to you if you need to view
 the log while you're debugging. This file is only readable by the root
 user.

 My config files won't be that much help I don't think, as the setup of
 both our servers will be quite different.

 How did you try to install Pear on your Fedora 11 system? The package
 manager that comes with Fedora (I use KPackageKit on KDE) allows you
 install and remove Pear modules as you need.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



Dear Ash,

When I tried to install pear from the net into our server ( FC11 64Bit )
as the following cmd :
[root]# yum install pear
Loaded plugins: refresh-packagekit
Setting up Install Process
No package pear available.
Nothing to do
[root]#

So, I ask for the solution here ( for help )...

Hope anyone or you can help me...

Edward.



Re: [PHP] pear for fedora 11

2010-03-08 Thread Edward. S. P. Leong
Ashley Sheridan wrote:

On Mon, 2010-03-08 at 01:07 +0800, Edward. S. P. Leong wrote:

  

Dear All,

Which can we download pear ann install into fc 11 system ?

Thank for your help !

Edward.





I'm not sure I understand your question. Do you mean what Pear
components can be installed on a Fedora 11 system? I'm running Fedora 11
on my desktop and laptop at the moment, and both systems are running
5.2.12, so any of the Pear modules that say they will run on that are
fine. If you need to check to see what version of PHP is running, in a
console or text login, type 'yum list php' and you'll get a line that
reads something like:

php.i5865.2.12-1.fc11@updates

Thanks,
Ash
http://www.ashleysheridan.co.uk
  

Dear Ash,

1, My means is where can we download the pear and install it into the
fedora 11 system ?
Due to our web server :
[pear]# pwd
/usr/share/pear
[pear]# dir
Archive data OS pearcmd.php peclcmd.php System.php XML
Console doc PEAR PEAR.php Structures test
[pear]#
So, it is not update ( pear ) ?

2, Would you mind to send me your php config ( php.ini ) and Web Server
config ( httpd.conf ) as sample ?
Due to our Web Server is problem :
After upload all of homepage data ( php format ) to Web Server, then
type http://ip or domain_name the result is blank page...

Thank for your help !

Edward.


[PHP] pear for fedora 11

2010-03-07 Thread Edward. S. P. Leong
Dear All,

Which can we download pear ann install into fc 11 system ?

Thank for your help !

Edward.

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



[PHP] Help with regex (search/replace) please

2010-02-06 Thread Ryan S
Hey guys,

As many of you might know, i totally suck at regex..so would really appreciate 
some help here.

Basically i have a html page with a lot of textboxes,radios,checkboxes etc 
i need your help in the form of a regex so that when i give it the name and 
value it gives me the entire code of that checkbox.
for example here are 2 checkboxes:

input type=checkbox name=something value=1 /

input type=checkbox name=something2 value=2 id=something 
onClick=javascript_code_etc() onSomething=lots of js cod here() /



so if i want the second checkbox code i was thinking of something like this:

$the_name=something2;
$the_value=2;
$fetched=getCheckboxFromHTML($the_name,$the_value);

and then if successful the variable $fetched would contain
input type=checkbox name=something2 value=2 id=something 
onClick=javascript_code_etc() onSomething=lots of js cod here() /

the idea is that i would use the contents of $fetch to add some code before the 
end just before  the greater than symbol, and do a str_replace().

What do you think? Critique of my logic above too is welcome!

Thanks!
Ryan


  

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



[PHP] Help with regex (search/replace) please

2010-02-06 Thread Ryan S
Hey guys,

As many of you might know, i totally suck at regex..so would really appreciate 
some help here.

Basically i have a html page with a lot of textboxes,radios,checkboxes etc 
i need your help in the form of a regex so that when i give it the name and 
value it gives me the entire code of that checkbox.
for example here are 2 checkboxes:

input type=checkbox name=something value=1 /

input
type=checkbox name=something2 value=2 id=something
onClick=javascript_code_etc() onSomething=lots of js cod here()
/



so if i want the second checkbox code i was thinking of something like this:

$the_name=something2;
$the_value=2;
$fetched=getCheckboxFromHTML($the_name,$the_value);

and then if successful the variable $fetched would contain
input
type=checkbox name=something2 value=2 id=something
onClick=javascript_code_etc() onSomething=lots of js cod here()
/

the idea is that i would use the contents of $fetch to add
some code before the end just before  the greater than symbol, and do a
str_replace().

What do you think? Critique of my logic above too is welcome!

Thanks!
Ryan



  

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



Re: [PHP] Help with regex (search/replace) please

2010-02-06 Thread Ryan S
Hey Ash,Bastien!
clip

Rather than a regex, you're probably better off using something like 
DomDocument, where you can iterate over all of the input elements in the 
document, and check the attributes of each one to check if they match your 
criteria.
/clip

@Ash, You're kinda reading my mind... i did do this in domDocument but it didnt 
work out so well... so now am trying to do this in a diff way.
Is it ok if i send you the code via an attachment? it is REA messy code 
right now though.

@Bastien, you're talking client side... i need to do this server side as then i 
am writing the results to a file which is going to be used as a template in 
other scripts.

Thanks!
Ryan


  

Re: [PHP] DOM TextArea (and dom chart please)

2010-02-03 Thread Ryan S



 I think what you are looking for is $input2-textContent in PHP.

Hey Andrew (and everyone else was was kind enough to write back) !

Found the solution, this is what i am using (and it works!), and i hope it 
helps anyone else who finds themselves in the spot i found myself

$inputs2 = $dom-getElementsByTagName('textarea'); // Find textareas  
foreach ($inputs2 as $input2) { 
if(!$input2-nodeValue || $input2-nodeValue==) { 
$input2-nodeValue=it works!; 
} 
} 


Cheers guys!
/R



  

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



[PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ryan S
Hey Guys,

Coming from a C and Java background I just loved PHP and have been programming 
with it for years thanks in a large part to the kind people on this list... 
present and past (Immediately the name John Holmes comes to mind.. i hope the 
dude is well)
but now I have have to leave PHP or split time between php and .NET for just 
one reason:

.NET offers a way to run programs using the Windows GUI / stand alone executable

There always was talk on the list about running php code as standalone, but 
since I had a long absence from the list sorry if I missed any new updates... 
but I'm hoping someone can offer a way to run php standalone executable.

Before posting I always google, and the main results I have gotten so far is:
priado blender
and PHP-GTK

but no way to kind of drag and drop what you need like visual studio (i dont 
know how to use it yet, but been reading) or some other visual development tool 
like visual basic.

I need to make a few standalones programs that will run (mostly) on Windows... 
is there any other way that I have not found that i can use PHP instead of 
learning something new like .NET?

I have resisted going the microsoft way for years.. looks like my luck has 
run out...

Thanks,
Ryan



  

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



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ryan S
Thanks for the reply Michael, Robert and Jochem,

makes sense, a native windows app is going to look more in place than any of 
the demos and graphics i have seen of GTK.

Was also looking at GTK-Builder, unfortunately you really have to hunt for each 
scrap of new info - which is why I'm guessing open source falls back a bit 
compared to M$'s offerings.

MS shoehorning something into dotnet sounds interesting, will ask my pal google 
what he can bring up ;)
I did read about FLEX but i have pretty much complete php scripts that i want 
to use in a desktop environment, FLEX wouldnt do for my (present) needs.

Will look up WxWidgets and HipHop (somehow i get the feeling i'm gonna be 
drowned in millions of results that have rap lyrics instead of programming 
information - should be a test of my patience :-)))

Anyone have anything more to add/advise, please do so.

Cheers guys!



  

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



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ryan S
Thanks for the links and advise guys!

Of all I found this most interesting as it would run native:


check out http://www.php-compiler.net/doku.php

unfortunately I think this project is dead or at best stagnant because the 
server is slower than a 99 year old on weed and forums link dead. Documentation 
is badly limited as well.

 But if someone was used this or is using this, would love to hear from you.

Till then am back to checking out the other recommendations and googling.
Keep any other advise/links coming ;) they are most appreciated.

Cheers!
R



  

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



[PHP] DOM TextArea (and dom chart please)

2010-02-02 Thread Ryan S
Hey!
i'm just starting with PHP's DOM-XML and need a little help please.


Basically, first i am trying to see if a input like a textbox has a 'VALUE=' 
associated with it, if yes, i leave it be, if no, i add a default value.

This *is working* as can be seen by the attached code below.

But a bit confused as to how to do the same for a textarea as textarea's do not 
have a 'VALUE=' attribute.

Heres my code:


$website_data = file_get_contents('dom_test.html');//load the website data,

$dom = new DomDocument; //make a new DOM container in PHP
$dom-loadHTML($website_data);  //load all the fetched data into the DOM 
container

$inputs = $dom-getElementsByTagName('input'); // Find Sections 

foreach ($inputs as $input) { //***  this block has the guts of the 
functionality ***
if(!$input-getAttribute(value) || $input-getAttribute(value)==) 
{
$input-setAttribute(value, RRR);
}
}



// * now we come to the textarea bit that is not working *

$inputs2 = $dom-getElementsByTagName('textarea'); // Find textareas 

foreach ($inputs2 as $input2) {
if(!$input2-firstChild.nodeValue==) {
$input2-firstChild.nodeValue==it works!;
}
}



echo $dom-saveHTML();
?

+++

// I have even tried this instead of the above:

foreach ($inputs2 as $input2) {
if(!$input2-getAttribute(defaultValue)==) {
$input2-setAttribute(defaultValue,it works!);
}
}

but no joy.

I'm betting its pretty simple but i dont have a DOM chart for php, the only 
ones i have been able to find via google are for javascript like this one: 
http://www.hscripts.com/tutorials/javascript/dom/textarea-events.php


and that chart does not help much.  Does anyone have a PHP DOM chart or a 
resource that i can use to get started using this?

Thanks in advance!
Ryan



 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

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



Re: [PHP] DOM TextArea (and dom chart please)

2010-02-02 Thread Ryan S



// I have even tried this instead of the above:

foreach ($inputs2 as $input2) {
if(!$input2-getAttribute(defaultValue)==) {
$input2-setAttribute(defaultValue,it works!);
}
}

but no joy.

I'm betting its pretty simple but i dont have a DOM chart for php, the only 
ones i have been able to find via google are for javascript like this one: 
http://www.hscripts.com/tutorials/javascript/dom/textarea-events.php


and that chart does not help much.  Does anyone have a PHP DOM chart or a 
resource that i can use to get started using this?


When I get stuck on things like this, I find print_r() invaluable as it can 
basically dump out the objects entire contents, so I can see what values it has 
set.


Hey Ash,
Thanks for replyng.

Where exactly do i use the print_r? and on which variable?
Because i have tried it in different places but still no luck..


  

[PHP] Read directory; store filenames found in mySQL table?

2010-01-13 Thread Rahul S. Johari

Ave,

This is what I'm trying to do; I want to read a directory (eg: W:\Test 
\) and take all the filenames found in the directory (eg: 1.vox,  
2.wav, 3.txt) and store them in  a simple mySQL table.


Can I do this?

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Read directory; store filenames found in mySQL table?

2010-01-13 Thread Rahul S. Johari


On Jan 13, 2010, at 9:56 AM, Warren Windvogel wrote:


On 2010/01/13 04:25 PM, Rahul S. Johari wrote:

Ave,

This is what I'm trying to do; I want to read a directory (eg: W: 
\Test\) and take all the filenames found in the directory (eg:  
1.vox, 2.wav, 3.txt) and store them in  a simple mySQL table.




Sorry. Forgot to include this.

function dirList ($directory)
{

   // create an array to hold directory list
   $results = array();

   // create a handler for the directory
   $handler = opendir($directory);

   // keep going until all files in directory have been read
   while ($file = readdir($handler)) {

   // if $file isn't this directory or its parent,
   // add it to the results array
   if ($file != '.'  $file != '..')
   $results[] = $file;
   }

   // tidy up: close the handler
   closedir($handler);

   // done!
   return $results;

}

If you're dealing with 1 directory you can use it to read all files  
in it to an array.


Kind regards
Warren




This is an interesting approach. Following is what I came up with to  
scan a directory and store the filenames into an array ... very  
similar to your example:


   $listDir = array();
$dir = ../mounts/wd/IDT/IDT/;
if($handler = opendir($dir)) {
while (($sub = readdir($handler)) !== FALSE) {
if ($sub != .  $sub != ..  $sub !=  
Thumb.db) {

if(is_file($dir./.$sub)) {
$listDir[] = $sub;
}elseif(is_dir($dir./.$sub)){
$listDir[$sub] = $this- 
ReadFolderDirectory($dir./.$sub);

}
}
}
closedir($handler);
}

and this is what I'm trying to implement in order to store the array  
into a mysql table ..


$db = mysql_connect(localhost,usr,pwd);
mysql_select_db(db,$db);
			$colors=serialize($listDir); //takes the data from a post  
operation...
			$sql=INSERT INTO recordings (ID, RECORDING, ADDED)  
VALUES('','$colors','');

$result = mysql_query($sql) or die (mysql_error());

I'm not sure if this the best or fastest approach ... but it's running  
in the background as I write this (I should have tested on a smaller  
folder). The folder I'm scanning has literally over 80,000 files ...  
so it's taking LOOONG!!


---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Read directory; store filenames found in mySQL table?

2010-01-13 Thread Rahul S. Johari


On Jan 13, 2010, at 10:07 AM, Kenneth Sande wrote:



Ashley Sheridan wrote:

On Wed, 2010-01-13 at 09:25 -0500, Rahul S. Johari wrote:



Ave,

This is what I'm trying to do; I want to read a directory (eg: W: 
\Test \) and take all the filenames found in the directory (eg:  
1.vox,  2.wav, 3.txt) and store them in  a simple mySQL table.


Can I do this?

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com









You'll probably want to look at the readdir() function. The manual  
page
also has dozens of different example scripts that would be easy to  
tweak

for your purpose.

http://php.net/manual/en/function.readdir.php


Thanks,
Ash
http://www.ashleysheridan.co.uk




I use the glob function in my little homemade web cam page, which  
can really swell up in memory when used against a large amount of  
files (in my case around 30k files).

=
$imgdir = 'img/south*';
$files = glob( $imgdir );

// Sort files by modified time, latest to earliest
// Use SORT_ASC in place of SORT_DESC for earliest to latest
array_multisort( array_map( 'filemtime', $files ), SORT_NUMERIC,  
SORT_DESC, $files );

=
http://www.php.net/manual/en/function.glob.php
DISCLAIMER: I found this code on a how-to somewhere out there and  
modified it to fit my need. Quite possibly there are much better  
means to this end.


Ken Sande/KC8QNI





Considering that I have over 80K files in the folder, would this be a  
faster/efficient then the readdir() method? Or should I stick to what  
I'm doing (other email)?


---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



[PHP] Why does CURLOPT_FOLLOWLOCATION require open_basedir to be turned off?

2009-12-13 Thread Alex S Kurilo
I was wondering why CURLOPT_FOLLOWLOCATION requires open_basedir and 
safe_mode to be turned off.


The following was found in the 
changelog(http://www.php.net/ChangeLog-5.php):


Disabled CURLOPT_FOLLOWLOCATION in curl when open_basedir or safe_mode 
are enabled. (Stefan E., Ilia)


Also I read some forum posts about security restrictions blah-blah but 
didn't find anything specific, unfortunately.


Can anybody explain the reasons of such a strange restriction or tell 
what security issues raises CURLOPT_FOLLOWLOCATION when open_basedir is set?


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



Re: [PHP] Why does CURLOPT_FOLLOWLOCATION require open_basedir to be turned off?

2009-12-13 Thread Alex S Kurilo

I can't see any conceivable benefit to this restriction when using 
open_basedir, as I thought that related to the local file system - unless CURL 
can use file:// URLs to access the local system?

That's the problem.
I always use open_basedir (not all the sites on my servers are safe 
enough). And that so called security restriction just makes me fury 
(unless I don't see significant reasons for it). So, in order not to 
irritate my nervous system every time somebody asks me to unset 
open_basedir for CURL I decided to find the roots of that PHP 
developers' action.


And I don't think it's related to the local file system: there is 
another option that restricts protocols while redirecting, 
CURLOPT_REDIR_PROTOCOLS, which allows by default all the protocols 
supported by CURL, but file and scp. So this kind of restriction (do not 
follow file:// while redirecting) would make sense, but not disabling 
FOLLOWLOCATION at all. Either they had a better reason or they messed up 
a bit :)


Still trying to find a better explanation.

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



Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!

2009-11-30 Thread Rahul S. Johari


On Nov 30, 2009, at 11:07 AM, Bob McConnell wrote:


From: news


even though the dbf has 10K records
Fox can't spend minutes to found a match
by the way, its very strange
to have 35 columns in a table/dbf or whatever

pay attention to the comment of Ashley
in Fox, you should:

SELECT directory
INDEX on phone_number to idx_directory_phone
- or -
INDEX on phone_number tag phone of cdx_directory

i worked with Fox
with dbfs of 2 millions of records
and the speed is amazing -- using indexes of course!


It has been a long time since I worked with either FoxPro or dBase,  
but

IIRC, both required you to explicitly create any indexes they might
need. They don't have query analyzers like Postgres, MySQL and other
modern DBMS engines.

Bob McConnell


That is correct! But in my case - I DO indeed have Indexes created  
manually. FoxPro created .CDX files for Indexes. The problem is - does  
PHP use those indexes?


---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!

2009-11-30 Thread Rahul S. Johari


On Nov 30, 2009, at 11:41 AM, Bob McConnell wrote:


From: Rahul S. Johari


On Nov 30, 2009, at 11:07 AM, Bob McConnell wrote:


From: news


even though the dbf has 10K records
Fox can't spend minutes to found a match
by the way, its very strange
to have 35 columns in a table/dbf or whatever

pay attention to the comment of Ashley
in Fox, you should:

SELECT directory
INDEX on phone_number to idx_directory_phone
- or -
INDEX on phone_number tag phone of cdx_directory

i worked with Fox
with dbfs of 2 millions of records
and the speed is amazing -- using indexes of course!


It has been a long time since I worked with either FoxPro or dBase,
but
IIRC, both required you to explicitly create any indexes they might
need. They don't have query analyzers like Postgres, MySQL and other
modern DBMS engines.

Bob McConnell


That is correct! But in my case - I DO indeed have Indexes created
manually. FoxPro created .CDX files for Indexes. The problem is -  
does



PHP use those indexes?


And the secondary question is whether you have enough memory to
'permanently' cache those indexes? They don't improve performance very
much unless they are kept in local memory all the time. The only way  
to

fix this is to move to a real DBMS engine.

Bob McConnell




Well that might be a problem. The indexes, along with the files, are  
stored on the network and they are accessed over the network, not  
locally. Although to be fair; I have tried using a copy of the DBF   
it's Index File (CDX) locally and it didn't make any difference to the  
search.


Either way, it all points in the same direction ... using a modern  
DBMS. It's just a problem on our end because all our customer data is  
in FoxPro databases and all the other applications are written for  
those FoxPro databases.


---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



[PHP] dbase_get_record_with_names; Very slow search!!!

2009-11-24 Thread Rahul S. Johari

Ave,

I'm connecting to a foxpro database (dbase) and simply running a  
search to retrieve a record. It's a very simple code.
The problem is, as the database is growing, the search is becoming  
ridiculously slow ... and I mean it's taking minutes. When the dbase  
had 10,000 records ... search was fast  efficient ... as if you were  
connecting to a mySQL Database. Now that the database has over 75,000  
records and still growing ... it's taking minutes to search.


The database has about 35 fields; Search is based on a phone number.
This is the code ...

?php
#Open DBF
$db = dbase_open(dbase.dbf, 0);

#PULL UP RECORD
if ($db) {
  $record_numbers = dbase_numrecords($db);
  for ($i = 1; $i = $record_numbers; $i++) {
 $row = dbase_get_record_with_names($db, $i);
 if ($row['PHONE'] == $_POST['PHONE']) {

#Retrieve row  display fields
echo $row['STUFF']; 
}   
}
}
?

It works ... but it's getting way too slow.

One thing with FoxPro DBF's is that they use an Index file for  
searches within FoxPro. These are .CDX files which contain the Index.  
You can create an Index on, for example, PHONE field. However I don't  
think there's any way in PHP to reference this Index file for faster  
searches.


Is there any possibility to improve search response time?

Thanks!

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] dbase_get_record_with_names; Very slow search!!!

2009-11-24 Thread Rahul S. Johari


On Nov 24, 2009, at 8:59 AM, Ashley Sheridan wrote:


On Tue, 2009-11-24 at 08:40 -0500, Rahul S. Johari wrote:


Ave,

I'm connecting to a foxpro database (dbase) and simply running a
search to retrieve a record. It's a very simple code.
The problem is, as the database is growing, the search is becoming
ridiculously slow ... and I mean it's taking minutes. When the  
dbase

had 10,000 records ... search was fast  efficient ... as if you were
connecting to a mySQL Database. Now that the database has over 75,000
records and still growing ... it's taking minutes to search.

The database has about 35 fields; Search is based on a phone number.
This is the code ...

?php
#Open DBF
$db = dbase_open(dbase.dbf, 0);

#PULL UP RECORD
if ($db) {
  $record_numbers = dbase_numrecords($db);
  for ($i = 1; $i = $record_numbers; $i++) {
 $row = dbase_get_record_with_names($db, $i);
 if ($row['PHONE'] == $_POST['PHONE']) {

#Retrieve row  display fields
echo $row['STUFF']; 
}   
}
}
?

It works ... but it's getting way too slow.

One thing with FoxPro DBF's is that they use an Index file for
searches within FoxPro. These are .CDX files which contain the Index.
You can create an Index on, for example, PHONE field. However I don't
think there's any way in PHP to reference this Index file for faster
searches.

Is there any possibility to improve search response time?

Thanks!



I would assume that any indexes created on any tables would be
referenced automatically by the dbms and wouldn't need to be  
explicitly

referenced from within PHP.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Makes sense; but I'm not sure if the Index is being referenced  
here ... based on the extremely slow searches.


---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!

2009-11-24 Thread Rahul S. Johari
Your post definitely gives me hope. It's possible I'm doing something  
wrong!
I definitely have the foxpro database indexed. I use this FoxPro  
command ...


INDEX ON PHONE TAG PHONE

I do have a .CDX file present for the Database and if I MODIFY  
STRUCTURE and I can see the INDEX present on PHONE.


Did you check my Code? Is there any other way to pull records off a  
FoxPro Database? Can you use SQL Commands via PHP on FoxPro databases  
(SELECT * FROM  ) ?


Thanks



On Nov 24, 2009, at 9:16 AM, keyser soze wrote:


even though the dbf has 10K records
Fox can't spend minutes to found a match
by the way, its very strange
to have 35 columns in a table/dbf or whatever

pay attention to the comment of Ashley
in Fox, you should:

SELECT directory
INDEX on phone_number to idx_directory_phone
- or -
INDEX on phone_number tag phone of cdx_directory

i worked with Fox
with dbfs of 2 millions of records
and the speed is amazing -- using indexes of course!

regards,
ks





Rahul S. Johari escribió:

Ave,
I'm connecting to a foxpro database (dbase) and simply running a  
search to retrieve a record. It's a very simple code.
The problem is, as the database is growing, the search is becoming  
ridiculously slow ... and I mean it's taking minutes. When the  
dbase had 10,000 records ... search was fast  efficient ... as if  
you were connecting to a mySQL Database. Now that the database has  
over 75,000 records and still growing ... it's taking minutes to  
search.

The database has about 35 fields; Search is based on a phone number.
This is the code ...
?php
   #Open DBF
   $db = dbase_open(dbase.dbf, 0);
  #PULL UP RECORD
   if ($db) {
 $record_numbers = dbase_numrecords($db);
 for ($i = 1; $i = $record_numbers; $i++) {
$row = dbase_get_record_with_names($db, $i);
if ($row['PHONE'] == $_POST['PHONE']) {
  #Retrieve row  display fields
   echo $row['STUFF'];   }   }
}
?
It works ... but it's getting way too slow.
One thing with FoxPro DBF's is that they use an Index file for  
searches within FoxPro. These are .CDX files which contain the  
Index. You can create an Index on, for example, PHONE field.  
However I don't think there's any way in PHP to reference this  
Index file for faster searches.

Is there any possibility to improve search response time?
Thanks!
---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email]sleepwal...@rahulsjohari.com
[Web]http://www.rahulsjohari.com



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 11:16:25 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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




---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!

2009-11-24 Thread Rahul S. Johari
I do believe that what I'm doing is scanning the foxpro dbase row by  
row to get the match ... which is why it's returning the results very  
slow.


But I don't know if there's any other way to do this. Basically the  
FoxPro DBF has 75,000 records and I have to search for the one row  
which has the Phone number I'm looking for, and display results. If  
there's any other way to do this ... I'll be more then happy to try.



On Nov 24, 2009, at 9:55 AM, keyser soze wrote:


i will try to help you
but think i'm old in Fox but new in php
and sadly never used php+fox

so, reading your code
i see you are scanning the whole dbf file from php
Fox cant help you in this way

if there is not another option for scan a dbf
the row by row method is very slow




Rahul S. Johari escribió:
Your post definitely gives me hope. It's possible I'm doing  
something wrong!
I definitely have the foxpro database indexed. I use this FoxPro  
command ...

INDEX ON PHONE TAG PHONE
I do have a .CDX file present for the Database and if I MODIFY  
STRUCTURE and I can see the INDEX present on PHONE.
Did you check my Code? Is there any other way to pull records off a  
FoxPro Database? Can you use SQL Commands via PHP on FoxPro  
databases (SELECT * FROM  ) ?

Thanks
On Nov 24, 2009, at 9:16 AM, keyser soze wrote:

even though the dbf has 10K records
Fox can't spend minutes to found a match
by the way, its very strange
to have 35 columns in a table/dbf or whatever

pay attention to the comment of Ashley
in Fox, you should:

SELECT directory
INDEX on phone_number to idx_directory_phone
- or -
INDEX on phone_number tag phone of cdx_directory

i worked with Fox
with dbfs of 2 millions of records
and the speed is amazing -- using indexes of course!

regards,
ks





Rahul S. Johari escribió:

Ave,
I'm connecting to a foxpro database (dbase) and simply running a  
search to retrieve a record. It's a very simple code.
The problem is, as the database is growing, the search is  
becoming ridiculously slow ... and I mean it's taking minutes.  
When the dbase had 10,000 records ... search was fast   
efficient ... as if you were connecting to a mySQL Database. Now  
that the database has over 75,000 records and still growing ...  
it's taking minutes to search.
The database has about 35 fields; Search is based on a phone  
number.

This is the code ...
?php
  #Open DBF
  $db = dbase_open(dbase.dbf, 0);
 #PULL UP RECORD
  if ($db) {
$record_numbers = dbase_numrecords($db);
for ($i = 1; $i = $record_numbers; $i++) {
   $row = dbase_get_record_with_names($db, $i);
   if ($row['PHONE'] == $_POST['PHONE']) {
 #Retrieve row  display fields
  echo $row['STUFF'];   }   }
}
?
It works ... but it's getting way too slow.
One thing with FoxPro DBF's is that they use an Index file for  
searches within FoxPro. These are .CDX files which contain the  
Index. You can create an Index on, for example, PHONE field.  
However I don't think there's any way in PHP to reference this  
Index file for faster searches.

Is there any possibility to improve search response time?
Thanks!
---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email]sleepwal...@rahulsjohari.com
[Web]http://www.rahulsjohari.com



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 11:16:25 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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



---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email]sleepwal...@rahulsjohari.com
[Web]http://www.rahulsjohari.com



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 11:55:50 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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




---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!

2009-11-24 Thread Rahul S. Johari

Keyser,

It gets better -- I'm on a Mac OS X (Leopard)!! As far as I know,  
there isn't a VisualFoxPro ODBC Driver for Mac OS X.




On Nov 24, 2009, at 10:11 AM, keyser soze wrote:


Rahul, my friend
i found this in a first search
perhaps it be helpful

http://www.yinfor.com/blog/archives/2008/01/php_connect_dbf_file.html



Rahul S. Johari escribió:
I do believe that what I'm doing is scanning the foxpro dbase row  
by row to get the match ... which is why it's returning the results  
very slow.
But I don't know if there's any other way to do this. Basically the  
FoxPro DBF has 75,000 records and I have to search for the one row  
which has the Phone number I'm looking for, and display results. If  
there's any other way to do this ... I'll be more then happy to try.

On Nov 24, 2009, at 9:55 AM, keyser soze wrote:

i will try to help you
but think i'm old in Fox but new in php
and sadly never used php+fox

so, reading your code
i see you are scanning the whole dbf file from php
Fox cant help you in this way

if there is not another option for scan a dbf
the row by row method is very slow




Rahul S. Johari escribió:
Your post definitely gives me hope. It's possible I'm doing  
something wrong!
I definitely have the foxpro database indexed. I use this FoxPro  
command ...

INDEX ON PHONE TAG PHONE
I do have a .CDX file present for the Database and if I MODIFY  
STRUCTURE and I can see the INDEX present on PHONE.
Did you check my Code? Is there any other way to pull records off  
a FoxPro Database? Can you use SQL Commands via PHP on FoxPro  
databases (SELECT * FROM  ) ?

Thanks
On Nov 24, 2009, at 9:16 AM, keyser soze wrote:

even though the dbf has 10K records
Fox can't spend minutes to found a match
by the way, its very strange
to have 35 columns in a table/dbf or whatever

pay attention to the comment of Ashley
in Fox, you should:

SELECT directory
INDEX on phone_number to idx_directory_phone
- or -
INDEX on phone_number tag phone of cdx_directory

i worked with Fox
with dbfs of 2 millions of records
and the speed is amazing -- using indexes of course!

regards,
ks





Rahul S. Johari escribió:

Ave,
I'm connecting to a foxpro database (dbase) and simply running  
a search to retrieve a record. It's a very simple code.
The problem is, as the database is growing, the search is  
becoming ridiculously slow ... and I mean it's taking  
minutes. When the dbase had 10,000 records ... search was  
fast  efficient ... as if you were connecting to a mySQL  
Database. Now that the database has over 75,000 records and  
still growing ... it's taking minutes to search.
The database has about 35 fields; Search is based on a phone  
number.

This is the code ...
?php
 #Open DBF
 $db = dbase_open(dbase.dbf, 0);
#PULL UP RECORD
 if ($db) {
   $record_numbers = dbase_numrecords($db);
   for ($i = 1; $i = $record_numbers; $i++) {
  $row = dbase_get_record_with_names($db, $i);
  if ($row['PHONE'] == $_POST['PHONE']) {
#Retrieve row  display fields
 echo $row['STUFF'];   }   }
}
?
It works ... but it's getting way too slow.
One thing with FoxPro DBF's is that they use an Index file for  
searches within FoxPro. These are .CDX files which contain the  
Index. You can create an Index on, for example, PHONE field.  
However I don't think there's any way in PHP to reference this  
Index file for faster searches.

Is there any possibility to improve search response time?
Thanks!
---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email]sleepwal...@rahulsjohari.com
[Web]http://www.rahulsjohari.com



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 11:16:25 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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



---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email]sleepwal...@rahulsjohari.com
[Web]http://www.rahulsjohari.com



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 11:55:50 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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



---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email]sleepwal...@rahulsjohari.com
[Web]http://www.rahulsjohari.com



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 12:11:02 p.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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




---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com

Re: [PHP] Re: dbase_get_record_with_names; Very slow search!!!

2009-11-24 Thread Rahul S. Johari
Back in 1996 FoxPro was multi-platform. The last FoxPro version  
released for Mac was Visual FoxPro 3.0b (1996). After that Microsoft  
bought FoxPro and Mac Support/Development was cut off. As of now,  
there are NO known ODBC Drivers for FoxPro for the Mac Platform.


So that aside ... back to Original Topic:

Still no solution for a faster search through the dbf via PHP.


On Nov 24, 2009, at 11:11 AM, keyser soze wrote:


uhh, i don't know
(time ago Fox was multi-platform unix/mac/dos)
did you found that on the web?




Rahul S. Johari escribió:

Keyser,
It gets better -- I'm on a Mac OS X (Leopard)!! As far as I know,  
there isn't a VisualFoxPro ODBC Driver for Mac OS X.

On Nov 24, 2009, at 10:11 AM, keyser soze wrote:

Rahul, my friend
i found this in a first search
perhaps it be helpful

http://www.yinfor.com/blog/archives/2008/01/ 
php_connect_dbf_file.html




Rahul S. Johari escribió:
I do believe that what I'm doing is scanning the foxpro dbase row  
by row to get the match ... which is why it's returning the  
results very slow.
But I don't know if there's any other way to do this. Basically  
the FoxPro DBF has 75,000 records and I have to search for the  
one row which has the Phone number I'm looking for, and display  
results. If there's any other way to do this ... I'll be more  
then happy to try.

On Nov 24, 2009, at 9:55 AM, keyser soze wrote:

i will try to help you
but think i'm old in Fox but new in php
and sadly never used php+fox

so, reading your code
i see you are scanning the whole dbf file from php
Fox cant help you in this way

if there is not another option for scan a dbf
the row by row method is very slow




Rahul S. Johari escribió:
Your post definitely gives me hope. It's possible I'm doing  
something wrong!
I definitely have the foxpro database indexed. I use this  
FoxPro command ...

INDEX ON PHONE TAG PHONE
I do have a .CDX file present for the Database and if I MODIFY  
STRUCTURE and I can see the INDEX present on PHONE.
Did you check my Code? Is there any other way to pull records  
off a FoxPro Database? Can you use SQL Commands via PHP on  
FoxPro databases (SELECT * FROM  ) ?

Thanks
On Nov 24, 2009, at 9:16 AM, keyser soze wrote:

even though the dbf has 10K records
Fox can't spend minutes to found a match
by the way, its very strange
to have 35 columns in a table/dbf or whatever

pay attention to the comment of Ashley
in Fox, you should:

SELECT directory
INDEX on phone_number to idx_directory_phone
- or -
INDEX on phone_number tag phone of cdx_directory

i worked with Fox
with dbfs of 2 millions of records
and the speed is amazing -- using indexes of course!

regards,
ks





Rahul S. Johari escribió:

Ave,
I'm connecting to a foxpro database (dbase) and simply  
running a search to retrieve a record. It's a very simple code.
The problem is, as the database is growing, the search is  
becoming ridiculously slow ... and I mean it's taking  
minutes. When the dbase had 10,000 records ... search was  
fast  efficient ... as if you were connecting to a mySQL  
Database. Now that the database has over 75,000 records and  
still growing ... it's taking minutes to search.
The database has about 35 fields; Search is based on a phone  
number.

This is the code ...
?php
#Open DBF
$db = dbase_open(dbase.dbf, 0);
   #PULL UP RECORD
if ($db) {
  $record_numbers = dbase_numrecords($db);
  for ($i = 1; $i = $record_numbers; $i++) {
 $row = dbase_get_record_with_names($db, $i);
 if ($row['PHONE'] == $_POST['PHONE']) {
   #Retrieve row  display fields
echo $row['STUFF'];   }   }
}
?
It works ... but it's getting way too slow.
One thing with FoxPro DBF's is that they use an Index file  
for searches within FoxPro. These are .CDX files which  
contain the Index. You can create an Index on, for example,  
PHONE field. However I don't think there's any way in PHP to  
reference this Index file for faster searches.

Is there any possibility to improve search response time?
Thanks!
---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email]sleepwal...@rahulsjohari.com
[Web]http://www.rahulsjohari.com



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 11:16:25 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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



---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.
[Email]sleepwal...@rahulsjohari.com
[Web]http://www.rahulsjohari.com



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 091124-0, 24/11/2009
Tested on: 24/11/2009 11:55:50 a.m.
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com





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



---
Rahul Sitaram Johari
Founder, Internet

Re: [PHP] dbase_get_record_with_names; Very slow search!!!

2009-11-24 Thread Rahul S. Johari

Quite right.

Unfortunately there doesn't seem to be any available ODBC Drivers for  
FoxPro available for Mac OS X either!! I'm hitting a brick wall no  
matter what direction I take.



On Nov 24, 2009, at 12:22 PM, Olav wrote:


Ashley Sheridan wrote:


I would assume that any indexes created on any tables would be
referenced automatically by the dbms and wouldn't need to be  
explicitly

referenced from within PHP.


This is dBase (.dbf) he is asking about. There is no such thing as a  
DBMS

in dBase. The program / driver that accesses the data must handle
everything.


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




---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] dbase_get_record_with_names; Very slow search!!!

2009-11-24 Thread Rahul S. Johari
Well I use mySQL on my Mac for all my other database work. This  
particular database is natively produced in FoxPro as that is what our  
Company uses. My website offers some of our clients this data (stored  
in FoxPro DBF's) using PHP which is running on an Apache Web Server on  
Mac OS X.


I am looking into the option of importing the DBF records in my mySQL  
Server on my Mac. The one issue that's coming to my mind is ... the  
DBF is updated daily. An End-Of-Day program run at night updates the  
FoxPro DBF. I can write a program in PHP to import the DBF Records --  
mySQL ... however, I'm going to need to somehow Automate this  
procedure so that it runs automatically every nigh (or early  
morning) ... and also such that only NEWER records are imported from  
the DBF -- mySQL.


Sounds a bit rough ... but seems to be a plausible solution.

On Nov 24, 2009, at 12:46 PM, Olav wrote:


Rahul S. Johari wrote:


Quite right.

Unfortunately there doesn't seem to be any available ODBC Drivers for
FoxPro available for Mac OS X either!! I'm hitting a brick wall no
matter what direction I take.


Convert to SQLite and don't look back ;)

Unless your DBF files are still in use in another application of  
course.

If that use is not simultaneous you could at least trivially write an
import/export routine.


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




---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] dynamic meta tag and title app?

2009-11-19 Thread Jack S
Hi Todd,

This looks like a good starting point for me.
I was going to use $_SERVER['PHP_SELF'];  but I think
($_SERVER['SCRIPT_NAME']); in your example will always return just the
script info and not additionally passed information, which will save
me trouble shooting later!

Thanks!!!


On Thu, Nov 19, 2009 at 10:09 AM, tedd tedd.sperl...@gmail.com wrote:
 At 11:30 AM -0500 11/18/09, Jack S wrote:

 Hello All,

 Does anyone have a reference to a program that may be out there to
 help with using a single header.php for a site, but then dynamically
 loads different keywords , titles etc based on what page is including
 the header file?

 Sample:
 If home page include it knows the title and other variables would be
 home, about us would be about etc.

 --
 Thanks!
 Jack

 Jack:

 I do this for my site. It's pretty simple -- please follow:

 head
 ?php
 $self = basename($_SERVER['SCRIPT_NAME']);

 switch($self)
   {
   case 'index.php':
   ?
   titleTitle of Index Page/title
   meta name=keywords content=Keywords for Index Page
   meta name=description content=Description for Index Page
   ?php
   break;

 and so on.

 Cheers,

 tedd

 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com




-- 
Thanks!
Jack

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



[PHP] dynamic meta tag and title app?

2009-11-18 Thread Jack S
Hello All,

Does anyone have a reference to a program that may be out there to
help with using a single header.php for a site, but then dynamically
loads different keywords , titles etc based on what page is including
the header file?

Sample:
If home page include it knows the title and other variables would be
home, about us would be about etc.

-- 
Thanks!
Jack

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



Re: [PHP] php-ldap works in commandline but not through browser

2009-10-15 Thread chima s
Hi,

ldap extension was loaded in the php.ini file.

php -i |grep ldap
/etc/php.d/ldap.ini,
ldap
RCS Version = $Id: ldap.c,v 1.161.2.3.2.14 2008/12/31 11:17:39 sebastian Exp $


Regards
Chima.s


On Thu, Oct 15, 2009 at 7:17 PM,  xfe...@gmail.com wrote:
 Did you check both php.ini files?

 --
 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] php-ldap works in commandline but not through browser

2009-10-14 Thread chima s
Hi All,

I am using tring with sample program to connect the ldap using php.
Below is the sample code:

==
?php

echo $test=ldapAuthenticate('username','password','domainname');

function ldapAuthenticate($username,$password, $domainname) {
global $ds;

$ds = ldap_connect(xxx.xxx.xxx.xxx);

if($ds)
{
if(ldap_bind($ds))
{
$search = ldap_search($ds, ou=$domainname,dc=comapny, 
uid=$username);

if( ldap_count_entries($ds,$search) != 1 )
{
echo Error processing username -- please try 
to login again. (Debug 3);
return 0;
}


$info = ldap_get_entries($ds, $search);

$bind = @ldap_bind($ds, $info[0][dn], $password);
if( !$bind || !isset($bind))
{
echo Login failed -- please try again. (Debug 
4);
return 0;
}
$search = ldap_search($ds, ou=$domainname,dc=company, 
uid=$username);

$info = ldap_get_entries($ds, $search);
if( $username == $info[0][uid][0] )
{
return 1;
}
else
{
return 0;
}
}
else
{
echo \nAnonymous bind to LDAP FAILED.  Contact Tech 
Services! (Debug 2)\n;
return 0;
}
}
else
{
echo technical services!  (Debug 1);
return 0;
}
}
?
===

When i execute this program with command line its works fine

But when is try this in browser its not working. It struck with bind
statement and not throwing any error,

Following are the version of application:

httpd-2.0.52-41
php-5.2.9-1
openldap-2.2.13-8

Note: There is no filrewall between web server and ldap server.

Regards
Chima.s

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



Re: [PHP] moving to quad core

2009-09-15 Thread Rahul S. Johari



On 9/15/09 10:54 AM, Andres Gonzalez and...@packetstorm.com wrote:



I have an application developed that uses alot of PHP. Currently, it  
is

running on a Ubuntu 8.04 , single core CPU host.  We are moving to a
quad core host for this application.

Is there anything special that I need to do to configure PHP to run  
on a

quad core host? I noticed that my current single core system has PHP
configured with Thread Safety disabled (as reported from phpinfo()).
Does that need to be enabled to run in a multi-core environment?

Any other suggestions for configuring PHP for multi-core use?



Very interesting question indeed;

I moved from a single-core to dual-core some time back, and recently  
moved from dual-core to quad-core. Never paid attention to the hyper- 
threading difference in the httpd process. Would definitely be  
interesting in seeing more information on this topic.


---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



[PHP] ereg_replace to preg_replace translation

2009-08-11 Thread m a r k u s

Hi all,

I see that from PHP 5.3.0 ereg_replace() function is deprecated and throws a 
warning.
I would like to use the preg_replace() function as an alternative of ereg_replace() function but... 
can't undestand the \n#[^\n]*\n expression.


$sql = ereg_replace(\n#[^\n]*\n, , $sql);

Any help for tranlation or alternative ?
Thanks

--
m a r k u s

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



Re: [PHP] Ridiculous ..won't print or echo ...(RESOLVED)

2009-07-31 Thread ej S(ibr(ina on...@mojestopa.cz
Just testing message

Miller, Terion napsal(a):
 Yep I forgot about escaping the $
 
 
 
 On 7/29/09 10:51 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote:
 
 -Original Message-
 From: Miller, Terion [mailto:tmil...@springfi.gannett.com]
 Sent: 29 July 2009 16:36

 Ok in my output to Quark I need to have $P printed to the page like
 this:

 @$p2118 S. Campbell Ave

 So in my php which is going to be grabbing this info and formatting
 it for
 the Quarkisn't echoing that $p all I get is the @

 I have tried several things:

 $p = $p

 $p = print($p)
 
 $p is trying to interpolate the value of the variable $p -- if you had full 
 error reporting turned on, you would see a nonexistent variable error. Once 
 more, there are several things you can do, of which the two most obvious are:
 
 * Use single quotes: echo '$p';
 
 * Use a backslash: echo \$p;
 
 
 Cheers!
 
 Mike
  --
 Mike Ford,
 Electronic Information Developer, Libraries and Learning Innovation,
 Leeds Metropolitan University, C507, Civic Quarter Campus,
 Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
 Email: m.f...@leedsmet.ac.uk
 Tel: +44 113 812 4730
 
 
 
 
 
 To view the terms under which this email is distributed, please go to 
 http://disclaimer.leedsmet.ac.uk/email.htm
 
 --
 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] Ridiculous ..won't print or echo ...(RESOLVED)

2009-07-31 Thread ej S(ibr(ina on...@mojestopa.cz
I'm sorry for this post. It's only testing. Thanks for understand.

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



Re: [PHP] Making several variables into 1 variable

2009-07-28 Thread Richard S. Crawford
On Tue, Jul 28, 2009 at 6:32 AM, Miller,
Teriontmil...@springfi.gannett.com wrote:
 I need to take this:

   $pastDays = strtotime(-30 days);



 $past_day = date(d, $pastDays);

 $past_month = date(m, $pastDays);

 $past_year =date(y, $pastDays);


 And make it into one var to compare to a db field that is formatted like
 00/00/00

Try:

$past_date = date(m/d/y, $pastDays)

Or even:

$past_date = date (m/d/y, time() - 2592000)

(where 2592000 is 30 * 86400, and 86400 is the number of seconds in one day.)




-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



Re: [PHP] Font problem

2009-07-28 Thread Richard S. Crawford
2009/7/28 Dušan Novaković ndu...@gmail.com:
 Hi,

 Is there a possibility that if there is no font installed on client
 side somehow browser finds it and redirect that font form server to
 client machine. For example: I have site that use Microsoft font and
 that font is not available on Linux distributions. So when u open page
 in FF on some Linux u get some default font (because browser doesn't
 recognize that font). I hope that I've managed to explane a problem
 :-) Does anyone has any solution for this problem??? Please it's very
 urgent

Not really, no. The choice of font is up to the user's browser.

However, you can, with CSS, set some basic parameters. If, say, you
want to ensure that the users sees a sans-serif font on their browser,
you can use:

font-family: arial, helvetica, verdana, sans-serif

This basically says, ensure that the browser uses arial; if arial
isn't available, use helvetica; if helvetica isn't available, use
verdana; and if verdana isn't available, use whatever sans-serif font
the user has installed on their computer.

Look up the font-family attribute for CSS on the web. There's too much
detail to go into and this is a PHP list, not a CSS list.


-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Richard S. Crawford
2009/7/28 Thodoris t...@kinetix.gr:
 Hi gang,
   I've been looking for a str_to_date (mysql) equivalent in PHP. I've
 noticed that these are matching the description:

 http://www.php.net/manual/en/datetime.createfromformat.php
 http://www.php.net/manual/en/function.date-create-from-format.php

 but I don't have PHP 5.3.0 installed in any of my systems to test it and the
 function/method is not well documented yet. So I will have to write a
 workaround this.

 Has anybody tried this?

Does strtotime() not work for you?

-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



Re: [PHP] str_to_date equivalent in PHP

2009-07-28 Thread Richard S. Crawford
On Tue, Jul 28, 2009 at 10:09 AM, Jim Lucasli...@cmsws.com wrote:
 Richard S. Crawford wrote:
 2009/7/28 Thodoris t...@kinetix.gr:
 Hi gang,
   I've been looking for a str_to_date (mysql) equivalent in PHP. I've
 noticed that these are matching the description:

 http://www.php.net/manual/en/datetime.createfromformat.php
 http://www.php.net/manual/en/function.date-create-from-format.php

 but I don't have PHP 5.3.0 installed in any of my systems to test it and the
 function/method is not well documented yet. So I will have to write a
 workaround this.

 Has anybody tried this?

 Does strtotime() not work for you?


 he is talking about to /MySQL/ date string format


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


 Hm, probably $date =  date('Y-m-d',strtotime($string)) then.



-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



Fwd: [PHP] newbie: problem with $_Post[]

2009-07-27 Thread Richard S. Crawford
 form action=pass.php method=POST
 username : input type=text name=user br /
 password : input type=password name=pass br /
 input type=submit value=gop
 /form

 ?php
 $user=$_POST['user'];
 $pass=$_POST['pass'];
 if(($user==myname)($pass=mypass))
 echo access granted;
 else
 echo access denied;
 ?

 getting Notice: Undefined index: user and Notice: Undefined index: pass.
 changing form action to another page will solve the problem but i want to be
 able to use $_POST array on the same page, how can i do it?
 thanks in advance

 /Arash

Arash,

It's hard to respond when it's unclear exactly what you want to do.
I'm guessing that you want to simply have the same page show both the
form, and also process the form, so that you can cut down on the
number of pages you have to create.

The way I do this is by first checking to see if the $_POST array has
been set; if it has not been set, then I know that the form wasn't
filled out, and so the script needs to print out the form. If the
array has been set, on the other hand, then the script can process the
form data. Here's a real quick example of what I mean:

?php
if (!isset($_POST)) { ? // The $_POST array is not set, so display the form
    form action=pass.php method=POST
    username : input type=text name=user br /
    password : input type=password name=pass br /
    input type=submit value=gop
    /form
?php } else { // The $_POST array *is* set, so process the data
    $user=$_POST['user'];
    $pass=$_POST['pass'];
    if(($user==myname)($pass=mypass)) {
    echo access granted;
    } else {
    echo access denied;
    }
?

Hope that helps.

--
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



[PHP] How do I Upload XML file using cUrl?

2009-06-12 Thread Rahul S. Johari

Ave,

I have a client who used Lead360.Com to manage their Leads. We have a  
Leads Management application in place that creates an XML file of the  
lead which give the client manually to download.


What are client is requesting is to POST the XML File directly to  
their Leads360.Com account. We have a POST Url from Leads360 where we  
can send the lead, but I'm not sure what kind of a cUrl script I need  
to use to POST an XML file. I've handled POST Data before using cUrl  
but I haven't written a cUrl script that uploads a file to a URL.


From what I have gathered so far ... this is what I have ...

[CODE]

$filename = file.xml;
$handle = fopen($filename, r);
$XPost = fread($handle, filesize($filename));
fclose($handle);

$url = https://secure.leads360.com/Import.aspx;;
$ch = curl_init(); // initialize curl handle

curl_setopt($ch, CURLOPT_VERBOSE, 1); // set url to post to
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
curl_setopt($ch, CURLOPT_HTTPHEADER, Array(Content-Type: text/xml));
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 40); // times out after 4s
curl_setopt($ch, CURLOPT_POSTFIELDS, $XPost); // add POST fields
curl_setopt($ch, CURLOPT_POST, 1);

$result = curl_exec($ch); // run the whole process

[END CODE]

Am I on the right track here or am I missing something?

Thanks Guys!

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



[PHP] PHP as Server Side for a Web Database Application.

2009-06-09 Thread R. S. Patil
Hi,

We are in phase of evaluating PHP as Serverside technology for our first web
application.
We have finalized Flex for user interface and Birt as reporting engine. Now
the data services
are to be evaluated. Flex forums recommended us using PHP for this.

We would like to implement SOA for database access/Inserts/Updates/Queries
for report engine BIRT.
For SOA implementation we are considering XML-RPC and WSO2-WSF since we dont
have any past
experience on web development we are not position to make any decisions
about PHP serverside
technologies can somebody guide use which one we should select (May be
different than these two).
We will be using flex forms to insert and update data through web services
(mainly CRUD operations)
and PHP Query data services will be acting as Data Source to Birt for
reporting. Please suggest us
technolgy which is secure and prooven. The problem of integrating Birt in to
PHP has been solved
and successfully tested also.

Thanks and Best Regards

Raja


Re: [PHP] Problems with HTTPS and maybe an .htaccess???

2009-05-05 Thread Alex S Kurilo aka Kamazee

RewriteRule . index.php


Add an asterisk after the dot:
RewriteRule .* index.php



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



Re: [PHP] Problems with HTTPS and maybe an .htaccess???

2009-05-05 Thread Alex S Kurilo aka Kamazee
No, adding * after the period had no affect at all. Still goes to the  
live site.


Sorry, I misunderstood you. I'm too lazy to read all the message :)

http and https may be handled by different virtual hosts.
http for http://dev.sitename.com/ seems to be configured properly (Virtual host 
at port 80) but not https://dev.sitename.com/ (vhost at port 443).


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



Re: [PHP] How to deal with identical fields in db

2009-05-05 Thread Richard S. Crawford
On Tue, May 5, 2009 at 1:34 PM, PJ af.gour...@videotron.ca wrote:
 I'm coming up with a bit of a quandry: how to enter and retrieve an
 identical book title with different authors.
 It is rather unbelievable what contortions one finds as authors :-(
 like editors, associations and then the unknowns and anon y mouses.
 I suppose one has to get really creative...
 Anyone for tea?

What I've done for this sort of project in the past was create
separate tables for authors, books, and author relationships (e.g.,
author, translator, editor), then linking tables for each of those.
You seriously want to do some normalization on this task; otherwise,
you end up with a giant table of books, with multiple rows duplicating
the title of the book, leading to a huge books table, and nobody
wants that.

-- 
Richard S. Crawford (rscrawf...@mossroot.com)
http://www.mossroot.com
Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

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



[PHP] Extract variable out of a Class - Function

2009-04-23 Thread Rahul S. Johari


I have a function within a class. There is a variable inside that  
function which I need to access  use outside of the class/function.


For example ...

Class Test {
function showOutput {
if ($this-url) {
$justTT = substr($this-url,-10,7);
echo $justTT;
}
}

}

I need to use $justTT. How do I get the value of $justTT into a  
different variable outside of this class/function so I can use it in a  
different class?


---
Rahul S. Johari
Supervisor, Internet  Administration
Informed Sources, Inc.

[Email] ra...@troyjobs.com
[Web]   https://www.informed-sources.com
[Phone] 518-687-6700  Ext: 154
[Fax]   518-687-6799

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Extract variable out of a Class - Function

2009-04-23 Thread Alex S Kurilo aka Kamazee
I have a function within a class. There is a variable inside that  
function which I need to access  use outside of the class/function.


For example ...

Class Test {
function showOutput {
if ($this-url) {
$justTT = substr($this-url,-10,7);
echo $justTT;
}
}

}

I need to use $justTT. How do I get the value of $justTT into a  
different variable outside of this class/function so I can use it in a  
different class?




Return it?



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



Re: RES: [PHP] Extract variable out of a Class - Function

2009-04-23 Thread Rahul S. Johari


Yes!!! It works!! Thats' exactly what I was looking for ... getting  
the value of $justTT in $othervar.

I'm new to classes ... thus the noobity!

On Apr 23, 2009, at 2:04 PM, Jônatas Zechim wrote:


Class Test {
function showOutput {
if ($this-url) {
$this-justTT = substr($this-url,-10,7);
}
}

}

$myvar=new Test();
$myvar-showOutput();

$othervar=$myvar-justTT;

echo $othervar;

$otherClass=new anotherclass($othervar);

Is that u want?

Zechim
SP/Brazil


-Mensagem original-
De: Rahul S. Johari [mailto:sleepwal...@rahulsjohari.com]
Enviada em: quinta-feira, 23 de abril de 2009 14:56
Para: php-general@lists.php.net
Assunto: [PHP] Extract variable out of a Class - Function


I have a function within a class. There is a variable inside that
function which I need to access  use outside of the class/function.

For example ...

Class Test {
function showOutput {
if ($this-url) {
$justTT = substr($this-url,-10,7);
echo $justTT;
}
}

}

I need to use $justTT. How do I get the value of $justTT into a
different variable outside of this class/function so I can use it in a
different class?


---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] self in inherited methods

2009-04-21 Thread Alex S Kurilo aka Kamazee

Is it right that 'self' in inherited method still points to the parent?
If it is, can you explain it? It makes me worry :)

Up until 5.3 this was just the way it was. It has been fixed in 5.3.
See here for more info: http://php.net/lsb


Thanks. It seems that 'static' keyword (instead of 'self') is the thing I 
actually need.



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



[PHP] self in inherited methods

2009-04-19 Thread Alex S Kurilo aka Kamazee

Is it right that 'self' in inherited method still points to the parent?
If it is, can you explain it? It makes me worry :)

A piece of code below for example

?php
class MyParent {
   const NAME = 'MyParent';
   public function get_instance() {
   return new self;
   }
   public function get_another_instance() {
   $class_name = get_class($this);
   return new $class_name;
   }
   public function get_name() {
   return self::NAME;
   }
}

class MyClass extends MyParent {
   const NAME = 'MyClass';
}

$a = new MyClass;
$b = $a-get_instance();
$c = $a-get_another_instance();

echo $a-get_name(),\n;
echo get_class($b),\n;
echo get_class($c),\n;
?



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



[PHP] Connecting to dBase using ODBC on Mac OS X

2009-04-09 Thread Rahul S. Johari

Ave,

Does anyone have any knowledge on connecting a FoxPro table (.dbf,  
dbase) using ODBC on a Mac OS X? I've been googling but not much is  
turning up. Some information is available on ODBC Connections using  
PHP ... very little on Mac OS X ... and absolutely none to do with a  
FoxPro dBase table.


Thanks.

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



[PHP] Writing to dbase (dbf) deletes index (cdx)

2009-03-25 Thread Rahul S. Johari

Ave,

I noticed something peculiar and I can't find a solution for this. I'm  
wondering if anyone can help me out.


I'm using the dbase functions to read  write from dbf (foxpro)  
tables. The DBF tables usually have an Index which is contained in  
filename.cdx. It appears that anytime I Write to the dbf table, it  
deletes the Index. Is there any way around this?


Here's a simple code that I use for appending to a DBF table:

// open in read-write mode
$db = dbase_open(dbf/myfile.dbf, 2);

 // gets the old row
if ($db) {
  $record_numbers = dbase_numrecords($db);
  for ($i = 1; $i = $record_numbers; $i++) {
 $row = dbase_get_record_with_names($db, $i);
 if ($row['SECCODE'] == $_COOKIE['seccodeCookie']) {

  unset($row[deleted]); 
  // Update fields  

  $row['f1'] = $_POST['name'];
  $row['f2'] = $_POST['email']; 

  //echo Replacing Record number $i;
  // Replace the record
  $row = array_values($row);
  dbase_replace_record($db, $row, $i) or die(Fatal 
Error);
  }
  }
}
dbase_close($db);
?

Thanks.

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



[PHP] Export/Write rows from DBF to CSV

2009-03-13 Thread Rahul S. Johari

Ave,

I'm trying to retrieve data from a DBF database and write it to a CSV  
file in a comma delimited format. I'm able to get the data and write  
it to CSV, but it only writes the last row/record ... not all the  
records. I know I don't have the correct code and I'm hoping someone  
can help me...


_
#CREATE CSV
$date = date('mdy');
$_file = 'CSV/TransferData_'.$date.'.csv';
$_fp = @fopen( $_file, 'w' );

#SELECT DBF TO OPEN - READ ONLY
$db = dbase_open(mydata.dbf, 0);
#PULL UP RECORD
if ($db) {
  $record_numbers = dbase_numrecords($db);
  for ($i = 1; $i = $record_numbers; $i++) {
$row = dbase_get_record_with_names($db, $i);

#WRITE ROWS TO VARIABLE
		$_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n;  
-- THIS is where my problem is! This only writes the last row!!

  }
}

#WRITE TO CSV   
@fwrite( $_fp, $_csv_data );
@fclose( $_fp );
_

Thanks!

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Export/Write rows from DBF to CSV

2009-03-13 Thread Rahul S. Johari


On Mar 13, 2009, at 10:01 AM, Bastien Koert wrote:


On Fri, Mar 13, 2009 at 9:56 AM, Rahul S. Johari 
sleepwal...@rahulsjohari.com wrote:


Ave,

I'm trying to retrieve data from a DBF database and write it to a  
CSV file
in a comma delimited format. I'm able to get the data and write it  
to CSV,
but it only writes the last row/record ... not all the records. I  
know I

don't have the correct code and I'm hoping someone can help me...

_
#CREATE CSV
$date = date('mdy');
$_file = 'CSV/TransferData_'.$date.'.csv';
$_fp = @fopen( $_file, 'w' );

  #SELECT DBF TO OPEN - READ ONLY
  $db = dbase_open(mydata.dbf, 0);
  #PULL UP RECORD
  if ($db) {
$record_numbers = dbase_numrecords($db);
for ($i = 1; $i = $record_numbers; $i++) {
  $row = dbase_get_record_with_names($db, $i);

  #WRITE ROWS TO VARIABLE
  $_csv_data =
trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is  
where my

problem is! This only writes the last row!!
}
  }

#WRITE TO CSV
@fwrite( $_fp, $_csv_data );
@fclose( $_fp );
_

Thanks!

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com

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



You are overwriting the variable ($csv_data) that holds the row, add a
period (concatenator) operator to build the up the data

#WRITE ROWS TO VARIABLE
  $_csv_data .=
trim($row['PHONE']).,.trim($row['DATE']).,.\n;
-- THIS is where my problem is! This only writes the last row!!

--

Bastien

Cat, the other other white meat



AH!!! The Simplest Solution!! It works Absolutely 100% Perfect!!

Much Thanks :)

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Export/Write rows from DBF to CSV

2009-03-13 Thread Rahul S. Johari


On Mar 13, 2009, at 11:44 AM, Shawn McKenzie wrote:


Rahul S. Johari wrote:


On Mar 13, 2009, at 10:01 AM, Bastien Koert wrote:


On Fri, Mar 13, 2009 at 9:56 AM, Rahul S. Johari 
sleepwal...@rahulsjohari.com wrote:


Ave,

I'm trying to retrieve data from a DBF database and write it to a  
CSV

file
in a comma delimited format. I'm able to get the data and write  
it to

CSV,
but it only writes the last row/record ... not all the records. I  
know I

don't have the correct code and I'm hoping someone can help me...

_
#CREATE CSV
$date = date('mdy');
$_file = 'CSV/TransferData_'.$date.'.csv';
$_fp = @fopen( $_file, 'w' );

 #SELECT DBF TO OPEN - READ ONLY
 $db = dbase_open(mydata.dbf, 0);
 #PULL UP RECORD
 if ($db) {
   $record_numbers = dbase_numrecords($db);
   for ($i = 1; $i = $record_numbers; $i++) {
 $row = dbase_get_record_with_names($db, $i);

 #WRITE ROWS TO VARIABLE
 $_csv_data =
trim($row['PHONE']).,.trim($row['DATE']).,.\n; -- THIS is
where my
problem is! This only writes the last row!!
   }
 }

#WRITE TO CSV
@fwrite( $_fp, $_csv_data );
@fclose( $_fp );
_

Thanks!

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com

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

@fwrite( $_fp, $_csv_data );
You are overwriting the variable ($csv_data) that holds the row,  
add a

period (concatenator) operator to build the up the data

#WRITE ROWS TO VARIABLE
 $_csv_data .=
trim($row['PHONE']).,.trim($row['DATE']).,.\n;
-- THIS is where my problem is! This only writes the last row!!

--

Bastien

Cat, the other other white meat



AH!!! The Simplest Solution!! It works Absolutely 100% Perfect!!

Much Thanks :)


Or even simpler and won't build a huge string if you have millions of
rows, just move your fwrite() up into the loop to write each record to
the csv:

#WRITE ROWS TO VARIABLE AND WRITE LINE TO CSV
$_csv_data = trim($row['PHONE']).,.trim($row['DATE']).,.\n;
@fwrite( $_fp, $_csv_data );

--
Thanks!
-Shawn
http://www.spidean.com



Very, Very Interesting Snippet - works perfectly fine and I agree,  
more efficient!


Thanks!!

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



[PHP] Re: Extract result from a https remote server response

2009-02-13 Thread m a r k u s

Shawn McKenzie wrote:

m a r k u s wrote:

Hi all,

Example : 
https://www.moneybookers.com/app/email_check.pl?email=t...@toto.comcust_id=123546password=123

The MB server response displayed is : Illegal operation.
We would like to put the result below in a php variable and process it .
An idea ?

PS: The server is secured. The php functions like file(), 
file_get_contents(), readfile(), fopen() has been tested.

Regards

--

m a r  k u s




Well, I don't know how you tested, but if fopen_wrappers are enabled in
php.ini, then this:

echo
file_get_contents('https://www.moneybookers.com/app/email_check.pl?email=t...@toto.comcust_id=123546password=123');

displays this:

Illegal operation


Seems to work for me.



The question is how to extract what is displayed to be processed by our script ?

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



[PHP] Re: Extract result from a https remote server response

2009-02-13 Thread m a r k u s

Shawn McKenzie wrote:

Shawn McKenzie wrote:

m a r k u s wrote:

Hi all,

Example : 
https://www.moneybookers.com/app/email_check.pl?email=t...@toto.comcust_id=123546password=123

The MB server response displayed is : Illegal operation.
We would like to put the result below in a php variable and process it .
An idea ?

PS: The server is secured. The php functions like file(), 
file_get_contents(), readfile(), fopen() has been tested.

Regards

--

m a r  k u s




allow_url_fopen = On



We have no control of the MB remote server configuration.

--
m a r k u s

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



Re: [PHP] Re: Extract result from a https remote server response

2009-02-13 Thread m a r k u s

Sorry all, I was testing in a Windows environment.
I feel like an idiot... :)

Thanks to all.

--
m a r k u s

Bruno Fajardo wrote:

Assigning the return of file_get_contents to a variable?
Didn't get your point...

2009/2/13 m a r k u s queribus2...@hotmail.com

Shawn McKenzie wrote:

Shawn McKenzie wrote:

m a r k u s wrote:

Hi all,

Example : 
https://www.moneybookers.com/app/email_check.pl?email=t...@toto.comcust_id=123546password=123
The MB server response displayed is : Illegal operation.
We would like to put the result below in a php variable and process it .
An idea ?

PS: The server is secured. The php functions like file(), file_get_contents(), 
readfile(), fopen() has been tested.
Regards

--

m a r  k u s



allow_url_fopen = On


We have no control of the MB remote server configuration.

--
m a r k u s

--
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] Extract result from a https remote server response

2009-02-12 Thread m a r k u s

Hi all,

Example :
https://www.moneybookers.com/app/email_check.pl?email=t...@toto.comcust_id=123546password=123
The MB server response displayed is : Illegal operation.
We would like to put the result below in a php variable and process it .
An idea ?

PS: The server is secured. The php functions like file(),
file_get_contents(), readfile(), fopen() has been tested.

Thanks,
Markus

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



Re: [PHP] Re: help with end of line charater

2009-01-30 Thread Konstantin S. Kurilov

Hello Adam!

$list2 = explode(\n, $list); // \n not \r\n
$list = implode(\r\n, $list2);

foreach ... - not need

with the best regards

 - Konstantin Kurilov

Shawn McKenzie wrote:


Adam Williams wrote:


I have staff inputting email addresses into a textarea named $list on
a form and when they click submit, my php script sorts the email
addresses and writes to disk.  The problem is, lets say they enter the
email addresses

b...@mdah.state.ms.usstaff hits enter
ama...@mdah.state.ms.usstaff hits enter
sa...@mdah.state.ms.usstaff hits enter
j...@mdah.state.ms.usstaff hits enter
ci...@mdah.state.ms.usstaff does not hit enter and clicks on submit
button

then views the sortes email addresses, it displays as:

ama...@mdah.state.ms.us
b...@mdah.state.ms.us
ci...@mdah.state.ms.usjoe@mdah.state.ms.us
sa...@mdah.state.ms.us

because the staff didn't hit enter on the last line.  Is there a way to
read each line of input and add a carriage return if needed?  I tried
the code below but it did not work, nothing happened, and i don't know
to examine each line to see if it ends in \r\n either.

$list2 = explode(\r\n, $list);

foreach ($list2 as $key = $var)
  {

  $var = $var.\r\n;

  }

$list = implode(\r\n, $list2);




This may be best handled in your sorting code.  What does it look like?



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



  1   2   3   4   5   6   7   8   9   10   >