[PHP] Do I need to recompile Apache2 "--with-apxs" for PayPal PHP SDK?

2005-07-29 Thread John Hicks

I'm trying to install and configure PayPal Website Payments Pro using
the PayPal PHP SDK.

The first step in the SDK Quickstart instructions is:
Enable Apache modules and APXS (Apache Extension Tool)
In your Apache root directory, run:
../configure ?enable-mod=so --with-apxs /usr/local/apache/bin/apxs (sic)

I think of the  ./configure directive as a precursor to compiling with
"make," yet there is no mention made of running "make".

I'm running RHEL 4.1 with Apache 2 precompiled. I can see that modules
are enabled, but I'm guessing it wasn't compiled with apxs since I
just installed apxs 10 minutes ago. (FWIW, it's part of the
httpd-devel package.)

But, then, when I search the Apache site, I see no mention of a
"--with-apxs" directive for Apache 2 (only for Apache 1.3). So I'm
thinking the instructions may be a little off. Is there such a
directive for Apache 2?

So I'm wondering if this step is really necessary. I hate to futz with
a perfectly fine Red Hat installation if it isn't.

Does anyone know how PayPal uses apxs? Does it actually build its own
module to be loaded into apache? If I proceed without recompiling
Apache, how will I be able to tell if my existing installation of
Apache is inadequate?

Any help would be appreciated. Thanks.

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



Re: [PHP] PHP noobie

2005-07-29 Thread Bob Stia
On Friday 29 July 2005 02:55, Jochem Maas wrote:
> Bob Stia wrote:
> > Hello PHP list
> >
> > First allow me to apologize if this is the wrong place for this and
> > direct me to the proper place. (be nice now!)
>
> this list is really for people who are programmning in php.
> as you describe it your looking for a php solution as an end user,
> so no this is not really the right place - although I couldn't
> really say where you would be better off.

.
>
Hello PHP people,

First of all let me thank all of the kind people who replied to my call 
for help and intruded into your domain, and there were many of you. It 
is much appreciated. I scrutinized all of your replies and have gained 
some knowledge from your replies.

Some of you have offered help privately and I may well call upon your 
expertise. May I reserve the right to return to this list with a few 
questions???

Thanks again,
Bob S.

  

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



Re: [PHP] Re: Automated Numerical Filenames for Directory

2005-07-29 Thread Kevin Waterson
This one time, at band camp, "Smittie" <[EMAIL PROTECTED]> wrote:

> Okay - figured it out and have it working now

What was your solution?

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] exec / shell_exec issues

2005-07-29 Thread leonski

Robert Cummings wrote:

On Fri, 2005-07-29 at 22:45, leonski wrote:


Robert Cummings wrote:


On Fri, 2005-07-29 at 22:17, leonski wrote:



Jason Wong wrote:



On Saturday 30 July 2005 08:49, leonski wrote:





sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
No such file or directory sh: line 1: /usr/local/bin/mogrify
/tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!



I think the error message is trying to tell you that 
"/usr/local/bin/mogrify" does not exist.




:-( yeah it does and it works under the terminal (nicely I might add, 
thanks ImageMagick).

leonski.



Because you've used escapeshellargs() (or whatever it is) it's probably
treating the entire parameter to exec() (excluding the string
concatenation for output redirection) as the command to execute. I know
you said  you tried it otherwise but try the following:

if( file_exists( $imagefile ) )
{
   $arg = escapeshellarg( $imagefile );
   exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
}

Cheers,
Rob.


did:

if( file_exists( $imagefile ) )
{
$arg = escapeshellarg( $imagefile );
echo $str= "/usr/local/bin/mogrify $arg -resize 95x72 ";
exec($str);
}

added a line so I could see the string

got:

/usr/local/bin/mogrify '/tmp/phpPdCiGS' -resize 95x72
Warning: fopen('/tmp/phpPdCiGS') [function.fopen]: failed to open 
stream: No such file or directory in 
/Library/WebServer/Documents/build2/admin/classes/class_upload.php on 
line 254


so again - how does it get past the file_exists if it doesn't?!!!

keep it coming Robert;-)



Ah, but the above error is a completely different error than you
were posting previously, so we've moved past the first error which was
as I suspected.

Cheers,
Rob.
Indeed you are very right - it seems mogrify is working, but I'm 
stuffing up something else.


I've just tried this using convert instead of mogrify so I can interject 
and grab the image as its being written to /tmp. - I checked out what 
Jason was saying too and he is also very right - the errors were 
obviously not mogrify errors (der! on my part).


