php-general Digest 29 Jan 2008 18:01:52 -0000 Issue 5263

2008-01-29 Thread php-general-digest-help

php-general Digest 29 Jan 2008 18:01:52 - Issue 5263

Topics (messages 268238 through 268261):

Re: Posting Summary for Week Ending 25 January, 2008: [EMAIL PROTECTED]
268238 by: Zoltán Németh

how to display photos of the day?
268239 by: jeffry s
268240 by: Zoltán Németh
268241 by: Steve Edberg
268242 by: Paul Scott
268252 by: tedd
268254 by: Per Jessen

Framed  Linked Content
268243 by: Mike Potter
268244 by: Per Jessen
268246 by: Robert Cummings
268248 by: Jason Pruim
268250 by: Robert Cummings
268251 by: Per Jessen
268253 by: Robert Cummings
268256 by: Per Jessen
268259 by: Per Jessen

Handle time-outs and errors with file()
268245 by: John Papas
268260 by: Nathan Nobbe

Another question about functions...
268247 by: Jason Pruim
268255 by: Nathan Nobbe
268258 by: Jason Pruim

PHP 5.2.5 Install Question/Problem
268249 by: Strader, William A.

Re: disable referer ? (was: Framed  Linked Content)
268257 by: Per Jessen
268261 by: Robert Cummings

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
2008. 01. 28, hétfő keltezéssel 13.35-kor Daniel Brown ezt írta:
 Whoops  :-x
 
 The odd thing is, the characters came out fine during the tests,
 and because some changes were made to the script during the week, some
 people will show up two or more times (read: people with non-English
 characters in their names).  I've been pretty sick all week, so I
 haven't really worked on it at all.  Once I get the bugs worked out
 and the scripts cleaned up, I'll post the source and database.
 
 For now, I'm going back to bed

get better soon!

one small notice. the non-English characters are getting converted to
utf-8 well, but this e-mail is sent with
Content-Type: text/plain; charset=ISO-8859-1
so the utf-8 characters are screwed up... it might be the forwarding by
gmail, or something (I don't think the list server would interfere with
that)

and of course Richard Lynch wins the week :D

greets
Zoltán Németh


 
 
 Posting Summary for PHP-General List
 Week Ending: Friday, 25 January, 2008
 
 Messages| Bytes  | Sender
 ++--
 567 (100%)  1420607 (100%)  EVERYONE
 77 (13.6%) 113559  (8%)Richard Lynch ceo at
 l-i-e dot com
 56 (9.9%)  73653   (5.2%)  Nathan Nobbe
 quickshiftin at gmail dot com
 51 (9%)82210   (5.8%)  Jochem Maas jochem at
 iamjochem dot com
 34 (6%)74332   (5.2%)  Eric Butera eric dot
 butera at gmail dot com
 29 (5.1%)  42938   (3%)Daniel Brown parasane
 at gmail dot com
 23 (4.1%)  35023   (2.5%)  Dotan Cohen dotancohen
 at gmail dot com
 22 (3.9%)  36344   (2.6%)  Robert Cummings robert
 at interjinn dot com
 19 (3.4%)  12639   (0.9%)  Per Jessen per at
 computer dot org
 18 (3.2%)  27591   (1.9%)  Jason Pruim japruim at
 raoset dot com
 17 (3%)19199   (1.4%)  Chris dmagick at gmail dot 
 com
 12 (2.1%)  29497   (2.1%)  Zoltán NÃ(c)meth
 znemeth at alterationx dot hu
 10 (1.8%)  11840   (0.8%)  David Powers Email Removed
 8  (1.4%)  12421   (0.9%)  nihilism machine
 nihilismmachine at gmail dot com
 8  (1.4%)  7667(0.5%)  Apple applepro
 at gmail dot com
 6  (1.1%)  8460(0.6%)  Stut stuttle at gmail dot com
 6  (1.1%)  25309   (1.8%)  Wolf LoneWolf at nc
 dot rr dot com
 6  (1.1%)  19482   (1.4%)  Jay Blanchard
 jblanchard at pocket dot com
 6  (1.1%)  9857(0.7%)  Nathan Rixham nrixham
 at gmail dot com
 5  (0.9%)  9818(0.7%)  Bastien Koert
 bastien_k at hotmail dot com
 5  (0.9%)  9964(0.7%)  Tom Ray [Lists] lists
 at blazestudios dot com
 5  (0.9%)  3100(0.2%)  Floor Terra floort at
 gmail dot com
 5  (0.9%)  6743(0.5%)  Jim Lucas lists at
 cmsws dot com
 5  (0.9%)  4849(0.3%)  mike mike503 at gmail dot com
 5  (0.9%)  21985   (1.5%)  AndrÃ(c)s Robinet
 agrobinet at bestplace dot biz
 5  (0.9%)  3583(0.3%)  Colin Guthrie gmane at
 colin dot guthr dot ie
 4  (0.7%)  5240(0.4%)  Paul Scott pscott at
 uwc dot ac dot za
 4  (0.7%)  

Re: [PHP] Fwd: Posting Summary for Week Ending 25 January, 2008: [EMAIL PROTECTED]

2008-01-29 Thread Zoltán Németh
2008. 01. 28, hétfő keltezéssel 13.35-kor Daniel Brown ezt írta:
 Whoops  :-x
 
 The odd thing is, the characters came out fine during the tests,
 and because some changes were made to the script during the week, some
 people will show up two or more times (read: people with non-English
 characters in their names).  I've been pretty sick all week, so I
 haven't really worked on it at all.  Once I get the bugs worked out
 and the scripts cleaned up, I'll post the source and database.
 
 For now, I'm going back to bed

get better soon!

one small notice. the non-English characters are getting converted to
utf-8 well, but this e-mail is sent with
Content-Type: text/plain; charset=ISO-8859-1
so the utf-8 characters are screwed up... it might be the forwarding by
gmail, or something (I don't think the list server would interfere with
that)

and of course Richard Lynch wins the week :D

greets
Zoltán Németh


 
 
 Posting Summary for PHP-General List
 Week Ending: Friday, 25 January, 2008
 
 Messages| Bytes  | Sender
 ++--
 567 (100%)  1420607 (100%)  EVERYONE
 77 (13.6%) 113559  (8%)Richard Lynch ceo at
 l-i-e dot com
 56 (9.9%)  73653   (5.2%)  Nathan Nobbe
 quickshiftin at gmail dot com
 51 (9%)82210   (5.8%)  Jochem Maas jochem at
 iamjochem dot com
 34 (6%)74332   (5.2%)  Eric Butera eric dot
 butera at gmail dot com
 29 (5.1%)  42938   (3%)Daniel Brown parasane
 at gmail dot com
 23 (4.1%)  35023   (2.5%)  Dotan Cohen dotancohen
 at gmail dot com
 22 (3.9%)  36344   (2.6%)  Robert Cummings robert
 at interjinn dot com
 19 (3.4%)  12639   (0.9%)  Per Jessen per at
 computer dot org
 18 (3.2%)  27591   (1.9%)  Jason Pruim japruim at
 raoset dot com
 17 (3%)19199   (1.4%)  Chris dmagick at gmail dot 
 com
 12 (2.1%)  29497   (2.1%)  Zoltán NÃ(c)meth
 znemeth at alterationx dot hu
 10 (1.8%)  11840   (0.8%)  David Powers Email Removed
 8  (1.4%)  12421   (0.9%)  nihilism machine
 nihilismmachine at gmail dot com
 8  (1.4%)  7667(0.5%)  Apple applepro
 at gmail dot com
 6  (1.1%)  8460(0.6%)  Stut stuttle at gmail dot com
 6  (1.1%)  25309   (1.8%)  Wolf LoneWolf at nc
 dot rr dot com
 6  (1.1%)  19482   (1.4%)  Jay Blanchard
 jblanchard at pocket dot com
 6  (1.1%)  9857(0.7%)  Nathan Rixham nrixham
 at gmail dot com
 5  (0.9%)  9818(0.7%)  Bastien Koert
 bastien_k at hotmail dot com
 5  (0.9%)  9964(0.7%)  Tom Ray [Lists] lists
 at blazestudios dot com
 5  (0.9%)  3100(0.2%)  Floor Terra floort at
 gmail dot com
 5  (0.9%)  6743(0.5%)  Jim Lucas lists at
 cmsws dot com
 5  (0.9%)  4849(0.3%)  mike mike503 at gmail dot com
 5  (0.9%)  21985   (1.5%)  AndrÃ(c)s Robinet
 agrobinet at bestplace dot biz
 5  (0.9%)  3583(0.3%)  Colin Guthrie gmane at
 colin dot guthr dot ie
 4  (0.7%)  5240(0.4%)  Paul Scott pscott at
 uwc dot ac dot za
 4  (0.7%)  3486(0.2%)  Richard Heyes richardh
 at phpguru dot org
 4  (0.7%)  3920(0.3%)  Alain Roger raf dot
 news at gmail dot com
 4  (0.7%)  54333   (3.8%)  mattias mj at mjw dot se
 4  (0.7%)  5407(0.4%)  Thijs Lensselink dev
 at lenss dot nl
 3  (0.5%)  4161(0.3%)  Tor Vidvei tor dot
 vidvei at event dot no
 3  (0.5%)  4169(0.3%)  Dave Goodchild
 buddhamagnet at gmail dot com
 3  (0.5%)  7109(0.5%)  James Ausmus james dot
 ausmus at gmail dot com
 3  (0.5%)  1883(0.1%)  Pastor Steve smarquez
 at ccfortsmith dot com
 3  (0.5%)  7054(0.5%)  Andrew Ballard
 aballard at gmail dot com
 3  (0.5%)  2781(0.2%)  Luc Maltier lmaltier
 at lcandco dot com
 3  (0.5%)  3512(0.2%)  Casey heavyccasey at
 gmail dot com
 3  (0.5%)  3445(0.2%)  Marcus marcus dot k79
 at arcor dot de
 3  (0.5%)  3875(0.3%)  Al news at ridersite dot org
 3  (0.5%)  3690(0.3%)  Børge Holen borge at
 arivene dot net
 3  (0.5%)  1751(0.1%)  Emil Edeholt emil at
 knmedical dot se
 3  (0.5%)  10211   (0.7%)  Keith Roberts keith at
 karsites dot net
 2  (0.4%)  4396(0.3%)  shiplu shiplu dot net
 at 

Re: [PHP] how to display photos of the day?

2008-01-29 Thread Steve Edberg

At 6:33 PM +0800 1/29/08, jeffry s wrote:

sorry if this question sound stupid.
i need a good, simple and efficient function to display lets say photo of
the day.

i have a mysql table contain data about 1000 rows. i want to display any of
the photos randomly
and it is fixed for one day.

anyone know how to write the function that return a fixed table id for the
day?



