[PHP] file get contents

2005-11-14 Thread Ross
Hello,

I have been  usng the file_get_contents function to insert a (repeating) 
part of my code


$lines = file_get_contents('../shared/acessibility_box.htm');

   echo "$lines";


In this file I have the a self submitting link

A


The problem I think is this code is inserted after the page headers have 
been set. And so the line just generates an error.
When I roll over the link I get (or something similar)


http://localhost/nhs/?text_size=small

I have tried most of the other similar functions (include, require) with no 
success.


Any help would be great...


Ross

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



[PHP] Re: file get contents

2005-11-14 Thread Ross
Ok...got it now.

Thanks for the tip max. It was that there was no parsing with the 
file_get_contents function. Had another minor error but helped that I knew 
include() was the way to go.

R.
""Ross"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello,
>
> I have been  usng the file_get_contents function to insert a (repeating) 
> part of my code
>
>
> $lines = file_get_contents('../shared/acessibility_box.htm');
>
>   echo "$lines";
>
>
> In this file I have the a self submitting link
>
> A
>
>
> The problem I think is this code is inserted after the page headers have 
> been set. And so the line just generates an error.
> When I roll over the link I get (or something similar)
>
>
> http://localhost/nhs/?text_size=small
>
> I have tried most of the other similar functions (include, require) with 
> no success.
>
>
> Any help would be great...
>
>
> Ross 

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



[PHP] Re: sending/notifying a server process

2005-11-14 Thread tony yau
Thanks Richard,

the server app was in another box from the database and we thought there may
be security issues behind the router etc.
we have now put the server app in the same box as the database and will use
php UDP to notify the app.

thanks for your help

Tony

"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Fri, November 11, 2005 4:57 am, tony yau wrote:
> > I have a server process that sends fax,print, etc (both in C# and in
> > Java).
> > Currently it polls says the fax table in the database for any fax
> > jobs.
> >
> > How can I get my PHP script to call or notify these services directly
> > so not
> > having to wait for the next poll.
> > I can't open a socket to the server vai the PHP so what mechanism do I
> > use?
>
> Why can't you open a socket to the server?
> http://php.net/fsockopen
>
> If you really can't do that, then just make it poll more often, I
> guess, so the wait time is insignificant.
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] file get contents

2005-11-14 Thread Richard Davey
Hi Ross,

Monday, November 14, 2005, 9:44:45 AM, you wrote:

> $lines = file_get_contents('../shared/acessibility_box.htm');

> In this file I have the a self submitting link
> A

> The problem I think is this code is inserted after the page headers have
> been set. And so the line just generates an error.

file_get_contents does exactly that - it gets the contents of the file
*without* parsing it, i.e. any raw PHP code that exists within it,
will be treated as what it is when 'got' = plain text.

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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



Re: [PHP] file get contents

2005-11-14 Thread Richard Heyes

Ross wrote:

Hello,

I have been  usng the file_get_contents function to insert a (repeating) 
part of my code



$lines = file_get_contents('../shared/acessibility_box.htm');

   echo "$lines";


In this file I have the a self submitting link

A


The problem I think is this code is inserted after the page headers have 
been set. And so the line just generates an error.

When I roll over the link I get (or something similar)


http://localhost/nhs/?text_size=small

I have tried most of the other similar functions (include, require) with no 
success.


Use require('../shared/acessibility_box.htm'); and change the link to this:

http://localhost/nhs/?text_size=small

Note the equals sign after the http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP / MySQL Authentication class

2005-11-14 Thread Alan Milnes
Can anyone point me to a good User Authentication class written in PHP 
(Version 5 preferably) that uses MySQL as the backend.  If the output is 
valid XHTML then even better. There are lots of hits on Google but I 
need some help sorting the wheat from the chaff.


It's for a hobbyist site so I'm looking for something using cookies that 
will keep people logged in between visits and provide some 
personalisation.  Obviously it needs to be reasonably secure but it's 
not a banking system or anything.


Thanks!

Alan

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



[PHP] Changes from 5.0.4 => 5.0.5 (_SERVER variabes not defined).

2005-11-14 Thread Sean O Sullivan

Hello,

Was upgrading PHP-5.0.3 => 5.0.5
Apache version : httpd-2.0.46-54.ent
Distro : RHEL3 U2

configure switches :
./configure --with-zlib --without-gd --without-gdbm 
--with-oracle=/opt/oracle/app/oracle/product/9.2.0/ --enable-sigchild 
--enable-force-cgi-redirect --enable-memory-limit --enable-ftp 
--enable-xml --with-apxs2=/usr/sbin/apxs --prefix=/usr 
--exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin 
--sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include 
--libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var 
--mandir=/usr/share/man --infodir=/usr/share/info 
--with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d


I came accross a problem where in 5.0.3 I had a series of PHP Variables 
defined ( _SERVER & _ENV )

By and large, these were the same as the Environment variables.
e.g.

HOSTNAME => myhostname
SHELL => /bin/bash
TERM => xterm

_SERVER["HOSTNAME"] => myhostname
_SERVER["SHELL"] => /bin/bash
_SERVER["TERM"] => xterm

(just to give a brief example).

However, these were not defined in PHP-5.0.5 - I then tried PHP-5.0.4 to 
see if affected this too, which it didn't.


So there is some change in PHP between 5.0.4 & 5.0.5, I'd be grateful 
for any suggestions/ideas in regards to this matter.


Regards,

Sean O Sullivan

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



[PHP] Help with Reverse Tree Traversal using Recursion ..

2005-11-14 Thread Greg Schnippel
I have a large data tree that I wanted to display in an outline
format. I used a textbook tree recursion function to go through the
data and display it as nested unordered lists:

function outputTree($id) {

   if (checkChildObjectExists($id)) {
   print "";
   $child = getChildArray($id);
   foreach ($child as $key => $value) {
   print "$value";
   outputTree($key);
   }
   print "";
   }
}

This works as expected:

> Level 1 (Top)
   > Level 2
  > Level 3 (Bottom)

However, I also want to display a reverse tree to allow users to trace
their way back up the tree after landing on a lower branch. I tried to
be clever and reverse the function above as:

function outputReverseTree($id) {

   if (checkParentExists($id)) {
   print "";
   $parent = getParentArray($id);
   foreach ($parent as $key => $value) {
   print "$value\n";
   outputReverseTree($key);
   }
   print "";
   }
}

Which works, but there is something wrong with my logic as the tree
comes back reversed:

> Level 3 (Bottom)
   > Level 2
  > Level 1 (Top)

Any suggestions on how to do this?

Thanks,

- Greg

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



[PHP] Virtual includes of PHP into SSI pages.

2005-11-14 Thread Neil Hoggarth

Hi Folks,

I'm attempting to diagnose an apparent problem with my Apache/PHP 
server setup. The platform is SPARC Solaris 9. I'm running Apache httpd

2.0.55 and PHP 4.4.1, built from NetBSD pkgsrc.

I have a user who has .shtml (server side include) pages which include 
PHP fragments using directives like  
(and yes, I know this is silly, and that obvious thing to do is to use 
PHP for the top level pages rather than SSI; unfortunatly I'm the 
sysadmin providing the service, rather than the person maintaining the 
content).


I wanted to check to see if anyone knows of any known problems or 
gotchas in this area?


I'm told that this mechanism was working okay until recently, but it 
broke at some point in the last few months. I've done a number of 
upgrades to both the apache2 and PHP packages over the time period in 
question, in response to security advisories; unfortunately the user 
can't pinpoint exactly when things started to fail.


I've recreated a very simple test case:

test.shtml:

  
  
  Test Page
  
  
  Begin Test
  
  End Test
  
  

foo1.php:

  Hello From PHP

Fetching "test.shtml" produces the output:

  Begin Test

  End Test

(no sign of the included fragment in the output).

Editing the test harness to teplacing the include of foo1.php with an 
include of a plain HTML or SHTML file produces the expected output 
(included content appears in the output between the begin and end 
markers).


Furthermore, if I edit the test harness to include an HTML file and 
*then* the PHP fragment, I get a reproduceable segmentation fault in 
PHP:


Program received signal SIGSEGV, Segmentation fault.
0xfecb541c in zend_hash_index_update_or_next_insert (ht=0xfed3c1c4, h=0, 
pData=0xffbfdec8, nDataSize=12,
pDest=0x0, flag=1) at 
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend_hash.c:390

390 p = ht->arBuckets[nIndex];
(gdb) where
#0  0xfecb541c in zend_hash_index_update_or_next_insert (ht=0xfed3c1c4, 
h=0, pData=0xffbfdec8,