Turns out now it WORKS (since I'm escaping correctly now)

My eyball sockets thank you both. In a great Aussie tradition I'd buy 
you a beer or three if you were here!

Could also substitute coffee, pepsi max etc depending on preferred poison.

Thanks soo much.

I only hope to be able to spot these issues as rapidly as you guys and 
give back to the community too.


Cheers,
leonski.

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



Re: [PHP] exec / shell_exec issues

2005-07-29 Thread leonski
WAIT - DISREGARD THAT LAST POST - I forgot to // some other debug lines 
- the output is inconsistent with what I was testing (Robert's code) - 
I'll do better.



leonski wrote:

Robert Cummings wrote:


On Fri, 2005-07-29 at 22:17, leonski wrote:


Jason Wong wrote:


On Saturday 30 July 2005 08:49, leonski wrote:




sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
No such file or directory sh: line 1: /usr/local/bin/mogrify
/tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!




I think the error message is trying to tell you that 
"/usr/local/bin/mogrify" does not exist.




:-( yeah it does and it works under the terminal (nicely I might add, 
thanks ImageMagick).

leonski.




Because you've used escapeshellargs() (or whatever it is) it's probably
treating the entire parameter to exec() (excluding the string
concatenation for output redirection) as the command to execute. I know
you said  you tried it otherwise but try the following:

if( file_exists( $imagefile ) )
{
$arg = escapeshellarg( $imagefile );
exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
}

Cheers,
Rob.



did:

if( file_exists( $imagefile ) )
{
$arg = escapeshellarg( $imagefile );
echo $str= "/usr/local/bin/mogrify $arg -resize 95x72 ";
exec($str);
}

added a line so I could see the string

got:

/usr/local/bin/mogrify '/tmp/phpPdCiGS' -resize 95x72
Warning: fopen('/tmp/phpPdCiGS') [function.fopen]: failed to open 
stream: No such file or directory in 
/Library/WebServer/Documents/build2/admin/classes/class_upload.php on 
line 254


so again - how does it get past the file_exists if it doesn't?!!!

keep it coming Robert;-)

leonski.


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



Re: [PHP] exec / shell_exec issues

2005-07-29 Thread Robert Cummings
On Fri, 2005-07-29 at 22:45, leonski wrote:
> Robert Cummings wrote:
> > On Fri, 2005-07-29 at 22:17, leonski wrote:
> > 
> >>Jason Wong wrote:
> >>
> >>>On Saturday 30 July 2005 08:49, leonski wrote:
> >>>
> >>>
> >>>
>  sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
> No such file or directory sh: line 1: /usr/local/bin/mogrify
> /tmp/phpS1KCen -resize 95x72! : No such file or directory
> 
> beats me how it gets inside the if, if it doesn't exist!
> >>>
> >>>
> >>>I think the error message is trying to tell you that 
> >>>"/usr/local/bin/mogrify" does not exist.
> >>>
> >>
> >>:-( yeah it does and it works under the terminal (nicely I might add, 
> >>thanks ImageMagick).
> >>leonski.
> > 
> > 
> > Because you've used escapeshellargs() (or whatever it is) it's probably
> > treating the entire parameter to exec() (excluding the string
> > concatenation for output redirection) as the command to execute. I know
> > you said  you tried it otherwise but try the following:
> > 
> > if( file_exists( $imagefile ) )
> > {
> > $arg = escapeshellarg( $imagefile );
> > exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
> > }
> > 
> > Cheers,
> > Rob.
> 
> did:
>
> if( file_exists( $imagefile ) )
>  {
>  $arg = escapeshellarg( $imagefile );
>  echo $str= "/usr/local/bin/mogrify $arg -resize 95x72 ";
>  exec($str);
>  }
> 
> added a line so I could see the string
> 
> got:
> 
> /usr/local/bin/mogrify '/tmp/phpPdCiGS' -resize 95x72
> Warning: fopen('/tmp/phpPdCiGS') [function.fopen]: failed to open 
> stream: No such file or directory in 
> /Library/WebServer/Documents/build2/admin/classes/class_upload.php on 
> line 254
> 
> so again - how does it get past the file_exists if it doesn't?!!!
> 
> keep it coming Robert;-)

Ah, but the above error is a completely different error than you
were posting previously, so we've moved past the first error which was
as I suspected.

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] exec / shell_exec issues

2005-07-29 Thread Jason Wong
On Saturday 30 July 2005 10:17, leonski wrote:
> Jason Wong wrote:
> > On Saturday 30 July 2005 08:49, leonski wrote:
> >>  sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240!
> >> : No such file or directory sh: line 1: /usr/local/bin/mogrify
> >> /tmp/phpS1KCen -resize 95x72! : No such file or directory
> >>
> >>beats me how it gets inside the if, if it doesn't exist!
> >
> > I think the error message is trying to tell you that
> > "/usr/local/bin/mogrify" does not exist.
> >
> :-( yeah it does and it works under the terminal (nicely I might add,

That error certainly does not come from mogrify. Just perform these simple 
tests:

1) /usr/local/bin/command-that-does-not-exist

2) mogrify file-that-does-not-exist; #assume mogrify in $PATH

As Robert has pointed out, it is probably telling you that the file 
"/usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240!" does not exist.

-- 
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
--
New Year Resolution: Ignore top posted posts

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



[PHP] Re: Automated Numerical Filenames for Directory

2005-07-29 Thread Smittie
Okay - figured it out and have it working now

Thanks

- Original Message -
From: "Smittie" <[EMAIL PROTECTED]>
To: 
Sent: 28 July 2005 10:29
Subject: Automated Numerical Filenames for Directory


> Hi everybody
>
> Have this headache and hope there is someone that can help:
>
> I need to generate numerical filenames in a directory, first filename
being
> 20001.php
>
> The next filename should be 20002.php etc.- no problem and easy enough
>
> BUT, if you have files in the directory ;
>
> 20001.php
> 20002.php
> 20003.php
> 20004.php
> 20005.php
>
> and you delete 20002.php, then the nexttime a new file is generated it
> should be 20002.php and not 20006.php
>
> Any ideas?
>
> Thanks
>
> Smittie
>
>
>
>
>
>

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



Re: [PHP] exec / shell_exec issues

2005-07-29 Thread leonski

Robert Cummings wrote:

On Fri, 2005-07-29 at 22:17, leonski wrote:


Jason Wong wrote:


On Saturday 30 July 2005 08:49, leonski wrote:




sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
No such file or directory sh: line 1: /usr/local/bin/mogrify
/tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!



I think the error message is trying to tell you that 
"/usr/local/bin/mogrify" does not exist.




:-( yeah it does and it works under the terminal (nicely I might add, 
thanks ImageMagick).

leonski.



Because you've used escapeshellargs() (or whatever it is) it's probably
treating the entire parameter to exec() (excluding the string
concatenation for output redirection) as the command to execute. I know
you said  you tried it otherwise but try the following:

if( file_exists( $imagefile ) )
{
$arg = escapeshellarg( $imagefile );
exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
}

Cheers,
Rob.


did:

if( file_exists( $imagefile ) )
{
$arg = escapeshellarg( $imagefile );
echo $str= "/usr/local/bin/mogrify $arg -resize 95x72 ";
exec($str);
}

added a line so I could see the string

got:

/usr/local/bin/mogrify '/tmp/phpPdCiGS' -resize 95x72
Warning: fopen('/tmp/phpPdCiGS') [function.fopen]: failed to open 
stream: No such file or directory in 
/Library/WebServer/Documents/build2/admin/classes/class_upload.php on 
line 254


so again - how does it get past the file_exists if it doesn't?!!!

keep it coming Robert;-)

leonski.

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



Re: [PHP] exec / shell_exec issues

2005-07-29 Thread Robert Cummings
On Fri, 2005-07-29 at 22:17, leonski wrote:
> Jason Wong wrote:
> > On Saturday 30 July 2005 08:49, leonski wrote:
> > 
> > 
> >>  sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
> >>No such file or directory sh: line 1: /usr/local/bin/mogrify
> >>/tmp/phpS1KCen -resize 95x72! : No such file or directory
> >>
> >>beats me how it gets inside the if, if it doesn't exist!
> > 
> > 
> > I think the error message is trying to tell you that 
> > "/usr/local/bin/mogrify" does not exist.
> > 
> :-( yeah it does and it works under the terminal (nicely I might add, 
> thanks ImageMagick).
> leonski.

Because you've used escapeshellargs() (or whatever it is) it's probably
treating the entire parameter to exec() (excluding the string
concatenation for output redirection) as the command to execute. I know
you said  you tried it otherwise but try the following:

if( file_exists( $imagefile ) )
{
$arg = escapeshellarg( $imagefile );
exec( "/usr/local/bin/mogrify $arg -resize 95x72 ");
}

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] exec / shell_exec issues

2005-07-29 Thread leonski

Jason Wong wrote:

On Saturday 30 July 2005 08:49, leonski wrote:



 sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
No such file or directory sh: line 1: /usr/local/bin/mogrify
/tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!



I think the error message is trying to tell you that 
"/usr/local/bin/mogrify" does not exist.


:-( yeah it does and it works under the terminal (nicely I might add, 
thanks ImageMagick).

leonski.

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



Re: [PHP] exec / shell_exec issues

2005-07-29 Thread Jason Wong
On Saturday 30 July 2005 08:49, leonski wrote:

>   sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
> No such file or directory sh: line 1: /usr/local/bin/mogrify
> /tmp/phpS1KCen -resize 95x72! : No such file or directory
>
> beats me how it gets inside the if, if it doesn't exist!

I think the error message is trying to tell you that 
"/usr/local/bin/mogrify" does not exist.

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] exec / shell_exec issues

2005-07-29 Thread leonski

Robert Cummings wrote:

On Fri, 2005-07-29 at 20:49, leonski wrote:


Greetings.

I've practically worn my eyeballs out trying to figure out a problem and 
in desperation am posting here in the hope for familiar eyes to guide 
me, so thanks in advance.


check out this code section:

if (file_exists($imagefile)) {
$execstring = escapeshellarg("/usr/local/bin/mogrify ".$imagefile." 



Ummm, looks to me like your escaping the entire command instead of just
individual arguments. Check if that's your problem.

Cheers,
Rob.


I'm getting the same result whether escapeshellarg is there or not :-(

I am a bit suspect that I've missed a compile time directive, as I used 
a pre-compiled version of Marc Liyanage (what a dude btw). Maybe the 
--bindir directive?


I just don't know enough about it and am having trouble finding docs on 
it - any more ideas Robert?


Thanks.
leonski.

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



Re: [PHP] exec / shell_exec issues

2005-07-29 Thread Robert Cummings
On Fri, 2005-07-29 at 20:49, leonski wrote:
> Greetings.
> 
> I've practically worn my eyeballs out trying to figure out a problem and 
> in desperation am posting here in the hope for familiar eyes to guide 
> me, so thanks in advance.
> 
> check out this code section:
> 
> if (file_exists($imagefile)) {
>  $execstring = escapeshellarg("/usr/local/bin/mogrify ".$imagefile." 

Ummm, looks to me like your escaping the entire command instead of just
individual arguments. Check if that's your problem.

Cheers,
Rob.

> -resize 95x72! ");
>  }
>  else echo ("sorry there was a problem with that file");
> // then2>&1 is assisting the debug
> $op = shell_exec($execstring.' 2>&1');
>  echo $op;
> 
> pretty simple - uses the ImageMagick: mogrify. Funny enough it doesn't 
> work. The output is:
> 
>   sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : 
> No such file or directory sh: line 1: /usr/local/bin/mogrify 
> /tmp/phpS1KCen -resize 95x72! : No such file or directory
> 
> beats me how it gets inside the if, if it doesn't exist!
> 
> I have also tried ImageMagick:convert executable with a generated 
> tempfile using tempnam() and the file is created in /tmp as expected, 
> but is not filled by the convert - it stays empty, fails and doesn't get 
>   cleaned up.
> 
> I cannot give a link to php.ini as its not on a public server. But Safe 
> mode is Off, file size limits are OK as $imagefile can be displayed to 
> the screen prior to the shell_exec call.
> 
> I also tried using GD instead of ImageMagick and could not get 
> imagecreatetruecolor to work either.
> 
> OS is OS X on my laptop, entropy build of PHP as "Apache/1.3.29 (Darwin) 
> PHP/5.0.4"
> 
> I really do not know if this is a PHP, Apache or OS issue. Permissions 
> are not it, I'm sure, and the user is www quite capable of writing into 
> and reading from tmp, so there is no issue there.
> 
> If anybody can tell me what *anything* about this problem, I'd be greatful.
> 
> leonski.
-- 
..
| 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] exec / shell_exec issues

2005-07-29 Thread leonski

Greetings.

I've practically worn my eyeballs out trying to figure out a problem and 
in desperation am posting here in the hope for familiar eyes to guide 
me, so thanks in advance.


check out this code section:

if (file_exists($imagefile)) {
$execstring = escapeshellarg("/usr/local/bin/mogrify ".$imagefile." 
-resize 95x72! ");

}
else echo ("sorry there was a problem with that file");
// then2>&1 is assisting the debug
$op = shell_exec($execstring.' 2>&1');
echo $op;

pretty simple - uses the ImageMagick: mogrify. Funny enough it doesn't 
work. The output is:


 sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : 
No such file or directory sh: line 1: /usr/local/bin/mogrify 
/tmp/phpS1KCen -resize 95x72! : No such file or directory


beats me how it gets inside the if, if it doesn't exist!

I have also tried ImageMagick:convert executable with a generated 
tempfile using tempnam() and the file is created in /tmp as expected, 
but is not filled by the convert - it stays empty, fails and doesn't get 
 cleaned up.


I cannot give a link to php.ini as its not on a public server. But Safe 
mode is Off, file size limits are OK as $imagefile can be displayed to 
the screen prior to the shell_exec call.


I also tried using GD instead of ImageMagick and could not get 
imagecreatetruecolor to work either.


OS is OS X on my laptop, entropy build of PHP as "Apache/1.3.29 (Darwin) 
PHP/5.0.4"


I really do not know if this is a PHP, Apache or OS issue. Permissions 
are not it, I'm sure, and the user is www quite capable of writing into 
and reading from tmp, so there is no issue there.


If anybody can tell me what *anything* about this problem, I'd be greatful.

leonski.

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



[PHP] exec nor shell_exec not doing as expected.

2005-07-29 Thread leonski

Greetings.

I've practically worn my eyeballs out trying to figure out a problem and 
in desperation am posting here in the hope for familiar eyes to guide 
me, so thanks in advance.


check out this code section:

if (file_exists($imagefile)) {
$execstring = escapeshellarg("/usr/local/bin/mogrify ".$imagefile." 
-resize 95x72! ");

}
else echo ("sorry there was a problem with that file");
// then2>&1 is assisting the debug
$op = shell_exec($execstring.' 2>&1');
echo $op;

pretty simple - uses the ImageMagick: mogrify. Funny enough it doesn't 
work. The output is:


 sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : 
No such file or directory sh: line 1: /usr/local/bin/mogrify 
/tmp/phpS1KCen -resize 95x72! : No such file or directory


beats me how it gets inside the if, if it doesn't exist!

I have also tried ImageMagick:convert executable with a generated 
tempfile using tempnam() and the file is created in /tmp as expected, 
but is not filled by the convert - it stays empty, fails and doesn't get 
 cleaned up.


I cannot give a link to php.ini as its not on a public server. But Safe 
mode is Off, file size limits are OK as $imagefile can be displayed to 
the screen prior to the shell_exec call.


I also tried using GD instead of ImageMagick and could not get 
imagecreatetruecolor to work either.


OS is OS X on my laptop, entropy build of PHP as "Apache/1.3.29 (Darwin) 
PHP/5.0.4"


I really do not know if this is a PHP, Apache or OS issue. Permissions 
are not it, I'm sure, and the user is www quite capable of writing into 
and reading from tmp, so there is no issue there.


If anybody can tell me what *anything* about this problem, I'd be greatful.

leonski.

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



RE: [PHP] How to generate MD5 passwords

2005-07-29 Thread Martin B. Nielsen
Are you maybe looking for something like this:



The above will output: 098f6bcd4621d373cade4e832627b4f6 as MD5 hash value.
For more info, http://se2.php.net/manual/en/function.md5.php

Best regards,
Martin

-Original Message-
From: Michelle Konzack [mailto:[EMAIL PROTECTED] 
Sent: 30. juli 2005 03:03
To: php-general
Subject: [PHP] How to generate MD5 passwords

Hello *,

I like to generate md5 password but I have not found a command
or something like this to generate it.  Curently I am using

$PASSMD5=exec("echo $PASSCLEAR" |md5sum")

Is there a better way ?

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)

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



[PHP] How to generate MD5 passwords

2005-07-29 Thread Michelle Konzack
Hello *,

I like to generate md5 password but I have not found a command
or something like this to generate it.  Curently I am using

$PASSMD5=exec("echo $PASSCLEAR" |md5sum")

Is there a better way ?

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] PHP code in a MySQL record

2005-07-29 Thread André Medeiros
Either what Kris says, or you can use a templating engine.

See Smarty (http://smarty.php.net)

On 7/29/05, Kristen G. Thorson <[EMAIL PROTECTED]> wrote:
> Is there a particular reason you need *PHP* in the database?  If not,
> then use a placeholder system of some sort ( like #var# ) and str_replace():
> 
> while( $row=mysql_fetch_row($result) ) {
> echo str_replace( '#var#', $that_var, $row['entry'] );
> }
> 
> 
> 
> kgt
> 
> 
> 
> 
> Nathaniel Hall wrote:
> 
> >I am working on a project that uses an index.php page.  Depending on the
> >variable in the URL, a different php page is included.  I have a
> >config.php that contains variables that are accessible from any page.
> >That is the easy part.
> >
> >I have some pages pulling HTML out of a database. I would like to be
> >able to reference some of the variables in the config.php in the
> >database blob field.  Here is an example:
> >
> >[EMAIL PROTECTED]
> >--
> >...etc
> > >   include 'config.php';
> >   if (blabla) {
> >   include "thispage.php";
> >   } else {
> >   include "thatpage.php";
> >   }
> >?>
> >
> >config.php
> >--
> > >   $this_var=1;
> >   $that_var="Nothing";
> >?>
> >
> >test.php
> >--
> > >   $query="SELECT * from table";
> >   $result=mysql_query($query) or die ("Cannot process query");
> >   $row=mysql_fetch_row($result);
> >   echo $row[1];
> >?>
> >
> >MySQL record:
> >--
> >id,year,month,day,entry
> >
> >1,2005,01,01,This is a test
> >
> >_
> >I have tried using >? echo $that_var; ?< and I have tried
> >escaping everything, but that still didn't work.  Any ideas?
> >
> >Nathaniel Hall
> >[EMAIL PROTECTED]
> >
> >
> >
> 
> --
> 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] Automated Numerical Filenames for Directory

2005-07-29 Thread Smittie
Hi everybody

Have this headache and hope there is someone that can help:

I need to generate numerical filenames in a directory, first filename being
20001.php

The next filename should be 20002.php etc.- no problem and easy enough

BUT, if you have files in the directory ;

20001.php
20002.php
20003.php
20004.php
20005.php

and you delete 20002.php, then the nexttime a new file is generated it
should be 20002.php and not 20006.php

Any ideas?

Thanks

Smittie







Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson



Kristen G. Thorson wrote:
I'm not 100% sure where you're saying you're stuck, but I think you're 
trying to do with one query what you will probably find is best to do 
with several.  Hopefully the following will help some:



//first get all the questions
$sql = "select * from questions";
$result = mysql_query( $sql );

//now one-by-one go through the questions
while( $row = mysql_fetch_row( $result ) {

   //create the drop down box for THIS question
   echo '';

   //get all of the answers for THIS question
   $ans_sql = "select * from answers where 
question_id=".$row['question_id'];

   $ans_result = mysql_query( $ans_sql );
   while( $ans_row = mysql_fetch_row( $ans_result ) ) {

  //list the answers for THIS question
  echo 'value="'.$ans_row['answer_id'].'">'.$ans_row['answer_text'].'';

   }
   echo '';
}

outputs:

answer 1
answer 2
answer 3


answer 1
answer 2
answer 3
answer 4
answer 5



It requires numerous DB calls, but I believe in most cases, it's still 
better than what you'd have to do otherwise (create some arrays and do 
some sorting, etc.).  That is, if I've understood what you need ;)




 And it did!!
//first get all the questions
$sql = "select * from questions ORDER BY q_cat";
$result = mysql_query($sql);

//now one-by-one go through the questions
while($row = mysql_fetch_assoc($result)) {

//if the form has been submitted, and the question unanswered
//highlight this whole question and answer block in red.
if (sizeof($message[$row['q_name']])){
echo "";
}

//State the question
echo "";
echo $row['q_text'] . "";
echo "\n\n";
echo " ";
echo "\n";

//Create the dropdown for the answers
echo '  ';
echo "\n";

//get all of the answers for THIS question
$ans_sql = "select * from answers where answers.q_id=" . $row['q_id'];
$ans_result = mysql_query($ans_sql);

echo "Select from this list\n";
while($ans_row = mysql_fetch_assoc($ans_result)) {

//list the answers for THIS question
echo "" . $ans_row['a_answer'] . "";
echo "\n";
}
echo '  ' . "\n" . ' ' . "\n\n";
//If there *was* an error div, close it
if (sizeof($message[$row['q_name']])){
echo "";
}
}



Thanks so much!

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



Re: [PHP] Dropdown Building Function

2005-07-29 Thread David Christensen
On Fri, 2005-07-29 at 15:58 -0400, Jack Jackson wrote:
> Hi, can anyone even point me in a *direction*? I suppose this is the 
> most complex thing I've ever tried to do and I have been at it for tens 
> of hours and am still completely baffled.
> 
> 
> Jack Jackson wrote:
> > Hi,
> > because that last topic on multipage forms was so exciting, I decided to 
> > database the questions as well. I wonder if anyone can help me with a 
> > function to pull rows into dropdown boxes.
> > 
> > It's a 1:n relationship between questions and answers, and I have a 
> > table of questions
> > 
> > q_id
> > q_name
> > q_text
> > q_style //dropdown, radio, checkboxes
> > q_cat //question category
> > 
> > and a table full of answers
> > 
> > a_id
> > q_id
> > a_answer
> > 
> > 
> > When I do
> > 
> > $fields = 'SELECT *';
> > $from = 'FROM questions,answers';
> > $sort = "ORDER BY questions.q_cat";
> > $where = "WHERE answers.q_id=questions.q_id";
> > 
> > // construct the sql query:
> > $sql = "$fields $from $where $sort";
> > 
> > // Run SQL query 1
> > if (!($result = mysql_query($sql))) {
> > echo "Could not connect to the database ($sql)" . mysql_error();
> > }
> > 
> > while ($row = mysql_fetch_assoc($result)) {
> > 
> > 
> > I need to loop through the results and make a dropdown list from them, 
> > taking the question name as the select name, and then making each answer 
> > id and answer text the makings of an option ros.
> > 
> > Based on a problem a while ago which was similar but different, someone 
> > here actually made me a function *similar* to what I need to do now, 
> > This one acts different and I just cannot adapt the old one, because I 
> > still get confused at this level.
> > 
> > I think it wants to be something like (and note that part of the return 
> > is the code to react to error checking results):
> > 
> > $dropdown[] = ' > echo "selected "; ?> value=\'' . $a_id . '\'>' . $a_answer . '';
> > 
> > etc for all $a_answer(s)...
> > and then
> > 
> > return ' > class='error'>"; } ?>
> > 
> > 
> > Select from this list'
> >  join('',$dropdown)
> >  . ''
> >  . ' > ""; } ?>';
> > 
> > 
> > Can anyone point me at the right direction?
> > 
> > Thanks!!
> > 
> > JJ
> > 
> 

JJ,

I like to TBS (TinyButStrong) for all of my PHP->HTML needs.  There are
build in functions to handle output from database to a list like this as
well as wide depth of other great features for auto-generating specific
HTML.

http://www.tinybutstrong.com

Dave

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



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson

Aaron,
Thanks for showing me this it is very cool indeed.

However maybe I am being dumb and obdurate but what I am really trying 
to do is build some of these things myself (with, thankfully, help) so 
that I understand enough that when I see a great tool like yours I'll 
actually appreciate what it's doing for me. I can see that your tool is 
doing everything in one line, and I think its really great. I just am 
such a beginner that I think tools like that would encourage me to 
*never* get above this level I'm at now.


I got the questions and answers thing working, starting with Kristen's 
two-query code and moving from there. I would like to come back to see 
how it can be done with one query and one function, but at this point my 
eyes are so bleary I'm grateful for the fact that I can now focus on 
getting the form to process!


Thanks again

JJ

Aaron Greenspan wrote:

Jay,

This is why I think frameworks are helpful Here's how I'd do it with 
Lampshade in one line of code with my own hypothetical field names:


dropdownBox('answerid', "SELECT answerid, CONCAT(questions.description,' 
- ',answers.description) AS display FROM questions LEFT JOIN answers ON 
questions.questionid=answers.questionid ORDER BY questions.description, 
answers.description", $myrow['answerid'], 'Question and Answer', 'Choose 
an Answer');


For more information on this function:

http://www.thinkcomputer.com/software/lampshade/documentation.html?function=dropdownBox 



I'd be happy to help you get it set up if you have any questions.

Aaron

Aaron Greenspan
President & CEO
Think Computer Corporation

http://www.thinkcomputer.com



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



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Aaron Greenspan

Jay,

This is why I think frameworks are helpful Here's how I'd do it with 
Lampshade in one line of code with my own hypothetical field names:


dropdownBox('answerid', "SELECT answerid, CONCAT(questions.description,' 
- ',answers.description) AS display FROM questions LEFT JOIN answers ON 
questions.questionid=answers.questionid ORDER BY questions.description, 
answers.description", $myrow['answerid'], 'Question and Answer', 'Choose 
an Answer');


For more information on this function:

http://www.thinkcomputer.com/software/lampshade/documentation.html?function=dropdownBox

I'd be happy to help you get it set up if you have any questions.

Aaron

Aaron Greenspan
President & CEO
Think Computer Corporation

http://www.thinkcomputer.com

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



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson

And of course, I am finding that this way of yours is the easiest!!

Thanks, again, Kristen


JJ
Kristen G. Thorson wrote:
I'm not 100% sure where you're saying you're stuck, but I think you're 
trying to do with one query what you will probably find is best to do 
with several.  Hopefully the following will help some:



//first get all the questions
$sql = "select * from questions";
$result = mysql_query( $sql );

//now one-by-one go through the questions
while( $row = mysql_fetch_row( $result ) {

   //create the drop down box for THIS question
   echo '';

   //get all of the answers for THIS question
   $ans_sql = "select * from answers where 
question_id=".$row['question_id'];

   $ans_result = mysql_query( $ans_sql );
   while( $ans_row = mysql_fetch_row( $ans_result ) ) {

  //list the answers for THIS question
  echo 'value="'.$ans_row['answer_id'].'">'.$ans_row['answer_text'].'';

   }
   echo '';
}

outputs:

answer 1
answer 2
answer 3


answer 1
answer 2
answer 3
answer 4
answer 5



It requires numerous DB calls, but I believe in most cases, it's still 
better than what you'd have to do otherwise (create some arrays and do 
some sorting, etc.).  That is, if I've understood what you need ;)





kgt




Jack Jackson wrote:

Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for 
tens of hours and am still completely baffled.



Jack Jackson wrote:


Hi,
because that last topic on multipage forms was so exciting, I decided 
to database the questions as well. I wonder if anyone can help me 
with a function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

$fields = 'SELECT *';
$from = 'FROM questions,answers';
$sort = "ORDER BY questions.q_cat";
$where = "WHERE answers.q_id=questions.q_id";

// construct the sql query:
$sql = "$fields $from $where $sort";

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo "Could not connect to the database ($sql)" . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {
   I need to loop through the results and make a dropdown list from 
them, taking the question name as the select name, and then making 
each answer id and answer text the makings of an option ros.


Based on a problem a while ago which was similar but different, 
someone here actually made me a function *similar* to what I need to 
do now, This one acts different and I just cannot adapt the old one, 
because I still get confused at this level.


I think it wants to be something like (and note that part of the 
return is the code to react to error checking results):


$dropdown[] = 'echo "selected "; ?> value=\'' . $a_id . '\'>' . $a_answer . 
'';


etc for all $a_answer(s)...
and then
return '""; } ?>



Select from this list'
 join('',$dropdown)
 . ''
 . '""; } ?>';

   Can anyone point me at the right direction?

Thanks!!

JJ









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



Re: [PHP] is it possible.

2005-07-29 Thread Matt Darby

jenny mathew wrote:


hello group,
i have a problem and hope anybody here will be able to hep me out.
i have a downloads folder in my server which contains all the files in 
zipped form to be downloaded by members.members are authenticated by 
entering username and password.and when they click to download the files 
,they are forwarded to the the full file url by using header function of 
php.But the problem is that ,when the users click once to download a file 
,they can see the whole url and so next time they can easily download the 
file by entering the full url in the browser ,so there is no use of 
authentication next time and this leads to bandwidth theft and the urls of 
files are circulating in the emails and users are downloading the files 
without becoming the user of the site and without authenticating 
themselves.I know there are many professionals in this group who are very 
experienced and have helped me earlier.this is a very serious problem and i 
need a solution to this.What are your views?

Is there any solution for it?
waiting for your replies.
Thanks,
Jenny

 



Route the email link through a script that checks for availability based 
on a user name, or email address; have the link as such:


http://www.somesite.org/download.php?file=&user=

When this user clicks this email, it will direct them to download.php, 
where you could setup a call to a database. If this is the first time 
this "user" has accessed this "file", set a flag in the database that 
this link is no longer valid, and redirect the user's browser to the 
file (check out the "header" function). The link in the email will only 
be valid once (or as many times as you allow). You could even tie this 
in with a login/password form.


HTH!
Matt Darby

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



RE: [PHP] print value from db

2005-07-29 Thread Jay Blanchard
[snip]
Hi, I have a table with:

month, day, year, value

I need to print every value corresponding to a day, for example:

value[day1], if exist..
value[day2], if exist..
vale...

etc

It is possible?
[/snip]


Welcome to "Is It Possible Day" at the PHP Ranch. :)

Yes, it is possible to print every avlue corresponding to a day.

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



[PHP] print value from db

2005-07-29 Thread Jesús Alain Rodríguez Santos
Hi, I have a table with:

month, day, year, value

I need to print every value corresponding to a day, for example:

value[day1], if exist..
value[day2], if exist..
vale...

etc

It is possible?


-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.

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



Re: [PHP] is it possible.

2005-07-29 Thread Gorm
You could copy the file to a temp-file "file_id.zip" and delete it after 
download. But perhaps it is possible to just have the file in cache ?


jenny mathew wrote:
i used following code for downloading file.whenever the members cicked the 
file for downloading ,the download request (with the variable containing 
file id) was send to download.php .The download.php on recieving the file id 
fetches the url of the fileand redirects to the file url using 
Header("location:$url");
where $url is the full url of file such as 
http://www.abc.com/downloads/file1.zip.
so finally the url is exposed to the members who circulates the url in mails 
and everybody downloads the files.I want that only members can download the 
file.is  there any solution.


 On 7/29/05, André Medeiros <[EMAIL PROTECTED]> wrote: 


When deppending on authentication, never link the files directly.

You can create a download.php file that gets an ID through the URL,
checks if the user is authenticated and then read the file.

You will need these functions:

http://pt.php.net/file_get_contents
http://pt.php.net/header

Header() is to send the mime type, and file_get_contents is to read the
file's contents (DOH).

If you run into trouble, you can (in the order given ;):

1) Read the user's comments on both functions. They're pretty helpful
sometimes
2) Mail the ML :)

--
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] Dropdown Building Function

2005-07-29 Thread Jack Jackson


Kristen,

Thank you so much> this is precisely what I was trying to accomplish. 
However I was also trying to learn how to do it with those arrays you 
mentioned which I figure will help me emerge from total newbieness.


To date, I hope the list has seen I've progressed from absolutely *no* 
programming experience whatever to the point where I feel comfortable 
saying I am a newbie programmer (as opposed to a clueless one).


But Multidimensional arrays still baffle me and I believe that certain 
aspects of them work by magic!


I hope that people here will help me figure out both approaches. And 
thank you so much for the code here and the fix, which even I can follow!


JJ



Kristen G. Thorson wrote:
I'm not 100% sure where you're saying you're stuck, but I think you're 
trying to do with one query what you will probably find is best to do 
with several.  Hopefully the following will help some:



//first get all the questions
$sql = "select * from questions";
$result = mysql_query( $sql );

//now one-by-one go through the questions
while( $row = mysql_fetch_row( $result ) {

   //create the drop down box for THIS question
   echo '';

   //get all of the answers for THIS question
   $ans_sql = "select * from answers where 
question_id=".$row['question_id'];

   $ans_result = mysql_query( $ans_sql );
   while( $ans_row = mysql_fetch_row( $ans_result ) ) {

  //list the answers for THIS question
  echo 'value="'.$ans_row['answer_id'].'">'.$ans_row['answer_text'].'';

   }
   echo '';
}

outputs:

answer 1
answer 2
answer 3


answer 1
answer 2
answer 3
answer 4
answer 5



It requires numerous DB calls, but I believe in most cases, it's still 
better than what you'd have to do otherwise (create some arrays and do 
some sorting, etc.).  That is, if I've understood what you need ;)





kgt




Jack Jackson wrote:

Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for 
tens of hours and am still completely baffled.



Jack Jackson wrote:


Hi,
because that last topic on multipage forms was so exciting, I decided 
to database the questions as well. I wonder if anyone can help me 
with a function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

$fields = 'SELECT *';
$from = 'FROM questions,answers';
$sort = "ORDER BY questions.q_cat";
$where = "WHERE answers.q_id=questions.q_id";

// construct the sql query:
$sql = "$fields $from $where $sort";

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo "Could not connect to the database ($sql)" . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {
   I need to loop through the results and make a dropdown list from 
them, taking the question name as the select name, and then making 
each answer id and answer text the makings of an option ros.


Based on a problem a while ago which was similar but different, 
someone here actually made me a function *similar* to what I need to 
do now, This one acts different and I just cannot adapt the old one, 
because I still get confused at this level.


I think it wants to be something like (and note that part of the 
return is the code to react to error checking results):


$dropdown[] = 'echo "selected "; ?> value=\'' . $a_id . '\'>' . $a_answer . 
'';


etc for all $a_answer(s)...
and then
return '""; } ?>



Select from this list'
 join('',$dropdown)
 . ''
 . '""; } ?>';

   Can anyone point me at the right direction?

Thanks!!

JJ









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



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson

Hi, Jay,
I see perhaps I *was* thinking too complex. However this is *just* a bit 
  off:


Jay Blanchard wrote:

[snip]
Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for tens 
of hours and am still completely baffled.



Jack Jackson wrote:


Hi,
because that last topic on multipage forms was so exciting, I decided


to 

database the questions as well. I wonder if anyone can help me with a 
function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

   $fields = 'SELECT *';
   $from = 'FROM questions,answers';
   $sort = "ORDER BY questions.q_cat";
   $where = "WHERE answers.q_id=questions.q_id";

// construct the sql query:
$sql = "$fields $from $where $sort";

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo "Could not connect to the database ($sql)" . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {
   


I need to loop through the results and make a dropdown list from them,




taking the question name as the select name, and then making each


answer 


id and answer text the makings of an option ros.

Based on a problem a while ago which was similar but different,


someone 

here actually made me a function *similar* to what I need to do now, 
This one acts different and I just cannot adapt the old one, because I




still get confused at this level.

I think it wants to be something like (and note that part of the


return 


is the code to react to error checking results):

$dropdown[] = 'echo "selected "; ?> value=\'' . $a_id . '\'>' . $a_answer .


'';


   etc for all $a_answer(s)...
   and then
   
return 'class='error'>"; } ?>

   
   
   Select from this list'
join('',$dropdown)
. ''
. '""; } ?>';
   


Can anyone point me at the right direction?

Thanks!!

JJ



[/snip]


It seems that you have over-complicated the issue, let me boil it down a
little;

$sql = "select answer from table ";
if(!($result = mysql_query($sql, $connection))){
   echo mysql_error() . "\n";
   exit();
}

echo "\n;
while($row = mysql_fetch_array($result)){
echo "";
echo $row['answer'];
echo "\n";

}
echo "\n";

Your out put will look like this;


answer1
answer2
answer3


Is this what you're after?




Very close to it, thank you! However this completes the gap: I am still 
not sure if my syntax is right:



$sql = 'SELECT *
FROM questions,answers
WHERE answers.q_id=questions.q_id
ORDER BY questions.q_cat,questions.q_id,answers.q_id';

if(!($result = mysql_query($sql, $connection))){
echo mysql_error() . "\n";
exit();
 }

 /*each question has at least one answer, usually three to six
  *I need to give the select the name of $q_name
  *and dynamically loop through until all the question/answer
  *sets have their own dropdown
  */


 echo ""\n;
 while($row = mysql_fetch_array($result)){
echo ""\n;
echo $row['$a_answer'];
echo "\n";

 }
 echo "\n";

Then hopefully my output would look like
 
  
value="1">Answer One


 
  
value="2">Answer Two


 
  
value="3">Answer Two

 





TIA!!

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



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Kristen G. Thorson
I'm not 100% sure where you're saying you're stuck, but I think you're 
trying to do with one query what you will probably find is best to do 
with several.  Hopefully the following will help some:



//first get all the questions
$sql = "select * from questions";
$result = mysql_query( $sql );

//now one-by-one go through the questions
while( $row = mysql_fetch_row( $result ) {

   //create the drop down box for THIS question
   echo '';

   //get all of the answers for THIS question
   $ans_sql = "select * from answers where 
question_id=".$row['question_id'];

   $ans_result = mysql_query( $ans_sql );
   while( $ans_row = mysql_fetch_row( $ans_result ) ) {

  //list the answers for THIS question
  echo 'value="'.$ans_row['answer_id'].'">'.$ans_row['answer_text'].'';

   }
   echo '';
}

outputs:

answer 1
answer 2
answer 3


answer 1
answer 2
answer 3
answer 4
answer 5



It requires numerous DB calls, but I believe in most cases, it's still 
better than what you'd have to do otherwise (create some arrays and do 
some sorting, etc.).  That is, if I've understood what you need ;)





kgt




Jack Jackson wrote:

Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for 
tens of hours and am still completely baffled.



Jack Jackson wrote:


Hi,
because that last topic on multipage forms was so exciting, I decided 
to database the questions as well. I wonder if anyone can help me 
with a function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

$fields = 'SELECT *';
$from = 'FROM questions,answers';
$sort = "ORDER BY questions.q_cat";
$where = "WHERE answers.q_id=questions.q_id";

// construct the sql query:
$sql = "$fields $from $where $sort";

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo "Could not connect to the database ($sql)" . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {
   
I need to loop through the results and make a dropdown list from 
them, taking the question name as the select name, and then making 
each answer id and answer text the makings of an option ros.


Based on a problem a while ago which was similar but different, 
someone here actually made me a function *similar* to what I need to 
do now, This one acts different and I just cannot adapt the old one, 
because I still get confused at this level.


I think it wants to be something like (and note that part of the 
return is the code to react to error checking results):


$dropdown[] = 'echo "selected "; ?> value=\'' . $a_id . '\'>' . $a_answer . 
'';


etc for all $a_answer(s)...
and then
return '""; } ?>



Select from this list'
 join('',$dropdown)
 . ''
 . '""; } ?>';
   
Can anyone point me at the right direction?


Thanks!!

JJ





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



Re: [PHP] Safe mode subdirectory workaround patch

2005-07-29 Thread John Nichel

Bostjan Skufca wrote:

Hi everyone,

I created a patch which enables subdirectories to be created and used even if 
PHP is running with safe mode enabled (common problem on shared hosts where 
Apache/PHP runs as user 'nobody' or 'www').

Patch can be found here:
http://www.lenivec.com/php/patches/

Comments are welcome!


Not to dismiss the work you've put into this, but how does a user in a 
shared hosting enviroment apply this patch and re-compile php?


--
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] Dropdown Building Function

2005-07-29 Thread Jay Blanchard
[snip]
Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for tens 
of hours and am still completely baffled.


Jack Jackson wrote:
> Hi,
> because that last topic on multipage forms was so exciting, I decided
to 
> database the questions as well. I wonder if anyone can help me with a 
> function to pull rows into dropdown boxes.
> 
> It's a 1:n relationship between questions and answers, and I have a 
> table of questions
> 
> q_id
> q_name
> q_text
> q_style //dropdown, radio, checkboxes
> q_cat //question category
> 
> and a table full of answers
> 
> a_id
> q_id
> a_answer
> 
> 
> When I do
> 
> $fields = 'SELECT *';
> $from = 'FROM questions,answers';
> $sort = "ORDER BY questions.q_cat";
> $where = "WHERE answers.q_id=questions.q_id";
> 
> // construct the sql query:
> $sql = "$fields $from $where $sort";
> 
> // Run SQL query 1
> if (!($result = mysql_query($sql))) {
> echo "Could not connect to the database ($sql)" . mysql_error();
> }
> 
> while ($row = mysql_fetch_assoc($result)) {
> 
> 
> I need to loop through the results and make a dropdown list from them,

> taking the question name as the select name, and then making each
answer 
> id and answer text the makings of an option ros.
> 
> Based on a problem a while ago which was similar but different,
someone 
> here actually made me a function *similar* to what I need to do now, 
> This one acts different and I just cannot adapt the old one, because I

> still get confused at this level.
> 
> I think it wants to be something like (and note that part of the
return 
> is the code to react to error checking results):
> 
> $dropdown[] = ' echo "selected "; ?> value=\'' . $a_id . '\'>' . $a_answer .
'';
> 
> etc for all $a_answer(s)...
> and then
> 
> return ' class='error'>"; } ?>
> 
> 
> Select from this list'
>  join('',$dropdown)
>  . ''
>  . ' ""; } ?>';
> 
> 
> Can anyone point me at the right direction?
> 
> Thanks!!
> 
> JJ
> 
[/snip]


It seems that you have over-complicated the issue, let me boil it down a
little;

$sql = "select answer from table ";
if(!($result = mysql_query($sql, $connection))){
   echo mysql_error() . "\n";
   exit();
}

echo "\n;
while($row = mysql_fetch_array($result)){
echo "";
echo $row['answer'];
echo "\n";

}
echo "\n";

Your out put will look like this;


answer1
answer2
answer3


Is this what you're after?

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



[PHP] Safe mode subdirectory workaround patch

2005-07-29 Thread Bostjan Skufca
Hi everyone,

I created a patch which enables subdirectories to be created and used even if 
PHP is running with safe mode enabled (common problem on shared hosts where 
Apache/PHP runs as user 'nobody' or 'www').

Patch can be found here:
http://www.lenivec.com/php/patches/

Comments are welcome!

Best regards,
Bostjan



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson
Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for tens 
of hours and am still completely baffled.



Jack Jackson wrote:

Hi,
because that last topic on multipage forms was so exciting, I decided to 
database the questions as well. I wonder if anyone can help me with a 
function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

$fields = 'SELECT *';
$from = 'FROM questions,answers';
$sort = "ORDER BY questions.q_cat";
$where = "WHERE answers.q_id=questions.q_id";

// construct the sql query:
$sql = "$fields $from $where $sort";

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo "Could not connect to the database ($sql)" . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {


I need to loop through the results and make a dropdown list from them, 
taking the question name as the select name, and then making each answer 
id and answer text the makings of an option ros.


Based on a problem a while ago which was similar but different, someone 
here actually made me a function *similar* to what I need to do now, 
This one acts different and I just cannot adapt the old one, because I 
still get confused at this level.


I think it wants to be something like (and note that part of the return 
is the code to react to error checking results):


$dropdown[] = 'echo "selected "; ?> value=\'' . $a_id . '\'>' . $a_answer . '';


etc for all $a_answer(s)...
and then

return 'class='error'>"; } ?>



Select from this list'
 join('',$dropdown)
 . ''
 . '""; } ?>';



Can anyone point me at the right direction?

Thanks!!

JJ



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



Re: [PHP] PHP code in a MySQL record

2005-07-29 Thread Kristen G. Thorson
Is there a particular reason you need *PHP* in the database?  If not, 
then use a placeholder system of some sort ( like #var# ) and str_replace():


while( $row=mysql_fetch_row($result) ) {
   echo str_replace( '#var#', $that_var, $row['entry'] );
}



kgt




Nathaniel Hall wrote:


I am working on a project that uses an index.php page.  Depending on the
variable in the URL, a different php page is included.  I have a
config.php that contains variables that are accessible from any page.
That is the easy part.

I have some pages pulling HTML out of a database. I would like to be
able to reference some of the variables in the config.php in the
database blob field.  Here is an example:

[EMAIL PROTECTED]
--
...etc


config.php
--


test.php
--


MySQL record:
--
id,year,month,day,entry

1,2005,01,01,This is a test

_
I have tried using >? echo $that_var; ?< and I have tried
escaping everything, but that still didn't work.  Any ideas?

Nathaniel Hall
[EMAIL PROTECTED]

 



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



Re: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Chirantan Ghosh

Hi TG,

I do not have the admin to all local sites.

Well calling it doomsday device sure should scare anyone who believes email 
privacy but I HARDLY think an Image Designer of my coding capability can 
manage any harm even indenting so. I just don't have enough tech knowledge 
hence, the appeal to the forum.


If you could please give a little bit more lead I would be more than happy 
to my homework or I'll just have to keep googling "Parsing HTML".


Thanks a lot for responding,

C

- Original Message - 
From: <[EMAIL PROTECTED]>

To: 
Cc: <[EMAIL PROTECTED]>
Sent: Friday, July 29, 2005 2:37 PM
Subject: Re: [PHP] PHP Spider/Crawler for Emails possible?


I guess my question at this point is that it sounds like you have control 
of the system.  Why not have it so when they enter their email address, 
they can check a box saying "Add me to your mailing list".. and it'll put 
them directly into the database?   Why the need to parse already built 
webpages to get the email addresses?


Parsing HTML for email and web addresses shouldn't be too hard and there 
are probably a ton of examples of how to use regex or other pattern 
matching systems to do just that.  But you can see how people wouldn't 
want to help build a doomsday device that could fall into the wrong hands. 
:)


-TG

= = = Original message = = =

Hi Jay & Jim,

Let me apologize for mis-communication.
I HATE sp#ammers like any normal being in the net.

What I intend to do is build a customer forum(Purely opted in)
People come to a web page & deliberately add their Real Estate website and
sign up for our product & news letter.

Real estate spreads in peer networking hence, the email. Once the Emails 
are
collected from the spiders an automated mail will be sent comprising OPT 
IN

consent.
IF Opt In email is return then only these people will be subscribed to our
newsletter.

Thanks a lot,
C

N.B: In my last post I didn't mean to barter a trade was just trying to be
helpful if anyone needed graphic.


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




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



Re: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread tg-php
I guess my question at this point is that it sounds like you have control of 
the system.  Why not have it so when they enter their email address, they can 
check a box saying "Add me to your mailing list".. and it'll put them directly 
into the database?   Why the need to parse already built webpages to get the 
email addresses?

Parsing HTML for email and web addresses shouldn't be too hard and there are 
probably a ton of examples of how to use regex or other pattern matching 
systems to do just that.  But you can see how people wouldn't want to help 
build a doomsday device that could fall into the wrong hands. :)

-TG

= = = Original message = = =

Hi Jay & Jim,

Let me apologize for mis-communication.
I HATE sp#ammers like any normal being in the net.

What I intend to do is build a customer forum(Purely opted in)
People come to a web page & deliberately add their Real Estate website and 
sign up for our product & news letter.

Real estate spreads in peer networking hence, the email. Once the Emails are 
collected from the spiders an automated mail will be sent comprising OPT IN 
consent.
IF Opt In email is return then only these people will be subscribed to our 
newsletter.

Thanks a lot,
C

N.B: In my last post I didn't mean to barter a trade was just trying to be 
helpful if anyone needed graphic.


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

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



Re: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread eoghan

On 29 Jul 2005, at 19:16, Jay Blanchard wrote:


I also noticed that the thread started as a RE:, was this thread
hijacked?



yeah... was PHP noobie

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



Re: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Saqib Ali
Why code this yourself, when Google can do it for you. Google provides
an API for this. See the book called "Google Hacks" for details.

> I was wondering if one could create Spiders/Crawlers in PHP?
> I need for the PHP code to email me a list of emails, of domains listed in
> that page.

-- 
In Peace,
Saqib Ali
http://www.xml-dev.com/blog/

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



Re: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Chirantan Ghosh

Hi Jay & Jim,

Let me apologize for mis-communication.
I HATE sp#ammers like any normal being in the net.

What I intend to do is build a customer forum(Purely opted in)
People come to a web page & deliberately add their Real Estate website and 
sign up for our product & news letter.


Real estate spreads in peer networking hence, the email. Once the Emails are 
collected from the spiders an automated mail will be sent comprising OPT IN 
consent.
IF Opt In email is return then only these people will be subscribed to our 
newsletter.


Thanks a lot,
C

N.B: In my last post I didn't mean to barter a trade was just trying to be 
helpful if anyone needed graphic.



- Original Message - 
From: "Jim Moseby" <[EMAIL PROTECTED]>

To: 
Sent: Friday, July 29, 2005 2:14 PM
Subject: RE: [PHP] PHP Spider/Crawler for Emails possible?



Hi,

I was wondering if one could create Spiders/Crawlers in PHP?
I need for the PHP code to email me a list of emails, of
domains listed in
that page.

Is this possible?


Of course it is, but I'm afraid you might crawl the web, collect email
addresses, and send spam to the good people, or sell their email adresses 
to

someone else who will.

JM

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




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



RE: [PHP] Calendar program like on php.net

2005-07-29 Thread Jim Moseby
> Hello,
> Anyone knows a simple calendar program that will let people 
> to add event, and 
> then after the event is approved by webmaster / moderator, 
> the event would be 
> added to the calendar ? 
> 
> Just like the calendar for Upcoming Events on www.php.net. 
> What program is 
> that ? 
> 
> I've looked at PHPGroupware and Horde but they seems to be 
> more complicated 
> than what I need. I just need something simple and 
> straightforward for my 
> organization.
> 

The author of the calendar program on php.net answered this question, and
gave you a link to download the very code in use there. I'd repost the link
for you, but I've already deleted it.  Sorry. Look back through the
archives.

JM

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



RE: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Jim Moseby
> 
> [snip]
> Of course it is, but I'm afraid you might crawl the web, collect email
> addresses, and send spam to the good people, or sell their email
> adresses to
> someone else who will.
> [/snip]
> 
> Why be afraid? That's just paranoid.
> 
> I also noticed that the thread started as a RE:, was this thread
> hijacked?

Maybe "afraid" was a poor choice of words.  My point was that the OP plans
to write an email address harvester.  While he/she may have a legitimate use
for it in mind, most often they are used for spam.  Many people (myself
included) don't want to contribute to or support spammers.

JM

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



RE: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Jay Blanchard
[snip]
Of course it is, but I'm afraid you might crawl the web, collect email
addresses, and send spam to the good people, or sell their email
adresses to
someone else who will.
[/snip]

Why be afraid? That's just paranoid.

I also noticed that the thread started as a RE:, was this thread
hijacked?

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



[PHP] Calendar program like on php.net

2005-07-29 Thread Reuben D. Budiardja

Hello,
Anyone knows a simple calendar program that will let people to add event, and 
then after the event is approved by webmaster / moderator, the event would be 
added to the calendar ? 

Just like the calendar for Upcoming Events on www.php.net. What program is 
that ? 

I've looked at PHPGroupware and Horde but they seems to be more complicated 
than what I need. I just need something simple and straightforward for my 
organization.

Thank you for any help
RDB 

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



Re: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread tg-php
You might get a cold response because it sounds like you're asking if you can 
write a program in PHP that harvests email addresses from web pages.  Typically 
this would be used for mass email marketing aka 'spam'.  Not a lot of people 
want to support that kind of programming project.

But maybe your idea or intentions aren't along those lines.  Maybe you can 
re-describe or better describe what you need and what you plan to use it for 
and geta better response.

-TG

= = = Original message = = =

Hello Jay,

Pardon my ignorance but can you enlighten me a little more please?
Like where can I look for them or how to code?

As always all members are more than welcome to ask me for graphics I hope to 
be benevolent that way.
Thanks a lot,
C


- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Chirantan Ghosh" <[EMAIL PROTECTED]>; 
Sent: Friday, July 29, 2005 2:05 PM
Subject: RE: [PHP] PHP Spider/Crawler for Emails possible?


[snip]
I was wondering if one could create Spiders/Crawlers in PHP?
[/snip]

Yes.

[snip]
I need for the PHP code to email me a list of emails, of domains listed
in
that page.

Is this possible?
[/snip]

Yes.



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

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



RE: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Jay Blanchard
[snip]
Pardon my ignorance but can you enlighten me a little more please?
Like where can I look for them or how to code?
[/snip]

Start here http://www.php.net/file_get_contents

[snip]
As always all members are more than welcome to ask me for graphics I
hope to 
be benevolent that way.
[/snip]

I had never seen this offer before, but we don't usually barter for
information, just ask questions and they will get answered,usually.

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



RE: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Jim Moseby
> Hi,
> 
> I was wondering if one could create Spiders/Crawlers in PHP?
> I need for the PHP code to email me a list of emails, of 
> domains listed in 
> that page.
> 
> Is this possible?

Of course it is, but I'm afraid you might crawl the web, collect email
addresses, and send spam to the good people, or sell their email adresses to
someone else who will.

JM

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



Re: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread John Nichel

Jay Blanchard wrote:

[snip]
I was wondering if one could create Spiders/Crawlers in PHP?
[/snip]

Yes.

[snip]
I need for the PHP code to email me a list of emails, of domains listed
in 
that page.


Is this possible?
[/snip]

Yes.


Imagine that. ;)

--
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] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Chirantan Ghosh

Hello Jay,

Pardon my ignorance but can you enlighten me a little more please?
Like where can I look for them or how to code?

As always all members are more than welcome to ask me for graphics I hope to 
be benevolent that way.

Thanks a lot,
C


- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>

To: "Chirantan Ghosh" <[EMAIL PROTECTED]>; 
Sent: Friday, July 29, 2005 2:05 PM
Subject: RE: [PHP] PHP Spider/Crawler for Emails possible?


[snip]
I was wondering if one could create Spiders/Crawlers in PHP?
[/snip]

Yes.

[snip]
I need for the PHP code to email me a list of emails, of domains listed
in
that page.

Is this possible?
[/snip]

Yes.

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



RE: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Jay Blanchard
[snip]
I was wondering if one could create Spiders/Crawlers in PHP?
[/snip]

Yes.

[snip]
I need for the PHP code to email me a list of emails, of domains listed
in 
that page.

Is this possible?
[/snip]

Yes.

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



Re: [PHP] PHP Spider/Crawler for Emails possible?

2005-07-29 Thread Chirantan Ghosh

Hi,

I was wondering if one could create Spiders/Crawlers in PHP?
I need for the PHP code to email me a list of emails, of domains listed in 
that page.


Is this possible?

Thanks,
C 


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



Re: [PHP] isUserInRole equivalent in PHP

2005-07-29 Thread Saqib Ali
> Have you checked http://www.php.net/ldap ?

yes. couldn't find one. 

i can implement the function myself. i was just wondering if there is
something already available.

-- 
In Peace,
Saqib Ali
http://www.xml-dev.com/blog/

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



Re: [PHP] Sessions Issue

2005-07-29 Thread John Nichel

Tom Ray [Lists] wrote:
We built a box about 7 months or so ago using the SuSE 9.1 cd's, 
straight install from the CDs. While I've read that sessions are turned 
on by default, when we try to call on the sessions functions (like with 
phpOpenChat or start_session()) we get calls to undefined function 
errors. This is leading me to belive that sessions are disabled for some 
reason. I need to enable the sessions so I have a few questions


1) Can I do this without recompiling?
2) If I can't, how do I recompile this since I used the SuSE cds?

It's SuSE 9.1 running Php 4.3.4 with APache 2.0.49

any help would be great!


What does phpinfo() say?

--
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] isUserInRole equivalent in PHP

2005-07-29 Thread Jay Blanchard
[snip]
Java has a function to check if the logged in user is assigned a
certain Roles in LDAP.  The function is called:

isUserInRole
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpSer
vletRequestWrapper.html#isUserInRole(java.lang.String)

Is there a PHP equivalent of this? 
[/snip]

Have you checked http://www.php.net/ldap ?

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



[PHP] Sessions Issue

2005-07-29 Thread Tom Ray [Lists]
We built a box about 7 months or so ago using the SuSE 9.1 cd's, 
straight install from the CDs. While I've read that sessions are turned 
on by default, when we try to call on the sessions functions (like with 
phpOpenChat or start_session()) we get calls to undefined function 
errors. This is leading me to belive that sessions are disabled for some 
reason. I need to enable the sessions so I have a few questions


1) Can I do this without recompiling?
2) If I can't, how do I recompile this since I used the SuSE cds?

It's SuSE 9.1 running Php 4.3.4 with APache 2.0.49

any help would be great!

Thanks!

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



[PHP] isUserInRole equivalent in PHP

2005-07-29 Thread Saqib Ali
Hello All,

Java has a function to check if the logged in user is assigned a
certain Roles in LDAP.  The function is called:

isUserInRole 
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequestWrapper.html#isUserInRole(java.lang.String)

Is there a PHP equivalent of this? 

-- 
In Peace,
Saqib Ali
http://www.xml-dev.com/blog/

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



Re: [PHP] is it possible.

2005-07-29 Thread jenny mathew
i used following code for downloading file.whenever the members cicked the 
file for downloading ,the download request (with the variable containing 
file id) was send to download.php .The download.php on recieving the file id 
fetches the url of the fileand redirects to the file url using 
Header("location:$url");
where $url is the full url of file such as 
http://www.abc.com/downloads/file1.zip.
so finally the url is exposed to the members who circulates the url in mails 
and everybody downloads the files.I want that only members can download the 
file.is  there any solution.

 On 7/29/05, André Medeiros <[EMAIL PROTECTED]> wrote: 
> 
> When deppending on authentication, never link the files directly.
> 
> You can create a download.php file that gets an ID through the URL,
> checks if the user is authenticated and then read the file.
> 
> You will need these functions:
> 
> http://pt.php.net/file_get_contents
> http://pt.php.net/header
> 
> Header() is to send the mime type, and file_get_contents is to read the
> file's contents (DOH).
> 
> If you run into trouble, you can (in the order given ;):
> 
> 1) Read the user's comments on both functions. They're pretty helpful
> sometimes
> 2) Mail the ML :)
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>