What I would do is something like this (assuming your table has a 
column 'filename' in it):


Create a cron job (on windows, I think the command is called 'at'?) 
that runs this query


select filename from photo_table order by rand() limit 1

once per day, then copies that file to a predefined location (eg 
images/pic_of_the_day.jpg).


Then, your web page simply refers to images/pic_of_the_day.jpg. The 
contents of pic_of_the_day.jpg change every time the cronjob runs 
(unless you randomly pick the same picture twice; not likely with 
1000 rows, but you could include some sort of flag [eg; last used 
date] to avoid picking the same image twice, or to cycle through all 
images before reusing them).


This requires one database hit per day, returning one row, so the 
load is next to nothing.


The cronjob could be written in any language, but since this is a PHP 
list you'll have to promise to write it in PHP ;)


steve


--
+--- my people are the people of the dessert, ---+
| Steve Edberghttp://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center[EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin (530)754-9127 |
+ said t e lawrence, picking up his fork +

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



Re: [PHP] how to display photos of the day?

2008-01-29 Thread Zoltán Németh
2008. 01. 29, kedd keltezéssel 18.33-kor jeffry s ezt írta:
 sorry if this question sound stupid.
 i need a good, simple and efficient function to display lets say photo of
 the day.
 
 i have a mysql table contain data about 1000 rows. i want to display any of
 the photos randomly
 and it is fixed for one day.
 
 anyone know how to write the function that return a fixed table id for the
 day?

a good article on the subject:
http://www.titov.net/2005/09/21/do-not-use-order-by-rand-or-how-to-get-random-rows-from-table/

greets
Zoltán Németh

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



Re: [PHP] Framed Linked Content

2008-01-29 Thread Jason Pruim


On Jan 29, 2008, at 10:58 AM, Robert Cummings wrote:



On Tue, 2008-01-29 at 10:21 -0500, Mike Potter wrote:

There is JavaScript out there, to make a page break out of frames if
someone else has your page in a frame of theirs.
Is it possible to do this with PHP or is that the wrong side of
Server/Client-side operations?


PHP can echo the JavaScript that facilitates the break out.



Related, when target files are PDF's, images, or other than
.php/.htm(l), does PHP provide any remedies against that
sort of remote site linking?


The only remedy agaonst remote linking is to embed some kind of
expiration in the link that accesses the document. I usually do this  
by

using a combination of the document ID, a timestamp, and salt, and md5
or sha1. For instance the following:

?php

$id   = 'THE DOCUMENT ID :)';
$now  = time();
$salt = 'Some site specific salt.';

$accessId = $id.':'.$now.':'.sha1( $id.':'.$now.':'.$salt );

echo 'a href=/docs/myDocument.php?id='.urlencode( $accessId ).''
   .'The Document'
   .'/a';

?

Then when someone actually requests the page we do the following:

?php

$salt = 'Some site specific salt.';
$lifespan = 2 * 24 * 60 * 60; // 2 days

if( !($accessId = isset( $_GET['id'] ) ? $_GET['id'] : false) )
{
   die( 'No document requested.' );
}

list( $id, $timestamp, $code ) = explode( ':', $accessId );

if( $code !== sha1( $id.':'.$timestamp.':'.$salt ) )
{
   die( 'Invalid document request.' );
}

if( (time() - $lifespan)  $timestamp )
{
   die( 'Document has expired.' );
}

// Otherwise flush document to browser.

?

Now this doesn't stop anyone from saving the document locally but it
does prevent linking to your site and wasting your resources. The  
key to

the method is that only you know the $salt and so only you can create
the encoding that validates the passed ID and timestamp. You can also
add more attributes to the encoding such as a user ID. Then you could
ensure the user is logged in, and that the access ID must match their
logged in ID.

Cheers,
Rob.



I'm probably about to show my ignorance here... But by showing it  
hopefully, I can learn from it! Wouldn't it be just as effective to  
have a salt that gets passed to the script and do something like:


if($salt =Correct salt){
//display correct picture
}else{
	//display some random picture of a guy flipping you the bird and echo  
out Don't steal my pictures

}

Now that I type that out, I see that it will still use bandwidth which  
if you are on a measured plan I could see being a problem.


So I think I just convinced my self that yours is better... Any thing  
really wrong with my idea though?


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Framed Linked Content

2008-01-29 Thread Robert Cummings

On Tue, 2008-01-29 at 11:12 -0500, Jason Pruim wrote:
 On Jan 29, 2008, at 10:58 AM, Robert Cummings wrote:
 
 
  On Tue, 2008-01-29 at 10:21 -0500, Mike Potter wrote:
  There is JavaScript out there, to make a page break out of frames if
  someone else has your page in a frame of theirs.
  Is it possible to do this with PHP or is that the wrong side of
  Server/Client-side operations?
 
  PHP can echo the JavaScript that facilitates the break out.
 
 
  Related, when target files are PDF's, images, or other than
  .php/.htm(l), does PHP provide any remedies against that
  sort of remote site linking?
 
  The only remedy agaonst remote linking is to embed some kind of
  expiration in the link that accesses the document. I usually do this  
  by
  using a combination of the document ID, a timestamp, and salt, and md5
  or sha1. For instance the following:
 
  ?php
 
  $id   = 'THE DOCUMENT ID :)';
  $now  = time();
  $salt = 'Some site specific salt.';
 
  $accessId = $id.':'.$now.':'.sha1( $id.':'.$now.':'.$salt );
 
  echo 'a href=/docs/myDocument.php?id='.urlencode( $accessId ).''
 .'The Document'
 .'/a';
 
  ?
 
  Then when someone actually requests the page we do the following:
 
  ?php
 
  $salt = 'Some site specific salt.';
  $lifespan = 2 * 24 * 60 * 60; // 2 days
 
  if( !($accessId = isset( $_GET['id'] ) ? $_GET['id'] : false) )
  {
 die( 'No document requested.' );
  }
 
  list( $id, $timestamp, $code ) = explode( ':', $accessId );
 
  if( $code !== sha1( $id.':'.$timestamp.':'.$salt ) )
  {
 die( 'Invalid document request.' );
  }
 
  if( (time() - $lifespan)  $timestamp )
  {
 die( 'Document has expired.' );
  }
 
  // Otherwise flush document to browser.
 
  ?
 
  Now this doesn't stop anyone from saving the document locally but it
  does prevent linking to your site and wasting your resources. The  
  key to
  the method is that only you know the $salt and so only you can create
  the encoding that validates the passed ID and timestamp. You can also
  add more attributes to the encoding such as a user ID. Then you could
  ensure the user is logged in, and that the access ID must match their
  logged in ID.
 
  Cheers,
  Rob.
 
 
 I'm probably about to show my ignorance here... But by showing it  
 hopefully, I can learn from it! Wouldn't it be just as effective to  
 have a salt that gets passed to the script and do something like:
 
 if($salt =Correct salt){
   //display correct picture
 }else{
   //display some random picture of a guy flipping you the bird and echo  
 out Don't steal my pictures
 }
 
 Now that I type that out, I see that it will still use bandwidth which  
 if you are on a measured plan I could see being a problem.
 
 So I think I just convinced my self that yours is better... Any thing  
 really wrong with my idea though?

You can't pass the salt, the salt is like a password. If the end user
knows it they could arbitrarily change the document ID or timestamp in
which case access is no longer under your control. This is why we create
a sha1 encoding based on the document ID, the timestamp, and the salt.
If any of the parameters changes we don't get the access code and so we
know that tampering has occurred with the request parameters.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] PHP 5.2.5 Install Question/Problem

2008-01-29 Thread Strader, William A.
OK I have tried e-mailing the PHP-Install mailing list and all I got in
response from that list was spam... So I thought I would try here.

OK I am attempting to install PHP 5.2.5 on a new system here is what I
have:

SunOS server1 5.10 Generic_118833-24 sun4u sparc SUNW,Sun-Fire-V210

Here is the GCC version:

gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

now when I run the ./configure I am doing a :

./configure --prefix=/opt/local/stow/php-5.2.5
--with-apxs2=/usr/local/httpd-2.2.8/bin/apxs
--with-config-file-path=/usr/local/apache/conf

Nothing special on that.. I was originally trying to do a:

./configure --prefix=/opt/local/stow/php-5.2.5
--with-apxs2=/usr/local/httpd-2.2.8/bin/apxs --enable-calendar
--with-config-file-path=/usr/local/apache/conf --with-zlib
--with-openssl=/opt/local/stow/openssl-0.9.8d
--with-jpeg-dir=/opt/local/stow/jpeg-6b
--with-png-dir=/opt/local/stow/libpng-1.2.5 --with-gd
--enable-gd-native-ttf --with-ttf
--with-xpm-dir=/opt/local/stow/xpm-3.4k-solaris
--with-mysql=/opt/local/stow/mysql-5.0.51

But still nothing... Here is the error message:

/bin/sh /export/home/UID/php-5.2.5/libtool --silent --preserve-dup-deps
--mode=compile gcc  -Imain/ -I/export/home/ UID /php-5.2.5/main/
-DPHP_ATOM_INC -I/export/home/UID/php-5.2.5/include -I/export/home/ UID
/php-5.2.5/main -I/export/home/ UID /php-5.2.5
-I/usr/local/include/libxml2 -I/export/home/ UID /php-5.2.5/ext/date/lib
-I/export/home/UID/php-5.2.5/TSRM -I/export/home/UID/php-5.2.5/Zend
-D_POSIX_PTHREAD_SEMANTICS  -I/usr/local/include -D_REENTRANT   -c
/export/home/UID/php-5.2.5/main/mergesort.c -o main/mergesort.lo 

/bin/sh /export/home/UID/php-5.2.5/libtool --silent --preserve-dup-deps
--mode=compile gcc  -Imain/ -I/export/home/UID/php-5.2.5/main/
-DPHP_ATOM_INC -I/export/home/UID/php-5.2.5/include
-I/export/home/UID/php-5.2.5/main -I/export/home/UID/php-5.2.5
-I/usr/local/include/libxml2 -I/export/home/UID/php-5.2.5/ext/date/lib
-I/export/home/UID/php-5.2.5/TSRM -I/export/home/UID/php-5.2.5/Zend
-D_POSIX_PTHREAD_SEMANTICS  -I/usr/local/include -D_REENTRANT   -c
/export/home/UID/php-5.2.5/main/reentrancy.c -o main/reentrancy.lo 

/export/home/UID/php-5.2.5/main/reentrancy.c: In function `php_ctime_r':

/export/home/UID/php-5.2.5/main/reentrancy.c:63: error: too many
arguments to function `ctime_r'

/export/home/UID/php-5.2.5/main/reentrancy.c: In function
`php_asctime_r':

/export/home/UID/php-5.2.5/main/reentrancy.c:70: error: too many
arguments to function `asctime_r'