nDataSize=12, pDest=0x0, flag=1)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend_hash.c:390
#1  0xfecb8cc0 in zend_list_insert (ptr=0x299250, type=2)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend_list.c:45
#2  0xfecb8eb8 in zend_register_resource (rsrc_result=0x0, 
rsrc_pointer=0x299250, rsrc_type=2)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend_list.c:98
#3  0xfec693d8 in _php_stream_alloc (ops=0xfed31528, abstract=0x1eb770, 
persistent_id=0x0,
mode=0xfece83f0 "rb") at 
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:281
#4  0xfec6e0b0 in _php_stream_fopen_from_fd (fd=22, mode=0xfece83f0 "rb", 
persistent_id=0x0)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2072
#5  0xfec6de5c in _php_stream_fopen (filename=0x297cb8 
"/usr/pkg/share/httpd/htdocs/foo1.php",
mode=0xfece83f0 "rb", opened_path=0xffbfeb90, options=165)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2004
#6  0xfec6d5cc in _php_stream_fopen_with_path (filename=0x297cb8 
"/usr/pkg/share/httpd/htdocs/foo1.php",
mode=0xfece83f0 "rb", path=0xfece7fc8 ".:/usr/pkg/lib/php", 
opened_path=0xffbfeb90, options=165)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:1784
#7  0xfec6efd4 in php_plain_files_stream_opener (wrapper=0xfed31598,
path=0x297cb8 "/usr/pkg/share/httpd/htdocs/foo1.php", mode=0xfece83f0 "rb", 
options=165,
opened_path=0xffbfeb90, context=0x0)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2489
#8  0xfec6fb18 in _php_stream_open_wrapper_ex (path=0x297cb8 
"/usr/pkg/share/httpd/htdocs/foo1.php",
mode=0xfece83f0 "rb", options=173, opened_path=0xffbfeb90, context=0x0)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2696
#9  0xfec6ff34 in _php_stream_open_wrapper_as_file_handle (
path=0x297cb8 "/usr/pkg/share/httpd/htdocs/foo1.php", mode=0xfece83f0 "rb", 
options=141, fh=0xffbfeb88)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/streams.c:2823
#10 0xfec53900 in php_open_wrapper_for_zend (filename=0x297cb8 
"/usr/pkg/share/httpd/htdocs/foo1.php",
fh=0xffbfeb88) at 
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/main/main.c:764
#11 0xfec82730 in open_file_for_scanning (file_handle=0xffbfeb88) at 
Zend/zend_language_scanner.c:3022
#12 0xfec82a34 in compile_file (file_handle=0xffbfeb88, type=2) at 
Zend/zend_language_scanner.c:3114
#13 0xfecae520 in zend_execute_scripts (type=2, retval=0x0, file_count=1)
at /export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/Zend/zend.c:934
#14 0xfecd2b74 in php_handler (r=0x297150)
at 
/export/scratch/pkgsrc/www/ap-php/work/php-4.4.1/sapi/apache2handler/sapi_apache2.c:574
#15 0x000e3c28 in ap_run_handler (r=0x297150) at config.c:152
#16 0x000e4848 in ap_invoke_handler (r=0x297150) at config.c:364
#17 0x00114840 in ap_run_sub_req (r=0x297150) at request.c:1855
#18 0x000382a4 in handle_include (ctx=0x283660, bb=0xff

RE: [PHP] fopen on windows

2005-11-14 Thread Ford, Mike
On 11 November 2005 20:52, Jay Blanchard wrote:

> $theFile = fopen("docs/InstallationInstructionMaster.txt", "r") ||
> die;

You need "or" not || here.  The operator priorities are such that the above 
means

  $theFile = (fopen("docs/InstallationInstructionMaster.txt", "r") || die);

which assigns TRUE to $the File when the fopen() succeeds, rather than the file 
handle.  You can't have error reporting turned up very high, or this:
 
> while(!feof($theFile)){
>   $theLine = fgets($theFile, 4096);
>   echo $theLine . "\n";
> }

would be throwing all sorts of warnings about the invalid file handle.  I'm 
guessing that feof(TRUE) returns NULL as well as throwing the warning, so this 
should be an infinite loop echoing just linebreaks.  Oh, wait! ;)

On the other hand, the version using "or" works out to be:

   ($theFile = fopen("docs/InstallationInstructionMaster.txt", "r")) or die;

which assigns the result of fopen() to $theFile, and then executes die if it's 
false -- which is much more satisfactory. ;)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] fopen on windows

2005-11-14 Thread Ford, Mike
On 11 November 2005 21:21, Nathan Tobik wrote:

> I've always used:
> 
> fopen("C:\\dir\\dir\\file.txt");
> 
> on windows, I'm not sure how PHP interprets the slashes internally
> though... 

On Windows, "/" in filenames is internally translated by PHP to "\" -- which 
means you can write code that works on both Windows and *n*x using "/".  
*Really* portable code uses the DIRECTORY_SEPARATOR constant, however.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] fopen on windows

2005-11-14 Thread Jay Blanchard
[snip]
You need "or" not || here.  The operator priorities are such that the above
means
...
which assigns the result of fopen() to $theFile, and then executes die if
it's false -- which is much more satisfactory. ;)
[/snip]

Originally I did not have any '||' or 'or' in the conditional check, with
the same results. 

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



RE: [PHP] php session in ie

2005-11-14 Thread Ford, Mike
On 11 November 2005 18:47, sunaram patir wrote:

> array(1) { ["PHPSESSID"]=>  string(32)
> "337a44c0d6c9ed3cf4ba4e97d707589e" } is returned by firefox on calling
> var_dump($_COOKIE). NULL in ie.

If the very same piece of PHP produces different results in different browsers, 
this *MUST* be due to differences between the browsers.  It could be due to 
settings in the browsers, or it might simply be a bug in one or the other -- 
but it can NOT NOT NOT be down to PHP.  (Well, except inasmuch as you might be 
able to make reasonable adjustments in your PHP to allow for the difference. ;)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP] split or explode quoted strings

2005-11-14 Thread Ördögh László

Hello,

I would like to split or explode strings in a way that
quoted strings inside the strings should remain.
e.g.:

"first second \"third third\" fourth \"fifth fifth fifth\""

after the split I need:

"first"
"second"
"third third"
"fourth"
"fifth fifth fifth"

Is there a simple way to achieve this in PHP? (e.g. like Perl
Text::ParseWords quotedwords function)

Thanks In Advance,

--Laszlo Ordogh
[EMAIL PROTECTED]

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



Re: [PHP] split or explode quoted strings

2005-11-14 Thread Chris Shiflett

Ördögh László wrote:

I would like to split or explode strings in a way that
quoted strings inside the strings should remain.
e.g.:

"first second \"third third\" fourth \"fifth fifth fifth\""

after the split I need:

"first"
"second"
"third third"
"fourth"
"fifth fifth fifth"


I love explode(), too, but this is a job for sscanf():

http://php.net/sscanf

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



Re: [PHP] split or explode quoted strings

2005-11-14 Thread Robin Vickery
On 11/14/05, Ördögh László <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I would like to split or explode strings in a way that
> quoted strings inside the strings should remain.
> e.g.:
>
> "first second \"third third\" fourth \"fifth fifth fifth\""
>
> after the split I need:
>
> "first"
> "second"
> "third third"
> "fourth"
> "fifth fifth fifth"

How about something like this?



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



Re: [PHP] php Slow with Mac OS X 10.4

2005-11-14 Thread Nicolas Ross

I've finally narrow-it down and found a solution.

After much, much googeling, trying and error on my test machine and my
xserve running mac os x 10.4, I've found out that apache2 was shipped with
mac os X 10.4 server (server only).

I decided to compile my own php (as allways) againts this apache, and it
works, and it's fast !

This apache is in /opt/apache2, and is only configured with the default from
the apache distribution. The version that comes with os x 10.4 also suffers
from a bug in apr preventing it from delivering more than 64k of content.
But that's not important. I examined the compile option in
/opt/apache2/build/config.nice, and saw something verry importent :

--with-mpm=worker

Php compiled againts this apache works ok. But if I compile my own apache2,
with --with-mpm=worker, apache won't start saying php needs to be
recompiling.

Php's manual about apache2 clearly states not to use worker mpm. Ok, I took
the libphp4.so from the php compiled againts the stock apache2 from /opt,
and copied it into my own apache2 compiled with my usual configure options,
and all is well and fast.

After comparing phpinfo's output from my ususal php and the one's compiled
againts /opt/apache2's apache, I only see 2 difference.

Virtual Directory Support and Thread safety is enabled on the good apache
from /opt/apache2...

Now, after examining the output from configure command, and greping for
safety and all in my source tree, I found that --enable-experimental-zts is
enabling this. So, I tried agin my own php configure option, with my own
apache (without specifing mpm=worker), but with --enable-experimental-zts,
and voilà ! All is great.


Now to my question :

Why is that enabling threat safety in php afects the performance of apache2
accessing the filesystem ?

Nicolas

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



Re: [PHP] dependable combo boxes with mysql database (Solved)

2005-11-14 Thread Bhoomi Vora
I have got it done.
Below is the code:
-

Service



Select Service");
}
else {

print("$ser");
}
?>



Product


$a");
}
else {
print("$prd");
}

?>



Nature of Problem


Select Problem");
}

else{
print("$prb");
}

?>


-
regards,

Bhoomi

--- "Pranav Negandhi (concept-I)"
<[EMAIL PROTECTED]> wrote:

> This might be slightly OT on this list, but here
> goes nothing.
> 
> 1. Submit the form when the user shifts focus from
> D1 using Javascript's 
> onBlur event
> 2. On the server side, use PHP to retrieve the
> values for D2 and 
> generate the page again
> 3. Repeat 1 & 2 when the value of D2 changes.
> 
> HTH
> Pranav
> www.concept-i.co.in
> 
> 
> Bhoomi Vora wrote:
> > Hello All,
> > 
> > I have a php page which contains three combo
> boxes.
> > The first one will have the value 
> > 
> > from the mysql database table on page load itself.
> > 
> > Then depending upon the value selected in the
> first
> > combobox the second combo box 
> > 
> > should be populated with the respective values
> from
> > another mysql database table, and 
> > 
> > once again depending upon the value selected in
> second
> > combobox the third combobox 
> > 
> > should be populated with the respective values
> from
> > one more different database table.
> > 
> > I have read through mailing list and also searched
> in
> > google and found that it can be 
> > 
> > done with javascript onblur function but nothing
> is
> > working. Here is the code:
> .d similarly
> > D3 should be populated on event like 'onblur' to
> D2.
> > 
> > Pl. give me the exact code or proper guideline how
> > should I accomplish this on the same page.
> > 
> > Appreciate your replies.
> > 
> > Thanks and regards.
> > 
> > BJV
> > 
> > 
> > 
> > __ 
> > Yahoo! FareChase: Search multiple travel sites in
> one click.
> > http://farechase.yahoo.com
> > 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 




__ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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



[PHP] PHP Install problem

