RE: [PHP] chm file for tutorial

2004-10-26 Thread Denis Gerasimov


BTW does anybody know why CHM version hasn't been updated for a very long
time? I prefer to read help manuals in CHM format (that is more convenient
for me) so I am wondering...

Best regards, Denis Gerasimov
Outsourcing Services Manager,
VEKOS, Ltd.
www.vekos.ru

 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 25, 2004 3:28 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] chm file for tutorial
 
 [EMAIL PROTECTED] wrote:
  Hello all,
 
 
 
  I am new to PHP programming.. It will be nice to have a chm
 file
  on php tutorial. Can anyone point me to that location ?
 
 http://www.php.net/download-docs.php
 
  Also I would like to
  know how how to code the following line ?
 
 
 
  a href='http://www.geocities.com/murugesangct/index.html'Mail
  http://www.geocities.com/murugesangct/index.html /a
 
 You just did.
 
 --
 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] Specifying Variable Document Path in PHP

2004-10-26 Thread Jason Wong
On Tuesday 26 October 2004 04:46, Anthony Baker wrote:

 The problem here is that the path will vary slightly depending on whether
 it's the staging server or production server. I'd ideally like to set a
 single global variable that can handle this so I don't have to hard-code
 paths across the site (as I'm doing now).

 Is there any easy way to accomplish this?

Have a look at:

  print_r($_SERVER);

and find something that is unique (to each server) that you can use. 
$_SERVER['HTTP_HOST'] is usually a good candidate.

-- 
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
--
/*
I know it all.  I just can't remember it all at once.
*/

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



Re: [PHP] Content-Type header required for POST?

2004-10-26 Thread Olaf van der Spek
Chris Shiflett wrote:
--- Olaf van der Spek [EMAIL PROTECTED] wrote:
Content-Type is required for any request that has content.
It's an HTTP requirement and has very little to do with PHP.
Can you explain what you're talking about?
I was talking about the request, not about the response.

As was I. That's why I used the word request. :-)
I'm sorry, I misunderstood 'thas has content'.
You'll have a very tough time getting an answer if you can't explain your
question. That's the only helpful hint I can provide.
The reason I'm asking is that I've got a small application that does a 
POST request without that header and it used to work fine and not it 
doesn't.
So I was wondering in which version PHP changed this behaviour.

Chris
=
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Content-Type header required for POST?

2004-10-26 Thread Olaf van der Spek
Chris Shiflett wrote:
--- Olaf van der Spek [EMAIL PROTECTED] wrote:
Since which version does PHP require the Content-Type header in
POST requests?

Content-Type is required for any request that has content. It's an HTTP
The RFC says should, not is required to.
Any HTTP/1.1 message containing an entity-body SHOULD include a
Content-Type header field defining the media type of that body. If
and only if the media type is not given by a Content-Type field, the
recipient MAY attempt to guess the media type via inspection of its
content and/or the name extension(s) of the URI used to identify the
resource. If the media type remains unknown, the recipient SHOULD
treat it as type application/octet-stream.
requirement and has very little to do with PHP.
Can you explain what you're talking about?
Chris
=
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] System Command and snmp commands

2004-10-26 Thread Mulley, Nikhil
Hi All,
 
I want to use system command to perform snmp queries on a remote machine and the 
problem is that I want to store the output /result in an Array , so that I can later 
use it for parsing purposes.I know I could use exec and passthru statements 
actually,But I am unable to store the result in the array or I am unsure whether the 
result is not getting stored in the array 
 
 
Here is the code 
 
 
?php
exec(' snmpget -v 2c -c public 10.103.16.14  sysUpTime.0',$ret);
list($a)=split('[,]',$ret);
echo $a[0];
 
?  
 
Point me , if any thing wrong in the code
 
Please help me.
 
 
Thanks,
Nikhil.


[PHP] best php script that counts current online users, question.

2004-10-26 Thread Louie Miranda
Hi,

i got tired testing free php scripts that does count current online
users and i could not find the best one yet.

maybe someone can help me.

im looking for a current counter for online users, php script that
does count even if its inside a proxy with one ip.

i can't find one.

-- 
Louie Miranda
http://www.axishift.com

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



[PHP] Apache+PHP on Windows

2004-10-26 Thread gtm2
I have installed Apache 2.0.52 and PHP 5.0.2 on windows XP. I have configured 
directories and everything works until I unmark any of extensions. After this, during 
Apache server starting, I am reciving the 
warning : 
PHP Startup: Unable to load dynamic library 
D:/MyWWWsrv/php/ext/php_mysql.dll - the module could not be found
the result is that I cannot use MySQL in php scripts.
Please, write me back, what should be done to make it working correctly.
Thanks a lot. 
Gregor





--
Startuj z INTERIA.PL!!!  http://link.interia.pl/f1837

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



[PHP] Sending Mail with PHP

2004-10-26 Thread Wiesiek
Hi

I try to send mail (like http://www.php.net/mail) and it works fine.
I define my own headers.

But my question is about wrong mail delivery.
I use exim4.34.
When I send mail via PHP script, then I see in my logs:

2004-10-26 11:04:36 1CMNFs-00046O-T9 = [EMAIL PROTECTED] U=www-data 
P=local S=913

And mail was deliver to specify (To:) header
Mail arrive with correct From: header line.

But problem is present when domain does not exist:

(1) 2004-10-26 10:21:35 1CMMaF-0003Qm-IH = [EMAIL PROTECTED]  U=www-data 
P=local S=934
(2) 2004-10-26 10:21:35 1CMMaF-0003Qm-IH ** [EMAIL PROTECTED]: Unrouteable 
address
(3) 2004-10-26 10:21:35 1CMMaF-0003Qp-Jc =  R=1CMMaF-0003Qm-IH U=exim4 
P=local S=1692
(4) 2004-10-26 10:21:35 1CMMaF-0003Qp-Jc = /dev/null [EMAIL PROTECTED] 
R=system_aliases T=**bypassed**

So.. If domain was not exist (like (2)), then exim4 generate error message 
and send [EMAIL PROTECTED] (like (4)).
Is some way to change it? I never set in any config these address.
I try to set in mail header Return-Patch:, but it seems to no work :(

I use debian version php: 4.3.9

-- 
I greet
Wieslaw 

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



[PHP] mysql_escape_string breaks EOL?

2004-10-26 Thread David Robley
It seems that mysql_escape_string and mysql_real_escape_string do
undesirable things to EOL markers - data from textareas escaped with either
of those functions is entered, and retrieved with, the characters /r/n
instead of a true line break.

This snippet of code demonstrates the problem:

?php
$wibble = \This\ and\n'that';
echo Before: $wibbleBR\n;
$wibble1 = addslashes($wibble);
echo Addslashes: $wibble1BR\n;
$wibble2 = mysql_escape_string($wibble);
echo Escape: $wibble2BR\n;
?

And the output (from Show source) with line breaks exactly as in the source

Before: This and
'that'BR
Addslashes: \This\ and
\'that\'BR
Escape: \This\ and\n\'that\'BR

Is this a bug, or am I totally missing something?

Cheers
-- 
David Robley

Useless Invention: Avalanche prevention goggles.

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



Re: [PHP] Further help for PHP, SQL syntax, and register_globals

2004-10-26 Thread John Holmes
Sugimoto wrote:
Bad query: You have an error in your SQL syntax near 'and Tit like and Aut
like and Auty like ' at line 4
[snip]
  foreach ($_GET as $value) {
 if (empty($value)) $value = %;
You have an issue here. You're looping through $_GET and attempting to 
set a default value (which is good), but you're not making any changes 
to $_GET at all, just resetting the same $value variable to '%'.

foreach($_GET as $key=$value)
{
  if(empty($value))
  { $_GET[$key] = '%'; }
}
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Nick Wilson
Hello all, 

I was wondering if anyone might have suggestions or useful links on
protecting commercial php scripts.

I am about to design a system that would be pretty valuable in a very
niche market and would not wish the script to be passed on to others
once downloaded.

Suggestions, discussion and links would be much appreciated ;-)

-- 
Nick W
http://www.threadwatch.org
less noise, more signal

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



Re: [PHP] not _that_ fixed....

2004-10-26 Thread Robert Cummings
On Tue, 2004-10-26 at 00:58, Pierre Ancelot wrote:
 humm, thank you, finaly someone that did something of that kind :) 
 
 well, i want it as a dynamic extension that i could redistribute and which 
 wouldn't necessits recompilation, just adding it in php.in 
 
 does what you told still would works in this case ?

Yes. Sorry to respond so much later but I went to bed after my response
last night :)

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

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



Re: [PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Dirk Kredler
I found this one very usefull:
http://shiflett.org/php-security.pdf 

You should anyway start at:
http://php.net/security/

good luck,
Dirk

Am Dienstag, 26. Oktober 2004 13:44 schrieb Nick Wilson:
 Hello all,

 I was wondering if anyone might have suggestions or useful links on
 protecting commercial php scripts.

 I am about to design a system that would be pretty valuable in a very
 niche market and would not wish the script to be passed on to others
 once downloaded.

 Suggestions, discussion and links would be much appreciated ;-)

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