Re: [PHP] logging in using ssl

2005-07-29 Thread Dotan Cohen
On 7/29/05, Gregory Machin <[EMAIL PROTECTED]> wrote:
> Hi
> Please advise .
> I have a site that needs to move over to ssl only when the user login
> authenticates the log in ..
> How would i go about this, the cms is exponent writen in php..
> Many Thanks
> 
> --
> Gregory Machin
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> www.linuxpro.co.za
> Web Hosting Solutions
> Scalable Linux Solutions
> www.iberry.info (support and admin)
> www.goeducation (support and admin)
> +27 72 524 8096

Have the login form on a secure page. That way, the users login info
is not sent in clear text. This is not php related.

Dotan
http://lyricslist.com/lyrics/artist_albums/202/fleetwood_mac.php
Fleetwood Mac Song Lyrics

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



Re: [PHP] PHP noobie

2005-07-29 Thread John Nichel

Bob Stia wrote:

Hello PHP list

First allow me to apologize if this is the wrong place for this and 
direct me to the proper place. (be nice now!)


I know nothing about PHP and have read at least 100 faqs and googled for 
hours. I don't even know some of the basics.


The fact that you've searched before coming here puts you above 99% of 
the 'newbies'.


Allow me to explain. I am the webmaster for a small web site for a 
Florida car club. The members have been asking if they could post info 
about events, communicate community wide, maybe post their own 
Classified ads, etc,