/export/home/UID/php-5.2.5/main/reentrancy.c: In function
`php_readdir_r':

/export/home/UID/php-5.2.5/main/reentrancy.c:139: error: too few
arguments to function `readdir_r'

make: *** [main/reentrancy.lo] Error 1

Can anyone suggest anything for me to try???  Thank you all for any help
you can give.

Regards,
 
William Billy A. Strader
NAISMC Web Services
Work: 865-425-5178
Pager: 865-417-5012
Emergency Pager: 865-417-5622

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



[PHP] Another question about functions...

2008-01-29 Thread Jason Pruim

HI everyone,

I think I'm getting closer to understanding functions, but I'm  
blanking on how to fix a problem that I have... I am attempting to  
export a database to excel, which was working before converting the  
code into a function.


What's happening is, I have the code set and it downloads the file  
into excel, but it doesn't have the database fields in it, rather a  
copy of the entire webpage which it trys to put into excel. Below is  
the code that I am using in my function to export the records:


?PHP
function excelexportfunc($select, $sortOrder, $exportdate) {

$export = mysql_query($select);
$fields = mysql_num_fields($export);

for ($i = 0; $i  $fields; $i++) {
$header .= mysql_field_name($export, $i) . \t;
}

while($row = mysql_fetch_row($export)) {
$line = '';
foreach($row as $value) {
if ((!isset($value)) or ($value == )) {
$value = \t;
}
else
{
$value = str_replace('', '', $value);
$value = '' . $value . '' . \t;
}   
$line .= $value;
}
$data .= trim($line). \n;
}
$data = str_replace(\r, , $data);

if ($data ==) {
$data =\n(0) Records Found!\n;
}

header(Content-type: application/vnd.ms-excel);
		header(Content-Disposition: attachment; filename=Export.. 
$exportdate..xls);

header(Pragma: no-cache);
header(Expires: 0);



print $header\n$data;

}

?

I am calling the function like so: excelexportfunc($select,  
$sortOrder, $exportdate);


the $select is specified in an IF statement on the calling page like so:

if($exportoption ==all){
$sortOrder= $_SESSION['order'];
$search = ;
$select = SELECT * FROM .$table. order by .$sortOrder.;

}else{

$sortOrder = $_SESSION['order'];
$search = $_SESSION['search'];
		$select = SELECT * FROM .$table. WHERE FName like '%.$search.%'  
or LName like '%.$search.%' or Add1 like '%.$search.%' or Add2  
like '%.$search.%' or City like '%.$search.%' or State like '%. 
$search.%' or Zip like '%.$search.%' or XCode like '%.$search.%'  
order by .$sortOrder.;

}

If anyone has any ideas I would love to hear about them. Hopefully  
it's just a simple . in the wrong place! :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]




Re: [PHP] Framed Linked Content

2008-01-29 Thread Robert Cummings

On Tue, 2008-01-29 at 10:21 -0500, Mike Potter wrote:
 There is JavaScript out there, to make a page break out of frames if
 someone else has your page in a frame of theirs.
 Is it possible to do this with PHP or is that the wrong side of
 Server/Client-side operations?

PHP can echo the JavaScript that facilitates the break out.

 
 Related, when target files are PDF's, images, or other than
 .php/.htm(l), does PHP provide any remedies against that
 sort of remote site linking?

The only remedy agaonst remote linking is to embed some kind of
expiration in the link that accesses the document. I usually do this by
using a combination of the document ID, a timestamp, and salt, and md5
or sha1. For instance the following:

?php

$id   = 'THE DOCUMENT ID :)';
$now  = time();
$salt = 'Some site specific salt.';

$accessId = $id.':'.$now.':'.sha1( $id.':'.$now.':'.$salt );

echo 'a href=/docs/myDocument.php?id='.urlencode( $accessId ).''
.'The Document'
.'/a';

?

Then when someone actually requests the page we do the following:

?php

$salt = 'Some site specific salt.';
$lifespan = 2 * 24 * 60 * 60; // 2 days

if( !($accessId = isset( $_GET['id'] ) ? $_GET['id'] : false) )
{
die( 'No document requested.' );
}

list( $id, $timestamp, $code ) = explode( ':', $accessId );

if( $code !== sha1( $id.':'.$timestamp.':'.$salt ) )
{
die( 'Invalid document request.' );
}

if( (time() - $lifespan)  $timestamp )
{
die( 'Document has expired.' );
}

// Otherwise flush document to browser.

?

Now this doesn't stop anyone from saving the document locally but it
does prevent linking to your site and wasting your resources. The key to
the method is that only you know the $salt and so only you can create
the encoding that validates the passed ID and timestamp. You can also
add more attributes to the encoding such as a user ID. Then you could
ensure the user is logged in, and that the access ID must match their
logged in ID.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Another question about functions...

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 11:07 AM, Jason Pruim [EMAIL PROTECTED] wrote:

 What's happening is, I have the code set and it downloads the file
 into excel, but it doesn't have the database fields in it, rather a
 copy of the entire webpage which it trys to put into excel.


this sounds to me like you may not be linking to the code that generates
the excel spreadsheet properly.  this is just a hunch, but to test it, you
might try pointing your browser directly at the script that generates the
excel spreadsheet, rather than navigating to it via a link you have on your
current page.
as far as the data not showing up in the output, try experimenting by
omitting the header() calls and just dump out the result set of the query
to ensure the data is actually getting populated in your function.

-nathan


Re: [PHP] how to display photos of the day?

2008-01-29 Thread Per Jessen
jeffry s wrote:

 sorry if this question sound stupid.
 i need a good, simple and efficient function to display lets say photo
 of the day.
 
 i have a mysql table contain data about 1000 rows. i want to display
 any of the photos randomly and it is fixed for one day.

I use apache for that sort of thing:

.htaccess:
RewriteEngine on
RewriteCond todaysphoto.jpeg  !-s
RewriteRule picktodaysphoto.php

picktodaysphoto.php selects the photo of the day, writes it
as 'todaysphoto.jpeg', and then redirects to it.

'todaysphoto.jpeg' is then deleted once a day by cron. 


/Per Jessen, Zürich

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



Re: [PHP] Framed Linked Content

2008-01-29 Thread Per Jessen
Per Jessen wrote:

 Well then - for people who've disabled it, there's no remote linking
 to your content.  All done.

Btw, apache does a good job of dealing with remote links:

RewriteCond %{HTTP_REFERER} !^https?://jessen.ch/
RewriteRule /images/(.*) http://jessen.ch/no-remote-linking-please?item=$1

It's a rough example, but the idea should be obvious. 


/Per Jessen, Zürich

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



Re: [PHP] Framed Linked Content

2008-01-29 Thread Per Jessen
Robert Cummings wrote:

 
 On Tue, 2008-01-29 at 17:32 +0100, Per Jessen wrote:
 Robert Cummings wrote:
 
  The only remedy agaonst remote linking is to embed some kind of
  expiration in the link that accesses the document.
 
 Wouldn't a check of the REFERER field be enough to disable most
 remote
 links?  (I know it is easily forged.)
 
 Referer value is completely worthless. Many people completely disable
 it-- such as myself :)

Well then - for people who've disabled it, there's no remote linking to
your content.  All done. 


/Per Jessen, Zürich

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



Re: [PHP] how to display photos of the day?

2008-01-29 Thread tedd

At 6:33 PM +0800 1/29/08, jeffry s wrote:

sorry if this question sound stupid.
i need a good, simple and efficient function to display lets say photo of
the day.

i have a mysql table contain data about 1000 rows. i want to display any of
the photos randomly
and it is fixed for one day.

anyone know how to write the function that return a fixed table id for the
day?



jeffry:

Simple enough:.

1. Figure out what day it is.

2. Pull a random image from the database if that date has changed.

If it were me,  I would create a simple field in the database that 
would have todays date (day of the year) in it.


Then my script would check date(z) with that field. If the value is 
different, then I would replace that value with the new value and 
then change the picture accordingly by using the rand() function.


Cheers,

tedd

PS: date(z) produces the day of the year (1-365)
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Handle time-outs and errors with file()

2008-01-29 Thread John Papas
I'm using file() to get the contents of a remote page in my script but
I cannot find any information regarding how I could *gracefully*
handle a broken network connection or even a time-out (slow
connection).

Is there a way?

---
Example:
$menu = file('http://www.remotesite.org/mypage.html');
foreach ($menu as $line_num = $line) {
echo $line.\n;
}

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



[PHP] Framed Linked Content

2008-01-29 Thread Mike Potter
There is JavaScript out there, to make a page break out of frames if
someone else has your page in a frame of theirs.
Is it possible to do this with PHP or is that the wrong side of
Server/Client-side operations?

Related, when target files are PDF's, images, or other than
.php/.htm(l), does PHP provide any remedies against that
sort of remote site linking?

Mike

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



Re: [PHP] Re: disable referer ? (was: Framed Linked Content)

2008-01-29 Thread Robert Cummings

On Tue, 2008-01-29 at 17:55 +0100, Per Jessen wrote:
 Robert Cummings wrote:
 
  Referer value is completely worthless. Many people completely disable
  it-- such as myself :)
 
 But most people probably don't - 'coz most don't know how to edit e.g.
 the firefox config. 

I use Opera :)

 What is the purpose of disabling it?

Sites use it to cross reference your habits. It let's them know from
whence you've come. Whether that be google, msn, freepr0n, etc. No one's
business but my own how I arrived at point X in my surfing travels.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] how to display photos of the day?

2008-01-29 Thread Paul Scott

On Tue, 2008-01-29 at 18:33 +0800, jeffry s wrote:

 i have a mysql table contain data about 1000 rows. i want to display any of
 the photos randomly
 and it is fixed for one day.
 

MySQL has a rand() function, so you could bomb that off as a select once
a day on cron or something, or you could do a regular select and
array_rand() it in PHP.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Handle time-outs and errors with file()

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 10:58 AM, John Papas [EMAIL PROTECTED] wrote:

 I'm using file() to get the contents of a remote page in my script but
 I cannot find any information regarding how I could *gracefully*
 handle a broken network connection or even a time-out (slow
 connection).

 Is there a way?

 ---
 Example:
 $menu = 
 file('http://www.remotesite.org/mypage.html'http://www.remotesite.org/mypage.html%27
 );
 foreach ($menu as $line_num = $line) {
echo $line.\n;
 }


theoretically, you could use a stream context and set a notification
handler, however, i was unable to get notifications when using this code:

function httpStreamNotificationHandler($notification_code, $severity,
$message, $message_code, $bytes_transferred, $bytes_max) {
echo __FUNCTION__ . PHP_EOL;
var_dump(func_get_args());
}
$options = array('http' =
array('method' = 'GET',
  'timeout' = 3
)
);