Re: [PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Kevin Waterson
This one time, at band camp, Nick Wilson [EMAIL PROTECTED] wrote:

 Hello all, 
 
 I was wondering if anyone might have suggestions or useful links on
 protecting commercial php scripts.
 
 I am about to design a system that would be pretty valuable in a very
 niche market and would not wish the script to be passed on to others
 once downloaded.

If you mean source code needs to be protected, see Zend Encoder

Kevin

-
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

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



RE: [PHP] Further help for PHP, SQL syntax, and register_globals

2004-10-26 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 26 October 2004 12:01, John Holmes wrote:

 Sugimoto wrote:
  Bad query: You have an error in your SQL syntax near 'and Tit like
  and Aut like and Auty like ' at line 4
 [snip]
foreach ($_GET as $value) {
   if (empty($value)) $value = %;
 
 You have an issue here. You're looping through $_GET and attempting to
 set a default value (which is good), but you're not making
 any changes
 to $_GET at all, just resetting the same $value variable to '%'.
 
 foreach($_GET as $key=$value)
 {
if(empty($value))
{ $_GET[$key] = '%'; }
 }

Or, if I've been paying attention properly (which I might easily not have!
;), in PHP 5 you can do:

   foreach ($_GET as $value) {
  if (empty($value)) $value = %;
   }

Cheers!

Mike

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

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



Re: [PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Francisco M. Marzoa Alonso
Nick Wilson wrote:
Hello all, 

I was wondering if anyone might have suggestions or useful links on
protecting commercial php scripts.
I am about to design a system that would be pretty valuable in a very
niche market and would not wish the script to be passed on to others
once downloaded.
Suggestions, discussion and links would be much appreciated ;-)
 

There's no way to protect the code from copying. The only way to do that
is not to give no one the code, provide the service based on the code
instead of the code itself. Dont waste your time looking for a solution
for a lost battle. It's just an advice, of course.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Passing regexp substrings to a function

2004-10-26 Thread Robin Vickery
On Mon, 25 Oct 2004 15:33:59 +0300, Ville Mattila
[EMAIL PROTECTED] wrote:
 Hi there,
 
 I have a few e-mail templates in a file that should be parsed. A
 template can include also some module codes that should be replaced by
 a return value of a certain function. For example, if the template
 include a text {ProductInfo:1032}, the value 1032 would be passed as
 an argument to a function mdlProductInfo() and the whole string would be
 replaced by the return value of the function.
 
 One possible way is to loop the string like this:
 [...] 
 Any other ideas on this?

Yeah, use preg_replace_callback() , it does exactly what you're suggesting.

  http://fi.php.net/manual/en/function.preg-replace-callback.php

-robin

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



Re: [PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Nick Wilson

* and then Francisco M. Marzoa Alonso declared
 I was wondering if anyone might have suggestions or useful links on
 protecting commercial php scripts.
 
 I am about to design a system that would be pretty valuable in a very
 niche market and would not wish the script to be passed on to others
 once downloaded.
 
 There's no way to protect the code from copying. The only way to do that
 is not to give no one the code, provide the service based on the code
 instead of the code itself. Dont waste your time looking for a solution
 for a lost battle. It's just an advice, of course.

I've had about 5 off list (why so many today?) telling me about zend
encoder so that would seem not to be true.

Thankyou all, i will check out the links, and especially the zend
encoder page ;-)

-- 
Nick W

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



Re: [PHP] file upload

2004-10-26 Thread Kris
H
Setup a CRON job using SCP or cURL.  You can use SOAP or create your own 
similar system.  I have never used SOAP but use the same principles.

Example:  Company X needs some strange format of data (text file, CSV or 
whatever) delivered to them SECURELY at 5am EST.  The company cannot 
afford to pay for any sane sysAdmin to do this at -7 GMT.  Thanks to 
advances in PHP, the sane admin can now do what was once done via PERL 
and CRON; create a PHP shell script [executed by CRON] to do the following:

Pull data from a database, create this alleged data file, send the file 
via SCP or cURL.  If you use cURL, the remote system has a script which 
receives your connection and parses alleged file.  Security and parsing 
is another topic altogether.

PHP is a server side scripting language.  A browser is just another way 
to view output from PHP.

PHP is so many fantastic things.  It is generally less malicious than 
your needs purport.  Sounds like you need the efficacies of javascript 
if the example above does not fit your scenario.  Since most people 
ignore the wisdom of turning javascript off in their browsers, you 
should be able to take advantage of many of the features it 
provides.   However, you need to visit a javascript list for anything 
down this path.  If you are not forthcoming enough as to your 
intentions, you are most likely not going to receive any assistance 
simply because your idea sounds malicious.

Programmers tend to keep the caveats of programming exploits unto 
themselves.  However, it is just as likely that your intent is not 
malicious, and therefore you may wish to simply revise your question and 
description of the problem/scenario you are attempting to overcome.  All 
in all, more information leads to... more information! :)  I speak from 
experience.  I post confusing questions at times too, which result in 
confused responses or links to manual pages I've already read more than 
once.  The real solution to this aside is to post more detailed questions.


Victor C. wrote:
Thanks for answering Chris..
What if I want to send a file from my web server to another site for them to
parse?  I already know what file I want to send and I do not want to have to
select the file by doing browsing.
Chris [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

You can't, at least you SHOULDN'T. Just think about what you're asking
for, you want to download a file from a users computer, without them
knowing about it.
Major security/privacy issues there that browsers try to prevent.
Chris
Victor C. wrote:
   

Hi,
I'm trying to submit a file from index.php to index2.php. I know how
 

to
 

do file upload in PHP. On index.php
I have:
FORM ACTION=index2.php METHOD=POST
ENCTYPE=multipart/form-data
INPUT TYPE=file NAME=myfile SIZE=30
INPUT TYPE=submit NAME=Upload File
/FORM
The next page would only need to use $HTTP_POST_FILES['myfile'] to access
the submitted file.
My question is: if I already know which file I want to submit, say
file1.xml.  How can I just ask index.php
to submit file1.xml to index2.php?  Without asking the users to pick
 

the
 

file to upload?
Thanks a lot in advance!

 

 

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


Re: [PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Francisco M. Marzoa Alonso
Nick Wilson wrote:
* and then Francisco M. Marzoa Alonso declared
 

I was wondering if anyone might have suggestions or useful links on
protecting commercial php scripts.
I am about to design a system that would be pretty valuable in a very
niche market and would not wish the script to be passed on to others
once downloaded.
 

There's no way to protect the code from copying. The only way to do that
is not to give no one the code, provide the service based on the code
instead of the code itself. Dont waste your time looking for a solution
for a lost battle. It's just an advice, of course.
   

I've had about 5 off list (why so many today?) telling me about zend
encoder so that would seem not to be true.
 

AFAIK Zend Encoder is used to protect from reverse engineering, not from 
copying. The only thing it does is to produce a binary program as a 
compiler avoiding than the final users can easily view or modify the 
source code, but the users can still copy those binary files.

In the real world (tm) there's no effective protection for this kind of 
things. All inviolable protections for programs has been broken sooner 
than later since the first computer program code has been closed to 
today, even those based on hardware artifacts (as port-key devices).


Thankyou all, i will check out the links, and especially the zend
encoder page ;-)
 

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


Re: [PHP] file upload

2004-10-26 Thread Kris
Victor
Yes, Chris is correct.  Maybe you can POST your file via cURL to the 
remote script expecting to receive your file from the authentication 
site.  Definitely check PEAR.  There is also some info at php.net about 
new SOAP capabilites built-in to PHP 5.  Unfortunately I have only used 
cURL to do similar to what I think you are trying to do, so I can only 
suggest at this time to review what is new in PHP (which is where I saw 
mention of this built-in SOAP of PHP5.)

Feel free to write back and we will continue in attempts to assist.
Chris wrote:
Ahh, if you *have* to push the data (which you obviously do) and the 
authentication site has no other authentication methods then you have 
to POST the file with PHP. It can be done, there are many classes for 
it, I can't recommend any specific class, but I'm sure someone else 
here could.

I would surprise me if something in PEAR ( http://pear.php.net/ ) 
couldn't do it. Just look for an HTTP class that can POST files.

Chris
Victor C. wrote:
See... basically, I have two sites. One site provides user 
authentication
and another one requests the authentication. The requesting site need to
send to the authentication site its request in an XML.  The 
authentication
site is suppose to get the XML file using $HTTP_POST_FILES.  I'm 
using PHP
to dynamically generate the request XML file and I need to submit it 
to the
authenticating site; but I don't want to use file upload and browse
functionality, because the authentication process is suppose to be
transparent to the end users.

Again, thanx for the help and any insights would be greatly 
appreciated. :)


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


RE: [PHP] @session_start generates a new session_id

2004-10-26 Thread Lizet Peña de Sola
Hello Greg,
Thanks for reply, I did try
ini_set ( session.auto_start, 1); and it set the session.auto_start to
On on my configuration, however the rest of the users on that server had
auto_start off.
This didn't solve the problem, should I try to access .htaccess? I presume
it will affect all the sites on that server, right?
The problem continues, I run the logout script each time the user leaves the
admin site:
?
$_SESSION['validlogin']=;
$_SESSION['username']=;
$_SESSION['password']=;
unset($_SESSION['validlogin']);
unset($_SESSION['username']);
unset($_SESSION['password']);
session_unset();
print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

And when the user tries to enter the admin panel again and log in, the
following script runs:
?
...
session_start();
  
$_SESSION['validlogin']=true;
$_SESSION['username']=$username;
$_SESSION['password']=$password;

?

However when the user logs out and the first script runs, if that user tries
to log in again with a different account, the session is started, but the
username and password variables take the first user's values, they're not
overriden.
Any idea?
Thanks a lot in advance.
Lizet

-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 25, 2004 6:18 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] @session_start generates a new session_id