I would like to comply with their wishes for an email/blog kind of thing
but don't have the foggiest notion where to begin. The googling/faq's 
don't help me a bit and appears to be pretty complicated. I don't even 
know the basics. I really have no desire to go into a steep learning 
curve to accomplish what should be a pretty simple thing. I need simple 
and easy.


There are plenty of pre-built packages out there.  Look at places like 
HotScripts.com and php.resourceindex.com


I have composed in straight html (not that much,but enough) and with 
several GUI's. (all open source Linux based) I compose on my system and 
then simply upload to the site with FTP. I have found a few PHP 
packages but are not sure what they do. They require PHP, MySQL or 
Postgres, and Apache. Do I really need to install Apache? (The site is 
hosted by a commercial remote ISP as a courtesy/good will thing and I 
think they support PHP but do not wish to place any burden on them to 
support the site) Do I really need a data base?


Unless you build the app(s) yourself, you're at the mercy of the 
developers at to what is required to run the software.  Most of these 
pre-built packages are pretty easy to install though and you can do it 
without the knowledge of PHP, MySQL, etc.  Chances are, if your ISP is 
running some flavor of *nix for it's web servers, they already have 
Apache, PHP, and MySQL installed.


--
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] help with "ORDER BY" query

2005-07-29 Thread John Nichel