2005-11-14 Thread russbucket
Trying to get apache2, php5 and mysql running. get the following error when 
opening phpMyAdmin. Can someone explain what it means. There is an include 
path in php.ini.


-- 
Russ

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



Re: [PHP] PHP / MySQL Authentication class

2005-11-14 Thread Jochem Maas

Alan Milnes wrote:
Can anyone point me to a good User Authentication class written in PHP 
(Version 5 preferably) that uses MySQL as the backend.  If the output is 
valid XHTML then even better. There are lots of hits on Google but I 
need some help sorting the wheat from the chaff.


it might help you to think about it in terms of what 'Auth' is supposed to do...
and whether an 'Auth' module should be responsible for _any_ output what so 
ever?

i.e. imho if its outputting anything at all then its chaff.



It's for a hobbyist site so I'm looking for something using cookies that 
will keep people logged in between visits and provide some 
personalisation.  Obviously it needs to be reasonably secure but it's 
not a banking system or anything.


have a hunt here: pear.php.net - there is probably something there that fits 
the bill



Thanks!

Alan



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



Re: [PHP] Help with Reverse Tree Traversal using Recursion ..

2005-11-14 Thread Richard Lynch
On Mon, November 14, 2005 7:46 am, Greg Schnippel wrote:
> I have a large data tree that I wanted to display in an outline
> format. I used a textbook tree recursion function to go through the
> data and display it as nested unordered lists:
>
> function outputTree($id) {
>
>if (checkChildObjectExists($id)) {
>print "";
>$child = getChildArray($id);
>foreach ($child as $key => $value) {
>print " href=\"/object/$key/\">$value";
>outputTree($key);
>}
>print "";
>}
> }
>
> This works as expected:
>
>> Level 1 (Top)
>> Level 2
>   > Level 3 (Bottom)
>
> However, I also want to display a reverse tree to allow users to trace
> their way back up the tree after landing on a lower branch. I tried to
> be clever and reverse the function above as:
>
> function outputReverseTree($id) {
>
>  if (checkParentExists($id)) {
> print "";
> $parent = getParentArray($id);
> foreach ($parent as $key => $value) {

Just swap the order of these two lines:
>   print "$value\n";
>   outputReverseTree($key);

So that you walk up to the ROOT of the tree *before* you start
printing stuff out.

> }
> print "";
>   }
> }
>
> Which works, but there is something wrong with my logic as the tree
> comes back reversed:
>
>> Level 3 (Bottom)
>> Level 2
>   > Level 1 (Top)
>
> Any suggestions on how to do this?


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Good user comment system?

2005-11-14 Thread Richard Lynch
On Sun, November 13, 2005 7:59 pm, Guy Brom wrote:
> Anyone familiar with a good user-comment system for PHP, preferably
> one that
> works with adodb and has thread-like design (where users can answer
> each
> other).

It's not threaded, but the User Contributed notes system on
http://php.net should be worth looking at. :-)

After that, I suspect almost any forum/bulletin/board code could be
grafted on as a user-comment system...

FUD was recommended here recently as a good choice for
security-concious admins.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Output_Buffer problem

2005-11-14 Thread Richard Lynch
On Sun, November 13, 2005 4:39 pm, Todd Cary wrote:
> My client has switched to a shared server, so direct access to the
> php.ini is not availble.  Our calendar program expects to have
> output_buffering set to On ("1").
>
> Currently, I get the expected error of
>
> Warning: Cannot modify header information - headers already sent by
> (output started at
> /home/content/s/f/y/sfycadmin/html/php/calendar/private/ltw_config.php:375)
> in
> /home/content/s/f/y/sfycadmin/html/php/calendar/private/ltwdisplaymonth.php
> on line 283
>
> At the top of ltwdisplaymonth.php, I tried ini_set(output_buffering,
> "1"), but that does not appear to have an effect.
>
> Have I missed something?

I don't see why it wouldn't have worked, but perhaps try:



at the tip-top of the page instead.

Your other option is to structure your code better so that the headers
are dealt with before any HTML output, which, honestly, is usually the
natural way things fall out if your code is well-structured...

"Warning: Cannot modify header information - headers already sent by
(output started at "

is, for me, a Red Flag, that the code is a mess and not well-structured.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Install problem

2005-11-14 Thread Curt Zirzow
On Mon, Nov 14, 2005 at 10:06:17AM -0800, russbucket wrote:
> Trying to get apache2, php5 and mysql running. get the following error when 
> opening phpMyAdmin. Can someone explain what it means. There is an include 
> path in php.ini.

I think you forgot to include the error message.

curt.
-- 

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



[PHP] Create a numeric hash from a text string?

2005-11-14 Thread Brian Dunning
Does anyone know if there's a handy way to create a numeric hash from  
a text string? I'm trying to generate an integer as a sort of quick &  
dirty checksum for text strings. Needs to be a decimal integer, not  
hex or otherwise. Any clever ideas appreciated.   :)


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



Re: [PHP] mod_rewrite and include paths

2005-11-14 Thread Richard Lynch
On Sun, November 13, 2005 4:05 pm, Marcus Bointon wrote:
> This seems like a simple problem...

Maybe there should be a simple solution... :-)

> I have a rewrite like this:
>
> RewriteRule ^x/([0-9]+) x.php?x=$1 [PT,L]
>
> This maps a url like http://www.example.com/x/123 to http://
> www.example.com/x.php?x=123
>
> x.php contains a line to include some class like:
>
> require_once 'x.class.php';
>
> My include path contains '.' (plus paths to pear, etc), and the class
> file is in the top level directory.

If it's in the top level directory, then maybe that directory should
be hard-coded into the include_path, as well as '.'

include_path
".:/whatever/httpd.conf/has/for/DocumentRoot:/full/path/to/PEAR"

> So how can I get PHP to look in /? I can set include_path with a
> php_value in .htaccess, but I can only set it absolutely (losing
> existing values), not add to it (AFAIK?). I don't want to add an
> absolute path to my global include_path as there may be multiple
> independent deployments of the same scripts on the server, and I
> don't want them including each others files. Adding .. to the path
> would work but is a security risk. Any other ideas?

This all rules out the above, but one possibility is this:

In just the script that gives you trouble do this:

include_path("/full/path/to/DocumentRoot:" . include_path());
This may not be the right syntax/function to set include_path, but it
is a dynamic way to set the include path, from within PHP.

Of course, for the multiple deployments, you'll need to make the path
based on the deployment somehow.


Now, on to the simple solution I intimated at the beginning...

If mod_rewrite is giving you the headaches it gives me, just get rid
of it. :-)

INSTEAD, do this.

Create a PHP script, and name it 'x'

In .htaccess, force 'x' to be PHP as far as Apache is concerned:

  ForceType application/x-httpd-php


You can now access your "x=123" from $_SERVER['PATHINFO'] (or is it
'PATH_INFO'?

No more endless tweaking of Regex rules in httpd.conf and logging the
mod_rewrite and dinking with ^/[0-9]+ junk and re-starting Apache
every time you want to try a change.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Create a numeric hash from a text string?

2005-11-14 Thread Curt Zirzow
On Mon, Nov 14, 2005 at 10:41:53AM -0800, Brian Dunning wrote:
> Does anyone know if there's a handy way to create a numeric hash from  
> a text string? I'm trying to generate an integer as a sort of quick &  
> dirty checksum for text strings. Needs to be a decimal integer, not  
> hex or otherwise. Any clever ideas appreciated.   :)

This should work for a dirty checksum:
  http://php.net/crc32



Curt.
--

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



[PHP] Re: Create a numeric hash from a text string?

2005-11-14 Thread Dan Baker
Quick-n-easy:
int crc32 ( string str )  -- make sure to read the manual about the 
unsigned/signed issue.

DanB


"Brian Dunning" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Does anyone know if there's a handy way to create a numeric hash from  a 
> text string? I'm trying to generate an integer as a sort of quick &  dirty 
> checksum for text strings. Needs to be a decimal integer, not  hex or 
> otherwise. Any clever ideas appreciated.   :)
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> 

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



Re: [PHP] Printing to a buffer

2005-11-14 Thread Richard Lynch
On Sun, November 13, 2005 8:20 am, Marcus Bointon wrote:
>
> On 13 Nov 2005, at 00:17, Jasper Bryant-Greene wrote:
>
>>> seem to do that.  I just tried "application/text" since I use
>>> "application/pdf" for other applications.
>>
>> Whatever it's giving the user the ability to do, it's probably
>> because the browser doesn't recognise the (invalid) MIME-Type.
>
> Quite - it's right up there with 'application/force-download'. If you
> want to suggest (the final choice is not yours to make) that a
> browser might download something instead of displaying it, set an
> appropriate content-disposition header instead of setting the wrong
> type.

E.

It may not be my final choice whether they download or not, but if a
browser doesn't treat:
application/octet-stream
as a download, and only as a download, then that browser is pretty
broken.

Letting the user configure their browser for that MIME type to be
opened by an application is just plain wrong for a browser, by
specification.

If you find a browser that lets you configure application/octet-stream
to be opened with a specific application, then file a bug report with
whomever wrote that browser.

All the other johnny-come-lately hacks from Redmond to 'force'
downloads are highly suspect and non-portable, and should be avoided
if you want to keep your hair.

You can't rely on "Content-disposition ... filename" either, so you
either make the URL end in the filename you want as the default, or
you can count on some browsers using some other filename.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: Zend + Eclipse + Standized Framework

2005-11-14 Thread GamblerZG

Dan Rossi wrote:
Personally, i am trying to avoid all these frameworks until 
everyones ideas are collabroated into one as i think they only work for 
some or for the developers purposes only.


What features do you need from a framework?

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



[PHP] Walking through a bunch of MySQL Records

2005-11-14 Thread Phillip S. Baker
Greetings all,