$streamContext = stream_context_create($options);
if(stream_context_set_params($streamContext, array('notification',
'httpStreamNotificationHandler'))) {
echo 'stream context parameters set, loading remote resource..' .
PHP_EOL;
// load remote resource
$theFile = file('http://www.remotesite.org/mypage.html', null,
$streamContext);
var_dump($theFile);
} else {
echo 'couldnt set context parameters' . PHP_EOL;
}

you might also get something out of the timeout option, which i set in the
code above,
but ive not verified its working correctly either.
also, you might try curl.

-nathan


[PHP] how to display photos of the day?

2008-01-29 Thread jeffry s
sorry if this question sound stupid.
i need a good, simple and efficient function to display lets say photo of
the day.

i have a mysql table contain data about 1000 rows. i want to display any of
the photos randomly
and it is fixed for one day.

anyone know how to write the function that return a fixed table id for the
day?


Re: [PHP] Framed Linked Content

2008-01-29 Thread Robert Cummings

On Tue, 2008-01-29 at 17:50 +0100, Per Jessen wrote:
 Robert Cummings wrote:
 
  
  On Tue, 2008-01-29 at 17:32 +0100, Per Jessen wrote:
  Robert Cummings wrote:
  
   The only remedy agaonst remote linking is to embed some kind of
   expiration in the link that accesses the document.
  
  Wouldn't a check of the REFERER field be enough to disable most
  remote
  links?  (I know it is easily forged.)
  
  Referer value is completely worthless. Many people completely disable
  it-- such as myself :)
 
 Well then - for people who've disabled it, there's no remote linking to
 your content.  All done.

Is that what you tell paid subscribers? I'd tell you where to shove
it :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Handle time-outs and errors with file()

2008-01-29 Thread Eric Butera
On Jan 29, 2008 10:58 AM, John Papas [EMAIL PROTECTED] wrote:
 I'm using file() to get the contents of a remote page in my script but
 I cannot find any information regarding how I could *gracefully*
 handle a broken network connection or even a time-out (slow
 connection).

 Is there a way?

 ---
 Example:
 $menu = file('http://www.remotesite.org/mypage.html');
 foreach ($menu as $line_num = $line) {
 echo $line.\n;
 }

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



I'm not exactly sure what you are trying to accomplish or what sort of
access you have to the server, but if it were me I wouldn't rely on a
remote connection in real time.  I would have a cron job that
periodically updated the results that I am expecting so that reads on
your site are very fast.  Like I said though I'm not sure what you're
using this for so I cannot say whether or not it is okay for you to
cache this data locally for 5 minutes or even 1 day.

If you can cache it but cannot run cron jobs, then just write the
return buffer to a file and hold that for as long as possible checking
the last time it was wrote to see if it needs a refresh.

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



Re: [PHP] Re: disable referer ? (was: Framed Linked Content)

2008-01-29 Thread Robert Cummings

On Tue, 2008-01-29 at 13:01 -0500, Robert Cummings wrote:
 On Tue, 2008-01-29 at 17:55 +0100, Per Jessen wrote:
  Robert Cummings wrote:
  
   Referer value is completely worthless. Many people completely disable
   it-- such as myself :)
  
  But most people probably don't - 'coz most don't know how to edit e.g.
  the firefox config. 
 
 I use Opera :)
 
  What is the purpose of disabling it?
 
 Sites use it to cross reference your habits. It let's them know from
 whence you've come. Whether that be google, msn, freepr0n, etc. No one's
 business but my own how I arrived at point X in my surfing travels.

Actually, now you made me think on it... the primary reason I disable
referrer logging is because it will also pass along lovely information
such as any session ID embedded in the URL. So if you happen to get on a
malicious site, they could access the account from which you've come.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Framed Linked Content

2008-01-29 Thread Per Jessen
Mike Potter wrote:

 There is JavaScript out there, to make a page break out of frames if
 someone else has your page in a frame of theirs.
 Is it possible to do this with PHP or is that the wrong side of
 Server/Client-side operations?

I haven't checked, but I'm wondering if the REFERER field might help you
if want to do a server-side redirect. 

 Related, when target files are PDF's, images, or other than
 .php/.htm(l), does PHP provide any remedies against that
 sort of remote site linking?

Check the REFERER field. 


/Per Jessen, Zürich

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



Re: [PHP] Framed Linked Content

2008-01-29 Thread Per Jessen
Robert Cummings wrote:

 The only remedy agaonst remote linking is to embed some kind of
 expiration in the link that accesses the document.  

Wouldn't a check of the REFERER field be enough to disable most remote
links?  (I know it is easily forged.)


/Per Jessen, Zürich

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



Re: [PHP] Another question about functions...

2008-01-29 Thread Jason Pruim


On Jan 29, 2008, at 11:48 AM, Nathan Nobbe wrote:


On Jan 29, 2008 11:07 AM, Jason Pruim [EMAIL PROTECTED] wrote:
What's happening is, I have the code set and it downloads the file
into excel, but it doesn't have the database fields in it, rather a
copy of the entire webpage which it trys to put into excel.

this sounds to me like you may not be linking to the code that  
generates
the excel spreadsheet properly.  this is just a hunch, but to test  
it, you
might try pointing your browser directly at the script that  
generates the
excel spreadsheet, rather than navigating to it via a link you have  
on your

current page.
as far as the data not showing up in the output, try experimenting by
omitting the header() calls and just dump out the result set of the  
query

to ensure the data is actually getting populated in your function.

-nathan


Well, I commented out the header lines and just printed the data to  
the browser, and it fills it all in perfectly. So I think you are  
right about not calling it right... I'll do some more checking on  
that, back to the $salt farms I go! :)




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]




Re: [PHP] Framed Linked Content

2008-01-29 Thread Robert Cummings

On Tue, 2008-01-29 at 17:32 +0100, Per Jessen wrote:
 Robert Cummings wrote:
 
  The only remedy agaonst remote linking is to embed some kind of
  expiration in the link that accesses the document.  
 
 Wouldn't a check of the REFERER field be enough to disable most remote
 links?  (I know it is easily forged.)

Referer value is completely worthless. Many people completely disable
it-- such as myself :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Re: disable referer ? (was: Framed Linked Content)

2008-01-29 Thread Per Jessen
Robert Cummings wrote:

 Referer value is completely worthless. Many people completely disable
 it-- such as myself :)

But most people probably don't - 'coz most don't know how to edit e.g.
the firefox config. 

What is the purpose of disabling it?



/Per Jessen, Zürich

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



[PHP] first php 5 class

2008-01-29 Thread nihilism machine
Ok, trying to write my first php5 class. This is my first project  
using all OOP PHP5.2.5.


I want to create a config class, which is extended by a connection  
class, which is extended by a database class. Here is my config class,  
how am I looking?


?php

class dbconfig {
public $connInfo = array();
public $connInfo[$hostname] = 'internal-db.s23499.gridserver.com';
public $connInfo[$username] = 'db23499';
public $connInfo[$password] = 'ryvx4398';
public $connInfo[$database] = 'db23499_donors';

public __construct() {
return $this-$connInfo;
}
}

?

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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Jochem Maas

Nathan Nobbe schreef:

On Jan 29, 2008 3:02 PM, Stut [EMAIL PROTECTED] wrote:


Why? What exactly do you think you're saving by not putting the
instance in a variable? I can't think of one good reason to do this.



its an esthetic thing; and besides the simple factory method is an
easy workaround to achieve it.
as the article that, Eric, posted mentioned, other languages have
such support; ie javascript:
function Test() {}
Test.prototype = { doSomething : function() { alert('hello'); } }


^^  prototypal not class-based inheritance, orange meet apple.


new Test().doSomething();


besides which this is a dereferenced call and not method chaining,
if you want method chaining in JS you'll have to do extra work (i.e. use 
'return this;')

different strokes or something.



this is along the lines of the whole returnAnArray()['someIndex'] thing,
fortunately in this case, theres a workaround in userspace ;)

-nathan



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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 3:26 PM, Jochem Maas [EMAIL PROTECTED] wrote:

 Nathan Nobbe schreef:
  On Jan 29, 2008 3:02 PM, Stut [EMAIL PROTECTED] wrote:
 
  Why? What exactly do you think you're saving by not putting the
  instance in a variable? I can't think of one good reason to do this.
 
 
  its an esthetic thing; and besides the simple factory method is an
  easy workaround to achieve it.
  as the article that, Eric, posted mentioned, other languages have
  such support; ie javascript:
  function Test() {}
  Test.prototype = { doSomething : function() { alert('hello'); } }

^^  prototypal not class-based inheritance, orange meet apple.


i never said it was :P

besides which this is a dereferenced call and not method chaining,
 if you want method chaining in JS you'll have to do extra work (i.e. use
 'return this;')
 different strokes or something.


this example was to illustrate that in other languages, such as javascript,
an object
method can be invoked directly from an instance returned by a call to new
(which is
really what were talking about in this thread).  whereas, in php, as weve
seen today,
youll have to implement a workaround.

-nathan


[PHP] Using next() inside a foreach

2008-01-29 Thread Erik Stackhouse

Hello,

I'm hesitant to report this issue as a bug, since I see other bugs
(43890 and 43220) already opened describing similar, but not identical,
issues.  The latter bug is described as a documentation issue...

In my tests all versions of php prior to 5.2.4, foreach does NOT
increment the array pointer for each iteration, at least not at the top
of the loop.  This new behavior in 5.2.4 breaks array look-ahead logic,
when using next() -- since you end up looking TWO places ahead instead
of one.

This produces the effect that in the body of the loop, current()
actually returns the next value in the array -- which is the
workaround I've implemented in my code for doing a look-ahead -- though
it seems non-intuitive to have current() return the next value.

Perhaps the previous behavior was to increment the array pointer at the
END of the foreach block, and now for some reason it's incrementing it
at the BEGINNING?  That would explain it I guess...

Perhaps there's a better way to do look-ahead, but for a behavior change
like this, if it's intentional, shouldn't it at least be in the
Backward Compatibility section of the migration docs?

Example Code:

$test_arr = array('zero', 'one','two','three','four');

foreach ($test_arr as $idx = $val) {

$next_val = next($test_arr);

print This:  . $idx .  -  . $val . \n;
print Next:  . $next_val . \n;

}

-
output under v5.2.3 (and 4.4.8):
-

This: 0 - zero
Next: one
This: 1 - one
Next: two
This: 2 - two
Next: three
This: 3 - three
Next: four
This: 4 - four
Next:

---
output under v5.2.4 and v5.2.5:
---

This: 0 - zero
Next: two
This: 1 - one
Next: three
This: 2 - two
Next: four
This: 3 - three
Next:
This: 4 - four
Next:

---

Regards to All,

-Erik

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



Re: [PHP] Another question about functions...

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 3:53 PM, Jason Pruim [EMAIL PROTECTED] wrote:

 I did as you suggested, and I think I found the reason... I included info
 for the doctype, and some files that are on all my pages... Once I comment
 out those lines it works just fine...
 I'm assuming that that is expected behavior?


where did you include this information?
i didnt see it in the original code you posted.
and, btw. im no expert on setting mime types for excel :)

-nathan


Re: [PHP] first php class take 2

2008-01-29 Thread Jochem Maas

nihilism machine schreef:

How does this look now?


just as bad as before. you haven't even tried to run the code have you?



?php

class dbconfig {
public $connInfo = array();
public $connInfo[$hostname] = 'host.com';
public $connInfo[$username] = 'dbuser';
public $connInfo[$password] = 'dbpass';
public $connInfo[$database] = 'mydbname';

public __construct() {
return $this-$connInfo;
}
}

?

?php

include_once(dbconfig.class.php);

class dbconn extends dbconfig {

public $DB;

public __constructor(){

$this-$connInfo = new dbconfig();
$username =
$hostname =
$password =
$database =
$DB = new 
PDO(mysql:host=$connInfo[$hostname];dbname=$connInfo[$database], 
$connInfo[$username], $connInfo[$password]);

return $DB;
}
}

?



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



Re: [PHP] Another question about functions...

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 2:39 PM, Jason Pruim [EMAIL PROTECTED] wrote:

 Okay, so I checked everything I can think of, and it's still
 downloading it as an application which means it's downloading the
 entire website instead of just the data from the database... Anyone
 have any idea what to check?


im guessing youre trying to hit the invocation of excelexportfunc(), as
it sits in your existing script.  create a simple test script that does
nothing
else but invoke the excelexportfunc() function.  you can pass variables to
it from the url, or hardcode them if you like; id probly hardcode them at
first.

?php
include('excelexportfunc.php'); // -- set accordingly

$select = ''; // -- set me
$sortOrder = '' -- set me
$exportdate = '' -- set me

excelexportfunc($select, $sortOrder, $exportdate);
?

that *should* get you the results youre looking for.  from there you need to
determine why the method isnt working in the context of your existing
script.

-nathan


Re: [PHP] php installation problem

2008-01-29 Thread Umar

Dear Richar!

I already told you there is no iconv or iconv-devel installed on my first
box then whey I need on second box?

Regrads,

Umar Draz


Richard Lynch wrote:
 
 Perhaps you don't have iconv and/or iconv-devel installed on the
 second box?
 
 On Sun, January 27, 2008 2:54 am, Umar wrote:

 Dear Members!

 I have installed php-5.2.5 on slackware 12.0 with these option
 successfully

 ./configure --prefix=/usr/local/php
 --with-apxs=/usr/local/apache/bin/apxs
 --with-config-file-path=/usr/local/apache/conf --with-pcre-regex
 --with-layout=GNU --enable-sysvshm --enable-shmop --enable-sysvmsg
 --enable-sysvsem --enable-exif --enable-ftp --enable-safe-mode
 --enable-bcmath --disable-debug --enable-sockets
 --enable-force-cgi-redirect
 --with-gettext --with-zlib --with-gd --enable-gd-native-ttf
 --disable-rpath
 --enable-mbregex --with-bz2 --with-mime-magic --enable-calendar
 --enable-inline-optimization --enable-magic-quotes
 --enable-wddx=shared
 --with-ncurses=shared --with-xmlrpc --with-regex=system --with-pear
 --with-curl --with-gmp --with-png-dir=/usr/local --enable-mbstring
 --with-jpeg-dir=/usr/local --with-pic --with-mm=/usr/local
 --with-libexpat-dir=/usr/local --with-xsl=/usr/local --with-mcrypt
 --with-mhash --with-ldap=/usr/local/ldap

 Now I am trying to install php-5.2.5 on another slackware 12.0 with
 same
 options but i got error on make

 ext/gd/libgd/.libs/gdkanji.o: In function `do_convert':
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/gd/libgd/gdkanji.c:350:
 und
 efined reference to `libiconv_open'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/gd/libgd/gdkanji.c:365:
 und
 efined reference to `libiconv'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/gd/libgd/gdkanji.c:381:
 und
 efined reference to `libiconv_close'
 ext/iconv/.libs/iconv.o: In function `_php_iconv_strlen':
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:603:
 undefine
 d reference to `libiconv_open'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:626:
 undefine
 d reference to `libiconv'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:660:
 undefine
 d reference to `libiconv_close'
 ext/iconv/.libs/iconv.o: In function `php_iconv_string':
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:441:
 undefine
 d reference to `libiconv_open'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:453:
 undefine
 d reference to `libiconv'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:467:
 undefine
 d reference to `libiconv'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:478:
 undefine
 d reference to `libiconv_close'
 ext/iconv/.libs/iconv.o: In function `_php_iconv_strpos':
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:851:
 undefine
 d reference to `libiconv_open'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:879:
 undefine
 d reference to `libiconv'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:993:
 undefine
 d reference to `libiconv_close'
 ext/iconv/.libs/iconv.o: In function `_php_iconv_appendl':
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:348:
 undefine
 d reference to `libiconv'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:385:
 undefine
 d reference to `libiconv'
 ext/iconv/.libs/iconv.o: In function `_php_iconv_substr':
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:723:
 undefine
 d reference to `libiconv_open'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:747:
 undefine
 d reference to `libiconv'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:802:
 undefine
 d reference to `libiconv_close'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:806:
 undefine
 d reference to `libiconv_close'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:755:
 undefine
 d reference to `libiconv_open'
 ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_decode':
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:1354:
 undefin
 ed reference to `libiconv_open'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:1465:
 undefin
 ed reference to `libiconv_close'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:1468:
 undefin
 ed reference to `libiconv_open'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:1823:
 undefin
 ed reference to `libiconv_close'
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:1826:
 undefin
 ed reference to `libiconv_close'
 ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_dtor':
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:2465:
 undefin
 ed reference to `libiconv_close'
 ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_encode':
 /home/data/pkgs_docs/unix-pkgs/web/php/php-5.2.5/ext/iconv/iconv.c:1043:
 undefin
 

Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Eric Butera
On Jan 29, 2008 1:53 PM, Christoph Boget [EMAIL PROTECTED] wrote:
 Constructors return the object, correct?  If so, how can I do this:

 class Bob {
   private $blah;
   _construct( $blah ) {
 $this-blah = $blah;
   }
   public getBlah() {
 return $this-blah;
   }
 }

 echo Bob( 'Hello!' )-getBlah();

 When I try that, I get the message Undefined function Bob.  I've also tried

 echo new Bob( 'Hello!' )-getBlah();
 echo (new Bob( 'Hello!' ))-getBlah();

 but PHP didn't like either of those at all.  Is it just not possible
 what I'm trying to do?

 I'm using PHP5.2.1

 thnx,
 Chris

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



http://www.travisswicegood.com/index.php/2007/10/26/fluent_api_here_i_come

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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Andrew Ballard
On Jan 29, 2008 1:53 PM, Christoph Boget [EMAIL PROTECTED] wrote:
 Constructors return the object, correct?

Actually, I don't think so. I believe constructors return void, while
the 'new' keyword returns a copy of the object.

Andrew

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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Paul Scott

On Tue, 2008-01-29 at 14:17 -0500, Eric Butera wrote:

 http://www.travisswicegood.com/index.php/2007/10/26/fluent_api_here_i_come
 


Looks like a repurpose of one of my posts:

http://fsiu.uwc.ac.za/index.php?module=blogaction=viewsinglepostid=gen9Srv59Nme5_7092_1182404204

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Richard Heyes

Christoph Boget wrote:

Constructors return the object, correct?  If so, how can I do this:

class Bob {
  private $blah;
  _construct( $blah ) {
$this-blah = $blah;
  }
  public getBlah() {
return $this-blah;
  }
}

echo Bob( 'Hello!' )-getBlah();

When I try that, I get the message Undefined function Bob.  I've also tried

echo new Bob( 'Hello!' )-getBlah();
echo (new Bob( 'Hello!' ))-getBlah();


Bob is a class, not a method. You could try this:

?php
$obj = new Bob();
$obj-getBlah();
?

It's not method chaining though.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software for £299pa hosted for you -
no installation, no maintenance, new features automatic and free

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



Re: [PHP] Re: disable referer ? (was: Framed Linked Content)

2008-01-29 Thread Per Jessen
Robert Cummings wrote:

 Actually, now you made me think on it... the primary reason I disable
 referrer logging is because it will also pass along lovely information
 such as any session ID embedded in the URL. So if you happen to get on
 a malicious site, they could access the account from which you've
 come.

Hmm, interesting idea.  I wonder if the sessionid isn't tied to the
IP-address even when it's part of the URL?  

Still, I can't help thinking that if this is a serious problem, it would
have been dealt with long ago.


/Per Jessen, Zürich

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



[PHP] How can I do this -- method chaining

2008-01-29 Thread Christoph Boget
Constructors return the object, correct?  If so, how can I do this:

class Bob {
  private $blah;
  _construct( $blah ) {
$this-blah = $blah;
  }
  public getBlah() {
return $this-blah;
  }
}

echo Bob( 'Hello!' )-getBlah();

When I try that, I get the message Undefined function Bob.  I've also tried

echo new Bob( 'Hello!' )-getBlah();
echo (new Bob( 'Hello!' ))-getBlah();

but PHP didn't like either of those at all.  Is it just not possible
what I'm trying to do?

I'm using PHP5.2.1

thnx,
Chris

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



Re: [PHP] Re: disable referer ? (was: Framed Linked Content)

2008-01-29 Thread Robert Cummings

On Tue, 2008-01-29 at 19:48 +0100, Per Jessen wrote:
 Robert Cummings wrote:
 
  Actually, now you made me think on it... the primary reason I disable
  referrer logging is because it will also pass along lovely information
  such as any session ID embedded in the URL. So if you happen to get on
  a malicious site, they could access the account from which you've
  come.
 
 Hmm, interesting idea.  I wonder if the sessionid isn't tied to the
 IP-address even when it's part of the URL?

It sure isn't. AOL is known to on the fly change your connection domain
so tying an IP address to a session ID won't work very well for people
connecting via AOL. Similar problems exist for multiple users behind
NAT. Other companies do similar. You can test for yourself too... the
default session ID created via PHP sessions is not tied to anything.

 Still, I can't help thinking that if this is a serious problem, it would
 have been dealt with long ago.

http://www.google.com/search?hl=enq=referer+session+hijacking

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 2:27 PM, Andrew Ballard [EMAIL PROTECTED] wrote:

 On Jan 29, 2008 1:53 PM, Christoph Boget [EMAIL PROTECTED]
 wrote:
  Constructors return the object, correct?

 Actually, I don't think so. I believe constructors return void, while
 the 'new' keyword returns a copy of the object.