Jesús Alain Rodríguez Santos wrote:

I have a query:

$query = mysql_query("SELECT event FROM table WHERE month = 'x' ORDER BY
day ASC");

I have all days of the month insert in day field: 1, 2, 3, 4, 5 ...

when I print the query:
if ($query_r = mysql_fetch_array($query)) {


-^

Right there, you called the first result row, then below


 do {
  echo "".$query_r['event']."\n";
   } while ($query_r = mysql_fetch_array($query));


-^

You call it again, and since you already called for the first row, this 
time it is returning results starting from the second row.



   echo " \n";
   } else {
echo "No se encontraron registros";
  }

It print all result of the query, less day 1
What it's the problem






--
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] help with "ORDER BY" query

2005-07-29 Thread André Medeiros
if( mysql_num_rows( $query_r ) > 0 ) {
while( $currentResult = mysql_fetch_array( $query_r ) ) {
// do something with the result.
}
}
else {
echo 'No results.';
}

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



Re: [PHP] Including Check box ifo in PHP mail

2005-07-29 Thread Chirantan Ghosh

Hi Everybody,

The reference PHP is http://www.primarywave.com/BrokerOutpost_Contact.php.
I want it have Checkbox like 
http://www.primarywave.com/BrokerOutpost_Contact.htm & have it sent vis POST 
form action like the PHP sited before.