I have a question.
I want to display a group of records pulled form a MySQL db in the following
fashion.

16
27
38
49
510

Now I can easily figure out how to display the records as

12
34
56
78
910

But since I am in an HTML table and the need to display the  and  I
am not sure how to make th logic so that I can get the first listing. Can
anyone help me out?? Need more information??

Thanks

Phillip

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



Re: [PHP] Printing to a buffer

2005-11-14 Thread Richard Lynch




On Sun, November 13, 2005 1:53 pm, Marcus Bointon wrote:
> On 13 Nov 2005, at 19:27, Jasper Bryant-Greene wrote:
>
>>> Many thanks!  I did not know that MIME-Type.  Change duly made!
>>
>> You're not suggesting that you actually set the MIME-Type to
>> application/force-download, are you?
>
> I think he is. I've called the MIME-type police and they'll be round
> later.
>
> Todd, I think you should read this: http://support.microsoft.com/kb/
> q260519/
>
> There's a PHP example just before the user notes here: http://
> www.php.net/header
>
> Marcus
> --
> Marcus Bointon
> Synchromedia Limited: Putting you in the picture
> [EMAIL PROTECTED] | http://www.synchromedia.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Help with Reverse Tree Traversal using Recursion ..

2005-11-14 Thread Greg Schnippel
Richard -

Thanks for the helpful suggestion but that won't resolve my problem
the way I currently have it written because I'm creating a new, nested
 each time I loop through:

print "";
foreach ($parent as $key => $value) {
...
}
print "";

So when I tried this, the output was still inverted because it began
printing at the innermost branch of the nested list.

I'm trying to figure out a way now to save the output into an array
instead of outputting and then traversing the array in a separate
function to output it. Might run into the same problem again but I'm
hopeful that once the data is an array, I can make use of a php
function to reverse or sort the array.

Another reader also recommended this article on php and recursion:

http://www.zend.com/zend/art/recursion.php

I'll post if I get any closer,

- Greg


On 11/14/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Mon, November 14, 2005 7:46 am, Greg Schnippel wrote:
> > I have a large data tree that I wanted to display in an outline
> > format. I used a textbook tree recursion function to go through the
> > data and display it as nested unordered lists:
> >
> > function outputTree($id) {
> >
> >if (checkChildObjectExists($id)) {
> >print "";
> >$child = getChildArray($id);
> >foreach ($child as $key => $value) {
> >print " > href=\"/object/$key/\">$value";
> >outputTree($key);
> >}
> >print "";
> >}
> > }
> >
> > This works as expected:
> >
> >> Level 1 (Top)
> >> Level 2
> >   > Level 3 (Bottom)
> >
> > However, I also want to display a reverse tree to allow users to trace
> > their way back up the tree after landing on a lower branch. I tried to
> > be clever and reverse the function above as:
> >
> > function outputReverseTree($id) {
> >
> >  if (checkParentExists($id)) {
> > print "";
> > $parent = getParentArray($id);
> > foreach ($parent as $key => $value) {
>
> Just swap the order of these two lines:
> >   print "$value\n";
> >   outputReverseTree($key);
>
> So that you walk up to the ROOT of the tree *before* you start
> printing stuff out.
>
> > }
> > print "";
> >   }
> > }
> >
> > Which works, but there is something wrong with my logic as the tree
> > comes back reversed:
> >
> >> Level 3 (Bottom)
> >> Level 2
> >   > Level 1 (Top)
> >
> > Any suggestions on how to do this?
>
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
>
>

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



Re: [PHP] Printing to a buffer

2005-11-14 Thread Richard Lynch
On Sun, November 13, 2005 4:55 pm, Todd Cary wrote:
> Because this was just a test of what will be many "print" lines.  The
> original application used a file to hold the data and upon request by
> the user, it was emailed.  But with my client's shared server, files
> cannot be opened...a pain.
>
> If you have a better solution, I am open to other ideas.

Switch hosts?
:-^

PS
I'll say it again:
Content-disposition will give you grief from older browsers.
Content-type: application/octet-stream will "just work"

To get the filename default prompt, tack the filename onto the end of
your URL.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: Good user comment system?

2005-11-14 Thread Dan Baker
How about good ol' phpbb?
http://www.phpbb.com/

DanB

"Guy Brom" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi all,
>
> Anyone familiar with a good user-comment system for PHP, preferably one 
> that works with adodb and has thread-like design (where users can answer 
> each other).
>
> Thanks!
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> 

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



Re: [PHP] php/linux user groups in the east bay area..

2005-11-14 Thread Richard Lynch
On Sat, November 12, 2005 2:33 pm, bruce wrote:
> anybody know of any php/linux/apache user groups in the east bay
> (dublin/pleasanton/san ramon/etc...) area?
>
> need to join one to find other like minded php/linux guys who are into
> developing..

You have to do some weeding, but this is pretty extensive:
http://phpusergroups.org

If you find a group that's not in there, get them to add themselves.

If you don't find a group, just start one!

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Install problem

2005-11-14 Thread russbucket
On Monday 14 November 2005 10:47, Curt Zirzow wrote:
> On Mon, Nov 14, 2005 at 10:06:17AM -0800, russbucket wrote:
> > Trying to get apache2, php5 and mysql running. get the following error
> > when opening phpMyAdmin. Can someone explain what it means. There is an
> > include path in php.ini.
>
> I think you forgot to include the error message.
>
> curt.
> --
Your right, hand got ahead of my brain,  Heres the messages when using 
http/localhost/phpMyAdmin/ 

phpMyAdmin - Error
 phpMyAdmin was unable to read your configuration file!
This might happen if PHP finds a parse error in it or PHP cannot find the 
file.
Please call the configuration file directly using the link below and read the 
PHP error message(s) that you receive. In most cases a quote or a semicolon 
is missing somewhere.
If you receive a blank page, everything is fine.

 config.inc.php

Clicking on the config.inc.php gives following error.
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 
0
 
 Warning: Unknown: Failed opening '/srv/www/htdocs/phpMyAdmin/config.inc.php' 
for inclusion (include_path='.:') in Unknown on line 0

I've checked and rechecked the configurations files, they look correct.

Thanks for responding even with my goof.

-- 
Russ

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



Re: [PHP] Recommendations for the Zend PHP Certification

2005-11-14 Thread Richard Lynch
On Sat, November 12, 2005 10:29 am, Gustavo Narea wrote:
>- AFAIK, there are 3 versions of the Standard SQL (1993, 1999 and
> 2003), but, Which one am I going to need for this test?

I think it would be best to focus on SQL 92 because:

A) It's unlikely that a significant number of Zend Cert questions
would be THAT picuyane to depend on SQL99 (?) or SQL03 (??)

B) Most db platforms haven't even caught up to SQL92 yet, not fully. 
They're all "close" but none are "done".
So you may miss a question or two because of the difference between
reality and the Cert test question, but you won't miss a whole bunch
of them.

>- Should I learn to use another HTTP server?

HTTP server?

It might be good to play with PHP on a Windows box, just to see what
it's like...  Not with IIS, though, as that's just TOO painful :-)

There are enough differences there to stretch your mind a bit, and to
get a better picture of how it all fits together, without driving you
crazy.

Another SQL server would probably be even more useful.

PostgreSQL is probably the easiest (and certainly the cheapest) to try
from a MySQL background.  And PostgresQL is picky enough that all the
bad habits you picked up in MySQL will get corrected pretty
quick-like. :-)

PS MySQL 5 has settings that allow it to be more standard, and that's
a Good Thing (tm) imho.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: Create a numeric hash from a text string?

2005-11-14 Thread Brian Dunning

Perfect - thanks guys!  :)

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



RE: [PHP] Walking through a bunch of MySQL Records

2005-11-14 Thread Jim Moseby
> 
> I have a question.
> I want to display a group of records pulled form a MySQL db 
> in the following
> fashion.
> 
> 16
> 27
> 38
> 49
> 510
> 
> Now I can easily figure out how to display the records as
> 
> 12
> 34
> 56
> 78
> 910
> 
> But since I am in an HTML table and the need to display the 
>  and  I
> am not sure how to make th logic so that I can get the first 
> listing. Can
> anyone help me out?? Need more information??


You could load up an array with your result set:

$records=array();
$rownum=0;
while ($row=mysql_fetch_array($result)){
  $rownum++;
  records[$rownum]=$row['data'];
}

...then use $rownum/2 to determine the second column:

for ($i==1;$i<=$rownum/2;$i++){
  $col1=$i;
  $col2=$i+($rownum/2);
  echo "$record[$col1]";
  echo "$record[$col2]";
}

There are probably much better ways to do this, but this is a start.

JM

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



Re: [PHP] PHP Install problem

2005-11-14 Thread Ben

russbucket said the following on 11/14/2005 11:15 AM:


Clicking on the config.inc.php gives following error.
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 
0
 
 Warning: Unknown: Failed opening '/srv/www/htdocs/phpMyAdmin/config.inc.php' 
for inclusion (include_path='.:') in Unknown on line 0


I've checked and rechecked the configurations files, they look correct.



Sounds like your web server's user does not have permission to read the 
file.


chmod 444 /srv/www/htdocs/phpMyAdmin/config.inc.php

will set your permissions (assuming your on *nix) to r--r--r-- which 
will give your web server's user (and ever other user account on the 
machine - which may not be what you want) permission to read the file.


- Ben

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



Re: [PHP] emailing MySQL list not working

2005-11-14 Thread Richard Lynch
On Fri, November 11, 2005 9:33 pm, Bruce Gilbert wrote:
>   $headers = "From: $sender";
>   $headers .= "Reply-To: $reply_to";
>   $headers .= "Return-Path: $return_path";

>   $headers .= "X-Sender: $x_sender";
>   $headers .= "X-Mailer: PHP4\n"; //mailer

These two may trip some spam filters.

>   $headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal

Setting this at all probably trips a few spam filters.

>   $headers .= "Mime-Version:1.0\n Content-Type: text/plain;
> charset=\"iso-8859-1\nContent-Transfer-Encoding: 8bit\n";
>
>   mail( $recipient, $subject, stripslashes($message), $headers );

Check the return error code!!!
http://php.net/mail

>   sleep(1);

Just how many emails are you trying to send with mail()?

http://php.net/mail was never designed for heavy-volume lists...

Look into http://phpclasses.org for something that WAS designed to
handle the volume you need.

> }
>
> // run second query to automatically dump unsubscribed email
> addresses.


> $query2 = "
>   DELETE FROM
>   mailinglist
>   WHERE
>   subscribe='0'
>   AND
>   confirmed='0' ";
>
> //run the query
> mysql_query($query2, $link) or die (mysql_error());

Dude, if I unsubscribed, get me off the list *BEFORE* you send out
another email, not after.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Good user comment system?

2005-11-14 Thread Greg Schnippel
If you're looking for a light-weight, threaded discussion script, I
can recommend this class from xhawk.net

http://www.xhawk.net/projects/discussion/

I like it because I can quickly integrate this into blogs or galleries
by just instantiating a new board instance for each object id or
article.

It does need some work fending off comment-spam, as the demo version
illustrates. However, it is very small and well-documented so you can
easily integrate an approval-based or captcha anti-spam defense.

- Greg



On 11/13/05, Guy Brom <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Anyone familiar with a good user-comment system for PHP, preferably one that
> works with adodb and has thread-like design (where users can answer each
> other).
>
> Thanks!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] PHP Install problem

2005-11-14 Thread Richard Lynch
On Mon, November 14, 2005 1:15 pm, russbucket wrote:
> On Monday 14 November 2005 10:47, Curt Zirzow wrote:
>> On Mon, Nov 14, 2005 at 10:06:17AM -0800, russbucket wrote:
>> > Trying to get apache2, php5 and mysql running. get the following
>> error
>> > when opening phpMyAdmin. Can someone explain what it means. There
>> is an
>> > include path in php.ini.
>>
>> I think you forgot to include the error message.
>>
>> curt.
>> --
> Your right, hand got ahead of my brain,  Heres the messages when using
> http/localhost/phpMyAdmin/
>
> phpMyAdmin - Error
>  phpMyAdmin was unable to read your configuration file!
> This might happen if PHP finds a parse error in it or PHP cannot find
> the
> file.
> Please call the configuration file directly using the link below and
> read the
> PHP error message(s) that you receive. In most cases a quote or a
> semicolon
> is missing somewhere.
> If you receive a blank page, everything is fine.
>
>  config.inc.php
>
> Clicking on the config.inc.php gives following error.
> Warning: Unknown: failed to open stream: Permission denied in Unknown
> on line
> 0
>
>  Warning: Unknown: Failed opening
> '/srv/www/htdocs/phpMyAdmin/config.inc.php'
> for inclusion (include_path='.:') in Unknown on line 0
>
> I've checked and rechecked the configurations files, they look
> correct.

The file contents are fine (maybe) but PHP can't even *READ* the file
because it's set up as un-readable by the PHP user.

You need to find out the permissions on the file (config.inc.php)

In a shell prompt on the server you can do:
ls -als config.inc.php
The output will have something not unlike:
 7 -rw-rw-r--  1 russbucket  nwi_group ... config.inc.php

But I'll bet a dollar *YOUR* file doesn't have the last 'r' letter 
there, and just has '-' instead:
-rw-rw

You need to change that:
chmod 554 config.inc.php

WARNING:
On a shared server, this is exposing your database password to
everybody else on that shared server.  You may not have any other
option, however.

To mitigate this risk, you may want to do several things, after you
get phpMyAdmin working.

1. Move the file out of your web tree, so *ONLY* users on the shared
server could possibly read it, not the whole friggin' world.

2. Move it to a directory that denies listings by other users, so they
can't stumble across it. (This may make it unreadable by PHP, though,
depending on things I've never fully understood, so then don't do
that...)

More involved methods of keeping the password accessible to PHP and
not everybody else with a login can be found here:
http://phpsec.org

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Walking through a bunch of MySQL Records

2005-11-14 Thread tg-php
Depending on how strict your requirements are for the table layout, you could 
always do something like this:


  
Item 1
Item 2
Item 3
Item 4
Item 5
  
  
Item 6
Item 7
Item 8
Item 9
Item 10
  


Each item isn't in it's own , but if they don't have to be, then that could 
be a solution.

Or, as someone else mentioned I believe, you could pre-load the results into 
another array structured how you want it to be.

Depending on the specifics, there are probably other methods.

-TG



= = = Original message = = =

Greetings all,

I have a question.
I want to display a group of records pulled form a MySQL db in the following
fashion.

16
27
38
49
510

Now I can easily figure out how to display the records as

12
34
56
78
910

But since I am in an HTML table and the need to display the  and  I
am not sure how to make th logic so that I can get the first listing. Can
anyone help me out?? Need more information??

Thanks

Phillip


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Walking through a bunch of MySQL Records

2005-11-14 Thread Richard Lynch
On Mon, November 14, 2005 1:03 pm, Phillip S. Baker wrote:
> Greetings all,
>
> I have a question.
> I want to display a group of records pulled form a MySQL db in the
> following
> fashion.
>
> 16
> 27
> 38
> 49
> 510
>
> Now I can easily figure out how to display the records as
>
> 12
> 34
> 56
> 78
> 910
>
> But since I am in an HTML table and the need to display the  and
>  I
> am not sure how to make th logic so that I can get the first listing.
> Can
> anyone help me out?? Need more information??

$col = 0;
$row = 0;
$count = mysq_numrows($result);
$half_count = floor($count/2); //use ceiling to get "widow" on right
while (list($number) = mysql_fetch_row($result)){
  $table[$row][$col] = $number;
  $row++;
  if ($row == $half_count) $col++;
}
echo "\n";
foreach($table as $row){
  echo "\t\n";
  foreach($row as $number){
echo "\t\t$number\n";
  }
}
echo "\n";

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Create a numeric hash from a text string?

2005-11-14 Thread Richard Lynch
On Mon, November 14, 2005 12:41 pm, Brian Dunning wrote:
> Does anyone know if there's a handy way to create a numeric hash from
> a text string? I'm trying to generate an integer as a sort of quick &
> dirty checksum for text strings. Needs to be a decimal integer, not
> hex or otherwise. Any clever ideas appreciated.   :)

Why an integer?...

For that matter, down in the guts, it's all just an integer,
technically...

Do you need a 32-bit integer for some reason?

Something involving md5, substr, and http://php.net/pack should sort
of work.

You're probably better off re-thinking your "needs to be an integer"
requirement, though, honestly, unless there is some really really
compelling driving external force at work.



-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] url query problem

2005-11-14 Thread Richard Lynch
On Fri, November 11, 2005 9:12 pm, Imroz wrote:
> Hi PHP Gurus
> Am new to the php world, I need help to do something. PlZz help
>
> I have this link HYPERLINK
> "http://www.taximauritius.mu/link1.php"http://www.taximauritius.mu/link1
> ..php.
>
> What I want to do :
>
> When clicking on the link above, that would bring me to a page
> HYPERLINK
> "http://www.taximauritius.mu/reservation.php?client=apartment1"http://ww
> w.taximauritius.mu/reservation.php?client=apartment1, and in this URL,
> as can be seen, there is a variable called apartment1.
>
> I want to get the name of this variable + other form fields in my
> email
> message when the form is sent. Actually I do get the other form fields
> in my email message. I just don’t get the variable (client=apartment1)
>
> Am attaching the codes, It would really be grateful if you could plzzz
> help me.

Read the PHP FAQ on http://php.net/faq about processing all POST values.



-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Question about session

2005-11-14 Thread Richard Lynch
On Fri, November 11, 2005 7:09 pm, Bagus Nugroho wrote:
> I have session code which written WindowsXP and It wotk properly as
> expected, but when I'm used in Windows 2K, it got error as;
> Notice: Undefined index: loginMessage in
> C:\CentralData\forms\mainForm.php on line 65
> I'am used Apache 2.0 and PHP 5.0.4.
> Is  php.ini setting on W2K different with XP

The difference is you have:
E_ALL
on the Win 2K box, and:
E_ALL ~ E_NOTICE
on the XP box.

The bug is in your code in BOTH cases, but the message is being
suppressed by php.ini on the XP box.

Fix your code is the best answer.

Changing E_ALL to just E_ALL ~ E_NOTICE is a distant second.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] What is the purpose of sessions extension?

2005-11-14 Thread Richard Lynch
On Fri, November 11, 2005 6:59 pm, Jasper Bryant-Greene wrote:
> GamblerZG wrote:
>> What is the purpose of sessions extension?
>>
>> The reason I ask is because learning to deal with all its functions,
>> ini
>> options and quirks took me _much_ more time than writing pure-php
>> replacement. (That is, without using  session_set_save_handler().)
>
> I realise that yours might be a special case, but for most situations
> I
> have only had to do session_start() and then simply used $_SESSION as
> if
> it were any other array with the simple difference that it persists
> across requests. When done with the session, use session_destroy() if
> you feel the need.
>
> I'm not sure how that could be harder than writing a pure-PHP
> replacement for the session extension...

The FIRST time one uses PHP session_start() et al, it tends to be a
lot of wading through and taking the wrong path and...

Once you figure out that you need:

at the top of every page, and to just read/write session data with:
$_SESSION
it gets real easy.

But it ain't easy the first time.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Recommendations for the Zend PHP Certification

2005-11-14 Thread Gustavo Narea

Hi, Richard.

Richard Lynch wrote:

On Sat, November 12, 2005 10:29 am, Gustavo Narea wrote:


  - AFAIK, there are 3 versions of the Standard SQL (1993, 1999 and
2003), but, Which one am I going to need for this test?



I think it would be best to focus on SQL 92 because:

A) It's unlikely that a significant number of Zend Cert questions
would be THAT picuyane to depend on SQL99 (?) or SQL03 (??)

B) Most db platforms haven't even caught up to SQL92 yet, not fully. 
They're all "close" but none are "done".

So you may miss a question or two because of the difference between
reality and the Cert test question, but you won't miss a whole bunch
of them.


Yes, I am going to take that into account.

By the way, I was wrong: There are more than 3 versions of this 
standard; according wikipedia there are five.




  - Should I learn to use another HTTP server?



HTTP server?

It might be good to play with PHP on a Windows box, just to see what
it's like...  Not with IIS, though, as that's just TOO painful :-)


Good ;-), I spent a couple of years using PHP on Window$ (with Apache) 
before switching to GNU/Linux a few months ago.




Another SQL server would probably be even more useful.

PostgreSQL is probably the easiest (and certainly the cheapest) to try
from a MySQL background.  And PostgresQL is picky enough that all the
bad habits you picked up in MySQL will get corrected pretty
quick-like. :-)


That's a good reason for me to learn PostgreSQL!

Thanks you so much, Richard.

Regards.
--
Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.

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



[PHP] Re: Filtering and Escaping (Was: Select and $_POST)

2005-11-14 Thread Richard Lynch
On Fri, November 11, 2005 5:18 pm, Chris Shiflett wrote:
> Richard Lynch wrote:
>> Suppose PHP had a superglobal $_CLEAN which was an empty array.
>
> This seems like a decent idea, for two reasons:
>
> 1. Developers don't have to remember to initialize their array, which
> offers some protection. PHP can do this for them.
>
> 2. Variable scope issues are not a concern. Currently, using this
> technique within functions and classes is clumsy at best.
>
> However, most security issues like XSS and SQL injection aren't really
> input filtering problems. Often, input filtering can effectively
> eliminate these vulnerabilities (and there's no excuse to not be
> filtering input), but escaping addresses the root cause of the
> problem.

It's certainly not a magic bullet.

But I think it would help a lot of newbies get set on the right path
from the get-go, of thinking about security from "Hello World" instead
of trying to graft Security onto their 30,000 line forum after it gets
nailed by bad guys.

The residual effects are, hopefully, bigger than the direct benefit.

If a good way to escape OUTPUT was also incorporated, that would be
even better.

But just getting folks THINKING about this kind of stuff from Day One
of their PHP scripting would make a big difference.

Perhaps one should use:
$_ICLEAN
$_OCLEAN
for Input and Output.

$kosher = '/[^A-Za-z0-9\\',\\.-]/';
$_ICLEAN['first_name'] = preg_replace($kosher, '', $_GET['first_name'];
/* more code */
$_OCLEAN['first_name'] = htmlentities($_ICLEAN['first_name']);
echo "$_OCLEAN[first_name] is way smarter than me.\n";

If you had anything other than $_OCLEAN in an echo and friends, then
you would know you were screwing up.

I really think it's important for the PHP community to push towards
safer practices at the most basic levels.
Examples in the manual, textbooks, etc.

If everybody knew $_ICLEAN and $_OCLEAN meant data cleaned from input
or data cleaned for output, then one could simply use them in examples
instead of $_GET or $data.

I'm not sure we can (or even should) go as far as Perl's tainted mode,
but I think setting the right example and having an infrastructure to
"do it right" would be a Good Thing.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Easiest way to user DomDocument->getElementById()?

2005-11-14 Thread Erik Franzén
According to the php docs, the method DomDocument->getElementById() will 
not work unless the document is validated using a DTD (not schema):


"According to the DOM standard this requires a DTD which defines the 
attribute ID to be of type ID. You need to validate your document with 
DOMDocument->validate() or DOMDocument->validateOnParse before using 
this function."


I cannot use a schema in ordet to "activate" DomDocument->getElementById()?

/Erik

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



Re: [PHP] fopen on windows

2005-11-14 Thread Richard Lynch
On Fri, November 11, 2005 2:51 pm, Jay Blanchard wrote:
> $theFile = fopen("docs/InstallationInstructionMaster.txt", "r") ||
> die;

Don't use || when you mean 'or' :-)

Nor sure it really matters here, but better to follow the crowd and
use 'or' here.

> while(!feof($theFile)){
>   $theLine = fgets($theFile, 4096);

4096 is longer than any line in the file?

>   echo $theLine . "\n";
> }
> fclose($theFile);
>
> The above code appears to work, but all that is output is lines of
> line
> breaksno data. The file is a tab delimited test file;

View Source?

> Am I missing something other than an ice cold beer?

Are you 100% certain you don't have an empty file in
docs/InstallationInstructionMaster.txt sitting right next to your
script, while the REAL file you want is somewhere else?

Been there.  Done that.  Smacked the forehead.

Use the full path to the file to be SURE you are reading the file you
think you are reading.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] fopen on windows

2005-11-14 Thread Richard Lynch
On Fri, November 11, 2005 3:23 pm, Jay Blanchard wrote:
> // Left off the "b" because it ain't binary :)

I think you will find this is the crucial difference if you go back to
your original and take it out.

Your file is text.

It's not binary.

On Windowz, that matters, for some odd reason.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: Easiest way to user DomDocument->getElementById()?

2005-11-14 Thread Erik Franzén

I have run into this behavior on several sites:

$dom->validate('books.dtd');

But according to the docs, the method it is defined

class DOMDocument {

bool validate ( void )

}

Is the dtd (file?) parameter deprecated?

/Erik

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



Re: [PHP] REQ: DOMDocument needs a way to format XML code

2005-11-14 Thread Richard Lynch
On Fri, November 11, 2005 2:27 pm, Daevid Vincent wrote:
> I have a feature request (and I'm a bit disappointed that this isn't
> already
> in the DOMDocument, when there are nearly useless methods like
> "normalize()")... Ruby has this built in. xmllint has the --format
> parameter. But yet PHP's DOMDocument has no way of cleaning up the
> code.
>
> Could someone please make a method in PHP v5.x to format the XML.
> After
> adding/deleting nodes, the XML gets fairly messy. Ideally it would
> have an
> offset character position to start the indent (default of 0 or left
> margin),
> and a parameter for how many spaces to use for each indentation
> (default of
> say 4 or 5 (same as a tab)).
>
> You could just make this optional parameters to saveXML(), but I think
> it's
> more flexible to have a DOMDocument->format(offset,spaces);

It might be easy to run your XML through XMLTidy somehow...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] What is the purpose of sessions extension?

2005-11-14 Thread Carlo Razzeto
In my office we found it to be quite quick and easy to write a library
which uses PHP session extensions to store all session data into a
database (we work in a load balanced environment). We found this to be
the best method of dealing with this because we did not need to deal
with generating unique session id's or identifying when a session has
expired thus reducing code complexity and the DB load.

Carlo Razzeto
Programmer
Mortgage Information Services
Phone: (216) 514-1025 ex. 1212
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 14, 2005 3:18 PM
To: Jasper Bryant-Greene
Cc: GamblerZG; php-general@lists.php.net
Subject: Re: [PHP] What is the purpose of sessions extension?

On Fri, November 11, 2005 6:59 pm, Jasper Bryant-Greene wrote:
> GamblerZG wrote:
>> What is the purpose of sessions extension?
>>
>> The reason I ask is because learning to deal with all its functions,
>> ini
>> options and quirks took me _much_ more time than writing pure-php
>> replacement. (That is, without using  session_set_save_handler().)
>
> I realise that yours might be a special case, but for most situations
> I
> have only had to do session_start() and then simply used $_SESSION as
> if
> it were any other array with the simple difference that it persists
> across requests. When done with the session, use session_destroy() if
> you feel the need.
>
> I'm not sure how that could be harder than writing a pure-PHP
> replacement for the session extension...

The FIRST time one uses PHP session_start() et al, it tends to be a
lot of wading through and taking the wrong path and...

Once you figure out that you need:

at the top of every page, and to just read/write session data with:
$_SESSION
it gets real easy.

But it ain't easy the first time.

-- 
Like Music?
http://l-i-e.com/artists.htm

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


Disclaimer: This message (including any attachments) contains confidential 
information intended for a specific individual and purpose, and is protected by 
law. If you are not the intended recipient, you should delete this message. Any 
disclosure, copying, or distribution of this message, or the taking of any 
action based on it, is strictly prohibited.

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



RE: [PHP] fopen on windows

2005-11-14 Thread Jay Blanchard
[snip]
On Fri, November 11, 2005 2:51 pm, Jay Blanchard wrote:
> $theFile = fopen("docs/InstallationInstructionMaster.txt", "r") ||
> die;

Don't use || when you mean 'or' :-)

Nor sure it really matters here, but better to follow the crowd and
use 'or' here.
[/snip]

Okie dokie. Found there to be no change in behavior at this point. Perhaps I
need to set the error checking higher, say E_ALL.

[snip]
> while(!feof($theFile)){
>   $theLine = fgets($theFile, 4096);

4096 is longer than any line in the file?
[/snip]

Yes, it accounts for every line in the file.

[snip]
>   echo $theLine . "\n";
> }
> fclose($theFile);
>
> The above code appears to work, but all that is output is lines of
> line
> breaksno data. The file is a tab delimited test file;

View Source?
[/snip]


Looks like;








[snip]
Are you 100% certain you don't have an empty file in
docs/InstallationInstructionMaster.txt sitting right next to your
script, while the REAL file you want is somewhere else?

Been there.  Done that.  Smacked the forehead.

Use the full path to the file to be SURE you are reading the file you
think you are reading.
[/snip]

Did that too. Still no joy.