On Mon, 25 Oct 2004 15:59:18 -0400, Lizet Peña de Sola [EMAIL PROTECTED]
wrote:
 How can I set session_auto_start On, I have a similar problem and I 
 think it's because my web hosting has that feature off.

.htaccess

php_flag session.auto_start on


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
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] Strange explode()

2004-10-26 Thread Ryan A
Hi,
Any idea why it is taking the first array as blank and giving me an array
count of 3 instead of 2?
?
$final=http://something.com/cgi-bin/atx/out.cgi?s=63c=1l=galsu=http://bl
ah.something.com/bs3/index1.htm;
$final2=explode(http://,$final);
$res=count($final2);
echo brbrbr.$res;
print_r($final2);
?

This is the output that is confusing me:
Array
(
[0] =
[1] = something.com/cgi-bin/atx/out.cgi?s=63c=1l=galsu=
[2] = blah.something.com/bs3/index1.htm
)

Thanks,
Ryan

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



[PHP] uploading large files

2004-10-26 Thread marc serra
Hi,
I'm designing a web site and i need to let users upload large files like 
10M or more.

I got some solution that are using common file transfert in PHP or using 
FTP transfert in PHP.
The problem is that if someone upload a big file he will not have any 
indication about the upload status. Is there an easy way to give them a 
status indication like file size/percentage uploaded or showing them a 
graphical bar.

Can u indicate me if there is any classes or scripts that can help me...
Thanks,
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] List of Dates Grouped by Week

2004-10-26 Thread Shaun
Hi,

I am creating an online timesheet application. Most parts are done, however 
I have a problem displaying a list of unapproved timesheets.

Here is my timesheet table:

mysql DESCRIBE Timesheets;
+---+-+--+-+++
| Field | Type| Null | Key | Default| Extra 
|
+---+-+--+-+++
| Timesheet_ID  | int(11) |  | PRI | NULL   | auto_increment 
|
| Type  | varchar(40) | YES  | | NULL   | 
|
| Project_ID| int(11) | YES  | | NULL   | 
|
| User_ID   | int(11) |  | | 0  | 
|
| Hours | float   |  | | 0  | 
|
| Date  | date|  | | -00-00 | 
|
| Status| varchar(40) | YES  | | Open   | 
|
+---+-+--+-+++

When a timesheet is submitted for approval the manager logs in and approves 
/ rejects the timesheets. How can I display a list of unapproved timesheets 
grouped by week and user? i.e.

Week 1 - Bill - 45 Hours
Week 1 - Fred - 40 Hours
Week 2 - Bill - 45 Hours
Week 2 - Fred - 40 Hours
Week 2 - Sam  - 12 Hours

Thanks for your help. 

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



RE: [PHP] System Command and snmp commands

2004-10-26 Thread Mulley, Nikhil

Tring Tring .


Just to ring please help me.
I am giving to out print_r($ret) then it returns 1 at 

exec(' snmpget -v 2c -c public 10.103.16.14  sysUpTime.0',$ret);

--Nikhil



-Original Message-
From: Mulley, Nikhil [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 26, 2004 12:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] System Command and snmp commands


Hi All,
 
I want to use system command to perform snmp queries on a remote machine and the 
problem is that I want to store the output /result in an Array , so that I can later 
use it for parsing purposes.I know I could use exec and passthru statements 
actually,But I am unable to store the result in the array or I am unsure whether the 
result is not getting stored in the array 
 
 
Here is the code 
 
 
?php
exec(' snmpget -v 2c -c public 10.103.16.14  sysUpTime.0',$ret);
list($a)=split('[,]',$ret);
echo $a[0];
 
?  
 
Point me , if any thing wrong in the code
 
Please help me.
 
 
Thanks,
Nikhil.

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



Re: [PHP] uploading large files

2004-10-26 Thread raditha dissanayake
Double Shameless Plus follows:
marc serra wrote:
Hi,
I'm designing a web site and i need to let users upload large files 
like 10M or more.
You need to tweak your php installation to be able to handle such large 
files http://www.radinks.com/upload/config.php will help you do that.

I got some solution that are using common file transfert in PHP or 
using FTP transfert in PHP.
The problem is that if someone upload a big file he will not have any 
indication about the upload status. Is there an easy way to give them 
a status indication like file size/percentage uploaded or showing them 
a graphical bar.

Can u indicate me if there is any classes or scripts that can help me...
http://www.raditha.com/megaupload/

Thanks,
Marc

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] best php script that counts current online users, question.

2004-10-26 Thread raditha dissanayake
Louie Miranda wrote:
Hi,
i got tired testing free php scripts that does count current online
users and i could not find the best one yet.
 

what is the yard stick
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: best php script that counts current online users, question.

2004-10-26 Thread Daniel Schierbeck
Louie Miranda wrote:
Hi,
i got tired testing free php scripts that does count current online
users and i could not find the best one yet.
maybe someone can help me.
im looking for a current counter for online users, php script that
does count even if its inside a proxy with one ip.
i can't find one.
Dunno 'bout the proxy part, but can't you just have a MySQL table like this:
id INT; ip VARCHAR(15); time DATETIME; PRIMARY KEY id
Then check if the client IP exists in the table upon page load. If it 
does, update the timestamp. Otherwise insert a new row. After the query 
you delete all rows that are more than 5 or so minutes old.

--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com): 
http://www.spreadfirefox.com/?q=user/registerr=6584

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


Re: [PHP] Strange explode()

2004-10-26 Thread Brent Baisley
The result is correct. You are splitting the string based on http://;.  
There are two instances of it, so there are 3 resulting elements. Since  
there is not text before the first instance, your first array element  
is empty. If there was text before the first instance, you would expect  
3 resulting elements. Functions should always be consistent in what  
they return. So two instances will always give you three elements.