My ignorace is getting the best of me do help please.

The PHP code that I have ( Form post method Printing info in email part)
=
 $value) {
   ${$indx}=$value;
}
foreach($HTTP_POST_VARS as $indx => $value) {
   ${$indx}=$value;
}
if($sendmessage == "yes"){

$todaytime = date("F j, Y, g:i a");

$mailTo = "[EMAIL PROTECTED]";
//This is where I want it to be mailed when form is submitted

$mailSubject = "Primary Wave Media Contact BrokerOutpost Ref :: 
$todaytime";


$mailBody = "Information:\n\n";
if($number){
 $mailBody .= "Number:   $number\n\n";
}
$mailBody .= "Full Name:   $name\n";
$mailBody .= "Company:  $company\n";
$mailBody .= "State:$state\n";
$mailBody .= "Email:$email\n";
$mailBody .= "Phone:$phone\n\n";
$mailBody .= "Main Activities:  $activities\n\n";
/This is where I want to add the Check box like( 
http://www.primarywave.com/BrokerOutpost_Contact.htm )

$mailBody .= "SelectedNumber:  $SelectedNumber\n";
$mailBody .= "Comments:  $comments\n\n\n";
$mailBody .= "$todaytime";


$mailHeaders = "From: [EMAIL PROTECTED]";

mail($mailTo, $mailSubject, $mailBody, $mailHeaders);

print "Thank You";


}else{

$_num = new number();
$_num->init();

$number = $_num->num_info[number];

?>
==
I tried putting in labeled Checkbox & included the names in
$mailBody .= "CheckBox name:  $CheckBoxname\n";
I tried the NAME, LABLE all same to avoid confusion


Thanks a lot,
C

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



RE: [PHP] help with "ORDER BY" query

2005-07-29 Thread Carlo Razzeto
The following line:
$query_r = mysql_fetch_array($query)

Will pop off the first result from the query, you can avoid this problem by 
using mysql_num_rows instead:

if( mysql_num_rows( $query ) > 0 )...

Carlo Razzeto
Programmer
Mortgage Information Services
Phone: (216) 514-1025 ex. 1212
-Original Message-
From: Jesús Alain Rodríguez Santos [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 29, 2005 11:00 AM
To: php-general@lists.php.net
Subject: [PHP] help with "ORDER BY" query

I have a query:

$query = mysql_query("SELECT event FROM table WHERE month = 'x' ORDER BY
day ASC");

I have all days of the month insert in day field: 1, 2, 3, 4, 5 ...

when I print the query:
if ($query_r = mysql_fetch_array($query)) {
 do {
  echo "".$query_r['event']."\n";
   } while ($query_r = mysql_fetch_array($query));
   echo " \n";
   } else {
echo "No se encontraron registros";
  }

It print all result of the query, less day 1
What it's the problem



-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.

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


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

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



[PHP] help with "ORDER BY" query

2005-07-29 Thread Jesús Alain Rodríguez Santos
I have a query:

$query = mysql_query("SELECT event FROM table WHERE month = 'x' ORDER BY
day ASC");

I have all days of the month insert in day field: 1, 2, 3, 4, 5 ...

when I print the query:
if ($query_r = mysql_fetch_array($query)) {
 do {
  echo "".$query_r['event']."\n";
   } while ($query_r = mysql_fetch_array($query));
   echo " \n";
   } else {
echo "No se encontraron registros";
  }

It print all result of the query, less day 1
What it's the problem



-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.

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



[PHP] logging in using ssl

2005-07-29 Thread Gregory Machin
Hi
Please advise .
I have a site that needs to move over to ssl only when the user login
authenticates the log in ..
How would i go about this, the cms is exponent writen in php..
Many Thanks
 
-- 
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions 
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096

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



Re: [PHP] PHP and ISMAP

2005-07-29 Thread Jochem Maas

Michelle Konzack wrote:

Hello *,

I have a landmap splited into 100x100 pixel parts and show it in a
grid of e.g. 8x6.  Now I like to use ISMAP to get infos about places
on this card.  The problem is, that I can not send additonal Card infos

like




which will result in a URL like

http://localhost/card.php?MAP=offenburg&CARD=00041_00037?61,67
 ^  ^
  \/
   \  /
 Which does not work  :-(


you said that Apache's ModRewrite is no good for you (your loss - btw you know 
the
connection between modRewrite and php?)
but have you tried lookiing in the value of $_SERVER['REQUEST_URI'] as apposed
to relying on the contents of $_GET in this case - I am assuming that card.php
is actually called.

now I'll bet $_SERVER['REQUEST_URI'] contains:

http://localhost/card.php?MAP=offenburg&CARD=00041_00037?61,67

and I'm going to assume that you are capable enough to be able to 'parse'
that string to extract the information manually... yes? good!

that's all folks :-)



This mean, I need to create for each Image a seperatly php file like




with the MAP-Data and use "include" to get the rest of the CGI and get
an URL like

http://localhost/offenburg/00041_00037.php?61,67

Here is a test:


(Clickmaps are not working but scrolling does work)

Q 1:WHAT is the best solution ?

Q 2:HOW can I get the ISMAP Data into my PHP-CGI ?

Q 3:HOW must I make/implement my MAP-Data

Please note, that I have around 400.000 tildes and I can not load a
singel filed which contain all the MAP-Data because it is dynamicly
updated.

Greetings
Michelle



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



Re: [PHP] Re: PHP and ISMAP

2005-07-29 Thread André Medeiros
On Fri, 2005-07-29 at 14:47 +0200, Michelle Konzack wrote:
> Please no CC, I am on the list.
> 
> Am 2005-07-29 14:20:47, schrieb André Medeiros:
> > Why not using a rewrite rule that would point to an index.php or
> > somesuch?
> 
> And then ?
> I have e.g. 8x6 click maps, pointing all to the same index.php ?
> How do the CGI know on which map I have clicked ?
> 
> And using rewrites on my webserver is no option because they are
> people which can not do that.
>  
> Greetings
> Michelle
> 

Whenever you hit a rewrite rule, the file knows what the original
request was. So, in this case, you'd know whitch image was called ;)

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



[PHP] Re: PHP and ISMAP

2005-07-29 Thread Michelle Konzack
Please no CC, I am on the list.

Am 2005-07-29 14:20:47, schrieb André Medeiros:
> Why not using a rewrite rule that would point to an index.php or
> somesuch?

And then ?
I have e.g. 8x6 click maps, pointing all to the same index.php ?
How do the CGI know on which map I have clicked ?

And using rewrites on my webserver is no option because they are
people which can not do that.
 
Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


[PHP] php array and java fold out menu

2005-07-29 Thread Gregory Machin
Hi .
Please could you advise.
I'm insearch of a java fold out menu that looks good, and can acept an
array containg the links and link names etc from a php array ... i
havent worked in java script yet so please help :-)...

Many thanks 

-- 
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions 
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096

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



[PHP] php mysql field update not looping properly ..

2005-07-29 Thread Gregory Machin
Hi 
please could you advise..

I'm trying to prase a column in a table, to grep each field's contens,
one contains a web page, and there are about 1000 pages in the column,
thus they have to be one at a time
so as not to over load the server /php ..

the script below , gets an array of the table id's then using this
array gets the total number of fields from the array. Thus geting the
field to be grep'ed them grep'ing it then writing it back then moving
on to the next field.

this is the out put from the echo's
with the full code below.
Many Thanks in advance. 

SELECT idtemp FROM temp;0
query 2 SELECT file_content FROM temp WHERE idtemp = '1'

Warning: mysql_real_escape_string() expects parameter 1 to be string,
array given in /var/www/html/update_filecontent.php on line 36
query 3 UPDATE temp SET file_content = 'hello' WHERE idtemp = '1';
1

Notice: Undefined offset: 1 in /var/www/html/update_filecontent.php on line 24
query 2 SELECT file_content FROM temp WHERE idtemp = ''

Notice: Undefined offset: 1 in /var/www/html/update_filecontent.php on line 40
query 3 UPDATE temp SET file_content = 'hello' WHERE idtemp = '';
2

Notice: Undefined offset: 2 in /var/www/html/update_filecontent.php on line 24
query 2 SELECT file_content FROM temp WHERE idtemp = ''

Notice: Undefined offset: 2 in /var/www/html/update_filecontent.php on line 40
query 3 UPDATE temp SET file_content = 'hello' WHERE idtemp = '';
3



'; //regex used to carry out the replace
$replace = ' '; // code to be inserted 

stepper($regy, $replace, $index, $table, $column);


function stepper ($regy, $replace, $index, $table, $column ) { // used
to parse $column... and carry out the updates
$query = "SELECT ". $index ." FROM ".$table.";"; // get an array
holding $index the column id.
echo $query;
$result = mysql_query($query) or die( mysql_error());
$i = 0;
$index_Array = mysql_fetch_array($result); // push the 'id' 
array
into an array varray variable

While ($i < mysql_num_rows($result)) { // get number of rows, and
assocated row id array
echo $i."";

  $query2 = "SELECT ". $column ." FROM ". $table ." WHERE 
".$index."
= '". $index_Array[$i] ."'";
// query2 selects the field in the 
column containing the
required strings
 //to be grep'ed and up dated 
 echo "query 2 ".$query2 . ""; 
//echo $query2.""; //for testing 

$result2 = mysql_query($query2) or die( mysql_error()); 
$query_row = mysql_fetch_row($result2); 

$regex_input = $query_row;
//echo $regex_input; //for testing 

$regex_ouput = preg_replace($regy, $replace, 
$regex_input);
$sql_input = mysql_real_escape_string($regex_ouput);
//echo $sql_input;

//echo $regex_ouput; //for testing'
$query3 = "UPDATE ".$table." SET " . $column . " = 'hello' WHERE
".$index." = '". $index_Array[$i]."';";
echo "query 3 " .$query3."";
//$result3 = mysql_query($query3) or die( 
mysql_error());



$i++;
}   

}
mysql_close($link)
?>



-- 
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions 
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096

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



Re: [PHP] PHP and ISMAP

2005-07-29 Thread André Medeiros
Why not using a rewrite rule that would point to an index.php or
somesuch?

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



Re: [PHP] is it possible.

2005-07-29 Thread André Medeiros
When deppending on authentication, never link the files directly.

You can create a download.php file that gets an ID through the URL,
checks if the user is authenticated and then read the file.

You will need these functions:

http://pt.php.net/file_get_contents
http://pt.php.net/header

Header() is to send the mime type, and file_get_contents is to read the
file's contents (DOH).

If you run into trouble, you can (in the order given ;):

1) Read the user's comments on both functions. They're pretty helpful
sometimes
2) Mail the ML :)

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