Several other methods have been provided and I will use one of those.
However, when I get to the point that fopen would be my only choice I will
likely encounter these same problems. C'est la vie!

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



[PHP] Re: Easiest way to user DomDocument->getElementById()?

2005-11-14 Thread Erik Franzén



I have run into this behavior on several sites:

$dom->validate('books.dtd');

But according to the docs, the method it is defined

class DOMDocument {

bool validate ( void )

}

Is the dtd (file?) parameter deprecated?

/Erik



Just tested, $dom->validate('books.dtd') generates the warning 
"DOMDocument::validate() expects exactly 0 parameters, 1 given in ..."


/Erik

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



Re: [PHP] Walking through a bunch of MySQL Records

2005-11-14 Thread Miles Thompson


First of all - remember results display in a web browser, and if you want 
to print these you will get results that are not like a normal printed page.


Second - here's an approach. Dump all records into an array, you'll have 
the record count, then selectively fetch elements according to how you 
want  them displayed.  Here's a rough approximation.


i = 1
col_lgth = 5
until i = 1+col_lgth+i
tr td
arr[i]
/td td
arr[ i + col_lgth ]
/td /tr
i ++
and keep on looping. You'll have to work out something for odd-numbered 
result sets, which will not give you a balanced column.


Others may have more sophisticated displays, a CSS guru could probably do 
something tricky.


I do not think you can access the $result value returned by any of the 
queries with an index.


HTH - Miles



At 03:03 PM 11/14/2005, Phillip S. Baker wrote:

Greetings all,

I have a question.
I want to display a group of records pulled form a MySQL db in the following
fashion.

16
27
38
49
510

Now I can easily figure out how to display the records as

12
34
56
78
910

But since I am in an HTML table and the need to display the  and  I
am not sure how to make th logic so that I can get the first listing. Can
anyone help me out?? Need more information??

Thanks

Phillip

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


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



RE: [PHP] Walking through a bunch of MySQL Records

2005-11-14 Thread Miles Thompson

Yeah Jim - that's better than mine.
Miles
At 03:28 PM 11/14/2005, Jim Moseby wrote:

>
> I have a question.
> I want to display a group of records pulled form a MySQL db
> in the following
> fashion.
>
> 16
> 27
> 38
> 49
> 510
>
> Now I can easily figure out how to display the records as
>
> 12
> 34
> 56
> 78
> 910
>
> But since I am in an HTML table and the need to display the
>  and  I
> am not sure how to make th logic so that I can get the first
> listing. Can
> anyone help me out?? Need more information??


You could load up an array with your result set:

$records=array();
$rownum=0;
while ($row=mysql_fetch_array($result)){
  $rownum++;
  records[$rownum]=$row['data'];
}

...then use $rownum/2 to determine the second column:

for ($i==1;$i<=$rownum/2;$i++){
  $col1=$i;
  $col2=$i+($rownum/2);
  echo "$record[$col1]";
  echo "$record[$col2]";
}

There are probably much better ways to do this, but this is a start.

JM

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


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



[PHP] [EMAIL PROTECTED]

2005-11-14 Thread Miles Thompson

Can someone get rid of him?
Every time I post, which I admit is not often, I get a bounce.

Cheers - Miles

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



[PHP] Re: Filtering and Escaping (Was: Select and $_POST)

2005-11-14 Thread Ben Ramsey

On 11/14/05 3:38 PM, Richard Lynch wrote:

Perhaps one should use:
$_ICLEAN
$_OCLEAN
for Input and Output.

$kosher = '/[^A-Za-z0-9\\',\\.-]/';
$_ICLEAN['first_name'] = preg_replace($kosher, '', $_GET['first_name'];
/* more code */
$_OCLEAN['first_name'] = htmlentities($_ICLEAN['first_name']);
echo "$_OCLEAN[first_name] is way smarter than me.\n";

If you had anything other than $_OCLEAN in an echo and friends, then
you would know you were screwing up.


I don't like $_OCLEAN primarily because I like Chris's suggestion of 
using an output array that is named according to where the data is 
going, so $url, $sql, $html, etc. But, with that in mind, it wouldn't be 
too hard to use $_OCLEAN['url'], $_OCLEAN['sql'], and $_OCLEAN['html'] 
as arrays within the $_OCLEAN array.


--
Ben Ramsey
http://benramsey.com/

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



Re: [PHP] What is the purpose of sessions extension?

2005-11-14 Thread GamblerZG

Richard Lynch wrote:

But it ain't easy the first time.


If you're using DB to store session data, and trying to improve session 
security, than it ain't easy even the second time. Or the third. In 
fact, I gave up on that extension before it became easy. After that my 
session-related code shrunk by half. And I have 100% control over what 
happens and when it happens.


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



Re: [PHP] [EMAIL PROTECTED]

2005-11-14 Thread Jasper Bryant-Greene

Miles Thompson wrote:

Can someone get rid of him?
Every time I post, which I admit is not often, I get a bounce.


Yeah, same. I think there was some discussion recently regarding it but 
I don't know what happened.


I even tried to go to www.xasamail.com and register an account ale0952 
just to stop the bounces, but it appears there is no way to sign up on 
that webmail site.


Jasper

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



[PHP] Can't use secure file wrappers - Windows

2005-11-14 Thread Chuck Anderson

[I've had this posted in the php.windows group for a few days, but I got no 
replies there.]

I have been plugging away at this for some time now and I can not figure out 
how to get https and ftps as registered streams in my Windows installation of 
Php (4.4.0).  My direct need is to use fopen on secure URLs - https.

(I've installed openssl - enabled the Php openssl extension - and verified that 
my copy of Php was compiled with the openssl module.)

The latest thing I have read says that I need a "special" copy of 
php4ts.dll in order to enable secure streams (https, ftps) in Php on 
Windows (XP, in my case).


The posts I read point to copies of php4ts.dll for Php 4.3.4.

I am running Php 4.4.0.  Where can I find a copy of php4ts.dll for 
Php4.4.0 that enables secure streams?


(And is that really the solution in Php 4.4.0?)

Thanks in Advance

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



[PHP] Re: Filtering and Escaping (Was: Select and $_POST)

2005-11-14 Thread GamblerZG

Richard Lynch wrote:

If you had anything other than $_OCLEAN in an echo and friends, then
you would know you were screwing up.


Personally, if I pull something info from the database, then I do not 
usually sanitize it. Yes, I know it's less secure, but I'm willing to 
take such (negligible) risk for extra performance. So I sanitize data on 
input only.


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



Re: [PHP] mod_rewrite and include paths

2005-11-14 Thread Marcus Bointon


On 14 Nov 2005, at 18:51, Richard Lynch wrote:


include_path("/full/path/to/DocumentRoot:" . include_path());
This may not be the right syntax/function to set include_path, but it
is a dynamic way to set the include path, from within PHP.


Yup, I tried this and it kind-of works, but still leads to some weird  
behaviour.



INSTEAD, do this.

Create a PHP script, and name it 'x'

In .htaccess, force 'x' to be PHP as far as Apache is concerned:

  ForceType application/x-httpd-php


You can now access your "x=123" from $_SERVER['PATHINFO'] (or is it
'PATH_INFO'?

No more endless tweaking of Regex rules in httpd.conf and logging the
mod_rewrite and dinking with ^/[0-9]+ junk and re-starting Apache
every time you want to try a change.


That's a nice trick - I'll have to remember that. My rules are  
in .htaccess (as seems normal for 'deployable' systems) so I don't  
need to restart apache and it's easy to twiddle with them, and  
besides, I like regexes ;^) The issue isn't really the passing of  
parameters (which your approach deals with very nicely), it's that  
PHP gets fooled into thinking that it's somewhere that it's not. The  
most annoying thing about this problem is that I'm sure it should  
'just work', and I know I've seen it do so before in both my scripts  
and others - Serendipity has an almost identical setup for rewrites  
and it doesn't do anything special to work with them - all this  
futzing with paths that mod_rewrite does is long finished by the time  
that PHP gets to hear about anything - PHP never has to know the real  
URL, it should be happy to deal with the rewritten one.


The problem seems to be that given the incoming URL:

/x/123

this gets rewritten to

/x.php?x=123

and it does run the correct script in the correct directory, however,  
once it's running PHP acts as if it had said:


/x/x.php?x=123

Which just breaks paths everywhere. I know that this is what the  
passthrough option is supposed to deal with, but removing it doesn't  
help either. Maybe I should look more carefully at my RewriteBase etc.


I've asked in sitepoint apache forums too, see if anyone there has  
any idea.


Thanks for the ideas.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] Printing to a buffer

2005-11-14 Thread Marcus Bointon

On 14 Nov 2005, at 19:01, Richard Lynch wrote:


It may not be my final choice whether they download or not, but if a
browser doesn't treat:
application/octet-stream
as a download, and only as a download, then that browser is pretty
broken.

Letting the user configure their browser for that MIME type to be
opened by an application is just plain wrong for a browser, by
specification.

If you find a browser that lets you configure application/octet-stream
to be opened with a specific application, then file a bug report with
whomever wrote that browser.


There's no such spec for browsers per se (which is why they vary so  
much) - they are just HTTP clients. I can think of a perfectly  
reasonable situation where I would want a plugin to handle  
application/octet-stream - say I'm pulling some arbitrary binary data  
and while I'm debugging, an in-browser hex dump could be very useful.  
The other thing is that I may be being forced to use that 'wrong'  
MIME type to work around bad implementations of content- 
disposition... I know that's not a common situation, but there should  
be nothing preventing me from doing it. There are browsers that don't  
do downloads at all (I've written some), there are others that do  
nothing but downloads (I use Interarchy for just that). I could offer  
a similar opinion about the browsers that have odd implementations of  
content-disposition.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] Re: Filtering and Escaping (Was: Select and $_POST)

2005-11-14 Thread Chris Shiflett