im pretty sure constructors return an object instance:
php  class Test { function __construct() {} }
php  var_dump(new Test());
object(Test)#1 (0) {
}

but anyway, how could you even test that __construct() returned void
and the new keyword returned a copy of the object?  new essentially
invokes __construct() and passes along its return value, near as i can tell.

Christoph,
if you dont want to write a function in the global namespace, as suggested
in the article, Eric posted, just add a simple factory method in your class,
eg.
?php
class Test {
public static function getInstance() {
return new Test();
}

public function doSomething() {
echo __METHOD__ . PHP_EOL;
}
}
Test::getInstance()-doSomething();
?

-nathan


Re: [PHP] Another question about functions...

2008-01-29 Thread Jason Pruim


On Jan 29, 2008, at 11:58 AM, Jason Pruim wrote:



On Jan 29, 2008, at 11:48 AM, Nathan Nobbe wrote:


On Jan 29, 2008 11:07 AM, Jason Pruim [EMAIL PROTECTED] wrote:
What's happening is, I have the code set and it downloads the file
into excel, but it doesn't have the database fields in it, rather a
copy of the entire webpage which it trys to put into excel.

this sounds to me like you may not be linking to the code that  
generates
the excel spreadsheet properly.  this is just a hunch, but to test  
it, you
might try pointing your browser directly at the script that  
generates the
excel spreadsheet, rather than navigating to it via a link you have  
on your

current page.
as far as the data not showing up in the output, try experimenting by
omitting the header() calls and just dump out the result set of the  
query

to ensure the data is actually getting populated in your function.

-nathan


Well, I commented out the header lines and just printed the data to  
the browser, and it fills it all in perfectly. So I think you are  
right about not calling it right... I'll do some more checking on  
that, back to the $salt farms I go! :)



Okay, so I checked everything I can think of, and it's still  
downloading it as an application which means it's downloading the  
entire website instead of just the data from the database... Anyone  
have any idea what to check?



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 2:37 PM, Paul Scott [EMAIL PROTECTED] wrote:

 Looks like a repurpose of one of my posts:


 http://fsiu.uwc.ac.za/index.php?module=blogaction=viewsinglepostid=gen9Srv59Nme5_7092_1182404204


actually, this is slightly different; here we are talking about being
able to immediately invoke a method  off the call to the constructor,
whereas in your post you chain calls after storing the instance in a
variable
in the call to the constructor.

-nathan


Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Christoph Boget
 On Jan 29, 2008 2:37 PM, Paul Scott [EMAIL PROTECTED] wrote:
  Looks like a repurpose of one of my posts:
 
http://fsiu.uwc.ac.za/index.php?module=blogaction=viewsinglepostid=gen9Srv59Nme5_7092_1182404204
 actually, this is slightly different; here we are talking about being
 able to immediately invoke a method  off the call to the constructor,
 whereas in your post you chain calls after storing the instance in a
 variable in the call to the constructor.

Right, and that's what I was trying to avoid, if possible.

thnx,
Chris


  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Jochem Maas

Christoph Boget schreef:

Constructors return the object, correct?  If so, how can I do this:

class Bob {
  private $blah;
  _construct( $blah ) {
$this-blah = $blah;
  }
  public getBlah() {
return $this-blah;
  }
}

echo Bob( 'Hello!' )-getBlah();

When I try that, I get the message Undefined function Bob.  I've also tried

echo new Bob( 'Hello!' )-getBlah();
echo (new Bob( 'Hello!' ))-getBlah();

but PHP didn't like either of those at all.  Is it just not possible
what I'm trying to do?



class Foo
{
private $x;
private function __construct($x) { $this-x = $x; }
static function init($x) { return new self($x); }
function double() { $this-x *= 2; return $this; }
function triple() { $this-x *= 3; return $this; }
function output()  { echo $this-x, \n; }
}

Foo::init(2)-double()-triple()-output();

you can't chain of the constructor as Andrew explained.
you may wish to return object clones to chain with as opposed to
the same object - the example below is fairly bogus but it
mgiht be helpful to you (btw run the code to see what it actually
does as opposed to what you think it should do ... hey it caught
me out and I wrote it!):

class Foo2
{
private $x;
private function __construct($x) { $this-x = $x; }
static function init($x) { return new self($x); }
function double() { $this-x *= 2; return clone $this; }
function triple() { $this-x *= 3; return clone $this; }
function output()  { echo $this-x, \n; }
}

$a = Foo2::init(2);
$b = $a-double()-triple();

$a-output();
$b-output();








I'm using PHP5.2.1

thnx,
Chris



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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Stut

On 29 Jan 2008, at 19:43, Christoph Boget [EMAIL PROTECTED] wrote:


On Jan 29, 2008 2:37 PM, Paul Scott [EMAIL PROTECTED] wrote:

Looks like a repurpose of one of my posts:


http://fsiu.uwc.ac.za/index.php?module=blogaction=viewsinglepostid=gen9Srv59Nme5_7092_1182404204

actually, this is slightly different; here we are talking about being
able to immediately invoke a method  off the call to the constructor,
whereas in your post you chain calls after storing the instance in a
variable in the call to the constructor.


Right, and that's what I was trying to avoid, if possible.


Why? What exactly do you think you're saving by not putting the  
instance in a variable? I can't think of one good reason to do this.


-Stut

--
http://stut.net/

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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 3:02 PM, Stut [EMAIL PROTECTED] wrote:

 Why? What exactly do you think you're saving by not putting the
 instance in a variable? I can't think of one good reason to do this.


its an esthetic thing; and besides the simple factory method is an
easy workaround to achieve it.
as the article that, Eric, posted mentioned, other languages have
such support; ie javascript:
function Test() {}
Test.prototype = { doSomething : function() { alert('hello'); } }
new Test().doSomething();

this is along the lines of the whole returnAnArray()['someIndex'] thing,
fortunately in this case, theres a workaround in userspace ;)

-nathan


Re: [PHP] first php 5 class

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 3:19 PM, nihilism machine [EMAIL PROTECTED] wrote:

 Ok, trying to write my first php5 class. This is my first project
 using all OOP PHP5.2.5.

 I want to create a config class, which is extended by a connection
 class, which is extended by a database class. Here is my config class,
 how am I looking?

 ?php

 class dbconfig {
public $connInfo = array();
public $connInfo[$hostname] = 'internal-db.s23499.gridserver.com';
public $connInfo[$username] = 'db23499';
public $connInfo[$password] = 'ryvx4398';
public $connInfo[$database] = 'db23499_donors';

public __construct() {
return $this-$connInfo;
}
 }

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


if youre going to have a class for configuration information; you probly
should
go for singleton:
http://www.phppatterns.com/docs/design/singleton_pattern?s=singleton

-nathan


[PHP] first php class take 2

2008-01-29 Thread nihilism machine

How does this look now?

?php

class dbconfig {
public $connInfo = array();
public $connInfo[$hostname] = 'host.com';
public $connInfo[$username] = 'dbuser';
public $connInfo[$password] = 'dbpass';
public $connInfo[$database] = 'mydbname';

public __construct() {
return $this-$connInfo;
}
}

?

?php

include_once(dbconfig.class.php);

class dbconn extends dbconfig {

public $DB;

public __constructor(){
$this-$connInfo = new dbconfig();
$username =
$hostname =
$password =
$database =
		$DB = new PDO(mysql:host=$connInfo[$hostname];dbname= 
$connInfo[$database], $connInfo[$username], $connInfo[$password]);

return $DB;
}
}

?

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



Re: [PHP] first php 5 class

2008-01-29 Thread Jochem Maas

nihilism machine schreef:
Ok, trying to write my first php5 class. This is my first project using 
all OOP PHP5.2.5.


I want to create a config class, which is extended by a connection 
class, which is extended by a database class. Here is my config class, 
how am I looking?


dunno can't see you. but your class looks like crap, in fact it don't think it
will even parse. have you tried running it?



?php

class dbconfig {
public $connInfo = array();
public $connInfo[$hostname] = 'internal-db.s23499.gridserver.com';
public $connInfo[$username] = 'db23499';
public $connInfo[$password] = 'ryvx4398';
public $connInfo[$database] = 'db23499_donors';


the above is plain wrong.

1. you can't do multiple property definitions for a single [array] property
2. your storing hardcoded values in a class which is meant to be somewhat 
generic/reusable
3. you've just told the world your password/login/db credentials



public __construct() {
return $this-$connInfo;
}


constructors aren't meant to return anything. besides you won't be able to
retrieve the returned value.

not too mention '$this-$connInfo' is the wrong syntax it should be:

$this-connInfo

I'd recommend some more research on basic class syntax.


}

?



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



Re: [PHP] Another question about functions...

2008-01-29 Thread Jason Pruim


On Jan 29, 2008, at 2:46 PM, Nathan Nobbe wrote:


On Jan 29, 2008 2:39 PM, Jason Pruim [EMAIL PROTECTED] wrote:
Okay, so I checked everything I can think of, and it's still
downloading it as an application which means it's downloading the
entire website instead of just the data from the database... Anyone
have any idea what to check?

im guessing youre trying to hit the invocation of excelexportfunc(),  
as
it sits in your existing script.  create a simple test script that  
does nothing
else but invoke the excelexportfunc() function.  you can pass  
variables to
it from the url, or hardcode them if you like; id probly hardcode  
them at first.


?php
include('excelexportfunc.php'); // -- set accordingly

$select = ''; // -- set me
$sortOrder = '' -- set me
$exportdate = '' -- set me

excelexportfunc($select, $sortOrder, $exportdate);
?

that *should* get you the results youre looking for.  from there you  
need to
determine why the method isnt working in the context of your  
existing script.


-nathan




Hey Nathan,

I did as you suggested, and I think I found the reason... I included  
info for the doctype, and some files that are on all my pages... Once  
I comment out those lines it works just fine...


I'm assuming that that is expected behavior?


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]




Re: [PHP] first php class take 2

2008-01-29 Thread Andrew Ballard
On Jan 29, 2008 3:36 PM, Jochem Maas [EMAIL PROTECTED] wrote:
 nihilism machine schreef:
  How does this look now?

 just as bad as before. you haven't even tried to run the code have you?


 
  ?php
 
  class dbconfig {
  public $connInfo = array();
  public $connInfo[$hostname] = 'host.com';
  public $connInfo[$username] = 'dbuser';
  public $connInfo[$password] = 'dbpass';
  public $connInfo[$database] = 'mydbname';
 
  public __construct() {
  return $this-$connInfo;
  }
  }
 
  ?
 
  ?php
 
  include_once(dbconfig.class.php);
 
  class dbconn extends dbconfig {
 
  public $DB;
 
  public __constructor(){
  $this-$connInfo = new dbconfig();
  $username =
  $hostname =
  $password =
  $database =
  $DB = new
  PDO(mysql:host=$connInfo[$hostname];dbname=$connInfo[$database],
  $connInfo[$username], $connInfo[$password]);
  return $DB;
  }
  }
 
  ?
 