[PHP] is it possible.

2005-07-29 Thread jenny mathew
hello group,
i have a problem and hope anybody here will be able to hep me out.
i have a downloads folder in my server which contains all the files in 
zipped form to be downloaded by members.members are authenticated by 
entering username and password.and when they click to download the files 
,they are forwarded to the the full file url by using header function of 
php.But the problem is that ,when the users click once to download a file 
,they can see the whole url and so next time they can easily download the 
file by entering the full url in the browser ,so there is no use of 
authentication next time and this leads to bandwidth theft and the urls of 
files are circulating in the emails and users are downloading the files 
without becoming the user of the site and without authenticating 
themselves.I know there are many professionals in this group who are very 
experienced and have helped me earlier.this is a very serious problem and i 
need a solution to this.What are your views?
Is there any solution for it?
waiting for your replies.
Thanks,
Jenny


Re: [PHP] Fundamental question about ADTs

2005-07-29 Thread Jochem Maas

Jasper Bryant-Greene wrote:

Hi all

Recently I've been reading /Code Complete/ by Steve McConnell, and in it 
he recommends the use of ADTs, or Abstract Data Types, which I have been 


big words :-) guess it means he can charge more per hour ;-)


thinking about implementing in a major project I am currently embarking on.

Basically the question that I have for the list is this:

If I have a relatively simple class, for example Photo, then why does 
McConnell recommend that I do this:



doesn't McConnell give a reason? (maybe he is a scientologist
and just demands blind faith)





getCaption();
//do something with $caption
$instanceOfPhotoClass->setCaption($caption);
?>

Rather than this:

caption;
// do something with $caption
$instanceOfPhotoClass->caption = $caption;
?>

I'm just looking for some alternative explanations to what McConnell 
offers in the book. I can understand that the first example allows me to 
"know" when an attribute has been modified... but it annoys me that I 
have code like this:


class Photo {
private $caption;

[...]

public function setCaption($newCaption) {
$this->caption = $newCaption;
}
}

It just seems so pointless..


the point is encapsulation. basically you want to do something (set the caption)
how that is implemented, should, according to OO, theory be hidden from the 
user of the
object.

it also means that if you want to log something or do any kind of action as a 
reaction to
the caption changing you can implement it (at any stage in the development) in 
one place
and all instances of code where the caption is potentially being changed will 
comply - whereas
if you were doing $photo->caption = $caption all over the place you would be 
stuck...

also consider this:

class PhotoAdv {
private $caption;

public function setCaption($newCaption) {
if (is_string($newCaption)) {
$this->caption = $newCaption;
}
}
}
$p = new PhotoAdv();
$p->setCaption( array("this is not very smart") );

as apposed to:

class Photo {
public $caption;
}
$p = new Photo();
$p->caption = array("this is not very smart");


now I know which class/object I would rather be working with, for instance,
when it comes to generating some SQL to update the relevant record
in a DB. how about you?

HTH

ps - check out the __set(), __get() & __call() magic methods that are
available for classes in php5. you might be able to figure out a cool way to use
them in order to minimize the code you have to write (regarding repetitive
setter/getter functions)



Thanks in advance for any comments.

Jasper



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



Re: [PHP] Fundamental question about ADTs

2005-07-29 Thread Miles Thompson


Because the OOP religion requires everything to be done with methods?

Remember CC comes from the MSFT world, not the PHP corner of it. And in the 
larger world, public properties of your class, such as Caption, have 
corresponding local vars such as m_caption. That is, Caption is not 
manipulated directly by its class, and can only be set or read outside of 
the class through the class's set and get methods.


Seems a bit cumbersome, but does allow the class to be protected against 
dirty data by checking anything passed to it throug 
InstanceofCaptio=>SEt($somestring).


Hope this is helpful. In the Visual FoxPro world the caption, if it was 
public, could be set with CaptionInstance.Caption = somevar.


Regards - Miles

At 08:35 AM 7/29/2005, Jasper Bryant-Greene wrote:

Hi all

Recently I've been reading /Code Complete/ by Steve McConnell, and in it 
he recommends the use of ADTs, or Abstract Data Types, which I have been 
thinking about implementing in a major project I am currently embarking on.


Basically the question that I have for the list is this:

If I have a relatively simple class, for example Photo, then why does 
McConnell recommend that I do this:


getCaption();
//do something with $caption
$instanceOfPhotoClass->setCaption($caption);
?>

Rather than this:

caption;
// do something with $caption
$instanceOfPhotoClass->caption = $caption;
?>

I'm just looking for some alternative explanations to what McConnell 
offers in the book. I can understand that the first example allows me to 
"know" when an attribute has been modified... but it annoys me that I have 
code like this:


class Photo {
private $caption;

[...]

public function setCaption($newCaption) {
$this->caption = $newCaption;
}
}

It just seems so pointless..

Thanks in advance for any comments.

Jasper

--
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 noobie

2005-07-29 Thread Miles Thompson

Bob,

Try two things:

1. create a small file, name it phpinfo.php, which consists of these lines:


2. upload it to your web site

3. run it - http:///phpinfo.php
where www.your.url is the address of yorur site.

A. If PHP is installed, you will get a page full of information. It will 
include information on the database support, if any, which is compiled into 
PHP, the web server used for the site, and so forth.


B. If PHP is NOT installed, those three lines of code will echo back to you.

Where to go from here?  Either ask the ISP to provide the necessary 
software, or shift to a different host.
Many PHP applications rely on a back-end database, usually MySQL, because a 
database is the most efficient way to store and retrieve data.


Hope this is helpful, and that I've not repeated what others have advised.

Regards - Miles Thompson