GamblerZG wrote:

> If you had anything other than $_OCLEAN in an echo and friends, then
> you would know you were screwing up.

Personally, if I pull something info from the database, then I do not
usually sanitize it. Yes, I know it's less secure, but I'm willing to
take such (negligible) risk for extra performance. So I sanitize data
on input only.


Sanitizing is an alias for filtering and has nothing to do with 
escaping. One should never be considered a substitute for the other, 
although this is a common mistake.


Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



[PHP] Re: Zend + Eclipse + Standized Framework

2005-11-14 Thread Roman Ivanov

Dan Rossi wrote:
Personally, i am trying to avoid all these frameworks until 
everyones ideas are collabroated into one as i think they only work for 
some or for the developers purposes only.


What features do you need from a framework?

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



[PHP] Re: Zend + Eclipse + Standized Framework

2005-11-14 Thread Roman Ivanov

Dan Rossi wrote:
Just found this article via phpeclipse.de stating Zend will be including 
Eclipse framework in their development schedules :)


http://www.zend.com/news/zendpr.php?id=109

Id like to know more about this standardized application framework.


Me too, considering the fact that I spent last 1.5 years developing my 
own PHP framework.


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



Re: [PHP] Re: Zend + Eclipse + Standized Framework

2005-11-14 Thread Esteamedpw
_http://andigutmans.blogspot.com/_ (http://andigutmans.blogspot.com/) 
 
Andi talks about the Framework on his Blog.
 
- Clint


[PHP] Re: Can't use secure file wrappers - Windows

2005-11-14 Thread James Benson

Could use the xampp package or just the openssl & php from it,


http://www.apachefriends.org/en/xampp.html





Chuck Anderson wrote:
[I've had this posted in the php.windows group for a few days, but I got 
no replies there.]


I have been plugging away at this for some time now and I can not figure 
out how to get https and ftps as registered streams in my Windows 
installation of Php (4.4.0).  My direct need is to use fopen on secure 
URLs - https.


(I've installed openssl - enabled the Php openssl extension - and 
verified that my copy of Php was compiled with the openssl module.)


The latest thing I have read says that I need a "special" copy of 
php4ts.dll in order to enable secure streams (https, ftps) in Php on 
Windows (XP, in my case).


The posts I read point to copies of php4ts.dll for Php 4.3.4.

I am running Php 4.4.0.  Where can I find a copy of php4ts.dll for 
Php4.4.0 that enables secure streams?


(And is that really the solution in Php 4.4.0?)

Thanks in Advance


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



[PHP] Re: emailing MySQL list not working

2005-11-14 Thread Bruce Gilbert
Sorry for the newbie question...

I did a search on php.net but didn't find my answer.

what does \r\n do as opposed to just \n?

and yes, I know what  \n does.


On 11/14/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Fri, November 11, 2005 9:33 pm, Bruce Gilbert wrote:
> > $headers = "From: $sender";
> > $headers .= "Reply-To: $reply_to";
> > $headers .= "Return-Path: $return_path";
>
> > $headers .= "X-Sender: $x_sender";
> > $headers .= "X-Mailer: PHP4\n"; //mailer
>
> These two may trip some spam filters.
>
> > $headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
>
> Setting this at all probably trips a few spam filters.
>
> > $headers .= "Mime-Version:1.0\n Content-Type: text/plain;
> > charset=\"iso-8859-1\nContent-Transfer-Encoding: 8bit\n";
> >
> > mail( $recipient, $subject, stripslashes($message), $headers );
>
> Check the return error code!!!
> http://php.net/mail
>
> > sleep(1);
>
> Just how many emails are you trying to send with mail()?
>
> http://php.net/mail was never designed for heavy-volume lists...
>
> Look into http://phpclasses.org for something that WAS designed to
> handle the volume you need.
>
> > }
> >
> > // run second query to automatically dump unsubscribed email
> > addresses.
>
>
> > $query2 = "
> > DELETE FROM
> > mailinglist
> > WHERE
> > subscribe='0'
> > AND
> > confirmed='0' ";
> >
> > //run the query
> > mysql_query($query2, $link) or die (mysql_error());
>
> Dude, if I unsubscribed, get me off the list *BEFORE* you send out
> another email, not after.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
>
>


--
::Bruce::

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



Re: [PHP] Re: emailing MySQL list not working

2005-11-14 Thread Jasper Bryant-Greene

Bruce Gilbert wrote:

Sorry for the newbie question...

I did a search on php.net but didn't find my answer.

what does \r\n do as opposed to just \n?

and yes, I know what  \n does.


Different platforms have different line-break conventions. \n is a line 
feed, while \r is a carriage return (these names date from typewriters, 
I believe!)


I think that \r\n is the standard way to separate header fields in HTTP 
and SMTP, but maybe it's just the most interoperable way. Everyone I 
know does it, so I'm just being a sheep...


Jasper

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



Re: [PHP] Re: Zend + Eclipse + Standized Framework

2005-11-14 Thread Greg Donald
On Mon, 2005-11-14 at 03:55 -0500, Roman Ivanov wrote:
> What features do you need from a framework?

Convention over configuration.  (Yaml, not XML.  ActiveRecord not
Propel/Phing.)

A persist-able domain model where logic and data are presented in one
wrapping.  (I don't want to re-assign my data in the view for use in the
template after it's already ready already in the controller, pointless.)

A database-agnostic database abstraction layer capable of using database
meta data effectively.  (Why am I still writing SQL?)

Ajax, built-in.  (Cause all the cool kids are using it.)


-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



[PHP] Re: Can't use secure file wrappers - Windows

2005-11-14 Thread Chuck Anderson

James Benson wrote:


Could use the xampp package or just the openssl & php from it,


http://www.apachefriends.org/en/xampp.html

 

Hey thanks.  I may give that a try, but I already have two full apache 
servers loaded on my PC.  What I can't figure out is why these secure 
streams are not registered.  I seem to have done everything needed.


If I get some free time this week, I may install Xampp - see what happens.





Chuck Anderson wrote:
 

[I've had this posted in the php.windows group for a few days, but I got 
no replies there.]


I have been plugging away at this for some time now and I can not figure 
out how to get https and ftps as registered streams in my Windows 
installation of Php (4.4.0).  My direct need is to use fopen on secure 
URLs - https.


(I've installed openssl - enabled the Php openssl extension - and 
verified that my copy of Php was compiled with the openssl module.)


The latest thing I have read says that I need a "special" copy of 
php4ts.dll in order to enable secure streams (https, ftps) in Php on 
Windows (XP, in my case).


The posts I read point to copies of php4ts.dll for Php 4.3.4.

I am running Php 4.4.0.  Where can I find a copy of php4ts.dll for 
Php4.4.0 that enables secure streams?


(And is that really the solution in Php 4.4.0?)

Thanks in Advance
   



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



[PHP] Template Question

2005-11-14 Thread Leonard Burton
HI All,

In your template parsing classes do you put the code for tags in
seperate files or do you have some kind of array or other method of
assigning the action associated with the tag?

I have been putting the code for the tags in a dat/tag.dat file and
then including the file wherever the tag is called.  For good measure
I call the attributes in the tags (which a returned by a regex) as
$ATTRIBUTES['name']. and then any data needing passed back from the
code in the tag I call $PASSBACK['name'].

Does this seem standard?  I have looked through a few template parsing
classes and feel it is easier to come up with my own than it is to use
most of them.

Thanks,

--
Leonard Burton, N9URK
[EMAIL PROTECTED]


"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

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



Re: [PHP] Template Question

2005-11-14 Thread Robert Cummings
On Mon, 2005-11-14 at 23:42, Leonard Burton wrote:
> HI All,
> 
> In your template parsing classes do you put the code for tags in
> seperate files or do you have some kind of array or other method of
> assigning the action associated with the tag?
> 
> I have been putting the code for the tags in a dat/tag.dat file and
> then including the file wherever the tag is called.  For good measure
> I call the attributes in the tags (which a returned by a regex) as
> $ATTRIBUTES['name']. and then any data needing passed back from the
> code in the tag I call $PASSBACK['name'].
> 
> Does this seem standard?  I have looked through a few template parsing
> classes and feel it is easier to come up with my own than it is to use
> most of them.

I don't think there's a standard per se :) Different template systems
reach for different results and employ different methods in doing so. At
some point though there needs to be something to handle the
content/attributes and so your inclusion system works.

My own system requires that custom compilers be configured (registered)
in the project config file, and then the template manager loops over
each entry and allows each one to process the content in turn. Most of
these custom compilers inherit from a base compiler class and so the
actual parsing code is shared, upon parsing, the code performs a call to
tag handling methods contained/registered in the compiler object that
can process the content that was parsed. In this way custom compilers of
different semantics can be plugged in with a simple registry entry.
Additionally within this system the generated content can itself include
custom tags/content which can subsequently be reparsed. This can cause
recursion issues if the developer isn't wary, but allows for the
building of custom tags based on smaller custom tags.

HTH,
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] Create a numeric hash from a text string?

2005-11-14 Thread Curt Zirzow
On Mon, Nov 14, 2005 at 02:08:08PM -0600, Richard Lynch wrote:
> On Mon, November 14, 2005 12:41 pm, Brian Dunning wrote:
> > Does anyone know if there's a handy way to create a numeric hash from
> > a text string? I'm trying to generate an integer as a sort of quick &
> > dirty checksum for text strings. Needs to be a decimal integer, not
> > hex or otherwise. Any clever ideas appreciated.   :)
> 
> 
> You're probably better off re-thinking your "needs to be an integer"
> requirement, though, honestly, unless there is some really really
> compelling driving external force at work.

yeah, i would tend to agree.  I'm not sure what your 'Integer'
requirements are but if you use md5() or sha1(), you will more
likely be able to validate the content more reliably vs crc32().

Curt.
-- 

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