And it's not really good OO, either. Saying that dbconn extends
dbconfig is saying that a database connection IS-A database
configuration. It isn't. You might say that a database connection
HAS-A database configuration. Actually, your code says that a
database connection IS-A database configuration that HAS-A database
configuration since dbconfig is both a member property and a parent
class of dbconn. And, as pointed out on your other thread, the
dbconfig constructor should not even have a return statement.

I'm definitely no OO expert, but it looks like you are trying to use
OOP simply because you can, even though you don't seem to understand
how objects can/should relate to one another.

Andrew

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



[PHP] Timeout while waiting for a server-client transfer to start (large files)

2008-01-29 Thread Barney Tramble


Hey

I have a script that I am trying to figure out to allow a remote file to  
be sent to a client's browser. It works ok for small files, but it keeps  
timing out for large files. I don't think it should even take as long as  
it does (i.e. about 10seconds) before it pops up a dialog box for me to  
download a 700KB file. Any ideas? It times out on a line around which reads


 while (!feof($fp))
{
$tmp .= fread($fp, 64);
}

Thanks ;)

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



Re: [PHP] Using next() inside a foreach

2008-01-29 Thread Jim Lucas

Erik Stackhouse wrote:

Hello,

I'm hesitant to report this issue as a bug, since I see other bugs
(43890 and 43220) already opened describing similar, but not identical,
issues.  The latter bug is described as a documentation issue...

In my tests all versions of php prior to 5.2.4, foreach does NOT
increment the array pointer for each iteration, at least not at the top
of the loop.  This new behavior in 5.2.4 breaks array look-ahead logic,
when using next() -- since you end up looking TWO places ahead instead
of one.

This produces the effect that in the body of the loop, current()
actually returns the next value in the array -- which is the
workaround I've implemented in my code for doing a look-ahead -- though
it seems non-intuitive to have current() return the next value.

Perhaps the previous behavior was to increment the array pointer at the
END of the foreach block, and now for some reason it's incrementing it
at the BEGINNING?  That would explain it I guess...

Perhaps there's a better way to do look-ahead, but for a behavior change
like this, if it's intentional, shouldn't it at least be in the
Backward Compatibility section of the migration docs?



Check out the second NOTE on the foreach page:

http://us2.php.net/foreach

Note: Unless the array is referenced, foreach operates on a copy of the 
specified array and not the array itself. foreach  has some side effects on the 
array pointer. Don't rely on the array pointer during or after the foreach 
without resetting it.



if you are running next() or current() on the $test_arr below, you are not 
accessing the same array that is being used in the foreach loop.  Foreach is 
using a copy of the $test_arr array().




Example Code:

$test_arr = array('zero', 'one','two','three','four');

foreach ($test_arr as $idx = $val) {

$next_val = next($test_arr);

print This:  . $idx .  -  . $val . \n;
print Next:  . $next_val . \n;

}

-
output under v5.2.3 (and 4.4.8):
-

This: 0 - zero
Next: one
This: 1 - one
Next: two
This: 2 - two
Next: three
This: 3 - three
Next: four
This: 4 - four
Next:

---
output under v5.2.4 and v5.2.5:
---

This: 0 - zero
Next: two
This: 1 - one
Next: three
This: 2 - two
Next: four
This: 3 - three
Next:
This: 4 - four
Next:

---

Regards to All,

-Erik




--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Stut

On 29 Jan 2008, at 20:08, Nathan Nobbe [EMAIL PROTECTED] wrote:


On Jan 29, 2008 3:02 PM, Stut [EMAIL PROTECTED] wrote:
Why? What exactly do you think you're saving by not putting the
instance in a variable? I can't think of one good reason to do this.

its an esthetic thing; and besides the simple factory method is an
easy workaround to achieve it.
as the article that, Eric, posted mentioned, other languages have
such support; ie javascript:
function Test() {}
Test.prototype = { doSomething : function() { alert('hello'); } }
new Test().doSomething();

this is along the lines of the whole returnAnArray()['someIndex']  
thing,

fortunately in this case, theres a workaround in userspace ;)


I don't see how it's any more aesthetically pleasing, but each to  
their own I guess.


Personally I'd use a static method in this instance. If you need to  
create an instance of the class you can do so in the static method and  
that way it will get destroyed when the function is done. Otherwise  
the object scope is far larger than it needs to be, which IMHO is an  
unnecessary waste of resources and certainly less aesthetic.


-Stut

--
http://stut.net/

Re: [PHP] How can I do this -- method chaining

2008-01-29 Thread Nathan Nobbe
On Jan 29, 2008 7:27 PM, Stut [EMAIL PROTECTED] wrote:
 Personally I'd use a static method in this instance.

thats what i recommended.

If you need to create
 an instance of the class you can do so in the static method and that way it
 will get destroyed when the function is done. Otherwise the object scope is
 far larger than it needs to be, which IMHO is an unnecessary waste of
 resources and certainly less aesthetic.

lost you on this part ..
whether you create an instance in client code by calling new or
encapsulate the call
to new in a simple factory method there will still be only one
instance of the class,
and it will still be in scope once the method is finished executing,
because all it does
is return an instance of the class its a member of.
maybe you mean something other than what i posted earlier when you say
static method?

-nathan

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



[PHP] Mysql session handler?

2008-01-29 Thread Mike Yrabedra
Can anyone recommend a good php-mysql session handler class?

I have found a lot of them, but they are all pretty old, pre-2005

-- 
Mike B^)

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



Re: [PHP] call to a member function select() on a non object.

2008-01-29 Thread Nathan Nobbe
change
   $rows = $DB-select(SELECT * Users WHERE Email='$Email', AND
Password='$PasswordEncoded');

to
   $rows = $this-DB-select(SELECT * Users WHERE
Email='$Email', AND
Password='$PasswordEncoded');

you have to always reference the current instance w/ the $this keyword in php ;)

-nathan

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



[PHP] call to a member function select() on a non object.

2008-01-29 Thread nihilism machine
I amn trying to use my db class in my auth class, but i get the error:  
call to a member function select() on a non object


?php

class db {

//  Members
private $db_user = mydbuser;
private $db_pass = mypassword;
private $db_name = mydb;
private $db_server = myhost.com;
private $link;
private $result_id;

//  Methods
public function __construct() {
$this-connect();
}

// Connect to MySQL Server
private function connect() {
		$this-link = mysql_connect($this-db_server,$this-db_user,$this- 
db_pass) or die(ERROR - Cannot Connect to DataBase);
		mysql_select_db($this-db_name,$this-link) or die(ERROR: Cannot  
Select Database ( . $this-db_name .  ));	

}

// Disconnect from MySQL Server
private function disconnect() {
mysql_close($this-link);
}

// MySQL Select
public function select($sql) {
$this-result_id = $this-query($sql);
if($this-result_id){
$rows = $this-fetch_rows();
}
return $rows;
}

// Insert into MySQL
public function insert($params) {
extract($params);
$sql = 'INSERT INTO '.$table.' ('.$fields.') VALUES 
('.$values.')';
$this-query($sql);
if($this-result_id){
$affected_rows = $this-affected_rows();
}
return $affected_rows;  
}

// Delete from MySQL
public function delete($params) {
extract($params);
$sql = 'DELETE FROM '.$table.' WHERE '.$where;
if (is_numeric($limit)) {
$sql .= ' LIMIT '.$limit;
}
$this-query($sql);
if($this-result_id){
$affected_rows = $this-affected_rows();
}
return $affected_rows;  
}

// Update MySQL
public function update($params) {
extract($params);
$sql = 'UPDATE '.$table.' SET '.$values.' WHERE '.$where;
if(is_numeric($limit)){
$sql .= ' LIMIT '.$limit;
}
$this-query($sql);
if($this-result_id){
$affected_rows = $this-affected_rows();
}
return $affected_rows;
}

// MySQL Query
private function query($sql) {
$this-result_id = mysql_query($sql);
return $this-fetch_rows();
}   


// MySQL Fetch Rows
private function fetch_rows() {
$rows = array();
if($this-result_id){
while($row = mysql_fetch_object($this-result_id)){
$rows[] = $row;
}   
}
return $rows;   
}

// MySQL Affected Rows
private function affected_rows() {
return mysql_affected_rows($this-link);
}

// MySQL Affected Rows
private function num_rows() {
return mysql_num_rows($this-link);
}

// MySQL Affected Rows
private function select_id() {
return mysql_insert_id($this-link);
}

// Destruct!
public function __destruct() {
$this-disconnect();
}
}

?



?php

require_once(db.class.php);

