Re: [PHP] julian date

2004-02-09 Thread Adam Bregenzer
On Mon, 2004-02-09 at 00:32, adwinwijaya wrote:
> Hello php-general,
> 
>   I wonder is there any class/function in php to convert from dates
>   (dd/mm/ hh:mm:ss) to Julian date ?
> 
>   (I also wonder why there is no Julian date function in php function
>   libraries ... i think it is nice to have Julian date )

There are functions available that work with Julian dates, check the
calender section:
http://www.php.net/manual/en/ref.calendar.php

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



[PHP] Minor Heads Up

2004-02-09 Thread Gerard Samuel
Tested on winXP/Apache 2.0.48 (cgi)

php 4.3.3
var_dump( __FILE__ );
gives -> C:\Program Files\Apache Group\Apache2\htdocs\index.php

php 4.3.4
var_dump( __FILE__);
gives -> c:\program files\apache group\apache2\htdocs\index.php

php 4.3.5RC2
var_dump( __FILE__ );
gives -> C:\Program Files\Apache Group\Apache2\htdocs\index.php

The contents of __FILE__ in php 4.3.4 is lower cased, but seems to be working 
correctly in 4.3.5RC2, hence the reason why I didn't submit a bug report.
So if anyone asks, its in the archives, and I hope the powers to be
makes sure that 4.3.5 interpretation of __FILE__ stays the way it is...

Thanks

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



[PHP] php5: read-only variables

2004-02-09 Thread Vivian Steller
hello,

talking about php5, i'm missing "read-only" attributes/variables for
classes/objects. i.e. this would be very useful for implementing the new
DOM Level 3 Interfaces as given in http://www.w3.org/TR/2003
CR-DOM-Level-3-Core-20031107/idl-definitions.html .

And I don't think of any reason for Zend-Developers not to implement a
little keyword "readonly"... particularly they're using it in there C-Code
as you can see by testing the following script:

tagName = "test"; // this, of course, doesn't work...

print($root->tagName);
$root = $doc->appendChild($root);
?>

The output is a fatal error:
Fatal error: main() [function.main]: Cannot write property in ... on line 5

But i don't think they'll make any changes on it at this (beta) state?

If anybody has an acceptable fake-solution, please let me know...
thanks

vivi

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



[PHP] file access to "virtual files"

2004-02-09 Thread merlin
Hi there,

there is following scenario:
- One php file saved with .pdf extension
- .htaccess tells php to parse this file
- ?ID=x provides the database id for individual files
That whole thing workes perfectly as long as you access it via browser 
and URL.

Now I need to save those files, or send them as an email attachement.
I am using a phpmailer class. When I try to access the file with the ? 
and parameters email transaction failes.

$mail->AddAttachment('/invoice-sample.pdf?id='.$sl[ID], "invoice.pdf");

Has anybody an idea how to solve this or where the problem lives?

Thank you for any suggestion on that,

Merlin

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


Re: [PHP] Novell and PHP

2004-02-09 Thread Harry Sufehmi
On 06/02/2004 at 14:09 [EMAIL PROTECTED] wrote:
>Can someone explain what this all means then
>http://forge.novell.com/modules/xfmod/project/?php
>Are they supporting php or are they planning to take over something that is
>impossible ?