On Oct 26, 2004, at 9:08 AM, Ryan A wrote:
Hi,
Any idea why it is taking the first array as blank and giving me an  
array
count of 3 instead of 2?
?
$final=http://something.com/cgi-bin/atx/out.cgi? 
s=63c=1l=galsu=http://bl
ah.something.com/bs3/index1.htm;
$final2=explode(http://,$final);
$res=count($final2);
echo brbrbr.$res;
print_r($final2);
?

This is the output that is confusing me:
Array
(
[0] =
[1] = something.com/cgi-bin/atx/out.cgi?s=63c=1l=galsu=
[2] = blah.something.com/bs3/index1.htm
)
Thanks,
Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Configuration with upload maximum issue...

2004-10-26 Thread Joey
Hi everyone,
 
I changed the setting in my php.ini to allow an upload file size bigger then
the defaul 2MB chaning the setting shown below:

; Maximum allowed size for uploaded files.
;upload_max_filesize = 2M
upload_max_filesize = 5M

 

However when I go to phpinfo, or of course try to upload a file bigger then
that it bombs... yes I did restart apache after making the change to the
php.ini file...

Any ideas etc appreciated...


Thanks,


Joey

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



Re: [PHP] Strange explode()

2004-10-26 Thread Ryan A
Hey,
Thanks, I have also gotten rid of the blank one like this:

if($final2[0]==){unset($final2[0]);}

-Ryan

On 10/26/2004 3:36:45 PM, Brent Baisley ([EMAIL PROTECTED]) wrote:
 The result is correct. You are splitting the string based on http://;.
 
 There are two instances of it, so there are 3 resulting elements. Since
 
 there is not text before the first instance, your first array element
 
 is empty. If there was text before the first instance, you would expect
 
 3 resulting elements. Functions should always be consistent in what
 
 they return. So two instances will always give you three elements.
 
 
 
 On Oct 26, 2004, at 9:08 AM, Ryan A wrote:
 
 
 
  Hi,
 
  Any idea why it is taking the first array as blank and giving me an
 
  array
 
  count of 3 instead of 2?
 
  ?
 
 
 $final=http://something.com/cgi-bin/atx/out.cgi?
  s=63c=1l=galsu=http://bl
  ah.something.com/bs3/index1.htm;
 
  $final2=explode(http://,$final);
 
  $res=count($final2);
 
  echo brbrbr.$res;
 
  print_r($final2);
 
  ?
 
 
 
  This is the output that is confusing me:
 
  Array
 
  (
 
  [0] =
 
 

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



RE: [PHP] file upload

2004-10-26 Thread Jesse Castro
 Ahh, if you *have* to push the data (which you obviously do) and the
 authentication site has no other authentication methods then you have 
 to POST the file with PHP. It can be done, there are many classes for 
 it, I can't recommend any specific class, but I'm sure someone else 
 here could.

 I would surprise me if something in PEAR ( http://pear.php.net/ )
 couldn't do it. Just look for an HTTP class that can POST files.

 Chris

 Victor C. wrote:

 See... basically, I have two sites. One site provides user
 authentication
 and another one requests the authentication. The requesting site need
to
 send to the authentication site its request in an XML.  The 
 authentication
 site is suppose to get the XML file using $HTTP_POST_FILES.  I'm 
 using PHP
 to dynamically generate the request XML file and I need to submit it 
 to the
 authenticating site; but I don't want to use file upload and browse
 functionality, because the authentication process is suppose to be
 transparent to the end users.

 Again, thanx for the help and any insights would be greatly
 appreciated. :)


Victor,

I have recently come across the same problem.  Microsoft supplied a very
nice method to submit xml files in asp.  Unfortunately, it is harder to
implement in PHP.  The script below is what I eventually came up with,
and it works for me.  Don't know if it applies to your situation
exactly, but hope it helps at any rate.

Cheers,
Jesse R. Castro


$xmlRequest = request\n;
$xmlRequest.= \tcontentsfoo/contents\n;
$xmlRequest.= /request;

$url = http://www.wherever.com;;
$port = 83;
$path = /path/to/script.asp

/*
*   $errno and $errstr are blank, see the docs for fsockopen
*/

$sockXml = fsockopen($url, $port, $errno, $errstr, 30);

if (!$sockXml) {
   echo $errstr. (.$errno.)br /\n;
} else {
/*
*   http headers
*/
$out = POST .$path. HTTP/1.1\n;
$out .= Host: www.wherever.com:83\n;
$out .= Content-Type: application/x-www-form-urlencoded\n; 
$out .= Content-Length: .strlen($xmlRequest).\n; 
$out .= Connection: Close\n;
$out .= \n.$xmlRequest; 
$out .= \n ;

/*
*   write the http headers to the open socket
*/  
   fwrite($sockXml, $out);

/*
*   get the results back
*/
   $strReturned = ;
   while (!feof($sockXml)) {
$strReturned.= @fgets($sockXml, 4096);
   }
   echo $strReturned.\n;

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



[PHP] HTTP AUTH in PHP5

2004-10-26 Thread Nunners
I'm having some problems with using HTTP Auth in PHP5 - how do I check
whether the old $PHP_AUTH_USER exists?

 

Cheers
Nunners

 



[PHP] how to get bios info

2004-10-26 Thread Akshay
hi all,
how to get bios info in PHP
Is there any command?
Suggest me.
akshay
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] List of Dates Grouped by Week

2004-10-26 Thread John Nichel
Shaun wrote:
Hi,
I am creating an online timesheet application. Most parts are done, however 
I have a problem displaying a list of unapproved timesheets.

Here is my timesheet table:
mysql DESCRIBE Timesheets;
+---+-+--+-+++
| Field | Type| Null | Key | Default| Extra 
|
+---+-+--+-+++
| Timesheet_ID  | int(11) |  | PRI | NULL   | auto_increment 
|
| Type  | varchar(40) | YES  | | NULL   | 
|
| Project_ID| int(11) | YES  | | NULL   | 
|
| User_ID   | int(11) |  | | 0  | 
|
| Hours | float   |  | | 0  | 
|
| Date  | date|  | | -00-00 | 
|
| Status| varchar(40) | YES  | | Open   | 
|
+---+-+--+-+++

When a timesheet is submitted for approval the manager logs in and approves 
/ rejects the timesheets. How can I display a list of unapproved timesheets 
grouped by week and user?
Write a SQL statement?
http://dev.mysql.com/doc/mysql/en/index.html
http://lists.mysql.com/
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Configuration with upload maximum issue...

2004-10-26 Thread Greg Donald
On Tue, 26 Oct 2004 09:37:06 -0400, Joey [EMAIL PROTECTED] wrote:
 I changed the setting in my php.ini to allow an upload file size bigger then
 the defaul 2MB chaning the setting shown below:
 
 ; Maximum allowed size for uploaded files.
 ;upload_max_filesize = 2M
 upload_max_filesize = 5M

Did you edit the correct php.ini file?  For example on my Debian
system I have two:

/etc/php4/apache/php.ini
/etc/php4/cgi/php.ini


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Configuration with upload maximum issue...

2004-10-26 Thread John Nichel
Joey wrote:
Hi everyone,
 
I changed the setting in my php.ini to allow an upload file size bigger then
the defaul 2MB chaning the setting shown below:

; Maximum allowed size for uploaded files.
;upload_max_filesize = 2M
upload_max_filesize = 5M
 

However when I go to phpinfo, or of course try to upload a file bigger then
that it bombs... yes I did restart apache after making the change to the
php.ini file...
Any ideas etc appreciated...
phpinfo() will also tell you which php.ini file it is reading from. 
Check to see if you edited the right one.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] not _that_ fixed....

2004-10-26 Thread Curt Zirzow
* Thus wrote Robert Cummings:
 On Tue, 2004-10-26 at 00:37, Pierre Ancelot wrote:
   
  in fact i got it in the ./configure --help :
  
  [EMAIL PROTECTED]:~/phpsource/php-4.3.9$ ./configure --help | grep -i spider
--enable-spider   Enable spider support
...
 
 That said, if you still wish to compile a shared object module of your
 extension then you can run this from the PHP source directory (with
 suitable changes for your extension):
 
 cc -fpic -DCOMPILE_DL_INTERJINN=1 \
 -Iext/interjinn/ -Iinclude -Imain -I. -IZend -ITSRM \
 -c -o ext/interjinn/interjinn.o ext/interjinn/interjinn.c
 
 cc -shared -L/usr/local/lib -rdynamic -o \
 ext/interjinn/interjinn.so \
 ext/interjinn/interjinn.o
 
Actually it gets easier..

cd ext/custommodule/
phpize
./configure --with-custommodule
make

Now you'll have a custommodule.so available.

 

Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] HTTP AUTH in PHP5

2004-10-26 Thread John Nichel
Nunners wrote:
I'm having some problems with using HTTP Auth in PHP5 - how do I check
whether the old $PHP_AUTH_USER exists?
It's part of the $_SERVER super global.
$_SERVER['PHP_AUTH_USER']
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Configuration with upload maximum issue...

2004-10-26 Thread raditha dissanayake
Joey wrote:
Hi everyone,
I changed the setting in my php.ini to allow an upload file size bigger then
the defaul 2MB chaning the setting shown below:
; Maximum allowed size for uploaded files.
;upload_max_filesize = 2M
upload_max_filesize = 5M
 

http://www.radinks.com/upload/config.php shows all the settings that you 
have to change.

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] how to get bios info

2004-10-26 Thread Greg Donald
On Tue, 26 Oct 2004 18:54:45 +0530, Akshay [EMAIL PROTECTED] wrote:
 how to get bios info in PHP
 Is there any command?

Maybe something like:

php -r system('dmesg');


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Pierre Ancelot


i used turck mmcache you can googlize for it, it works very well, encrypts the 
code, store most used files in shared memory... in other words, it also 
opitimise... that's what i preconise 

On Tuesday 26 October 2004 13:44, Nick Wilson wrote:
 Hello all,

 I was wondering if anyone might have suggestions or useful links on
 protecting commercial php scripts.

 I am about to design a system that would be pretty valuable in a very
 niche market and would not wish the script to be passed on to others
 once downloaded.

 Suggestions, discussion and links would be much appreciated ;-)

 --
 Nick W
 http://www.threadwatch.org
 less noise, more signal

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



Re: [PHP] not _that_ fixed....

2004-10-26 Thread Pierre Ancelot
no worries, i was in bed too :P
trying, thanks :)