class auth {

public $DB;
public $UserID;
public $AdminLevel;
public $FirstName;
public $LastName;
public $DateAdded;
public $MobileTelephone;
public $LandLineTelephone;

// Connect to the database
public function __construct() {
$DB = new db();
}

// Attempt to login a user
public function CheckValidUser($Email, $Password) {
$PasswordEncoded = $this-encode($Password);
		$rows = $DB-select(SELECT * Users WHERE Email='$Email', AND  
Password='$PasswordEncoded');

if ($DB-num_rows  0) {
$this-UserID = $row['ID'];
$this-AdminLevel = $row['Admin_Level'];
$this-FirstName = $row['First_Name'];
$this-LastName = $row['Last_Name'];
$this-DateAdded = $row['Date_Added'];
$this-MobileTelephone = $row['Telephone_Mobile'];
$this-LandLineTelephone = $row['Telephone_Land_Line'];
// User info stored in Sessions
session_start();
$_SESSION['Status'] = loggedIn;

[PHP] potentially __sleep() bug

2008-01-29 Thread Nathan Nobbe
all,

i was playing around w/ some object serialization tonight during
further exploration of spl and i stumbled on what appears to be a
bug in the behavior of the __sleep() magic method.

here is the pertinent documentation on the method
..is supposed to return an array with the names of all variables
of that object that should be serialized.

so, the idea is, *only* the instance variables identified in the array
returned are marked for serialization.
however, it appears all instance variables are being serialized no matter what.
see the reproducible code below.  ive run this on 2 separate php5
boxes, one w/ 5.2.5, another w/ a 5.2.something..

?php
class A {
public $a1 = 'a1';
public $a2 = 'a2';
public $a3 = 'a3';

public function __sleep() {
echo __FUNCTION__ . PHP_EOL;
return array('a1', 'a2');
}
}

var_dump(unserialize(serialize(new A(;
?

this is what i get despite having marked only member variables 'a',
and 'b' for serialization.

__sleep
object(A)#1 (3) {
  [a1]=
  string(2) a1
  [a2]=
  string(2) a2
  [a3]=
  string(2) a3
}

consensus ?

-nathan

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



[PHP] php embeded in html after first submit html disappear

2008-01-29 Thread Janet N
Hi there,

I have two forms on the same php page.  Both forms has php embeded inside
html with it's own submit button.

How do I keep the second form from not disappearing when I click submit on
the first form?  My issue is that when I click the submit button from the
first
form (register), the second form (signkey) disappear.  Code below, any
feedback is appreciated:


form name=register method=post action=/DKIMKey.php
input type=submit name=register value=Submit Key

?php
if (isset($_POST['register']))
{
   $register = $_POST['register'];
}
if (isset($register))
{
   $filename = '/usr/local/register.sh';
   if(file_exists($filename))
   {
   $command = /usr/local/register.sh ;
   $shell_lic = shell_exec($command);
echo font size=2 color=blue$shell_lic/font;
   }
}
?
/form



form name=signkey action=/DKIMKey.php method=post  label
domain=labelEnter the domain name: /label
input name=domain type=text input type=submit name=makesignkey
value=Submit

?php
if (isset($_POST['makesignkey']))
{
$makesignkey = $_POST['makesignkey'];
}
if (isset($makesignkey))
{
  if(isset($_POST['domain']))
  {
$filename = '/usr/local//keys/generatekeys';
if(file_exists($filename))
{
$domain = $_POST['domain'];
$command = /usr/local/keys/generatekeys  . $domain;

$shell_createDK = shell_exec($command);
print(pfont size=2
color=blue$shell_createDK/font/p);
}
  }
?
/form


Re: [PHP] calling java within php setup?

2008-01-29 Thread Janet N
I have root; I was able to compile php with java and working now.  Thanks
all!


On Jan 16, 2008 4:06 PM, Richard Lynch [EMAIL PROTECTED] wrote:

 On Tue, January 15, 2008 5:32 pm, Jochem Maas wrote:
  Janet N schreef:
  with a bit of luck you'll then have a .so file that is your new
  extension,
  now it a matter moving the .so to a suitable place (if you have root
  access, you
  can run 'make install') and of editing php.ini to load the extension.

 If you don't have root, you probably can't move it to the suitable place.

 Otherwise, any bozo could install and .so file into the PHP binary,
 which could do anything at all to the PHP process, including hack all
 kinds of nasty functions to, say, dump ALL incoming GET/POST data
 whose variable name looks like *cc* or *credit* or *card* out to
 some email address...

 That said, if your host is a bit lax in security, you might be able to
 use DL to LOAD your .so file into your script:
 http://php.net/dl

 Note that 'dl' is probably going away in PHP 6, last I heard.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/from/lynch
 Yeah, I get a buck. So?




Re: [PHP] Another question about functions...

2008-01-29 Thread Chris



What's happening is, I have the code set and it downloads the file into 
excel, but it doesn't have the database fields in it, rather a copy of 
the entire webpage which it trys to put into excel. Below is the code 
that I am using in my function to export the records:


?PHP
function excelexportfunc($select, $sortOrder, $exportdate) {


echo $select . br/\n;

if you run that through your db manually do you get an error?


$export = mysql_query($select);


var_dump($export);


$fields = mysql_num_fields($export);


// initialize the header line to be an empty string.
$header = '';


for ($i = 0; $i  $fields; $i++) {
$header .= mysql_field_name($export, $i) . \t;
}


You will need a trim here otherwise you'll have an extra empty column 
(extra \t in there):


$header = trim($header);


while($row = mysql_fetch_row($export)) {
$line = '';
foreach($row as $value) {
if ((!isset($value)) or ($value == )) {
$value = \t;
}
else
{
$value = str_replace('', '', $value);
$value = '' . $value . '' . \t;
}   
$line .= $value;

}
$data .= trim($line). \n;
}
$data = str_replace(\r, , $data);
   
if ($data ==) {

$data =\n(0) Records Found!\n;
}
   
header(Content-type: application/vnd.ms-excel);
header(Content-Disposition: attachment; 
filename=Export..$exportdate..xls);

header(Pragma: no-cache);
header(Expires: 0);
   
   
   
print $header\n$data;


Once you've printed out the report, you should probably exit so nothing 
else is processed from the script.



}

?

I am calling the function like so: excelexportfunc($select, $sortOrder, 
$exportdate);


the $select is specified in an IF statement on the calling page like so:

if($exportoption ==all){
$sortOrder= $_SESSION['order'];
$search = ;
$select = SELECT * FROM .$table. order by .$sortOrder.;

}else{

$sortOrder = $_SESSION['order'];
$search = $_SESSION['search'];
$select = SELECT * FROM .$table. WHERE FName like 
'%.$search.%' or LName like '%.$search.%' or Add1 like 
'%.$search.%' or Add2 like '%.$search.%' or City like 
'%.$search.%' or State like '%.$search.%' or Zip like 
'%.$search.%' or XCode like '%.$search.%' order by .$sortOrder.;

}


$sortOrder is now part of $select you don't need to pass it to the 
function unless you actually use it in that function (which from your 
copy/paste isn't the case).



So your function can just be:

function excelexportfunc($select, $exportdate) {

and remove the $sortOrder from the calling lines:

excelexportfunc($select, $exportdate);

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

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



[PHP] Sum of results

2008-01-29 Thread Dax Solomon Umaming
Hi;

I've tried Googling this out but failed to search for an answer to this, so 
I'm posting to this list. I'd like to know if there's a way to get the sum 
this results:

// Results
Individual Daily Consumption
//AccountNo : Consumption
4146121002: 1.42
4146111002: 0.29
4146113002: 1.38
4146110002: 0.33
4146112002: 0.00
4146118002: 9.96
== MORE ==

// Code that generated the results
while ($row6 = mysql_fetch_assoc($queryconsumerresults)) {
// Show Consumer AccountNo and their Consumption
echo $row6['AccountNo'] . :  . sprintf(%1.2f, $row6['Reading'] 
+ 
$row6['KwHrAdjustment']) - ($row6['Reading1'] + $row6['KwHrAdjustment1'])) / 
$noofdays) * $row6['Multiplier'])) . br /;
}

I've tried getting the sum() from the MySQL table, but Multiplier is either at 
1 or 2 or 2.5 and the only way I can get an accurate total consumption is 
getting the sum from the results.

Is there a way I can place this code on an array? I've tried using
$indcons = array( sprintf(%1.2f, $row6['Reading'] + $row6
['KwHrAdjustment']) - ($row6['Reading1'] + $row6['KwHrAdjustment1'])) / 
$noofdays) * $row6['Multiplier']))) but I've obviously failed.

-- 
Dax Solomon Umaming
http://knightlust.com/
GPG: 0x715C3547


signature.asc
Description: This is a digitally signed message part.


Re: [PHP] Timeout while waiting for a server-client transfer to start (large files)

2008-01-29 Thread Chris

Barney Tramble wrote:


Hey

I have a script that I am trying to figure out to allow a remote file to 
be sent to a client's browser. It works ok for small files, but it keeps 
timing out for large files. I don't think it should even take as long as 
it does (i.e. about 10seconds) before it pops up a dialog box for me to 
download a 700KB file. Any ideas? It times out on a line around which reads


 while (!feof($fp))
{
$tmp .= fread($fp, 64);
}


Well you're still reading the file (or url or something) at this point. 
Is it the reading of the file or sending it to the browser that fails?


A bit of context might help for this code too. Is this reading a local 
file or url or what?


If it's a local file, use fpassthru (http://php.net/fpassthru) if it's 
not too big. If it is a big file then use your loop but don't store it 
in a $tmp variable, just output it.


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

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



Re: [PHP] Mysql session handler?

2008-01-29 Thread Chris

Mike Yrabedra wrote:

Can anyone recommend a good php-mysql session handler class?


http://www.php.net/manual/en/function.session-set-save-handler.php#79706 
looks ok.


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

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



Re: [PHP] Sum of results

2008-01-29 Thread Nathan Nobbe
On Jan 30, 2008 1:58 AM, Dax Solomon Umaming [EMAIL PROTECTED] wrote:
 I've tried Googling this out but failed to search for an answer to this, so
 I'm posting to this list. I'd like to know if there's a way to get the sum
 this results:

you can simply sum them as you print the report

$sum = 0.0;
while ($row6 = mysql_fetch_assoc($queryconsumerresults)) {
$curVal = ((($row6['Reading'] + $row6['KwHrAdjustment']) -
($row6['Reading1'] + $row6['KwHrAdjustment1'])) / $noofdays) *
$row6['Multiplier']));
// Show Consumer AccountNo and their Consumption
echo $row6['AccountNo'] . :  . sprintf(%1.2f, ( $curVal . br /;
// add curVal to sum
$sum += $curVal;
}

 Is there a way I can place this code on an array? I've tried using
 $indcons = array( sprintf(%1.2f, $row6['Reading'] + $row6
 ['KwHrAdjustment']) - ($row6['Reading1'] + $row6['KwHrAdjustment1'])) /
 $noofdays) * $row6['Multiplier']))) but I've obviously failed.

array() creates an array, what youve done on this line is created
an array with one element, which will be the last value of $row6 from the while
loop that precedes it.  since the last value returned from mysql_fetch_assoc()
is false (thats what terminates the while loop), im guessing $indcons contains
false as its only value.
if you want to place these values in an array as you iterate over them, add this
inside the while loop:
$indcons[] = $curVal;

-nathan

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



Re: [PHP] Need assistance using sendmail or mail()

2008-01-29 Thread Per Jessen
philip wrote:

 Hi everyone,
 
 I need assistance using sendmail or mail() as my web hosting service
 does not allow opening sockets.
 
 This is the code I use:

Philip, please state what sort of problems you are having.  mail() and
sendmail are both easy to use from php. 
And please don't post another 2000 lines of code. No-one is going to
read them. 



/Per Jessen, Zürich

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



Re: [PHP] call to a member function select() on a non object.

2008-01-29 Thread Jim Lucas

nihilism machine wrote:

// Connect to the database
public function __construct() {
$DB = new db();


Everything Nathan said, plus change the $DB to $this-DB in your 
construct() method.


Jim

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



Re: [PHP] Need assistance using sendmail or mail()

2008-01-29 Thread Nathan Nobbe
On Jan 30, 2008 2:47 AM, Per Jessen [EMAIL PROTECTED] wrote:
 Philip, please state what sort of problems you are having.  mail() and
 sendmail are both easy to use from php.
 And please don't post another 2000 lines of code. No-one is going to
 read them.

amen to that brother! :)

-nathan

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