At 07:47 PM 7/28/2005, Bob Stia wrote:

Hello PHP list

First allow me to apologize if this is the wrong place for this and
direct me to the proper place. (be nice now!)

I know nothing about PHP and have read at least 100 faqs and googled for
hours. I don't even know some of the basics.

Allow me to explain. I am the webmaster for a small web site for a
Florida car club. The members have been asking if they could post info
about events, communicate community wide, maybe post their own
Classified ads, etc,

I would like to comply with their wishes for an email/blog kind of thing
but don't have the foggiest notion where to begin. The googling/faq's
don't help me a bit and appears to be pretty complicated. I don't even
know the basics. I really have no desire to go into a steep learning
curve to accomplish what should be a pretty simple thing. I need simple
and easy.

I have composed in straight html (not that much,but enough) and with
several GUI's. (all open source Linux based) I compose on my system and
then simply upload to the site with FTP. I have found a few PHP
packages but are not sure what they do. They require PHP, MySQL or
Postgres, and Apache. Do I really need to install Apache? (The site is
hosted by a commercial remote ISP as a courtesy/good will thing and I
think they support PHP but do not wish to place any burden on them to
support the site) Do I really need a data base?

Please be patient and point the old guy in the right direction.

Thanks,
Bob S.

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


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



[PHP] Fundamental question about ADTs

2005-07-29 Thread Jasper Bryant-Greene

Hi all

Recently I've been reading /Code Complete/ by Steve McConnell, and in it 
he recommends the use of ADTs, or Abstract Data Types, which I have been 
thinking about implementing in a major project I am currently embarking on.


Basically the question that I have for the list is this:

If I have a relatively simple class, for example Photo, then why does 
McConnell recommend that I do this:


getCaption();
//do something with $caption
$instanceOfPhotoClass->setCaption($caption);
?>

Rather than this:

caption;
// do something with $caption
$instanceOfPhotoClass->caption = $caption;
?>

I'm just looking for some alternative explanations to what McConnell 
offers in the book. I can understand that the first example allows me to 
"know" when an attribute has been modified... but it annoys me that I 
have code like this:


class Photo {
private $caption;

[...]

public function setCaption($newCaption) {
$this->caption = $newCaption;
}
}

It just seems so pointless..

Thanks in advance for any comments.

Jasper

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



[PHP] pgp-gd and netpbm (pamdice)

2005-07-29 Thread Michelle Konzack
Hello *,

I like to upload new topographical maps into my System and split it
into smaller parts. Curently I am using exec() to do the Job, but
like to use php native tools to do the Job.

Also I need better naming schemes as netpbm (pamdice) do.  Exactly I
will like to give a horizontal vertical start number to get images
like
4_8.jpg 4_9.jpg 4_00010.jpg 4_00011.jpg 
5_8.jpg 5_9.jpg 5_00010.jpg 5_00011.jpg 
6_8.jpg 6_9.jpg 6_00010.jpg 6_00011.jpg 
7_8.jpg 7_9.jpg 7_00010.jpg 7_00011.jpg 
^ ^
  /  \
horizontallinevertical image

How can I do this ?

Thanks and Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


[PHP] PHP and ISMAP

2005-07-29 Thread Michelle Konzack
Hello *,

I have a landmap splited into 100x100 pixel parts and show it in a
grid of e.g. 8x6.  Now I like to use ISMAP to get infos about places
on this card.  The problem is, that I can not send additonal Card infos

like




which will result in a URL like

http://localhost/card.php?MAP=offenburg&CARD=00041_00037?61,67
 ^  ^
  \/
   \  /
 Which does not work  :-(

This mean, I need to create for each Image a seperatly php file like




with the MAP-Data and use "include" to get the rest of the CGI and get
an URL like

http://localhost/offenburg/00041_00037.php?61,67

Here is a test:


(Clickmaps are not working but scrolling does work)

Q 1:WHAT is the best solution ?

Q 2:HOW can I get the ISMAP Data into my PHP-CGI ?

Q 3:HOW must I make/implement my MAP-Data

Please note, that I have around 400.000 tildes and I can not load a
singel filed which contain all the MAP-Data because it is dynamicly
updated.

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] overwrite private class members in php5?

2005-07-29 Thread Rasmus Lerdorf
Norbert Wenzel wrote:
> Hi, I've done something like this:
> 
> class MyClass {
> 
>   private $var;
> 
>   function __construct($value) {
> $this->var = $value;
>   }
> 
>   public function printVar() {
> echo($this->var);
>   }
> 
> }
> 
> $object = new MyClass('1');
> $object->printVar(); // prints 1
> $object->var = 3; // Fatal Error as expected
> $object->$var = 2; // no error msg
> $object->printVar(); // prints 2
> 
> Hows that possible or what's the difference between
>  $object->var   and
>  $object->$var ?

$object->$var makes no sense.  Unless $var is set to 'var' in which case
it is the same thing and you will get the same fatal error as on the
line before.  The only way for $object->$var to print 2 in your example
is if you have $var = 'foo' and MyClass has a public property named foo
with a value of 2.

-Rasmus

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



[PHP] Re: overwrite private class members in php5?

2005-07-29 Thread Norbert Wenzel

Norbert Wenzel wrote:

  public function printVar() {
echo($this->var);
  }


I have to do a little correction, i wrote
$this->$var
to see the variable, otherwise i don't see
anything.

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



[PHP] overwrite private class members in php5?

2005-07-29 Thread Norbert Wenzel

Hi, I've done something like this:

class MyClass {

  private $var;

  function __construct($value) {
$this->var = $value;
  }

  public function printVar() {
echo($this->var);
  }

}

$object = new MyClass('1');
$object->printVar(); // prints 1
$object->var = 3; // Fatal Error as expected
$object->$var = 2; // no error msg
$object->printVar(); // prints 2

Hows that possible or what's the difference between
 $object->var   and
 $object->$var ?

thanks in advance for your help!
Norbert

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



[PHP] Visit to Germany

2005-07-29 Thread DL Neil, Newsletter a/c

Greetings,

I'm hoping to visit the Stuttgart area* for one week ~ ten days 
commencing c.Friday 19 August, to visit my brother-in-law and take a 
short vacation.


If there are any PHP-related gatherings or activities I would be 
interested to meet up (last time I tried, I missed out by one week...)


NB My grasp of the German language is in the feeble~abysmal range, but I 
promise to read at least page one of my language tutorial before I come!


Regards,
=dn
* Dettingen-unter-Teck, Kirchheim/Teck, Notzingen

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



Re: [PHP] function with argument of type array

2005-07-29 Thread Jochem Maas

Marcus Bointon wrote:

On 29 Jul 2005, at 08:19, Jochem Maas wrote:

unless String is a class you defined that won't work at all. basic  
data types

cannot be hinted (e.g. bool, int, string, float)



There's been quite a bit about this on php-internals. It seems to be  
because PHP doesn't differentiate between these types internally;  they 


so called zvals (zend value) and indeed typehinting these in php would
be silly.

all seem to be classified as a generic scalar type whose actual  type is 
determined according to context. Java can go to the other  extreme, 
where every simple type is an object, and hence it's easy  (if not 
mandatory) to specify types like this. You would never be  able to say 
'print "2" + 2' in Java and expect to get "4". This  looseness is very 
much part of what makes PHP so easy to get into -  if you really want 
these kind of features, you can just use Java  instead!


not unless you put a gun to my head ;-)



Another point is that exception handling (another PHP5 feature) is  next 
to useless without type hinting, so they HAD to implement it for  


that never crossed my mind!


objects so that catch clauses could work properly.

Marcus


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



RE: [PHP] safe mode

2005-07-29 Thread Kim Madsen
> -Original Message-
> From: Bostjan Skufca @ domenca.com [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 28, 2005 1:38 PM

> > > I would *never* host anything on a server with safe_mode on!
> 
> What are your reasons for this decision?

I correted it in a mail 5 minutes after.

With safe_mode off this is possible

System("cat /home/Bostjan/include/db_setup.inc");

>From any php script and any user. 

One should be protected by safe_mode_gid and safe_mode_include_dir, but I´ve 
seen several examples of hosting setups that allows complete access to another 
users directory. With safe_mode on I´M more safe and so are my customers ;-)

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper

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



Re: [PHP] time()

2005-07-29 Thread Marcus Bointon
On 29 Jul 2005, at 08:37, <[EMAIL PROTECTED]>  
<[EMAIL PROTECTED]> wrote:


I have the date when users registered stored in the database using  
time() function format.


Hm. I hope this means you're storing it as a TimeStamp format, or  
better, DateTime, and not as a simple integer field.


I have to search for users that are registered this week, this  
month and this year. How can i do that? I mean how can i found the  
beginning of this week?  Or the beginning of this month?


If you are storing it as a DateTime field, MySQL has loads of date  
related functions for doing this, and it's more efficient to do it  
using MySQL's functions that the equivalent in PHP. Take a look here:  
http://dev.mysql.com/doc/mysql/en/date-and-time-types.html and http:// 
dev.mysql.com/doc/mysql/en/date-and-time-functions.html


You can do the calculations in PHP. For example, to find the first  
day of this month as a timestamp:


$first = strtotime(date('Y-m-01'));

strtotime has some wonderful functionality - you can ask for dates  
like 'next week' 'last year' 'yesterday -1 week'.


To format a timestamp into a MySQL-compatible DateTime string, use:

$datetime = date('Y-m-d h:i:s', $timestamp);

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

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



Re: [PHP] function with argument of type array

2005-07-29 Thread Marcus Bointon

On 29 Jul 2005, at 08:19, Jochem Maas wrote:

unless String is a class you defined that won't work at all. basic  
data types

cannot be hinted (e.g. bool, int, string, float)


There's been quite a bit about this on php-internals. It seems to be  
because PHP doesn't differentiate between these types internally;  
they all seem to be classified as a generic scalar type whose actual  
type is determined according to context. Java can go to the other  
extreme, where every simple type is an object, and hence it's easy  
(if not mandatory) to specify types like this. You would never be  
able to say 'print "2" + 2' in Java and expect to get "4". This  
looseness is very much part of what makes PHP so easy to get into -  
if you really want these kind of features, you can just use Java  
instead!


Another point is that exception handling (another PHP5 feature) is  
next to useless without type hinting, so they HAD to implement it for  
objects so that catch clauses could work properly.


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

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



[PHP] time()

2005-07-29 Thread virtualsoftware
Hi,
I have the date when users registered stored in the database using time() 
function format.

I have to search for users that are registered this week, this month and this 
year. How can i do that? I mean how can i found the beginning of this week?  Or 
the beginning of this month?

Thanks in advance for your help!

Re: [PHP] function with argument of type array

2005-07-29 Thread Jochem Maas

Marcus Bointon wrote:

On 28 Jul 2005, at 12:07, André Medeiros wrote:


On Thu, 2005-07-28 at 11:08 +0200, marc serra wrote:


Hi, i want to know if it is possible to create a function and declare
that one of its arguments is array type.

In fact i want to do something like this

function test(String $litteral, array $foo){


unless String is a class you defined that won't work at all. basic data types
cannot be hinted (e.g. bool, int, string, float)




There is no way to do that. What you _CAN_ do, to ensure you're  getting
an array is:



There IS a way to do exactly this. It's called type hinting and it's  a 
PHP 5 feature:


for a split second I was about to say a word start with 'bull', but Marcus
is more or less correct - typehints for classes has existed since the beginning
of php5, the ability to typehint arrays is aparently being included in php5.1
(still in beta).

thanks Marcus for the heads up. :-)

=

now don't get me started on the fact that 'they' pulled the plug on being able
to do they following - I feel the breath of some purist overlord breathing down
my neck:

class Test { /* ...  */ }
function foo(Test $t = null) { /* ...  */ }

(the above worked in the first few betas of php5.0)


if a php 'God' reads this (and at least one of you is kind enough to grace us 
with
his presence on this list) - please reconsider allowing typehints with defaults 
of
NULL (only NULL and nothing else is more than enough for me!).



http://www.php.net/manual/en/language.oop5.typehinting.php

Marcus


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