On Tuesday 26 October 2004 14:01, Robert Cummings wrote:
 On Tue, 2004-10-26 at 00:58, Pierre Ancelot wrote:
  humm, thank you, finaly someone that did something of that kind :)
 
  well, i want it as a dynamic extension that i could redistribute and
  which wouldn't necessits recompilation, just adding it in php.in
 
  does what you told still would works in this case ?

 Yes. Sorry to respond so much later but I went to bed after my response
 last night :)

 Cheers,
 Rob.
 --
 ..

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

 `'

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



Re: [PHP] not _that_ fixed....

2004-10-26 Thread Robert Cummings
On Tue, 2004-10-26 at 10:14, Curt Zirzow wrote:
 * Thus wrote Robert Cummings:
  On Tue, 2004-10-26 at 00:37, Pierre Ancelot wrote:

   in fact i got it in the ./configure --help :
   
   [EMAIL PROTECTED]:~/phpsource/php-4.3.9$ ./configure --help | grep -i spider
 --enable-spider   Enable spider support
 ...
  
  That said, if you still wish to compile a shared object module of your
  extension then you can run this from the PHP source directory (with
  suitable changes for your extension):
  
  cc -fpic -DCOMPILE_DL_INTERJINN=1 \
  -Iext/interjinn/ -Iinclude -Imain -I. -IZend -ITSRM \
  -c -o ext/interjinn/interjinn.o ext/interjinn/interjinn.c
  
  cc -shared -L/usr/local/lib -rdynamic -o \
  ext/interjinn/interjinn.so \
  ext/interjinn/interjinn.o
  
 Actually it gets easier..
 
 cd ext/custommodule/
 phpize
 ./configure --with-custommodule
 make
 
 Now you'll have a custommodule.so available.

Aaah cool. When did that become available?

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

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



Re: [PHP] Apache+PHP on Windows

2004-10-26 Thread Janet Valade
[EMAIL PROTECTED] wrote:
I have installed Apache 2.0.52 and PHP 5.0.2 on windows XP. I have configured directories and everything works until I unmark any of extensions. After this, during Apache server starting, I am reciving the 
warning : 
PHP Startup: Unable to load dynamic library 
D:/MyWWWsrv/php/ext/php_mysql.dll - the module could not be found
the result is that I cannot use MySQL in php scripts.
Please, write me back, what should be done to make it working correctly.
For MySQL, there are two files that PHP needs to find--php_mysql.dll and 
libmysql.dll. The simplest, if not most elegant, way to be sure PHP can 
find them is to copy them into your windows\system32 directory.

Janet
Thanks a lot. 
Gregor



--
Startuj z INTERIA.PL!!!  http://link.interia.pl/f1837

--
Janet Valade -- janet.valade.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Add methods to object dinamically

2004-10-26 Thread Francisco M. Marzoa Alonso
I've seen that's possible to add members to objects dinamically, in example:
class MyClass {
   private $a;
}
$MyObject = new MyClass ();
$MyObject-b = 1;
Now $MyObject has a public member called 'b' that has a value of '1'.
The question is, is it possible to add methods in the same way?
I meant something such as:
function sum ( $this ) {
   return $this-a+$this-b;
}
$MyObject-sum = sum;
Note that code will not work, but it illustrates what I'm asking for.
TIA.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] not _that_ fixed....

2004-10-26 Thread Pierre Ancelot

It works !! thanks to you and robert, i use the phpize method, it's an 
excellent thing that generates all needed, no i use it in a specific folder, 
no need to haev the whole source around :)
THANKS !!



On Tuesday 26 October 2004 16:14, Curt Zirzow wrote:
 * Thus wrote Robert Cummings:
  On Tue, 2004-10-26 at 00:37, Pierre Ancelot wrote:
   in fact i got it in the ./configure --help :
  
   [EMAIL PROTECTED]:~/phpsource/php-4.3.9$ ./configure --help | grep -i
   spider --enable-spider   Enable spider support
 
 ...
 
  That said, if you still wish to compile a shared object module of your
  extension then you can run this from the PHP source directory (with
  suitable changes for your extension):
 
  cc -fpic -DCOMPILE_DL_INTERJINN=1 \
  -Iext/interjinn/ -Iinclude -Imain -I. -IZend -ITSRM \
  -c -o ext/interjinn/interjinn.o ext/interjinn/interjinn.c
 
  cc -shared -L/usr/local/lib -rdynamic -o \
  ext/interjinn/interjinn.so \
  ext/interjinn/interjinn.o

 Actually it gets easier..

 cd ext/custommodule/
 phpize
 ./configure --with-custommodule
 make

 Now you'll have a custommodule.so available.



 Curt
 --
 Quoth the Raven, Nevermore.

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



Re: [PHP] Add methods to object dinamically

2004-10-26 Thread Greg Donald
On Tue, 26 Oct 2004 18:13:10 +0200, Francisco M. Marzoa Alonso
[EMAIL PROTECTED] wrote:
 I've seen that's possible to add members to objects dinamically, in example:
 
 The question is, is it possible to add methods in the same way?

Why not just extend the class and add the new functions there?


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Strange explode()

2004-10-26 Thread Matthew Sims
 Hi,
 Any idea why it is taking the first array as blank and giving me an array
 count of 3 instead of 2?
 ?
 $final=http://something.com/cgi-bin/atx/out.cgi?s=63c=1l=galsu=http://bl
 ah.something.com/bs3/index1.htm;
 $final2=explode(http://,$final);
 $res=count($final2);
 echo brbrbr.$res;
 print_r($final2);
 ?

 This is the output that is confusing me:
 Array
 (
 [0] =
 [1] = something.com/cgi-bin/atx/out.cgi?s=63c=1l=galsu=
 [2] = blah.something.com/bs3/index1.htm
 )

 Thanks,
 Ryan

Not sure what you're thinking of explode means but the above is correct.
You've defined http:// as the boundry so anything before and after the
boundry is placed into the final2 array. http:// appears twice in your
string.

-- 
--Matthew Sims
--http://killermookie.org

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



[PHP] Re: PHP 5 abstract method and class type hints of extending classes

2004-10-26 Thread Jeremy Weir

Greg Beaver [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Jeremy Weir wrote:
 The quesion is: how would one make an abstract method that can be 
 compatible with all extending classes that define the method using 
 different class type hints?

 The php block below is how I thought it should work, but will give this 
 error at parse time:
 errorFatal error: Declaration of DisplayObjectOne::display() must be 
 compatible with that of DisplayBase::display()/error
 because the hint in the concrete method is different from that in the 
 abstract method.

 ?php
 // base display class
 abstract class DisplayBase {
 abstract public function display(ObjectBase $object);
 }

 // display ObjectOne
 class DisplayObjectOne extends DisplayBase {
 public function display(ObjectOne $object){
 print_r($object);
 }
 }

 // display ObjectTwo
 class DisplayObjectTwo extends DisplayBase {
 public function display(ObjectTwo $object){
 var_export($object);
 }
 }

 If you use type-hinting, this is a more strict contract.  You're telling 
 PHP that this method must receive an object that is of this class or any 
 subclass

 in DisplayObjectTwo, you're saying this method CANNOT accept a 
 DisplayBase or any child object unless it extends ObjectTwo

 In other words, imagine if what you want to do was allowed.  Someone comes 
 along who writes a method that uses an instanceof test like:

 $b = new ObjectOne;
 $a = new DisplayObjectTwo;
 if ($a instanceof DisplayBase) {
 $a-display($b);
 }

 to display another object, you get a serious problem, because the code 
 will fail with all DisplayObject* that aren't DisplayObjectOne, but the 
 instanceof test will succeed!

 In other words, your display() function is in fact not a generic function, 
 but is specific to each class, so the use of a DisplayBase class makes 
 absolutely no sense at all.  Better is to implement a method inside 
 ObjectBase called getDefaultDisplayObject() which will instantiate the 
 display object that is needed.  Custom classes can then override this 
 method to return the custom display object.

 Even though it is better, this still isn't great design.  What you 
 probably want is this:

 abstract class DisplayBase
 {
 public static function factory(ObjectBase $o)
 {
 $class = 'Display' . get_class($o);
 if (!class_exists($class)) {
 throw new Exception('No display object for ' . get_class($o) 
 . '');
 }
 $disp = new $class($o);

 }

 abstract public function __construct($o);
 abstract public function display($options); // might want this
 }

 class DisplayObjectOne extends DisplayBase
 {
 private $object;
 public function __construct($o)
 {
 if (!$o instanceof ObjectOne) {
 throw new Exception('parameter must be an ObjectOne');
 }
 $this-object = $o;
 }

 public function display($options)
 {
 print_r($this-object);
 }
 }

 class DisplayObjectTwo extends DisplayBase
 {
 private $object;
 public function __construct($o)
 {
 if (!$o instanceof ObjectTwo) {
 throw new Exception('parameter must be an ObjectTwo');
 }
 $this-object = $o;
 }

 public function display($options)
 {
 print_r($this-object);
 }
 }

 Now, your hypothetical user can do

 try {
 if ($d instanceof DisplayBase) {
 $d-display($options);
 }
 } catch (Exception $e) {
 // handle problems
 }

 and rest assured that the code will work under all circumstances.  Hope 
 this helps :)

 Regards,
 Greg

Thanks Greg,

I realize that it can all be rewritten using instanceof tests, but I was 
just hoping for an explanation of why the hints in the method definitions 
can't be subclasses of the hint in the abstract method. The doc sort of 
leads to this conclusion because of the comparison between the use of 
instanceof and the hint, but in fact it isn't totally true since at parse 
time it probably just does a text comparison between the abstract method and 
the overwritting definitions of the abstract method's arguments. 

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



RE: [PHP] @session_start generates a new session_id

2004-10-26 Thread Reinhart Viane
Instead of:
? $_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

Try this:

//unregister the sessions
$_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=;
//destroy the sessions array
$_SESSION = array(); 
//destroy the session
session_destroy(); 

Greetings
Reinhart Viane






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

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


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



[PHP] Re: Add methods to object dinamically

2004-10-26 Thread Matthew Weier O'Phinney
* Francisco M. Marzoa Alonso [EMAIL PROTECTED]:
 I've seen that's possible to add members to objects dinamically, in example:

 class MyClass {
 private $a;
 }

 $MyObject = new MyClass ();
 $MyObject-b = 1;

 Now $MyObject has a public member called 'b' that has a value of '1'.

 The question is, is it possible to add methods in the same way?

 I meant something such as:

 function sum ( $this ) {
 return $this-a+$this-b;
 }

 $MyObject-sum = sum;

No. There are some things you can look into, however. PHP4 has an
overload() function (and PHP5 has it built in) -- you could then add a
__call() method that checks to see if a function is defined, and if so,
calls it.

class MyClass 
{
var $a;

// Note: you'd call this differently in PHP5
function __call($function, $arguments, $return)
{
if (function_exists($function)) {
$function($arguments);
}
}
}
overload('MyClass'); // This line unncessary in PHP5

The other possibility is to look into the classkit extension
(http://php.net/classkit); this would require being able to install PHP
extensions (not a problem if it's your own box).

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



[PHP] Re: Add methods to object dinamically

2004-10-26 Thread Greg Beaver
Francisco M. Marzoa Alonso wrote:
I've seen that's possible to add members to objects dinamically, in 
example:

class MyClass {
   private $a;
}
$MyObject = new MyClass ();
$MyObject-b = 1;
Now $MyObject has a public member called 'b' that has a value of '1'.
The question is, is it possible to add methods in the same way?
I meant something such as:
function sum ( $this ) {
   return $this-a+$this-b;
}
$MyObject-sum = sum;
Note that code will not work, but it illustrates what I'm asking for.
Sort of :)
In PHP5, this will work.
?php
class DoesStuff
{
private $_methods = array();
public function __call($method, $params)
{
if (isset($this-_methods[$method])) {
$call = $this-_methods[$method];
return $call($this);
}
}
public function __set($var, $value)
{
if (is_string($value)  is_callable($value)) {
$this-_methods[$var] = $value;
} else {
$this-$var = $value;
}
}
}
function test($o)
{
return $o-val;
}
$o = new DoesStuff;
$o-val = 4;
$o-test = 'test';
echo $o-test();
?
However, you won't have access to private or protected data members.  It 
is always better to rigidly define your methods, and extend the class as 
someone else suggested.

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


[PHP] Re: Add methods to object dinamically

2004-10-26 Thread Francisco M. Marzoa
Greg Beaver wrote:
Sort of :)
In PHP5, this will work.
[...]
Very nice, thanks a lot :-)
However, you won't have access to private or protected data members.
Damn! that's exactly what I want! :-(
It is always better to rigidly define your methods, and extend the 
class as someone else suggested.
The problem is that I need to serialize some objects to put them on a 
database, but I'll have problems when some of these objects contains 
another ones from third parties where I do not control the inheritance 
and I've not access directly to object fields.

Converting the object to an array is useful for serialization, as I can 
access private and protected object member values, but I cannot 
unserialize them because I cannot wrote those members again.

Never mind. I surely must rethink the matter again.
Thanks a million, Greg.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Add methods to object dinamically

2004-10-26 Thread Robert Cummings
On Tue, 2004-10-26 at 14:21, Francisco M. Marzoa wrote:
 Greg Beaver wrote:
 
  Sort of :)
 
  In PHP5, this will work.
 
 [...]
 
 Very nice, thanks a lot :-)
 
 
  However, you won't have access to private or protected data members.
 
 Damn! that's exactly what I want! :-(
 
  It is always better to rigidly define your methods, and extend the 
  class as someone else suggested.
 
 The problem is that I need to serialize some objects to put them on a 
 database, but I'll have problems when some of these objects contains 
 another ones from third parties where I do not control the inheritance 
 and I've not access directly to object fields.
 
 Converting the object to an array is useful for serialization, as I can 
 access private and protected object member values, but I cannot 
 unserialize them because I cannot wrote those members again.
 
 Never mind. I surely must rethink the matter again.
 
 Thanks a million, Greg.

Could you serialize the object then parse the serialized data yourself
and manipulate the values as an array, then re-serialize back to object
form and then unserialize as an object with modified protected/private
members? Sounds like a lot of work, but it just might bypass the whole
protected/private issue :) Not that it's generally a good thing to
bypass such things *heheh*.

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

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



[PHP] Re: Protecting Commercial PHP Scripts

2004-10-26 Thread Manuel Lemos
Hello,
On 10/26/2004 08:44 AM, Nick Wilson wrote:
I was wondering if anyone might have suggestions or useful links on
protecting commercial php scripts.
I am about to design a system that would be pretty valuable in a very
niche market and would not wish the script to be passed on to others
once downloaded.
Suggestions, discussion and links would be much appreciated ;-)
You may want to try Roadsend PHP compiler, so far the only compiler that 
can produce real binaries from PHP code.

http://www.roadsend.com/
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
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] Regex Lookbehind help

2004-10-26 Thread Alex Hogan
Hi All,

I am trying to identify an email address in a page but I don't want to
return the email if it's [EMAIL PROTECTED]

Here's what I have;
(\w[-._\w]*\w(?!webmaster)@\w[-._\w]*\w\.\w{2,3})

It returns nothing, however when I take out the lookbehind section;
([EMAIL PROTECTED],3})
it works fine, returning all email addresses in a page.

What is wrong with my syntax?


alex hogan

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




RE: [PHP] Regex Lookbehind help

2004-10-26 Thread Michael Sims
Alex Hogan wrote:
 Hi All,

 I am trying to identify an email address in a page but I don't want to
 return the email if it's [EMAIL PROTECTED]

 Here's what I have;
 (\w[-._\w]*\w(?!webmaster)@\w[-._\w]*\w\.\w{2,3})

 It returns nothing, however when I take out the lookbehind section;
 ([EMAIL PROTECTED],3})
 it works fine, returning all email addresses in a page.

 What is wrong with my syntax?

I just tried this out and the first regex is actually working for me on php 4.3.8
(cli).  Can you post some code?

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



Re: [PHP] Is flock() necessary on a simple file append?

2004-10-26 Thread Kevin Grigorenko

Paul Fierro [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On 10/24/2004 5:11 PM, Kevin Grigorenko [EMAIL PROTECTED] wrote:

  I am appending to a file one line of text on every page hit, so there
could
  be many occurrences of this append simultaneously.  I am not opening for
  write (w) but for append (a). Do I need to use flock() to be sure
there
  are no issues?  I am running on Solaris.

 On 10/24/2004 5:39 PM, Hristo Yankov [EMAIL PROTECTED] wrote:

  append is the same as write (it requires write access
  for example), so if you are gonna use flock for w,
  use it for a too.

 According to this post, you do not need to use flock() if you open a file
in
 append mode:

 http://marc.theaimsgroup.com/?l=php-generalm=105165806915109w=2

That's exactly what I was looking for; however, I wonder whether that only
applies to the one byte the poster speaks of, or as long as everyone is only
appending.


 Paul

Kevin Grigorenko


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



Re: [PHP] Regex Lookbehind help

2004-10-26 Thread Alex Hogan
 I just tried this out and the first regex is actually working for me on php 4.3.8
 (cli).  Can you post some code?

At this point all I'm trying to do is print the array with the addresses.

$file=readfile('mypathto/myfile.html');
$patrn =(\w[-._\w]*\w(?!webmaster)@\w[-._\w]*\w\.\w{2,3});

$addresses =preg_match($patrn,$file);

print_r($addresses);



alex hogan

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



RE: [PHP] Is flock() necessary on a simple file append?

2004-10-26 Thread Michael Sims
Kevin Grigorenko wrote:
 Paul Fierro [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 According to this post, you do not need to use flock() if you open a
 file in append mode:

 http://marc.theaimsgroup.com/?l=php-generalm=105165806915109w=2

 That's exactly what I was looking for; however, I wonder whether that
 only applies to the one byte the poster speaks of, or as long as
 everyone is only appending.

This is my understanding, someone correct me if I'm wrong...

AFAIK, normally you need to lock even on appending.  Depending on how the OS buffers
disk writes (and how much data you are writing), it's possible that a portion of
process A's data will be written, then a portion of process B's, etc (interleaving).
You could end up with garbage data in your file if you don't ensure that the each
writer has exclusive write access.  In Rasmus's example you are only writing single
bytes, and the order that they are eventually written doesn't matter.  Each single
byte will be written as one operation (as opposed to being buffered into separate
writes if your data is larger) and it doesn't matter if process B gets to the file
before process A.  But if the amount of data you are writing is larger than what the
OS buffers then you could get interleaving data being written from concurrent
processes.

See:
http://groups.google.com/groups?selm=8c10kl%24frg%241%40rguxd.viasystems.com

That thread is from comp.lang.perl.misc, but what is discussed should apply to PHP
as well.

From your original post it looks like you aren't writing a lot of data per request,
so you probably won't have any problems with interleaving.  However, calling flock()
is fairly simple so I would if your data is important.

HTH

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



RE: [PHP] Regex Lookbehind help

2004-10-26 Thread Michael Sims
Alex Hogan wrote:
 I just tried this out and the first regex is actually working for me
 on php 4.3.8 (cli).  Can you post some code?

 At this point all I'm trying to do is print the array with the
 addresses.

 $file=readfile('mypathto/myfile.html');
 $patrn =
 (\w[-._\w]*\w(?!webmaster)@\w[-._\w]*\w\.\w{2,3});

 $addresses =preg_match($patrn,$file);

 print_r($addresses);

Check the documentation for preg_match()...it can't be used that way.  It returns
false or the number of matches, but not the matching text itself.  To get the
matches you have to supply the third parameter (matches).  Plus you'll probably want
to use preg_match_all() unless you only want to get the first match.

Also, I don't believe readfile() is what you want.  It looks like
file_get_contents() is more in line with what you are trying to do.

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



Re: [PHP] Regex Lookbehind help

2004-10-26 Thread Alex Hogan
 Check the documentation for preg_match()...it can't be used that way.  It returns
 false or the number of matches, but not the matching text itself.  To get the
 matches you have to supply the third parameter (matches).  Plus you'll probably 
 want to use preg_match_all() unless you only want to get the first match.

I caught that after I reread the manual.


 Also, I don't believe readfile() is what you want.  It looks like
 file_get_contents() is more in line with what you are trying to do.

That's got it.

Thanks...


alex hogan

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



[PHP] simplexml question.

2004-10-26 Thread postmaster

Hello,

I looking to get the data out of this test.xml file but dont
know how to get the data out because of the bo: namespaces.
If I remove all bo: from the xml then it works fine...
Is anyone can tell me how to do it?


?php
$file = test.xml;
$xml = simplexml_load_file($file) or die (Unable to load XML file!);
echo Name:  . $xml-UserAuthRequest-UserLoginName . \n;
?


test.xml:

?xml version=1.0 encoding=UTF-8?
bo:TXLife xsi:schemaLocation=http://ACORD.org/Standards/Life/2
TXLife2.9.90.XSD xmlns:bo=http://ACORD.org/Standards/Life/2;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
bo:UserAuthRequest
bo:UserLoginNameTest login/bo:UserLoginName



Thanks,

Andras Kende

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



[PHP] Validation and session variables

2004-10-26 Thread Stuart Felenstein
Having some odd behaviour. 
First , let me mention this is a multi page form using
session variables. (This might be important)

So I am doing a page by page validation, and have
tried putting the code before session_start or after. 
Either way my session variables are getting lost.

Now in order to do my validation on the same page, I
have set form action to nothing action=
And upon sucess of happy validation added this code:

if ($_SERVER[REQUEST_METHOD] == POST) {
 $url = success.php;
 Header(Location: $url);
}
?

The page progresses correctly but it seems the
variables are gone.  
Sound like it makes sense ? Any suggestions or ideas.

Thank you,
Stuart

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



[PHP] Re: Sending Mail with PHP

2004-10-26 Thread Manuel Lemos
Hello,
On 10/26/2004 06:22 AM, Wiesiek wrote:
So.. If domain was not exist (like (2)), then exim4 generate error message 
and send [EMAIL PROTECTED] (like (4)).
Is some way to change it? I never set in any config these address.
I try to set in mail header Return-Patch:, but it seems to no work :(
You may want to try this class that lets you set the return address 
using the Return-Path header. You can either use the main class or the 
sendmail sub-class for delivery. There are examples of how to set the 
return address here:

http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
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


Re: [PHP] mysql_escape_string breaks EOL?

2004-10-26 Thread Marek Kilimajer
David Robley wrote:
It seems that mysql_escape_string and mysql_real_escape_string do
undesirable things to EOL markers - data from textareas escaped with either
of those functions is entered, and retrieved with, the characters /r/n
instead of a true line break.
This snippet of code demonstrates the problem:
?php
$wibble = \This\ and\n'that';
echo Before: $wibbleBR\n;
$wibble1 = addslashes($wibble);
echo Addslashes: $wibble1BR\n;
$wibble2 = mysql_escape_string($wibble);
echo Escape: $wibble2BR\n;
?
And the output (from Show source) with line breaks exactly as in the source
Before: This and
'that'BR
Addslashes: \This\ and
\'that\'BR
Escape: \This\ and\n\'that\'BR
Is this a bug, or am I totally missing something?
No, it's not a bug. If you use it in mysql query, mysql server will 
convert \n to newline character

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


Re: [PHP] Re: PHP Crypt on MacOSX

2004-10-26 Thread Galen
I use md5 all the time and OS X is my web development staging 
environment! I write and test all my scripts on OS X and then send off 
to the server. I don't use crypt, but I have never seen any problems 
going between the two. apache, php, mysql, rsync, ssh, scp, everything 
*nixy plus a nice interface makes OS X the ideal web development 
environment - at least for me.

Not only can MySQL do md5, there is an md5 function in php which I've 
used many times under OS X no problem:
http://us2.php.net/md5

If that wasn't enough, OS X ships with an md5 binary that's in the 
usual file path so typing md5 in the command line will pull it up and 
man md5 gives all the info you could need on using it. I don't 
encourage the use of the command line version of md5 for php because it 
will be slower than the built in php function, but it is there!

-Galen
On Oct 25, 2004, at 10:38 AM, Daniel Schierbeck wrote:
Kris wrote:
I recently moved a site to a MacOSX based Apache/PHP server.  
Apparently crypt only uses DES.  I read somewhere that there is no 
way to get it use use MD5, which sounds hard to beleive considering 
the OS is BSD based.
So.. here is my dilema.. My db contains usernames and passwords.  The 
passwords are MD5 $1ljdslkjdsf$lkjdsaflkjdsf (created by crypt().)  
So on this new box, new accounts created get DES passwords.  I just 
as well prefer to not see any DES encryptions used in this db.
Any Mac OSX'ers in here that may have a solution?  All my users 
recreating new passwords for their account is not an option.
Thanks for any ideas,
Kris
Can't you just use the db's (i assume you use MySQL, most do) built-in 
MD5 function?

	SELECT id, username FROM users WHERE username LIKE 'myuser' AND 
password = MD5('mypass') LIMIT 1

--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com): 
http://www.spreadfirefox.com/?q=user/registerr=6584

--
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] not _that_ fixed....

2004-10-26 Thread Pierre Ancelot


in fact, i would code it in c++ but the used compiler is gcc... i tried to 
change the value CC in makefile but the lib obtained is invalid and is not 
working with php any idea on this ? 

Sorry to bother again :)

On Tuesday 26 October 2004 16:14, Curt Zirzow wrote:
 * Thus wrote Robert Cummings:
  On Tue, 2004-10-26 at 00:37, Pierre Ancelot wrote:
   in fact i got it in the ./configure --help :
  
   [EMAIL PROTECTED]:~/phpsource/php-4.3.9$ ./configure --help | grep -i
   spider --enable-spider   Enable spider support
 
 ...
 
  That said, if you still wish to compile a shared object module of your
  extension then you can run this from the PHP source directory (with
  suitable changes for your extension):
 
  cc -fpic -DCOMPILE_DL_INTERJINN=1 \
  -Iext/interjinn/ -Iinclude -Imain -I. -IZend -ITSRM \
  -c -o ext/interjinn/interjinn.o ext/interjinn/interjinn.c
 
  cc -shared -L/usr/local/lib -rdynamic -o \
  ext/interjinn/interjinn.so \
  ext/interjinn/interjinn.o

 Actually it gets easier..

 cd ext/custommodule/
 phpize
 ./configure --with-custommodule
 make

 Now you'll have a custommodule.so available.



 Curt
 --
 Quoth the Raven, Nevermore.

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



Re: [PHP] not _that_ fixed....

2004-10-26 Thread Curt Zirzow
You can write your program in c++, checkout this pecl extension:

  http://pecl.php.net/rar

You might want to join the pecl mailing list, there are more
developer eyes there that can answer questions about these things.


* Thus wrote Pierre Ancelot:
 
 
 in fact, i would code it in c++ but the used compiler is gcc... i tried to 
 change the value CC in makefile but the lib obtained is invalid and is not 
 working with php any idea on this ? 
 
 Sorry to bother again :)
 
 On Tuesday 26 October 2004 16:14, Curt Zirzow wrote:
  * Thus wrote Robert Cummings:
   On Tue, 2004-10-26 at 00:37, Pierre Ancelot wrote:
in fact i got it in the ./configure --help :
   
[EMAIL PROTECTED]:~/phpsource/php-4.3.9$ ./configure --help | grep -i
spider --enable-spider   Enable spider support
  
  ...
  
   That said, if you still wish to compile a shared object module of your
   extension then you can run this from the PHP source directory (with
   suitable changes for your extension):
  
   cc -fpic -DCOMPILE_DL_INTERJINN=1 \
   -Iext/interjinn/ -Iinclude -Imain -I. -IZend -ITSRM \
   -c -o ext/interjinn/interjinn.o ext/interjinn/interjinn.c
  
   cc -shared -L/usr/local/lib -rdynamic -o \
   ext/interjinn/interjinn.so \
   ext/interjinn/interjinn.o
 
  Actually it gets easier..
 
  cd ext/custommodule/
  phpize
  ./configure --with-custommodule
  make
 
  Now you'll have a custommodule.so available.
 
 
 
  Curt
  --
  Quoth the Raven, Nevermore.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] not _that_ fixed....

2004-10-26 Thread Curt Zirzow
* Thus wrote Robert Cummings:
 On Tue, 2004-10-26 at 10:14, Curt Zirzow wrote:
   
  Actually it gets easier..
  
  cd ext/custommodule/
  phpize
  ./configure --with-custommodule
  make
  
  Now you'll have a custommodule.so available.
 
 Aaah cool. When did that become available?

Its been around for a while, not sure but I believe in the early
stages of php4.


Curt
-- 
Quoth the Raven, Nevermore.

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



[PHP] alias a function

2004-10-26 Thread Justin French
Hi,
What's the quickest way to alias a user function?
I have a function which uses english spelling (eg categorise instead of 
categorize), and I want to alias the function with an Americanized 
spelling.

I'd rather that the alias categorize() did not have to be altered in 
any way to keep up with changes to the parent function categorise() 
-- in particular, having the correct number of attributes and default 
values, for example.

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


[PHP] __PHP_Incomplete_Class Errors...

2004-10-26 Thread Stephen Craton
I've been working on a script for a while now and it works perfectly on my
local machine. I'm using a couple of classes, mainly my database and users
classes.

After logging in, I assign a session variable to the user's row in the
database: $_SESSION['user'] = $db-row;

This works fine locally, but on my hosted machine, it settings the variable
to this:

__PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] = users
[user] = 
[loggedin] = 1
[ip] = 12.222.81.78
[db] = __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] = thedatabase
[host] = localhost
[user] = melchior_clients
[pass] = 
[data] = melchior_clients
[linkid] = 0
[res] = 0
[num] = 0
[row] = 
[logger] = __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] = logger
[logdir] = logs/
[fp] = 
)

)

[logger] = __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] = logger
[logdir] = logs/
[fp] = 
)

)

For some reason, as far as I can tell, it's making every class variable to
__PHP_Incomplete_Class for some reason. The way I'm accessing the classes
via another class this something like this:

$db = new theDatabase;
$user = new Users;
$user-db = $db;

And then, within the class, I access it as such:

$this-db-query($sql);

This works perfectly on my local machine, but it gets all weirded once I
upload it. I have NO idea why or how to fix it. Does anyone have any ideas?


Stephen Craton
[EMAIL PROTECTED]
IM: [EMAIL PROTECTED]
http://www.melchior.us


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



RE: [PHP] file upload

2004-10-26 Thread Zareef Ahmed
Hi,
Here is a small but working script which emulate post. You can post any
type of data as a form field.

http://www.zend.com/codex.php?id=77single=1

But as many other users have suggested, I think SOAP is the best thing
to try.

Visit 
http://sourceforge.net/projects/nusoap/

 
Zareef Ahmed

-Original Message-
From: Jesse Castro [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 7:13 PM
To: Victor C.
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] file upload


 Ahh, if you *have* to push the data (which you obviously do) and the 
 authentication site has no other authentication methods then you have 
 to POST the file with PHP. It can be done, there are many classes for 
 it, I can't recommend any specific class, but I'm sure someone else 
 here could.

 I would surprise me if something in PEAR ( http://pear.php.net/ ) 
 couldn't do it. Just look for an HTTP class that can POST files.

 Chris

 Victor C. wrote:

 See... basically, I have two sites. One site provides user 
 authentication and another one requests the authentication. The 
 requesting site need
to
 send to the authentication site its request in an XML.  The
 authentication
 site is suppose to get the XML file using $HTTP_POST_FILES.  I'm 
 using PHP
 to dynamically generate the request XML file and I need to submit it 
 to the
 authenticating site; but I don't want to use file upload and browse
 functionality, because the authentication process is suppose to be
 transparent to the end users.

 Again, thanx for the help and any insights would be greatly 
 appreciated. :)


Victor,

I have recently come across the same problem.  Microsoft supplied a very
nice method to submit xml files in asp.  Unfortunately, it is harder to
implement in PHP.  The script below is what I eventually came up with,
and it works for me.  Don't know if it applies to your situation
exactly, but hope it helps at any rate.

Cheers,
Jesse R. Castro


$xmlRequest = request\n;
$xmlRequest.= \tcontentsfoo/contents\n;
$xmlRequest.= /request;

$url = http://www.wherever.com;;
$port = 83;
$path = /path/to/script.asp

/*
*   $errno and $errstr are blank, see the docs for fsockopen
*/

$sockXml = fsockopen($url, $port, $errno, $errstr, 30);

if (!$sockXml) {
   echo $errstr. (.$errno.)br /\n;
} else {
/*
*   http headers
*/
$out = POST .$path. HTTP/1.1\n;
$out .= Host: www.wherever.com:83\n;
$out .= Content-Type: application/x-www-form-urlencoded\n; 
$out .= Content-Length: .strlen($xmlRequest).\n; 
$out .= Connection: Close\n;
$out .= \n.$xmlRequest; 
$out .= \n ;

/*
*   write the http headers to the open socket
*/  
   fwrite($sockXml, $out);

/*
*   get the results back
*/
   $strReturned = ;
   while (!feof($sockXml)) {
$strReturned.= @fgets($sockXml, 4096);
   }
   echo $strReturned.\n;


--
Zareef Ahmed :: A PHP develoepr in Delhi ( India )
Homepage :: http://www.zasaifi.com

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



Re: [PHP] Compiling PHP with extension; CLI works, Apache doesn't

2004-10-26 Thread Curt Zirzow
* Thus wrote Aaron Gould:
 I just compiled PHP with an extension for testing purposes 
 (mnoGoSearch).  After all was said and done, the CLI version sees the 
 mnogosearch extension just fine (php -m), but the Apache module 
 doesn't see it at all (nothing mnogosearch related at all in PHPINFO()).

Looks good, few things I would check:
  1. Did you restart apache?
  2. did the libphp.so make it to the right apache directory
  3. the extension_dir set to the right place.


Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Curt Zirzow
* Thus wrote Nick Wilson:
 Hello all, 
 
 I was wondering if anyone might have suggestions or useful links on
 protecting commercial php scripts.

One thing that is always overlooked besides trying to obscure the
code so only reverse engineering is possible, is to include a
license in the source and with the package you distribute.

It doesn't prevent the code from being stolen, but does officially
declare proper usage.


Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] alias a function

2004-10-26 Thread Curt Zirzow
* Thus wrote Justin French:
 Hi,
 
 What's the quickest way to alias a user function?
 
 I have a function which uses english spelling (eg categorise instead of 
 categorize), and I want to alias the function with an Americanized 
 spelling.
 
 I'd rather that the alias categorize() did not have to be altered in 
 any way to keep up with changes to the parent function categorise() 
 -- in particular, having the correct number of attributes and default 
 values, for example.

Instead of aliasing, I would deprecate the function, so the old
function would be:

function categorise($arg1, $arg2) {
  trigger_error('Deprecated categorise used', E_USER_NOTICE);
  return categorize($arg1, $arg2);
}

As far eliminating the parameter changes, I can only think that
you'd need to use func_get_args() and call_user_func_array():

function categorise() {
  call_user_func_array('categorize', func_get_args());
}

The latter solution is quite a bit of overhead just to get an alias,
perhaps trigger_error with that method as you migrate old code.



Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] __PHP_Incomplete_Class Errors...

2004-10-26 Thread Curt Zirzow
* Thus wrote Stephen Craton:
 I've been working on a script for a while now and it works perfectly on my
 local machine. I'm using a couple of classes, mainly my database and users
 classes.
 
 After logging in, I assign a session variable to the user's row in the
 database: $_SESSION['user'] = $db-row;
 
 This works fine locally, but on my hosted machine, it settings the variable
 to this:
 
 __PHP_Incomplete_Class Object

This means you are not defining your class before starting your
session.

If you store classes in a session you must define you class before
the call to session_start().  If you have session.auto_start = 1 in
your configuration, you will have to disable that so you can define
your classes before starting the session.

Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] Validation and session variables

2004-10-26 Thread Ligaya Turmelle
Without seeing the code:
Try putting session_start() at the VERY beginning.  Also try having the 
action go to the page itself ($PHP_SELF or putting in the path).  Is the 
session variables being set using $SESSION['']?

Respectfully,
Ligaya Turmelle
Stuart Felenstein wrote:
Having some odd behaviour. 
First , let me mention this is a multi page form using
session variables. (This might be important)

So I am doing a page by page validation, and have
tried putting the code before session_start or after. 
Either way my session variables are getting lost.

Now in order to do my validation on the same page, I
have set form action to nothing action=
And upon sucess of happy validation added this code:
if ($_SERVER[REQUEST_METHOD] == POST) {
 $url = success.php;
 Header(Location: $url);
}
?
The page progresses correctly but it seems the
variables are gone.  
Sound like it makes sense ? Any suggestions or ideas.

Thank you,
Stuart

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

Re: [PHP] Validation and session variables

2004-10-26 Thread Stuart Felenstein
Yes the session variables are set with $SESSION[''}.
The way it works is the variable gets set on the
follwing pages:

So, example on page 1:
I have this user input field: 
td width=172input name=ListingName type=text
id=ListingName maxlength=20 //td

On the following page (page 2):
$_SESSION['f1a'] = $_POST['ListingName'];

And all the pages follow the same method.  Inputs on
page 2 are $_SESSION[''] = $_POST['']; on page 3.

I did try putting the session_start() at the top of
the page.  Didn't seem to make any difference.

Just to show the validation code (and it's from a
class):

?php
require_once(WA_ValidationToolkit/WAVT_Scripts_PHP.php);
?
?php
require_once(WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php);
?
?php 
if ($_SERVER[REQUEST_METHOD] == POST)  {
  $WAFV_Redirect = ;
  $_SESSION['WAVT_Page1'] = ;
  if ($WAFV_Redirect == )  {
$WAFV_Redirect = $_SERVER[SCRIPT_NAME];
  }
  $WAFV_Errors = ;
  $WAFV_Errors .=
WAValidateAN(((isset($_POST[ListingName]))?$_POST[ListingName]:)
. ,true,true,true,true,,true,1);

  if ($WAFV_Errors != )  {
PostResult($WAFV_Redirect,$WAFV_Errors,Page1);
  }
}
?
if ($_SERVER[REQUEST_METHOD] == POST) {
 $url = Page2.php;
 Header(Location: $url);
}
?

So, for every page I add validation too, I can see at
the end from the printout, that the variables are
gone, missing .

Stuart


--- Ligaya Turmelle [EMAIL PROTECTED] wrote:

 Without seeing the code:
 Try putting session_start() at the VERY beginning. 
 Also try having the 
 action go to the page itself ($PHP_SELF or putting
 in the path).  Is the 
 session variables being set using $SESSION['']?
 
 Respectfully,
 Ligaya Turmelle
 
 
 Stuart Felenstein wrote:
  Having some odd behaviour. 
  First , let me mention this is a multi page form
 using
  session variables. (This might be important)
  
  So I am doing a page by page validation, and have
  tried putting the code before session_start or
 after. 
  Either way my session variables are getting lost.
  
  Now in order to do my validation on the same page,
 I
  have set form action to nothing action=
  And upon sucess of happy validation added this
 code:
  
  if ($_SERVER[REQUEST_METHOD] == POST) {
   $url = success.php;
   Header(Location: $url);
  }
  ?
  
  The page progresses correctly but it seems the
  variables are gone.  
  Sound like it makes sense ? Any suggestions or
 ideas.
  
  Thank you,
  Stuart
  
 
  -- 
 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