I'm guessing that they're tailoring PHP to their (Novell's) needs, and bundle them as 
part of their solution.

Their customers probably won't even realize that PHP is in their server, just as 
Apache already do. They'll just see even better packaged product from Novell.


>We have novell systems at work, if this means easier intergration with php
>on unix with novell products like ldap intergration, great :D. I think from
>what we know groupwise ldap is not a standard system which will work with
>openldap :\

Probably PHP for Netware will adapt to their version of LDAP, but I guess then the PHP 
team/anyone could always use that code for our own use.


regards,
-HS
--
Kampanye open-source Indonesia - http://www.DariWindowsKeLinux.com
Solusi canggih, bebas ikatan, dan bebas biaya

v0sw6Chw5ln3ck4u6Lw5-2Tl6+8Ds5MRr5e7t2Tb8TOp2/3en5+7g5HC - hackerkey.com

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



Re: [PHP] file access to "virtual files"

2004-02-09 Thread Jason Wong
On Monday 09 February 2004 16:23, merlin wrote:

> there is following scenario:
> - One php file saved with .pdf extension
> - .htaccess tells php to parse this file
> - ?ID=x provides the database id for individual files
>
> That whole thing workes perfectly as long as you access it via browser
> and URL.
>
> Now I need to save those files, or send them as an email attachement.
> I am using a phpmailer class. When I try to access the file with the ?
> and parameters email transaction failes.
>
> $mail->AddAttachment('/invoice-sample.pdf?id='.$sl[ID], "invoice.pdf");

That is telling php to get the file '/invoice-sample.pdf?id=XXX...' through 
the local filesystem, ie not through HTTP, and as such it will not be 
parsed/interpreted by php.

> Has anybody an idea how to solve this or where the problem lives?

You need to open the file through HTTP, whether you can do that depends on 
your version of PHP and the platform it's running on.

If the phpmailer class can handle the opening of files via HTTP then it should 
be a simple:

$mail->AddAttachment('http://www.yourwebserver.com/invoice-sample.pdf?id='.$sl[ID], 
"invoice.pdf");

Otherwise you need to manually read in the file then feed it into 
$mail->AddAttachment (somehow)

So something like:

  fopen('http://www.yourwebserver.com/invoice-sample.pdf?id='.$sl[ID], 'r');

along with your favourite file reading function.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Nothing is so often irretrievably missed as a daily opportunity.
-- Ebner-Eschenbach
*/

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



[PHP] Re: [PHP-QA] php5: read-only variables

2004-02-09 Thread Jan Lehnardt
Hi,
On 9 Feb 2004, at 8:26, Vivian Steller wrote:
hello,

talking about php5, i'm missing "read-only" attributes/variables for
classes/objects. i.e. this would be very useful for implementing the 
new
DOM Level 3 Interfaces as given in http://www.w3.org/TR/2003
CR-DOM-Level-3-Core-20031107/idl-definitions.html .

And I don't think of any reason for Zend-Developers not to implement a
little keyword "readonly"... particularly they're using it in there 
C-Code
as you can see by testing the following script:
Please see http://cvs.php.net/co.php/ZendEngine2/ZEND_CHANGES
Especially
[...]
* Constants.
 The Zend Engine 2.0 introduces per-class constants.

 Example:

 
 echo 'Foo::constant = ' . Foo::constant . "\n";
 ?>
 Old code that has no user-defined classes or functions
 named 'const' will run without modifications.
[...]

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


Re: [PHP] Running Apache in one machine and php in another

2004-02-09 Thread Harry Sufehmi
On 06/02/2004 at 11:55 Mrs. Geeta Thanu wrote:
>This is in addition to my previous mail.
>I feel the PHP script and the C program should be in one machine
>and apache in another.
>When a user click the link the php script should upload a form get the
>input and show the result.
>So apache should support running PHP in another machine.Is it possible.

It's possible.

The easiest way to do this is:

# On the webserver, you just need Apache, with a redirection setup.
So if a user entered http://webserver/genome-processing/ then it'll be redirected to 
http://application-server/genome-processing/
Example (put these in httpd.conf):



ProxyPass /genome-processing/ http://application-server/genome-processing/
ProxyPassReverse /genome-processing/ http://application-server/genome-processing/



# On the application server, you'll need Apache+PHP and that C program.
genome-processing/index.php in this box should process all user input, and then 
execute the C program with system() function:
http://uk.php.net/manual/en/function.system.php

# Ensure that the output from the C program can be easily parsed in PHP, or better 
yet, already HTML-tagged properly so you don't need to process it any further in your 
PHP script - just printf() the whole of its output straightaway.

There are other ways to do this, but as I said I think this is the easiest way.
CMIIW of course.


regards,
-HS



>On Fri, 6 Feb 2004, Jason Wong wrote:
>> On Saturday 07 February 2004 02:57, Mrs. Geeta Thanu wrote:
>> > I have configured Apache webserver executing PHP scripts on sun machine
>> > and everything is  working fine.
>> >
>> > Now I want the web server to pass on the PHP executions to
>> > another machine and once done should get the result and display it.
>> >
>> > Is it possible .

--
Kampanye open-source Indonesia - http://www.DariWindowsKeLinux.com
Solusi canggih, bebas ikatan, dan bebas biaya

v0sw6Chw5ln3ck4u6Lw5-2Tl6+8Ds5MRr5e7t2Tb8TOp2/3en5+7g5HC - hackerkey.com

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



[PHP] Re: [PHP-QA] php5: read-only variables

2004-02-09 Thread Vivian Steller
Jan Lehnardt wrote:

> [...]
> * Constants.
> 
> The Zend Engine 2.0 introduces per-class constants.
> 
> Example:
> 
>  class Foo {
> const constant = 'constant';
> }
> 
> echo 'Foo::constant = ' . Foo::constant . "\n";
> ?>
> 
> Old code that has no user-defined classes or functions
> named 'const' will run without modifications.
> 
> [...]

thanks, but i think constants are not the same as readonly variables!!
a constant - as the name sais - are values that should never be changed. but
in my example 

tagName = "test"; // this, of course, doesn't work...

print($root->tagName);
$root = $doc->appendChild($root);
?>

the constructor (/another class-) function of DomElement has to set the
object variable $root->tagName to "root", of course. this is why tagName
isn't defined as constant...
further you CAN read $root->tagName, but not set it - so it is a real
READONLY variable, define in C-Code of Zend Engine...

anyway, thanks a lot...

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



[PHP] Submitting several forms

2004-02-09 Thread Chitchyan, Ruzanna
Hi all
I have the following problem:
I want to allow users to update a number of records either one by one, or all 
together. Currently I have put each record in a separate form on a page and each form 
can be updated separately, but I don't know how to allow simultaneous update of all 
forms (without reverting to JavaScript). Any help is greatly appreciated.
Thanks
Rouza

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



[PHP] Re: php5: read-only variables

2004-02-09 Thread Alex Farran
Vivian Steller writes:

> hello,
> talking about php5, i'm missing "read-only" attributes/variables for
> classes/objects. i.e. this would be very useful for implementing the new
> DOM Level 3 Interfaces as given in http://www.w3.org/TR/2003
> CR-DOM-Level-3-Core-20031107/idl-definitions.html .

...

> If anybody has an acceptable fake-solution, please let me know...
> thanks

I don't think there's a good reason not to have read-only members.
Java and C++ don't either, but Eiffel does.  You fake it by declaring
them private and writing a get_foo() method for each one.  Done this
way it it is tedious and ugly, but by overloading member access with
the __get( $name ) method, you can achieve the same functionality with
fewer lines of code and a cleaner interface to client classes.  See
under overloading in http://www.php.net/zend-engine-2.php for
examples.

-- 

__oAlex Farran
  _`\<,_   Analyst / Programmer
 (_)/ (_)  www.alexfarran.com

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



Re: [PHP] Submitting several forms

2004-02-09 Thread Marek Kilimajer
make it one form and name the form elements using [], they will become 
arrays. example:






the numbers (1 and 2) are ids of the records. then you loop the array 
and update the rows:

foreach($_POST['name'] as $id => $null) {
	update table set name='{$_POST['name'][$id]}', 
surname='{$_POST['surname'][$id]}' where id='$id'
}

Chitchyan, Ruzanna wrote:
Hi all
I have the following problem:
I want to allow users to update a number of records either one by one, or all 
together. Currently I have put each record in a separate form on a page and each form 
can be updated separately, but I don't know how to allow simultaneous update of all 
forms (without reverting to JavaScript). Any help is greatly appreciated.
Thanks
Rouza
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] datetime control

2004-02-09 Thread Angelo Zanetti
is there a date picker object or control that i can use on an HTML page,
instead of making lots of dropdown lists for the various date fields?

thanx in advance
angelo


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP] ftell ? fseek ? help, please

2004-02-09 Thread Anna Yamaguchi
I would like to read first 224 bytes from a file A1, write them to another
(Bfile, and then coming back to file A1 read bytes from 225 to the end of
(Bfile.
(BCould somebody help me with this? Please.
(B
(BAnna
(B
(B[EMAIL PROTECTED]

Re: [PHP] datetime control

2004-02-09 Thread Tom Rogers
Hi,

Monday, February 9, 2004, 10:42:24 PM, you wrote:
AZ> is there a date picker object or control that i can use on an HTML page,
AZ> instead of making lots of dropdown lists for the various date fields?

AZ> thanx in advance
AZ> angelo

AZ> 
AZ> Disclaimer 
AZ> This e-mail transmission contains confidential information,
AZ> which is the property of the sender.
AZ> The information in this e-mail or attachments thereto is 
AZ> intended for the attention and use only of the addressee. 
AZ> Should you have received this e-mail in error, please delete 
AZ> and destroy it and any attachments thereto immediately. 
AZ> Under no circumstances will the Cape Technikon or the sender 
AZ> of this e-mail be liable to any party for any direct, indirect, 
AZ> special or other consequential damages for any use of this e-mail.
AZ> For the detailed e-mail disclaimer please refer to 
AZ> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911


http://javascript.internet.com/calendars/date-picker.html

-- 
regards,
Tom

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



[PHP] Exception handlind in PHP 4 a'la PHP5

2004-02-09 Thread aka MacGuru
Hi,

PHP 5 stable is not on the horizon yet. Someone have any idea how to 
emulate (or to be more precise, simulate), this feature in PHP 4 (I 
could do it if PHP4 would support macros and "goto", but there are no 
such).

Thanks in advance for any suggestion(s).

*
*   Best Regards   ---   Andrei Verovski
*
*   Personal Home Page
*   http://snow.prohosting.com/guru4mac/
*   Mac, Linux, DTP, Development, IT WEB Site
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] DLL in PHP?

2004-02-09 Thread Radwan Aladdin
Hi All,

Just would like to know if you can call DLL from PHP the same way you do in ASP? If so 
then can any one pass me some example or links.


Cheers..


[PHP] amfphp

2004-02-09 Thread Edward Peloke
Hello,

Is anyone using flash in conjunction with amfphp on a production site?  I am
really interested in trying it out and have been to the amfphp site, now am
just looking for some more examples of what it can do.

Thanks,
Eddie

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



[PHP] apache2 hanging

2004-02-09 Thread Bryan Simmons
I'm using php 4.3.4 as a loadable module for Apache2
on a Redhat box.
It works for the most part except that for about every
5th page that is
requested, the server hangs.  It always finishes the
process and the
page but it hangs for like 5 minutes.  Is this a known
error?  Does
anyone know how to fix this?


Regards,

Bryan Simmons
Network Systems Engineer
General Physics
410.379.3710
[EMAIL PROTECTED]


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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



Re: [PHP] beginner question about while loops

2004-02-09 Thread Jochem Maas
Paul,

   the warning that John refers to does occur - whether you see it 
depends on the error reporting level, PHP will create the array for you 
 if you have not already initialized it but a warning will be generated 
in such cases. - errors that may not display on one machine might be 
visible on another due to differences in the error reporting level.

error reporting level is set in the php.ini file (it can also be set in 
your script see http://nl2.php.net/ini_set), you probably have a line in 
your php.ini that looks like:

error_reporting = E_ALL & ~E_WARNING & ~E_NOTICE

which means: log all errors except warning level and notice level errors
I recommend you try to set the error reporting level to:
error_reporting = E_ALL

in this way all errors are logged (and possibly displayed) - if you can 
write bug/error free code with error reporting set to E_ALL then you 
will have made a good start towards more professional/better coding 
practices.

there is another php.ini line:

display_errors = On

this line determines if errors are output to the browser window. for web 
development this should be definitely on. (productions server often have 
it Off for speed and 'niceness' reasons - i.e. not many users are 
interested in seeing PHP errors, for whatever reason!)

---

as a rule of thumb it is better to initialize variable before you use them.

e.g. $pictures = array();

otherwise, in your case, if no files are present in the directory (or 
none have a 'jpg' extension) referencing the $pictures array the while 
loop will cause another error.

---
Side Note:
for beginners often RTFM only leads to more confusion because the 
contents of many technical manuals often assume that the reader has 
knowledge which a beginner does not yet have. I don't feel that this is 
very much the case of the PHP manual - my feeling is that is very 
accessible. I recommend taking the time to read all of it - the parts 
you don't yet understand often become clear with continued reading. The 
time invested in reading the manual is quickly regained!

Paul Furman wrote:

OK thanks again for helping through the stumbling blocks... I'm rolling 
again now.

John W. Holmes wrote:

Just make sure $pictures is defined as an array before you try to push a
value onto it (even using the method you have now), otherwise you'll 
get a
warning.


It seems to be working fine this way without defining it as an array but 
I guess other languages would not accept that approach.

   while ($file = readdir($dh)){
if (strstr ($file, '.jpg')){
$pictures[] = $file;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: DLL in PHP?

2004-02-09 Thread Ben Ramsey
I assume you would just register the COM object on the server and call 
it with PHP's COM functions (like in ASP).  Check out the COM functions 
in the manual:
http://www.php.net/manual/en/ref.com.php



Radwan Aladdin wrote:
Hi All,

Just would like to know if you can call DLL from PHP the same way you do in ASP? If so then can any one pass me some example or links.

Cheers..

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


Re: [PHP] DLL in PHP?

2004-02-09 Thread Stuart
Radwan Aladdin wrote:
Just would like to know if you can call DLL from PHP the same way you do in ASP? If so then can any one pass me some example or links.
If COM, http://php.net/com but if vanilla then you're looking at 
wrapping it in an extension.

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


[PHP] Re: DLL in PHP?

2004-02-09 Thread Ben Ramsey
I mean register the DLL and treat it like a COM object. :)
-Ben
Ben Ramsey wrote:

I assume you would just register the COM object on the server and call 
it with PHP's COM functions (like in ASP).  Check out the COM functions 
in the manual:
http://www.php.net/manual/en/ref.com.php



Radwan Aladdin wrote:

Hi All,

Just would like to know if you can call DLL from PHP the same way you 
do in ASP? If so then can any one pass me some example or links.

Cheers..

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


Re: [PHP] ftell ? fseek ? help, please

2004-02-09 Thread Adam Bregenzer
On Mon, 2004-02-09 at 07:21, Anna Yamaguchi wrote:
> I would like to read first 224 bytes from a file A1, write them to another
> file, and then coming back to file A1 read bytes from 225 to the end of
> file.
> Could somebody help me with this? Please.

This is the traditional method:
// Open input file
$fh = fopen('some_file', 'rb');
// Read header
$header_data = fread($fh, 224);
// Open header output file
$ofh = fopen('some_other_file', 'wb');
// Write header
fwrite($ofh, $header_data);
// Get rest of file
do {
   $data = fread($fh, 8192);
   if (strlen($data) == 0) {
   break;
   }
   $contents .= $data;
} while (true);
fclose($fh);

If you know you want the entire file, you can always use
file_get_contents.  It may behoove you to check the file size first
before reading it entirely into memory:
if (filesize('some_file') <= 1048576) {
$data = file_get_contents('some_file');
$header_data = substr($data, 0, 224);
$data = substr($data, 223);
}

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



[PHP] Re: apache2 hanging

2004-02-09 Thread Jas
Well first off you really should be posting to the Apache newsgroup, 
this is for PHP coding questions etc.

However, if you have poorly written code it could cause Apache to hang. 
 I would ask yourself a few questions, does it only happen on one 
particular website apache is running or on every site that apache is 
serving up pages for?  What kind of code are you running? PHP, Perl etc.
Have you looked in the Apache error logs yet? Usually in 
/path/to/apache/logs/error_log & access_log.  If you look at the 
requests in the error_log it will probably give you a good indication of 
why it keeps hanging.
HTH
Jas

Bryan Simmons wrote:
I'm using php 4.3.4 as a loadable module for Apache2
on a Redhat box.
It works for the most part except that for about every
5th page that is
requested, the server hangs.  It always finishes the
process and the
page but it hangs for like 5 minutes.  Is this a known
error?  Does
anyone know how to fix this?
Regards,

Bryan Simmons
Network Systems Engineer
General Physics
410.379.3710
[EMAIL PROTECTED]
__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] beginner question about while loops

2004-02-09 Thread Paul Furman
Jochem Maas wrote:
Paul,

   the warning that John refers to does occur - whether you see it 
depends on the error reporting level, PHP will create the array for you 
 if you have not already initialized it but a warning will be generated 
in such cases. ...

error_reporting = E_ALL

...
display_errors = On

...
as a rule of thumb it is better to initialize variable before you use them.

e.g. $pictures = array();

otherwise, in your case, if no files are present in the directory (or 
none have a 'jpg' extension) referencing the $pictures array the while 
loop will cause another error.


Thanks for the advice. I do think the manual is pretty good and I'll 
spend more time with it. But... I do have error reporting set to all. I 
think they may have changed the behavior on newer versions of PHP. I 
have indeed experienced the non-existant array eerror you describe. Lots 
of debugging to do!

PS here's my results from a voracious weekend of coding:

Thanks for all your help!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP, Excel, and tab delimited files question

2004-02-09 Thread jon roig
Right... But the principal is still the same. Excel handles those types
of fields in a uniform way, regardless of whether you do the entry
yourself or if you just import a csv file.

-- jon

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 06, 2004 5:15 PM
To: jon roig
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP, Excel, and tab delimited files question


jon roig wrote:
> Nah... Try it in excel itself and you'll see what I'm talking about. 
> You have to do it in numeric fields.
> 
> Do this in an excel field:
> - Type 10 and hit return.
> ... It becomes 10, right?
> 
> Now try it like this: '000100
> ... Tada! It stays as 00100 and puts a little green tab in the top 
> left corner.
> 
> There's no closing ' in this example, just the opening one at the 
> beginning of the text.
> 
> Hope that helps... 'course, I'm using excel 2002, so maybe different 
> versions do different things...
> 
>   -- jon
> 

This is different. You are talking about inputing data in excell 
application, but Jay is building csv file.

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
 

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



[PHP] Linked Tables

2004-02-09 Thread Sajid
What is the way to generate XML from MySql database using PHP?

Is DOMXML the only way? I dont have it installed on my server, can i still
get XML output?

I know the workaround like i query the database and echo a XML, but i am
looking for alternatives.

Thanks

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



Re: [PHP] Linked Tables

2004-02-09 Thread Michal Migurski
>What is the way to generate XML from MySql database using PHP?
>
>Is DOMXML the only way? I dont have it installed on my server, can i
>still get XML output?
>
>I know the workaround like i query the database and echo a XML, but i am
>looking for alternatives.

echo, printf, etc. XML is nothing more (or less) than text, so I wouldn't
call that a "workaround". DOMXML seems like complete overkill to me,
for a situation where you only need to generate XML for export.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] Linked Tables

2004-02-09 Thread Marek Kilimajer
Sajid wrote:

What is the way to generate XML from MySql database using PHP?

Is DOMXML the only way? I dont have it installed on my server, can i still
get XML output?
I know the workaround like i query the database and echo a XML, but i am
looking for alternatives.
Do it this way. It's easy and less memory consuming.

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


Re: [PHP] Whoa!!! e-Mail virus from bugs.php.net!

2004-02-09 Thread Scott Fletcher
Thanks

"Stuart" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Scott Fletcher wrote:
> > How on earth can bugs.php.net get infected???  I'm not even familiar
with
> > PHP bug #12494 'cause I never filed it or comment on it.
> >
> > I think somebody should look into bugs.php.net webserver/e-mail server
to
> > see that it is not infected.  Honestly
>
> Highly unlikely. Worms tend to fake the from address with an address
> picked at random from the infected users address book - that way they
> are likely to get past the simplest anti-spam measures. We've been
> getting hundreds of these a day lately. Damn pain they are too.
>
> -- 
> Stuart

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



[PHP] XML and Excel

2004-02-09 Thread Jake McHenry
Hi everyone. Since my last post of outputing to excel, I have converted my output to 
XML, quite happy with myself. It looks perfect. Perfect on my set that is. I have win 
xp with office xp. Excel with office xp recognizes XML. Office 2000, which the rest of 
my company is using, doesn't. Does anyone know of a way I can take the XML I have now 
and have office 2000 recognize it? I feel kinda stupid... lol  Sent out an email to my 
accounting department saying it was ready for them and all they get is garbage on 
their screen.

Anyone know of anything I can do?

Thanks,
Jake

RE: [PHP] PHP, Excel, and tab delimited files question

2004-02-09 Thread Jay Blanchard
[snip]
Right... But the principal is still the same. Excel handles those types
of fields in a uniform way, regardless of whether you do the entry
yourself or if you just import a csv file.
[/snip]

Actually that is not correct. We have prefaced the data with the single
quote in the output process and that single quote is visible in each
cell where that occurs. 

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



RE: [PHP] PHP, Excel, and tab delimited files question

2004-02-09 Thread Robert Sossomon
It may wind up being a user-learning issue.

I dump things to pipe delimited file (whether in *nix land or winDoze)
and that way the users can open it in Excel.  The ones who have to open
the files I just go to their desks the first time and show them how to
open the file, delimit it on the | and then on the "Next" screen change
the ### field to TEXT to keep it formatted correctly.  A pain in the
betuty the first time, but once they are shown they understand it.  If
they have to do work with the file they then save it local to their
machine and start hacking it in the way they want.

Only way I found to work around quotes and things, but I'm always
willing to learn new tricks.  :)

Robert

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



[PHP] mnoGoSearch on Windows?

2004-02-09 Thread Ben Ramsey
According to the PHP manual, the mnoGoSearch extension is not available 
on the Windows platform.  I had considered installing mnoGoSearch on our 
Windows box running PHP (even though I will have to pay for the Windows 
version of mnoGoSearch).  However, now that I've seen this in the 
manual, I want to know what my other search engine options may be (for 
preferably free, open-source software).

The search engine must index the site like a regular spider, and it 
should include have the ability to include PDF docs, Word docs, etc. and 
be configurable enough to exclude certain folders, etc.  I would also 
like the ability to access the engine through PHP, if possible.

Any suggestions or favorites out there?  I would prefer not to write one 
on my own.

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


[PHP] new user of php

2004-02-09 Thread Dominique ANOKRE
hello, 

i am a new user of php (and i speak french - but try to write english as well as 
possible) and 
i have a project consists to implement a web interface (with php) to connect a 
database (interbase) on 
plattform windows.
So where is the best link to download some documentation about php with interbase.

regards

Dominik


Re: [PHP] new user of php

2004-02-09 Thread Chris Garaffa
On Feb 9, 2004, at 12:22 PM, Dominique ANOKRE wrote:
So where is the best link to download some documentation about php 
with interbase.
The best place to get documentation about PHP is the PHP website at 
http://www.php.net
For InterBase functions, you should check out this page: 
http://www.php.net/manual/en/ref.ibase.php

--
Chris Garaffa
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] triple DES encryption

2004-02-09 Thread craig
Hi all,
I have to replicate the file encryption of a desktop bound
application. This means using triple DES, but I can't find 
anything on the web or in the maunual (other than single 
DES).

Does anyone know if it is doable to implement this using php, 
or if I should just tell the client that it can't be done?

TIA,
Craig

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



php-general Digest 9 Feb 2004 17:32:27 -0000 Issue 2580

2004-02-09 Thread php-general-digest-help

php-general Digest 9 Feb 2004 17:32:27 - Issue 2580

Topics (messages 177183 through 177220):

Re: julian date
177183 by: Adam Bregenzer

Minor Heads Up
177184 by: Gerard Samuel

Re: read-only variables
177185 by: Vivian Steller
177193 by: Alex Farran

file access to "virtual files"
177186 by: merlin
177188 by: Jason Wong

Re: Novell and PHP
177187 by: Harry Sufehmi

Re: [PHP-QA] php5: read-only variables
177189 by: Jan Lehnardt
177191 by: Vivian Steller

Re: Running Apache in one machine and php in another
177190 by: Harry Sufehmi

Submitting several forms
177192 by: Chitchyan, Ruzanna
177194 by: Marek Kilimajer

datetime control
177195 by: Angelo Zanetti
177197 by: Tom Rogers

ftell ? fseek ? help, please
177196 by: Anna Yamaguchi
177206 by: Adam Bregenzer

Exception handlind in PHP 4 a'la PHP5
177198 by: Andrei Verovski (aka MacGuru)

DLL in PHP?
177199 by: Radwan Aladdin
177203 by: Ben Ramsey
177204 by: Stuart
177205 by: Ben Ramsey

amfphp
177200 by: Edward Peloke

apache2 hanging
177201 by: Bryan Simmons
177207 by: Jas

Re: beginner question about while loops
177202 by: Jochem Maas
177208 by: Paul Furman

Re: PHP, Excel, and tab delimited files question
177209 by: jon roig
177215 by: Jay Blanchard
177216 by: Robert Sossomon

Linked Tables
177210 by: Sajid
177211 by: Michal Migurski
177212 by: Marek Kilimajer

Re: Whoa!!!  e-Mail virus from bugs.php.net!
177213 by: Scott Fletcher

XML and Excel
177214 by: Jake McHenry

mnoGoSearch on Windows?
177217 by: Ben Ramsey

new user of php
177218 by: Dominique ANOKRE
177219 by: Chris Garaffa

triple DES encryption
177220 by: craig

Administrivia:

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

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

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


--
--- Begin Message ---
On Mon, 2004-02-09 at 00:32, adwinwijaya wrote:
> Hello php-general,
> 
>   I wonder is there any class/function in php to convert from dates
>   (dd/mm/ hh:mm:ss) to Julian date ?
> 
>   (I also wonder why there is no Julian date function in php function
>   libraries ... i think it is nice to have Julian date )

There are functions available that work with Julian dates, check the
calender section:
http://www.php.net/manual/en/ref.calendar.php

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
Tested on winXP/Apache 2.0.48 (cgi)

php 4.3.3
var_dump( __FILE__ );
gives -> C:\Program Files\Apache Group\Apache2\htdocs\index.php

php 4.3.4
var_dump( __FILE__);
gives -> c:\program files\apache group\apache2\htdocs\index.php

php 4.3.5RC2
var_dump( __FILE__ );
gives -> C:\Program Files\Apache Group\Apache2\htdocs\index.php

The contents of __FILE__ in php 4.3.4 is lower cased, but seems to be working 
correctly in 4.3.5RC2, hence the reason why I didn't submit a bug report.
So if anyone asks, its in the archives, and I hope the powers to be
makes sure that 4.3.5 interpretation of __FILE__ stays the way it is...

Thanks
--- End Message ---
--- Begin Message ---
hello,

talking about php5, i'm missing "read-only" attributes/variables for
classes/objects. i.e. this would be very useful for implementing the new
DOM Level 3 Interfaces as given in http://www.w3.org/TR/2003
CR-DOM-Level-3-Core-20031107/idl-definitions.html .

And I don't think of any reason for Zend-Developers not to implement a
little keyword "readonly"... particularly they're using it in there C-Code
as you can see by testing the following script:

tagName = "test"; // this, of course, doesn't work...

print($root->tagName);
$root = $doc->appendChild($root);
?>

The output is a fatal error:
Fatal error: main() [function.main]: Cannot write property in ... on line 5

But i don't think they'll make any changes on it at this (beta) state?

If anybody has an acceptable fake-solution, please let me know...
thanks

vivi
--- End Message ---
--- Begin Message ---
Vivian Steller writes:

> hello,
> talking about php5, i'm missing "read-only" attributes/variables for
> classes/objects. i.e. this would be very useful for implementing the new
> DOM Level 3 Interfaces as given in http://www.w3.org/TR/2003
> CR-DOM-Level-3-Core-20031107/idl-definitions.html .

...

> If anybody has an acceptable fake-solution, please let me know...
> thanks

I don't think there's a good reason not to have read-only members.
Java and C++ don't either, but Eiffel does.  You fake it by declaring
them private and writing a get_foo() method for each one.  Done this
way it it is tedious and ugly, but by overloading member access with
the 

[PHP] OT -> Pocket PC/PALM Application making/syncing?

2004-02-09 Thread Robert Sossomon
I know this is way off topic, but I figured some or most have hit upon
this problem, or may very well in the future.  I have been looking for
and not really found a reference online or a hardcopy book that will
tell me how to write a PALM or winDoze pocket PC application that when I
sync it to the PC will go to the web and download data.  I am finding
that I need to learn this quickly (they say) so that I can transform a
set of pages online onto a PDA for the users that can only connect at
6AM and 6PM to the website.

Any thoughts, suggestions, topics, books??

I am assuming I will have to turn the PHP pages into a web service but I
need to learn the PDA end as well.

Thanks,
Robert

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



Re: [PHP] triple DES encryption

2004-02-09 Thread "Miguel J. Jiménez"
craig wrote:

Hi all,
I have to replicate the file encryption of a desktop bound
application. This means using triple DES, but I can't find 
anything on the web or in the maunual (other than single 
DES).

Does anyone know if it is doable to implement this using php, 
or if I should just tell the client that it can't be done?

TIA,
Craig
You'll need the MCRYPT module... it has DES, 3DES and whatever you want...



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

Re: [PHP] triple DES encryption

2004-02-09 Thread Adam Bregenzer
On Mon, 2004-02-09 at 12:36, craig wrote:
> Hi all,
> I have to replicate the file encryption of a desktop bound
> application. This means using triple DES, but I can't find 
> anything on the web or in the maunual (other than single 
> DES).

The mcrypt[1] module will do triple DES as well as stronger encryption
methods.  In the manual it is referred to as 3DES.

[1] http://www.php.net/mcrypt

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



Re: [PHP] XML and Excel

2004-02-09 Thread Marek Kilimajer
Create native xls files, there are at least two classes that can help 
you, here is one: 
http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/

Jake McHenry wrote:
Hi everyone. Since my last post of outputing to excel, I have converted my output to XML, quite happy with myself. It looks perfect. Perfect on my set that is. I have win xp with office xp. Excel with office xp recognizes XML. Office 2000, which the rest of my company is using, doesn't. Does anyone know of a way I can take the XML I have now and have office 2000 recognize it? I feel kinda stupid... lol  Sent out an email to my accounting department saying it was ready for them and all they get is garbage on their screen.

Anyone know of anything I can do?

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


RE: [PHP] triple DES encryption

2004-02-09 Thread craig
Thanks, I wasn't looking for 3DES.

That should do the trick for me.

Craig

> -Original Message-
> From: Adam Bregenzer [mailto:[EMAIL PROTECTED]
> Sent: February 9, 2004 10:36 AM
> To: craig
> Cc: Php
> Subject: Re: [PHP] triple DES encryption
>
>
> On Mon, 2004-02-09 at 12:36, craig wrote:
> > Hi all,
> > I have to replicate the file encryption of a desktop bound
> > application. This means using triple DES, but I can't find
> > anything on the web or in the maunual (other than single
> > DES).
>
> The mcrypt[1] module will do triple DES as well as stronger encryption
> methods.  In the manual it is referred to as 3DES.
>
> [1] http://www.php.net/mcrypt
>
> --
> Adam Bregenzer
> [EMAIL PROTECTED]
> http://adam.bregenzer.net/
>
> --
> 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] Can PHP redirects be detected?

2004-02-09 Thread Lowell Allen
A recent thread on the WebDesign-L raised the question of whether search
engines can detect (and penalize sites for) PHP redirects of the form:

header("Location: http://www.whatever.com/";);

I don't see how that could be the case, since the redirect occurs on the
server before any HTML is output to the browser. Someone else says:

> No, the header() redirect immediately tells the /client/ to make a second
> GET request at a different location and the client (search bot) must
> actively make that 2nd request to the "Location:" URL (what happens if you
> request amazon.com)  Note this is different from simply sniffing the UA
> string from a single request and serving altered content.

What say you, PHP list? Would it be better (in terms of search engine
detection) to use include() to serve different or altered content?

TIA

--
Lowell Allen 

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



[PHP] check if user session exists

2004-02-09 Thread Christian Calloway
Given a set of session id's, is it possible to query whether a given session
exists. I am not talking about the current user session, instead I am
referring to any and all possible user sessions currently in play. For
example:

if (session_exists($sessionId)) doSomething();

I've been looking very hard for this one and haven't found an answer at all.
Any ideas?

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



Re: [PHP] Can PHP redirects be detected?

2004-02-09 Thread John W. Holmes
From: "Lowell Allen" <[EMAIL PROTECTED]>

> A recent thread on the WebDesign-L raised the question of whether search
> engines can detect (and penalize sites for) PHP redirects of the form:
>
> header("Location: http://www.whatever.com/";);
>
> I don't see how that could be the case, since the redirect occurs on the
> server before any HTML is output to the browser. Someone else says:

No, that's not the case. What you quoted below is correct.

> > No, the header() redirect immediately tells the /client/ to make a
second
> > GET request at a different location and the client (search bot) must
> > actively make that 2nd request to the "Location:" URL (what happens if
you
> > request amazon.com)  Note this is different from simply sniffing the UA
> > string from a single request and serving altered content.
>
> What say you, PHP list? Would it be better (in terms of search engine
> detection) to use include() to serve different or altered content?

As for whether a redirect is penalized or not, I doubt it. It'd be in the
best interest of the search engine to follow the link just like it's going
to follow any link on a page and index the content. Now, whether the indexed
content will show up at domain.com in the search engine or
domain.com/redirected/url/page.php, I don't know.

---John Holmes...

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



Re: [PHP] Can PHP redirects be detected?

2004-02-09 Thread joel boonstra
On Mon, Feb 09, 2004 at 02:31:16PM -0500, Lowell Allen wrote:
> A recent thread on the WebDesign-L raised the question of whether search
> engines can detect (and penalize sites for) PHP redirects of the form:
> 
> header("Location: http://www.whatever.com/";);
> 
> I don't see how that could be the case, since the redirect occurs on the
> server before any HTML is output to the browser. Someone else says:
> 
> > No, the header() redirect immediately tells the /client/ to make a second
> > GET request at a different location and the client (search bot) must
> > actively make that 2nd request to the "Location:" URL (what happens if you
> > request amazon.com)  Note this is different from simply sniffing the UA
> > string from a single request and serving altered content.

This is accurate (the explanation from webdesign-l).  Try it yourself:

===
$> telnet www.yourserver.com 80
Trying 123.456.789.000...
Connected to www.yourserver.com.
Escape character is '^]'.
GET /path/to/redir.php http/1.0
host: www.yourserver.com

HTTP/1.1 302 Found
Date: Mon, 09 Feb 2004 19:49:35 GMT
Server: GoGoGadgetWebserver/0.3
Location: http://www.example.com/
Connection: close
Content-Type: text/html

Connection closed by foreign host.
===

Assuming redir.php contains a header() call that sends "Location:", the
bot will see something like that.  It's up to them to parse that,
determine the status code (302, in this case), and decide what to do
with it.  Browsers just do this transparently.

> What say you, PHP list? Would it be better (in terms of search engine
> detection) to use include() to serve different or altered content?

Do neither.  Create excellent content, structured well, and the search
engines will reward you for this.  Try to trick them, and they will
likely figure it out and penalize you.

However, if you're asking whether or not Google can determine if you're
using include() to serve up different content based on the UserAgent or
perhaps the IP address, then no, bots can't figure that out.  Unless
they switch useragents/IPs and compare the results that they get.  Or
unless a human complains that the listing is innacurate. etc...

-- 
[ joel boonstra | gospelcom.net ]

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



Re: [PHP] Can PHP redirects be detected?

2004-02-09 Thread joel boonstra
On Mon, Feb 09, 2004 at 02:48:07PM -0500, John W. Holmes wrote:

> As for whether a redirect is penalized or not, I doubt it. It'd be in the
> best interest of the search engine to follow the link just like it's going
> to follow any link on a page and index the content. Now, whether the indexed
> content will show up at domain.com in the search engine or
> domain.com/redirected/url/page.php, I don't know.

In my experience, it depends on the status code sent with the redirect.
If it's a 302, then the original URL is indexed.  If it's a 301 (Moved
Permanently), then the redirected URL is indexed.

I have nothing to back this up other than trying it out with some sites,
and watching the results (with Google) over a few months, but it makes
sense to me.

joel

-- 
[ joel boonstra | gospelcom.net ]

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



[PHP] Re: [PHP-DB] SMTP authentication

2004-02-09 Thread John W. Holmes
From: "Marco A. Ortiz" <[EMAIL PROTECTED]>

> I want to ask you, how I must setup my PHP.INI file, to send e-mail from
my
> Web Site if my SMTP server requires authentication. Otherwise, I want to
> know if exits some kind of "public" SMTP sever that I could use.

If your SMTP server requires authentication, then you'll have to make use of
a PHP class that handles this for you. I'm sure Manuel will post a specific
link ;) but try searching the phpclasses.org site in the mean time. I know
there are several there that implement this.

The basic mail() function that uses the php.ini configuration settings
cannot do authentication.

Also, what's this got to do with databases??? (you posted to the php-db@
list!) This should be on php-general@

---John Holmes...

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



[PHP] need help with references

2004-02-09 Thread motorpsychkill
Hi,

I'm having trouble with the code below.  Basically, I'm trying to set up
$message to inherit one of two forms depending on if there is a $_GET
request.  The script works IF there is a $_GET request.  It fails if there
isn't (i.e. parse error).

Is there a way to get $message to refer to include multiple references like
below?  Thank you!

-m



" . & $links . "" . & $body;  // This is where the
trouble is.
}


$results = db_query($query);
while ($row = db_fetch_array($results)){
$links .= "" .
$row['help_topic'] . "\n";
$body .= "" . $row['help_topic'] .
"" . $row['help_text'] . "";
}

echo  $message;

?>

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



RE: [PHP] check if user session exists

2004-02-09 Thread Larry Brown
I don't know of a function, but you could possibly read the directory where
the SID files are stored.  I use sessions a lot; however, I've not tried to
accomplish this.  I don't know if by default you can read the SID directory
from a script or if this is blocked for security reasons or not.  If not,
you could read the directory, match the SIDs from your list and go from
there.  There is no way of knowing if the person is still actively using the
SID this way though.

Larry.

-Original Message-
From: Christian Calloway [mailto:[EMAIL PROTECTED]
Sent: Monday, February 09, 2004 9:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] check if user session exists


Given a set of session id's, is it possible to query whether a given session
exists. I am not talking about the current user session, instead I am
referring to any and all possible user sessions currently in play. For
example:

if (session_exists($sessionId)) doSomething();

I've been looking very hard for this one and haven't found an answer at all.
Any ideas?

--
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] XML and Excel

2004-02-09 Thread Jake McHenry
- Original Message - 
From: "Marek Kilimajer" <[EMAIL PROTECTED]>
To: "Jake McHenry" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, February 09, 2004 12:42 PM
Subject: Re: [PHP] XML and Excel


> Create native xls files, there are at least two classes that can help
> you, here is one:
> http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
>
> Jake McHenry wrote:
> > Hi everyone. Since my last post of outputing to excel, I have converted
my output to XML, quite happy with myself. It looks perfect. Perfect on my
set that is. I have win xp with office xp. Excel with office xp recognizes
XML. Office 2000, which the rest of my company is using, doesn't. Does
anyone know of a way I can take the XML I have now and have office 2000
recognize it? I feel kinda stupid... lol  Sent out an email to my accounting
department saying it was ready for them and all they get is garbage on their
screen.
> >
> > Anyone know of anything I can do?
> >
> > Thanks,
> > Jake
>

sweet.. thanks a lot.. took me about 3 hours, but I got it all converted.
works great!

Thanks again,
Jake

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



Re: [PHP] check if user session exists

2004-02-09 Thread Christian Calloway
Yeah thats pretty much what I have concluded. I was absolutely sure there
would be a way to check if a session was still active, but I guess not :-(.
Thanks though

Christian

"Larry Brown" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I don't know of a function, but you could possibly read the directory
where
> the SID files are stored.  I use sessions a lot; however, I've not tried
to
> accomplish this.  I don't know if by default you can read the SID
directory
> from a script or if this is blocked for security reasons or not.  If not,
> you could read the directory, match the SIDs from your list and go from
> there.  There is no way of knowing if the person is still actively using
the
> SID this way though.
>
> Larry.
>
> -Original Message-
> From: Christian Calloway [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 09, 2004 9:28 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] check if user session exists
>
>
> Given a set of session id's, is it possible to query whether a given
session
> exists. I am not talking about the current user session, instead I am
> referring to any and all possible user sessions currently in play. For
> example:
>
> if (session_exists($sessionId)) doSomething();
>
> I've been looking very hard for this one and haven't found an answer at
all.
> Any ideas?
>
> --
> 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] Can PHP redirects be detected?

2004-02-09 Thread Lowell Allen
> On Mon, Feb 09, 2004 at 02:31:16PM -0500, Lowell Allen wrote:
>> A recent thread on the WebDesign-L raised the question of whether search
>> engines can detect (and penalize sites for) PHP redirects of the form:
>> 
>> header("Location: http://www.whatever.com/";);
>> 
>> I don't see how that could be the case, since the redirect occurs on the
>> server before any HTML is output to the browser. Someone else says:
>> 
>>> No, the header() redirect immediately tells the /client/ to make a second
>>> GET request at a different location and the client (search bot) must
>>> actively make that 2nd request to the "Location:" URL (what happens if you
>>> request amazon.com)  Note this is different from simply sniffing the UA
>>> string from a single request and serving altered content.
> 
> This is accurate (the explanation from webdesign-l).  Try it yourself:
> 
[snip]
> 
>> What say you, PHP list? Would it be better (in terms of search engine
>> detection) to use include() to serve different or altered content?
> 
> Do neither.  Create excellent content, structured well, and the search
> engines will reward you for this.  Try to trick them, and they will
> likely figure it out and penalize you.

I'm not interested in tricking search bots. However, for the sake of
user-friendly URLs, I use mod_rewrite to send most requests to index.php,
then based on the request string I include() different content. I wanted to
verify that wasn't creating a problem with search engines.

> However, if you're asking whether or not Google can determine if you're
> using include() to serve up different content based on the UserAgent or
> perhaps the IP address, then no, bots can't figure that out.  Unless
> they switch useragents/IPs and compare the results that they get.  Or
> unless a human complains that the listing is innacurate. etc...

Thanks Joel and thanks John for confirming the WebDesign-L explanation.

--
Lowell Allen

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



[PHP] file downloads using header problem

2004-02-09 Thread Joshua Minnie
I am trying to force a file download using headers.  The problem is not
forcing the download.  That is working fine, but if the user wants to click
on another download while the first one is still downloading it won't let
the user do it.

Here is the code that I'm using, adapted from phpbuilder.com:

http://www.somewhere.com'.urldecode( $_GET['link'] );
$type = urldecode( $_GET['type'] );
$size = filesize( $pathtofile );
header("Pragma: private");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// browser must download file from server instead of cache

// force download dialog
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Type: $type");

// use the Content-Disposition header to supply a recommended filename
and
// force the browser to display the save dialog.
header("Content-Disposition: attachment;
filename=".basename($download).";");

/*
The Content-transfer-encoding header should be binary, since the file
will be read
directly from the disk and the raw bytes passed to the downloading
computer.
The Content-length header is useful to set for downloads. The browser
will be able to
show a progress meter as a file downloads. The content-lenght can be
determines by
filesize function returns the size of a file.
*/
header("Content-Transfer-Encoding: binary");
header("Accept-Ranges: bytes");
header("Content-Length: $size");

$fh = fopen( $pathtofile , "rb");
fpassthru($fh);
fclose($fh);
?>
[after this the html content is displayed]

Does anybody have any idea to allow for multiple downloads while another one
was going on.  Maybe some additional headers?  I have tried adding headers
before and after where I open the file for HTTP/1.1 200 OK and the
corresponding headers.  I have also tried using a simple meta refresh, but
that doesn't work because it won't refresh until the page is entirely
loaded.

I am at a loss, I can't seem to find answer when I google it either.  Maybe
I'm just missing something.  I don't know.

Josh

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



[PHP] [PHP5] Using exceptions to write more perfect software, but ...

2004-02-09 Thread Markus Fischer
Hi,

I've been playing around quite some while with the new exceptions in PHP5 and must say that this new feature by it self is .. well, exceptional.

However .. since internal PHP function do not make use of them, it's pretty hard to produce "exception proof" software. Because earlier or later, some internal functions will always throw an PHP warnung or error. I'm talking about run-time errors here; not fatal errors. Which brings me into the dilemma that when I wisely use exceptions to catch bad runtime behaviour, I still may get out of luck because internal functions are not aware of this. In such cases either the error won't cought or will only be caught in a later stage due the domino effect.

Simple example: take mysql_query(). If it fails in a miserable way (due to malformed SQL statement, database changes, whatever), it still only produces a warning and will return false; it's not useable from the POV of exceptions.

So, to have this area covered, I started to *duplicate* internal functions in its own namespace (static class) which , in case of errors, will throw an exception, and not only a warning (the warning is still OK, it should go to a dedicated log file anyway and not the output stream).

In practive this looks like this:

class System {
static function mysql_query() {
$arguments = func_get_args();
if (false === ($retval = call_user_func_array('mysql_query', 
$arguments))) {
if (strlen($mysql_error = mysql_error()) > 0) {
$mysql_error = "; mysql_error = " . $mysql_error;
}
throw new Exception("Unable to execute MySQL 
query$mysql_error");
}
return $retval;
}
}
But doing this now for every internal function call I don't want to lead my program into an unwanted state isn't very appealing.

I've had given hints not to use PHP as programming language if I want to have such a degree of "safety". Not possible for me, I'm pretty mature in PHP and can't afford learning another language just because of this issue.

I'm seeking for a "more perfect" programming model for application demanding that uncontrolled factors are limited to the max.

Has anyone played around with PHP5 and thought about such issues?

cheers,

- Markus

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


Re: [PHP] check if user session exists

2004-02-09 Thread Rob Adams
"Christian Calloway" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Yeah thats pretty much what I have concluded. I was absolutely sure there
> would be a way to check if a session was still active, but I guess not
:-(.
> Thanks though

It depends on your definition of 'active.'  If you wanted to see if the
specific session you are looking at has been used in the past half hour,
that is possible.  Following is a script I've used to help debug sessions
sometimes.  While it's not what you're asking for, it may help you figure
out how to do it.  It may need tweaking to run on your server.

Path: $path";
$dir = dir($path);
 while ($file = $dir->read())
 {
   $file_arr[$file]['time'] = filectime($path . '/' . $file);
   $file_arr[$file]['size'] = filesize($path . '/' . $file);
 }
 $dir->close();
asort($file_arr);
 echo 'TimeSizeSessionID';
 foreach($file_arr as $fname => $data)
{
  if ($fname == '.' || $fname == '..')
continue;
  $ftime = date('Y-m-d G:i', $data['time']);
   $sessid = substr($fname, 5);
  echo "$ftime{$data['size']}$fname";
}
 echo '';
  } else if (isset($_GET['sessionid'])) {
setcookie('PHPSESSID', $_GET['sessionid']);
 header('Location: sessioninfo.php?show=true');
 exit();
  } else {
session_start();
echo '';
 print_r($_SESSION);
 print_r($_GET);
echo '';
  }
?>



>
> Christian
>
> "Larry Brown" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I don't know of a function, but you could possibly read the directory
> where
> > the SID files are stored.  I use sessions a lot; however, I've not tried
> to
> > accomplish this.  I don't know if by default you can read the SID
> directory
> > from a script or if this is blocked for security reasons or not.  If
not,
> > you could read the directory, match the SIDs from your list and go from
> > there.  There is no way of knowing if the person is still actively using
> the
> > SID this way though.
> >
> > Larry.
> >
> > -Original Message-
> > From: Christian Calloway [mailto:[EMAIL PROTECTED]
> > Sent: Monday, February 09, 2004 9:28 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] check if user session exists
> >
> >
> > Given a set of session id's, is it possible to query whether a given
> session
> > exists. I am not talking about the current user session, instead I am
> > referring to any and all possible user sessions currently in play. For
> > example:
> >
> > if (session_exists($sessionId)) doSomething();
> >
> > I've been looking very hard for this one and haven't found an answer at
> all.
> > Any ideas?
> >
> > --
> > 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] check if user session exists

2004-02-09 Thread Christian Calloway
Yeah, my solution so far has been to check the last modified time of the
session file and then go from there. If the modified time is > then time
permitted, then that file is removed and the user's session is rendered null
and void. What I am doing is allowing a variable X number of user's to
simultaneously log-in under the same user/pass combo (account), and the
problem I face is, if none of the user's logs-out, then how will I determine
when to pop an inactive account off the stack. Good times.. thanks guys

Christian


"Rob Adams" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Christian Calloway" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Yeah thats pretty much what I have concluded. I was absolutely sure
there
> > would be a way to check if a session was still active, but I guess not
> :-(.
> > Thanks though
>
> It depends on your definition of 'active.'  If you wanted to see if the
> specific session you are looking at has been used in the past half hour,
> that is possible.  Following is a script I've used to help debug sessions
> sometimes.  While it's not what you're asking for, it may help you figure
> out how to do it.  It may need tweaking to run on your server.
>
>$path = ini_get('session.save_path');
>   if (isset($_GET['empty']))
>   {
> if (isset($_COOKIE['PHPSESSID']))
>   setcookie('PHPSESSID', '');
> header('Location: sessioninfo.php');
>   }
>   if (count($_GET) == 0)
>   {
>  echo "Path: $path";
> $dir = dir($path);
>  while ($file = $dir->read())
>  {
>$file_arr[$file]['time'] = filectime($path . '/' . $file);
>$file_arr[$file]['size'] = filesize($path . '/' . $file);
>  }
>  $dir->close();
> asort($file_arr);
>  echo ' border=1>TimeSizeSessionID';
>  foreach($file_arr as $fname => $data)
> {
>   if ($fname == '.' || $fname == '..')
> continue;
>   $ftime = date('Y-m-d G:i', $data['time']);
>$sessid = substr($fname, 5);
>   echo "$ftime{$data['size']} href=\"?sessionid=$sessid\">$fname";
> }
>  echo '';
>   } else if (isset($_GET['sessionid'])) {
> setcookie('PHPSESSID', $_GET['sessionid']);
>  header('Location: sessioninfo.php?show=true');
>  exit();
>   } else {
> session_start();
> echo '';
>  print_r($_SESSION);
>  print_r($_GET);
> echo '';
>   }
> ?>
>
>
>
> >
> > Christian
> >
> > "Larry Brown" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > I don't know of a function, but you could possibly read the directory
> > where
> > > the SID files are stored.  I use sessions a lot; however, I've not
tried
> > to
> > > accomplish this.  I don't know if by default you can read the SID
> > directory
> > > from a script or if this is blocked for security reasons or not.  If
> not,
> > > you could read the directory, match the SIDs from your list and go
from
> > > there.  There is no way of knowing if the person is still actively
using
> > the
> > > SID this way though.
> > >
> > > Larry.
> > >
> > > -Original Message-
> > > From: Christian Calloway [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, February 09, 2004 9:28 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP] check if user session exists
> > >
> > >
> > > Given a set of session id's, is it possible to query whether a given
> > session
> > > exists. I am not talking about the current user session, instead I am
> > > referring to any and all possible user sessions currently in play. For
> > > example:
> > >
> > > if (session_exists($sessionId)) doSomething();
> > >
> > > I've been looking very hard for this one and haven't found an answer
at
> > all.
> > > Any ideas?
> > >
> > > --
> > > 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] CURL and Cookies

2004-02-09 Thread Richard Miller
I would appreciate any help you can give me about a problem I am having 
with PHP's CURL functions.

I want to use CURL to download news from Wall Street Journal Online.   
When you visit the WSJ home page, you're forwarded to an authentication 
page to enter your name and password, and then forwarded back to the 
home page.  I want my CURL command to send the authentication cookie so 
when it's forwarded to the authentication page it forwards right back 
to the home page without having to enter the name and password.

I can get the following CURL command to run fine at the command prompt, 
but not in PHP:

THIS WORKS
	curl --cookie "WSJIE_LOGIN=blahblahblah" -L -O 
"http://online.wsj.com/home/us";

THIS DOESN'T WORK
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://online.wsj.com/home/us";);
curl_setopt($ch, CURLOPT_COOKIE, "WSJIE_LOGIN=blahblahblah");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);


I used a packet sniffer to see how this works.  When I request the home 
page (above) and send the WSJIE_LOGIN cookie, the home page redirects 
to the authentication page.  The authentication page uses the 
WSJIE_LOGIN cookie to generate more cookies.  Then these 5-6 cookies 
are sent back to the home page and give the user access to the content. 
 The WSJIE_LOGIN cookie is my own personal authentication cookie; the 
other cookies change from time to time.  But I noticed that the PHP 
CURL isn't perpetuating these other cookies when it forwards back to 
the home page, like the command-line CURL does.  Here are blocks from 
the package capture:

CLI CURL
	...
	192.168.001.100.63745-206.157.193.068.00080: GET /home/us HTTP/1.1
	User-Agent: curl/7.10.2 (powerpc-apple-darwin7.0) libcurl/7.10.2 
OpenSSL/0.9.7b zlib/1.1.4
	Cookie: WSJIE_LOGIN=abc
	Host: online.wsj.com
	Pragma: no-cache
	Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
	Cookie: fastlogin=xyz; wsjproducts=xyz; user_type=xyz; 
REMOTE_USER=xyz; UBID=xyz
	...

PHP CURL
...
192.168.001.100.63750-206.157.193.068.00080: GET /home/us HTTP/1.1
Cookie: WSJIE_LOGIN=abc
Host: online.wsj.com
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
...
PHP's curl doesn't forward the cookies that it is given at the previous 
page, so, of course, I don't get my content.  Any ideas why?

Richard Miller

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


[PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T

2004-02-09 Thread Ryan A
Hi,
I have a table where a users details are entered for the products he bought,
the only part that is repeated is the order_id,
I basically need to only get the order per person, and paginate for all the
customers

eg:
if user "tom" bought 3 items in the database it would be entered as:
order_id  item_name
023 soap
023 brush
023 towel

So i am trying this:
$num_rows = mysql_result(mysql_query("SELECT COUNT(*),
DISTINCT(order_number)   FROM ".$prefix."_purchases"),0);

(the idea being taht $num_rows will give my paginating part of the program
the total number of records
that match my search.)


which gives me the most pretty error of:
Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in \www\p\admin\show_purc.php on line 9

I''m pretty sure the problem is in my SQL statement, but have had no luck
searching and reading in the mysql manual for
"count" with "distinct" but am pretty sure it can be done as i have not
found anything saying the opposite...any ideas?

Thanks,
-Ryan

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



[PHP] Re: CURL and Cookies

2004-02-09 Thread Manuel Lemos
Hello,

On 02/09/2004 05:29 PM, Richard Miller wrote:
I would appreciate any help you can give me about a problem I am having 
with PHP's CURL functions.

I want to use CURL to download news from Wall Street Journal Online.   
When you visit the WSJ home page, you're forwarded to an authentication 
page to enter your name and password, and then forwarded back to the 
home page.  I want my CURL command to send the authentication cookie so 
when it's forwarded to the authentication page it forwards right back to 
the home page without having to enter the name and password.
When I use CURL I specify the whole request header, so I don't know what 
is wrong with your code.

I only use CURL for HTTPS and fsockopen for normal HTTP requests. I 
encapsulated the whole HTTP client protocol handling including cookie 
support into this PHP HTTP client class, that you may want to check out:

http://www.phpclasses.org/httpclient

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] writing a manual

2004-02-09 Thread Tim Thorburn
Hi,

Sorry for the slightly off-topic post, but I've just had a client ask me to 
create a manual for the site management tool I wrote for them last 
fall.  Since I've never had to do one before I'm a bit lost on what would 
be a reasonable amount to charge and whether or not I should put any 
restrictions on how many copies they receive or if I'm ok with them 
photocopying and handing them out all over the organization.

Any thoughts on what a going rate for a manual is?  The site management 
tool does what most content management scripts do - lets the client 
add/edit/remove any and all text on their site, upload pictures, upload and 
re-size pics for a photo gallery ... nothing ground breaking - standard 
PHP/MySQL stuff, though last time I tried to put a manual together it 
quickly got to be over 40 pages and that client decided they didn't want it 
in the end.

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


Re: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T

2004-02-09 Thread Shaunak Kashyap
Try this:

"SELECT COUNT(*), order_number FROM " . $prefix . "_purchases GROUP BY
order_number"

as your query.

Shaunak

- Original Message - 
From: "Ryan A" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 09, 2004 8:36 PM
Subject: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T


> Hi,
> I have a table where a users details are entered for the products he
bought,
> the only part that is repeated is the order_id,
> I basically need to only get the order per person, and paginate for all
the
> customers
>
> eg:
> if user "tom" bought 3 items in the database it would be entered as:
> order_id  item_name
> 023 soap
> 023 brush
> 023 towel
>
> So i am trying this:
> $num_rows = mysql_result(mysql_query("SELECT COUNT(*),
> DISTINCT(order_number)   FROM ".$prefix."_purchases"),0);
>
> (the idea being taht $num_rows will give my paginating part of the program
> the total number of records
> that match my search.)
>
>
> which gives me the most pretty error of:
> Warning: mysql_result(): supplied argument is not a valid MySQL result
> resource in \www\p\admin\show_purc.php on line 9
>
> I''m pretty sure the problem is in my SQL statement, but have had no luck
> searching and reading in the mysql manual for
> "count" with "distinct" but am pretty sure it can be done as i have not
> found anything saying the opposite...any ideas?
>
> Thanks,
> -Ryan
>
> -- 
> 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 with mysql COUNT, DISTINCT syntax, might be a bit 0T

2004-02-09 Thread Ryan A
Hey,
Thanks for replying.

Nope, that didnt work, but i modified my search terms on google and kept on
trying with different search terms and got the solution here:
http://dbforums.com/arch/230/2002/11/623223

Cheers,
-Ryan


On 2/10/2004 3:14:21 AM, Shaunak Kashyap ([EMAIL PROTECTED])
wrote:
> Try this:
>
> "SELECT COUNT(*), order_number FROM " . $prefix .
> "_purchases GROUP BY
> order_number"
>
> as your query.
>
> Shaunak
>
> - Original Message -
> From: "Ryan A" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, February 09, 2004 8:36 PM
> Subject: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T
>
>
> > Hi,
> > I have a table where a users details are entered for the products he
> bought,
> > the only part that is repeated is the order_id,
> > I basically need to only get the order per person, and paginate for all
> the
> > customers
> >
> > eg:
> > if user "tom" bought 3 items in the database it would be entered as:
> > order_id  item_name
> > 023 soap
> > 023 brush
> > 023 towel
> >
> > So i am trying this:
> > $num_rows =
> mysql_result(mysql_query("SELECT COUNT(*),
> > DISTINCT(order_number)   FROM ".
> $prefix."_purchases"),0);
> >
> > (the idea being taht $num_rows will give my paginating part of the
> program
> > the total number of

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



[PHP] HELP: Detecting the name of the file a function is being called from

2004-02-09 Thread Samuel Ventura

Hi there

I have 2 scripts:




///


/
I get the output
test1.php

what I need is to detect the name of the script
from which I called the function, (test2.php) in this
case. 

For this application, it is not practical to pass an
aditional parameter to the function specifying the
caller, i need independence.

Any ideas?

 


__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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



Re: [PHP] Can PHP redirects be detected?

2004-02-09 Thread Adam Bregenzer
On Mon, 2004-02-09 at 14:31, Lowell Allen wrote:
> A recent thread on the WebDesign-L raised the question of whether search
> engines can detect (and penalize sites for) PHP redirects of the form:
> 
> header("Location: http://www.whatever.com/";);
> 
> I don't see how that could be the case, since the redirect occurs on the
> server before any HTML is output to the browser. Someone else says:

Technically the header function sends an HTTP reply to the client
(browser) with your Location header in the response.  The client then
initiates a second HTTP request with the new URL.  I remember reading
that apache[1] will look at Location: headers and if it can handle the
request it will process it and pass the output of the Location's URL to
the browser.  Regardless, the content will be cached by search engines
but the original URL used to initiate the process will be associated
with the content.  To have the redirected URL remembered you need to
pass a 301 Permanent Redirect status instead.

[1] I can not find this anywhere after a short search on Google, it
could be incorrect.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



Re: [PHP] HELP: Detecting the name of the file a function is being called from

2004-02-09 Thread Adam Bregenzer
On Mon, 2004-02-09 at 23:17, Samuel Ventura wrote:
> what I need is to detect the name of the script
> from which I called the function, (test2.php) in this
> case. 
> 
> For this application, it is not practical to pass an
> aditional parameter to the function specifying the
> caller, i need independence.
> 
> Any ideas?

I don't think this is possible in php4.  The __FILE__ variable is a
constant that is always replaced with a string containing the name of
the file it is in.  Check out reflection[1] in php5 for an answer from
the future.

[1]
http://sitten-polizei.de/php/reflection_api/docs/language.reflection.html

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



Re: [PHP] [PHP5] Using exceptions to write more perfect software, but ...

2004-02-09 Thread Adam Bregenzer
On Mon, 2004-02-09 at 15:58, Markus Fischer wrote:
> But doing this now for every internal function call I don't want to
> lead my program into an unwanted state isn't very appealing.

> I'm seeking for a "more perfect" programming model for application
> demanding that uncontrolled factors are limited to the max.
> 
> Has anyone played around with PHP5 and thought about such issues?

I have been thinking about this myself.  When exceptions come they will
be interesting.  I almost went down the path you are considering but
decided that I would likely end up with an object hierarchy of the
system calls available in PHP.  This is something I very much did not
want to deal with.  I also played with creating wrapper functions that
are designed to test for a specific indication of failure (returns
false, returns null, etc.).  The problem there is the error reporting
must become more technical ("ERROR: function mysql_query returned
NULL"), or more useless ("a function returned an error").  Plus, code
that uses this is harder to read.  Ultimately I decided to wrap my
necessary function calls in error checking wherever they are in my
files.  This gives me more granularity in the application of the error
at the cost of some code bloat.  It's not an optimal solution but I have
found I use little functions calls in the first place that would
generate an exception in return (memory errors are handled by PHP so
it's only functions that have system calls).  This has actually forced
me into creating libraries for what I use and abstracting out system
interfaces anyways.  Also, I have started using code generation for
handling the data side.

Ultimately I think it would be nice to have an object hierarchy of the
function calls in php.  However I don't see php supporting it natively
and PEAR is still trying to sort itself out.  Being a 'third party'
project it is too much for one person but would be quite useful.  Maybe
when php5 becomes more popular we can all band together and standardize
this.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



[PHP] Re: HELP: Detecting the name of the file a function is being called from

2004-02-09 Thread André Cerqueira
function called_from_file(){
$backtrace = debug_backtrace();
print $backtrace[0]['file'];
}
check: http://www.php.net/manual/en/function.debug-backtrace.php

Samuel Ventura wrote:
Hi there

I have 2 scripts:



function called_from_file(){
print __FILE__
}
?>
///

include("test1.php");

called_from_file();

?>

/
I get the output
test1.php
what I need is to detect the name of the script
from which I called the function, (test2.php) in this
case. 

For this application, it is not practical to pass an
aditional parameter to the function specifying the
caller, i need independence.
Any ideas?

 

__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


php-general Digest 10 Feb 2004 05:38:19 -0000 Issue 2581

2004-02-09 Thread php-general-digest-help

php-general Digest 10 Feb 2004 05:38:19 - Issue 2581

Topics (messages 177221 through 177251):

OT -> Pocket PC/PALM Application making/syncing?
177221 by: Robert Sossomon

Re: triple DES encryption
177222 by: "Miguel J. Jiménez"
177223 by: Adam Bregenzer
177225 by: craig

Re: XML and Excel
177224 by: Marek Kilimajer
177234 by: Jake McHenry

Can PHP redirects be detected?
177226 by: Lowell Allen
177228 by: John W. Holmes
177229 by: joel boonstra
177230 by: joel boonstra
177236 by: Lowell Allen
177248 by: Adam Bregenzer

check if user session exists
177227 by: Christian Calloway
177233 by: Larry Brown
177235 by: Christian Calloway
177239 by: Rob Adams
177240 by: Christian Calloway

Re: [PHP-DB] SMTP authentication
177231 by: John W. Holmes

need help with references
177232 by: motorpsychkill

file downloads using header problem
177237 by: Joshua Minnie

[PHP5] Using exceptions to write more perfect software, but ...
177238 by: Markus Fischer
177250 by: Adam Bregenzer

CURL and Cookies
177241 by: Richard Miller
177243 by: Manuel Lemos

php with mysql COUNT, DISTINCT syntax,might be a bit 0T
177242 by: Ryan A
177245 by: Shaunak Kashyap
177246 by: Ryan A

writing a manual
177244 by: Tim Thorburn

Re: Detecting the name of the file a function is being called from
177247 by: Samuel Ventura
177249 by: Adam Bregenzer
177251 by: André Cerqueira

Administrivia:

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

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

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


--
--- Begin Message ---
I know this is way off topic, but I figured some or most have hit upon
this problem, or may very well in the future.  I have been looking for
and not really found a reference online or a hardcopy book that will
tell me how to write a PALM or winDoze pocket PC application that when I
sync it to the PC will go to the web and download data.  I am finding
that I need to learn this quickly (they say) so that I can transform a
set of pages online onto a PDA for the users that can only connect at
6AM and 6PM to the website.

Any thoughts, suggestions, topics, books??

I am assuming I will have to turn the PHP pages into a web service but I
need to learn the PDA end as well.

Thanks,
Robert
--- End Message ---
--- Begin Message ---
craig wrote:

Hi all,
I have to replicate the file encryption of a desktop bound
application. This means using triple DES, but I can't find 
anything on the web or in the maunual (other than single 
DES).

Does anyone know if it is doable to implement this using php, 
or if I should just tell the client that it can't be done?

TIA,
Craig
You'll need the MCRYPT module... it has DES, 3DES and whatever you want...


--- End Message ---
--- Begin Message ---
On Mon, 2004-02-09 at 12:36, craig wrote:
> Hi all,
> I have to replicate the file encryption of a desktop bound
> application. This means using triple DES, but I can't find 
> anything on the web or in the maunual (other than single 
> DES).

The mcrypt[1] module will do triple DES as well as stronger encryption
methods.  In the manual it is referred to as 3DES.

[1] http://www.php.net/mcrypt

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
Thanks, I wasn't looking for 3DES.

That should do the trick for me.

Craig

> -Original Message-
> From: Adam Bregenzer [mailto:[EMAIL PROTECTED]
> Sent: February 9, 2004 10:36 AM
> To: craig
> Cc: Php
> Subject: Re: [PHP] triple DES encryption
>
>
> On Mon, 2004-02-09 at 12:36, craig wrote:
> > Hi all,
> > I have to replicate the file encryption of a desktop bound
> > application. This means using triple DES, but I can't find
> > anything on the web or in the maunual (other than single
> > DES).
>
> The mcrypt[1] module will do triple DES as well as stronger encryption
> methods.  In the manual it is referred to as 3DES.
>
> [1] http://www.php.net/mcrypt
>
> --
> Adam Bregenzer
> [EMAIL PROTECTED]
> http://adam.bregenzer.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Create native xls files, there are at least two classes that can help 
you, here is one: 
http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/

Jake McHenry wrote:
Hi everyone. Since my last post of outputing to excel, I have converted my output to XML, quite happy with myself. It looks perfect. Perfect on my set that is. I have win xp with office xp. Excel with office xp recognizes XML. Office 2000, which the rest of my company is using, doesn't. Does anyone know of 

[PHP] SESSION VARIABLES

2004-02-09 Thread Ronald Ramos
Hi All,

I've created 3 sample scripts, pls see below.
My problem is that page3.php can't display the value $username and
$password
Or is it because it the variables were not importe to that page, that's
why
$username and $password has no value? If it is, how can I import it?

Thank you

- login.php -






  
  USERNAME: 
  PASSWORD: 
  






-- auth.php -






function bukas() {
window.open(\"page3.php\",\"_new\");
};



$username

";
}

else {
echo "INVALID, TRY AGAIN";
};
?>

--- page3.php --



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



Re: [PHP] SESSION VARIABLES

2004-02-09 Thread Adam Bregenzer
On Tue, 2004-02-10 at 00:43, Ronald Ramos wrote:
> Hi All,
> 
> I've created 3 sample scripts, pls see below.
> My problem is that page3.php can't display the value $username and
> $password
> Or is it because it the variables were not importe to that page, that's
> why
> $username and $password has no value? If it is, how can I import it?

You need to have session_start() at the top of the third script as
well.  Also you have a typo:
> echo "#password";

should be:
echo "$password";

Consider using $_SESSION[1] instead of session_register[2].

[1] http://www.php.net/reserved.variables#reserved.variables.session
[2] http://www.php.net/session_register

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



[PHP] Linked Table Structure

2004-02-09 Thread Sajid
HI,

I have a problem.

I dont know how to create tables for this in PHPMYADMIN, the situation is
like this:

I have to display lot of items on the screen.

There are three Datagrids on the screen (I am using Flash for this so if i
get the database structure right, i will be able to take care of the rest of
the scripting to returning data from database.).

Lets say the three DataGrids are called:

DG1, DG2 and DG3

DG1 displays the list of CONTINENTS like (Norht America, Asia, South
America, Australia etc.)

If you click any region in DG1, DG2 gets populated with list of countries
(like USA, Canada, Mexico... etc.)

At the same time, when i have clicked a CONTINENT in DG1, an image of the
CONTINENT is displayed on the screen.

Now, If i click on any Country in DG2, DG3 is getting populated with a ist
of Clubs (like Club1, Club2, Club3 etc.)

At the same time, An image of the country and a description of the country
are displayed on the screen.

again, if i click on any CLUB, it displays a Image, description and URL of
the CLUB.

I dont know what the DATABASE STRUCTURE shold look like for this. I know
there has to be some kind of LINKING between the tables but i dont know
HOW. :(

I have been trying few things but without any success :(

---
The DG1 field will be:
Continent_Name | Continent_Image | Continent_Text

The DG2 fields will be:
Country_Name | Country_Image | Country_Text

The DG3 fields will be:
Club_Name | Club_Image | Club_Text | Club_Url
---

Can anyone show me the Sql for such a table structure?

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



[PHP] Zero Sized Reply

2004-02-09 Thread Deependra b. Tandukar
Dear all,

The script was working perfectly, but all of the sudden since last week 
stopped working, gives Zero Sized Reply. The site is 
http://coremag.net/corex/feedback/feedback.htm

Can anybody tell me what is the problem. Below is the page I get when 
submit the form:

ERROR
The requested URL could not be retrieved
While trying to retrieve the URL: 
http://coremag.net/corex/feedback/feedback.php

The following error was encountered:
Zero Sized Reply
Squid did not receive any data for this request.

Your cache administrator is webmaster.

Generated Tue, 10 Feb 2004 06:05:32 GMT by cache3.mos.com.np 
(squid/2.5.STABLE3)

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