Re: [PHP] Why not user...?

2007-08-27 Thread Gustav Wiberg

Hi!

Thnank you for your input, but I used AUTH_USER-server variable instead of 
PHP_AUTH_USER and that did the trick! :-)


Best regards
/Gustav W iberg

- Original Message - 
From: "Richard Lynch" <[EMAIL PROTECTED]>

To: "Stut" <[EMAIL PROTECTED]>
Cc: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Tuesday, August 28, 2007 3:20 AM
Subject: Re: [PHP] Why not user...?



On Mon, August 27, 2007 8:51 am, Stut wrote:

Gustav Wiberg wrote:

Why is it so that I get this error. I'm using Windows Integrated
authorization-method for actual webb I'm testing on.

Notice: Undefined index: PHP_AUTH_USER in
C:\www\utveckling\username.php
on line 2


For some reason it's not getting set. This could be because you've not
configured IIS correctly, are you sure you've disabled anonymous
authentication?

If you're sure it's configured correctly try var_dump'ing $_SERVER -
it's possible (though unlikely) the username is in another place.


Going for the more obvious...

Did you perhaps take code written with the default setting of E_ALL ~
E_NOTICE and are now running it with E_ALL, and this is the first
page-view before you've even typed in your usernane/password?

Cuz that for sure would do it.

Change the code to be more like this:

if (isset($_SERVER['PHP_AUTH_USER'])){
 //try to login
}

You'll probably have a fair number of these E_NOTICE thingies to fix
before you are through.

They're all trivial to fix, and there's no real excuse to have code
that has E_NOTICE messages firing off anyway.

Under extreme pressure, you can switch to E_ALL ~ E_NOTICE for this
app for now and put it on the ToDo list to fix it right someday...

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




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



[PHP] Session generating same "Captchas"

2007-08-27 Thread Michael Williams

Hi All,

I'm having a problem using Captchas.  Basically I'm using Joshua  
Houle's script to generate Captchas.  However, I get different  
behaviors on different systems.  On one system I can simply refresh  
the page and a different Captcha is generated each time.  However, on  
another system, a refresh simply makes it generate the exact same  
Capthca with a different visible length.  For instance, it will  
always generate length-wise variants  
"UPGR5MB". . ."UPGR". . ."UPGR5M". . ."UPG". . ."UPGR5".  The only  
way it will change is if I quit my browser and open another.  Also,  
despite the code directive, it always generates a string length of  
about 20 characters despite the code explicitly stating a random  
length between 4 and 7.  One interesting note, however, is that it  
does change the color and position of the letters upon refresh.


I would assume that part of the problem would be with $_SESSION, as  
when I "unset" it, new Captchas are generated.  This, however, is  
unacceptable as I need certain $_SESSION variables later.  Currently  
I'm using the following to solve the 20 character length issue:


	$_SESSION['captchastr'] = substr($captchastr,0,$strlength);  // 
$strlength being the $strlength used to generate the length of  
$captchastr at the beginning of the script


instead of the default code. Any ideas regarding what the differences  
between servers could be would certainly be appreciated.


Regards,
Michael

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



Re: [PHP] Database includes

2007-08-27 Thread Bruce Cowin
Thanks to everyone who responded.  Some really interesting ideas.  I'll
try them out.


Regards,

Bruce

>>> "Wouter van Vliet / Interpotential" <[EMAIL PROTECTED]>
28/08/2007 8:34 a.m. >>>
On 27/08/07, Stut <[EMAIL PROTECTED]> wrote:

> I use a slightly different approach to prevent the need to mess
about
> with files when moving to production. At the end on config.php I
have
> this...
>
> if (file_exists('config_dev.php'))
>  require 'config_dev.php';


I've got my own variation on this, came to use it to prevent
overwriting
config files for stage/dev/live or other versions of a site. I've got
a
general purpose constants file, which defines a lot of constants which
are
generally used a lot in my applications (file rootdir, DAY, HOUR,
database
passwords, some regexes, these things). Instead of just defining them
there,
I define them using a simple conditional define function (if
(!defined($constantName) define($constantName, $value)). On top of my
constants.inc.php (as I chose to call it) I use the following:

if (isset($_SERVER['SERVER_NAME'])) {
$_config_file =
dirname(__FILE__).'/../eg/'.$_SERVER['SERVER_NAME'].'.inc.php';
@include($_config_file);
}

The included hostname specific config file would then define some
constants,
and because they are already defined the default values from
constants.inc.php don't get set anymore.

Hope this is of help to anybody, it has certainly relaxed my
deployment
process..

Wouter


In config_dev.php I override anything defined in config.php that needs
> to be different on the current server. The config_dev.php file is
*not*
> in source control so it doesn't exist in production but each
development
> and test environment has a version that modifies the production
> environment.
>
> There is a hit involved in the call to file_exists, but PHP caches it
so
> the effect is minimal.
>
> -Stut
>
> --
> http://stut.net/ 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php 
>
>


-- 
Interpotential.com
Phone: +31615397471

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



[PHP] Job Opportunity: PHP Developer Opportunity

2007-08-27 Thread Anne Mcdonald
Eric,

I am an executive recruiter and am working on a search for a client of
mine that is a privately held software company located in Bend, OR. This
company is backed by Greystone out of NY. 

www.greystoneco.com

I was wondering if you might know of any PHP Developers that match the
job description. Please give me a call to discuss in more detail. I can
be reached at 541-306-6909. 


Best regards,
Anne Mcdonald

Interested in this job opportunity?
Click here
  to learn more...

Position Title:  PHP Developer Opportunity   
Location:Bend , OR  
Description: Developer- Strong PHP skills
Bend, OR (Can Work Remotely)

Work hard and play hard in Central Oregon - the playground of the
Northwest!

PROGRAMMER
Bend, Oregon on-line software company is looking for an experienced
programmer with strong skills in PHP.

COMPANY
This company provides online software as a service that supports
consumers in playing an active role in their Medicaid services
management, and lowers costs to state agencies by decreasing fraud and
increasing efficiencies in current paper based administrations.

This company targets a wide range of local, state, and federal
government agencies that are engaged in human services through the
Medicaid and Medicare programs. With a highly talented and committed
technical team, they have successfully brought an automated, fully
web-hosted service and payment solution to market. This software
application is designed to promote greater empowerment of people with
disabilities to direct their own services. 

REQUIRED EXPERIENCE AND SKILLS
. Minimum 3 years coding experience
. Write PHP 5 code to the Class level and practice OO design
. Database development experience with MySQL
. Experience with XML and Web Services
. Previous experience with the Document Object Model
. Previous experience with AJAX
. Working knowledge of CSS
. Ability to understand database and design
. Familiar with both CVS and SourceSafe
. In-depth knowledge of ECMA 262
. Ability to hand-code XHTML
. Experience with .NET / C# is desired
. Experience with EDI, HIPAA, Payroll accounting or IT systems is a plus

BENEFITS
. Salary commensurate with experience
. Health dental and vision insurance
. Life insurance
. 401k 
. Paid vacation, sick and holidays

TO APPLY
. Submit cover letter and resume and sample of code to
[EMAIL PROTECTED]

Options:.   I would like to learn more
  
.   Keep me informed
  of other relevant opportunities 
.   Forward this opportunity
  to a friend 

This message was sent by:

McDonald Group, Inc
McDonald Group, Inc specializes in professional recruiting throughout
Central Oregon in a variety of industries. 

61438 Linton Loop Bend, OR 97702

McDonald Group, Inc respects your online privacy. If you would like to
be removed from future McDonald Group, Inc mailings, you may unsubscribe
by clicking here
 .




Re: [PHP] Re: PHP eval() fatal error

2007-08-27 Thread Richard Lynch
On Mon, August 27, 2007 12:59 am, Maarten Balliauw wrote:
> Now let's repeat my question: is there any way to gracefully evaluate
> specific code, eventually catch an error and respond to that, without
> using parsekit() or launching another process to get this done?

I missed that you had an E_ERROR parse error.  Sorry.

To answer your question:

No.



You may want to look at various testing frameworks for PHP such as
php_unit and the "make test" of PHP itself to see how they run tests
such that syntax errors in individual tests don't halt the whole
process.

I know for sure the PHP make test fires off a separate PHP process.

Keep in mind that you're asking PHP to try to execute code that it
can't even parse to start with...  Rather like expecting to get an
a.out from a C program that doesn't compile.  Not gonna happen.

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

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



Re: [PHP] Adding text before last paragraph

2007-08-27 Thread Richard Lynch
On Mon, August 27, 2007 5:45 pm, Dotan Cohen wrote:
> Thank you Brian. This most certainly works. I'm having a very hard
> time decyphering your regex, as I'd like to learn from it. I'm going
> over PCRE again, but I think that I may hit google soon. Thank you
> very, very much for the working code. As usual, I have another night
> of regex waiting for me...

To understand regex, download "The Regex Coach" and play with your
input string and the pattern.

It color-codes and highlights everything if you check the right boxes,
and you can also do a step-by-step slow-motion instant-replay, again
with color-coding highlighting that makes it blatantly clear exactly
what is going on.

I cannot praise this tool enough for explaining regex.
http://weitz.de/regex-coach/

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

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



Re: [PHP] Adding text before last paragraph

2007-08-27 Thread Richard Lynch


On Mon, August 27, 2007 1:46 am, Dotan Cohen wrote:
> On 27/08/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>> On Sun, August 26, 2007 3:41 pm, Dotan Cohen wrote:
>> > I have a string with some HTML paragraphs, like so:
>> > $text="First paragraph\nMore text\nSome more
>> > text\nEnd of story";
>> >
>> > I'd like to add an image before the last paragraph. I know that
>> > preg_replace can replace only the first n occurrences of a string,
>> but
>> > how can I replace the _last_ occurrence of a string? My initial
>> idea
>> > was to do this:
>> > 1) Count how many  times "\n" occurs as $n
>> > 2) Replace them all with  "\n\n"
>> > 3) Replace $n-1 replacements back to "\n"
>> >
>> > Is there a cleaner way? Thanks in advance.
>>
>> If the string really really ENDS on that LAST "", then you can
>> key
>> off of that:
>>
>> $story = preg_replace("|(.*\$|Umsi",
>> "$new_paragraph\n\\1", $story;
>>
>> You may have to fiddle with the DOT_ALL setting to only match the
>> true
>> end of string and not just any old "\n" within the string...
>> http://php.net/pcre
>>
>
> Thanks, Richard, I was also trying to use a regex with pre_replace and
> getting nowhere. In the manual page for strrpos, there is a
> user-comment function for finding the last occurrence of a string:
> http://il2.php.net/manual/en/function.strrpos.php#56735
>
> However, I am unable to piece 2 and 2 together.
>
> Note that I'm adding a paragraph before the last paragraph, so I'm
> searching for the last instance of "\n".
>
> This is what I've done to your code, but I'm unable to get much
> further:
> $text = preg_replace("|(\n)\$|Umsi", "\nTest\n",
> $text);

The strrpos solution might be better/easier...

$last_paragraph = strrpos($text, "\n");
$text = substr($text, 0, $last_paragraph - 1) . "\nTest" .
substr($text, $last_paragraph);

I almost always get the "- 1" bit in the wrong place, but that should
get you close enough to work it out.

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

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



Re: [PHP] Capturing shell command output.

2007-08-27 Thread Richard Lynch
On Mon, August 27, 2007 2:43 am, shiplu wrote:

> I have tried same file as cli and as webpage. I don't know why only
> cli version works nicely.  There may be some issue. But my technique
> has some advantages. It can run command asynchronously. Thats what i
> need for my application. I can create command queue. I and I can get
> the completion percentage from there.
> Whatever, I wish I could know those issues.
> Rather it could happen that, php-apache framework is doing something
> that I am unaware of.

You can sometimes tack " &" onto the end of an exec() argument and get
an asynchronous result.

But then you won't get the results of the command no way nohow.

I generally have found that if I really need async operations, it's
better to just write a script that does a few operations at a time,
and then call it repeatedly in cron.

Any sort of web-interface merely accepts input for a queue of things
"to do" by the cron job, and then provides a status board page and/or
automated email upon completion of whatever the user is waiting for.

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

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



Re: [PHP] Why not user...?

2007-08-27 Thread Richard Lynch
On Mon, August 27, 2007 8:51 am, Stut wrote:
> Gustav Wiberg wrote:
>> Why is it so that I get this error. I'm using Windows Integrated
>> authorization-method for actual webb I'm testing on.
>>
>> Notice: Undefined index: PHP_AUTH_USER in
>> C:\www\utveckling\username.php
>> on line 2
>
> For some reason it's not getting set. This could be because you've not
> configured IIS correctly, are you sure you've disabled anonymous
> authentication?
>
> If you're sure it's configured correctly try var_dump'ing $_SERVER -
> it's possible (though unlikely) the username is in another place.

Going for the more obvious...

Did you perhaps take code written with the default setting of E_ALL ~
E_NOTICE and are now running it with E_ALL, and this is the first
page-view before you've even typed in your usernane/password?

Cuz that for sure would do it.

Change the code to be more like this:

if (isset($_SERVER['PHP_AUTH_USER'])){
  //try to login
}

You'll probably have a fair number of these E_NOTICE thingies to fix
before you are through.

They're all trivial to fix, and there's no real excuse to have code
that has E_NOTICE messages firing off anyway.

Under extreme pressure, you can switch to E_ALL ~ E_NOTICE for this
app for now and put it on the ToDo list to fix it right someday...

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

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



Re: [PHP] xml reader/writer

2007-08-27 Thread Richard Lynch
On Mon, August 27, 2007 12:41 pm, Sam Baker wrote:
> So I don't have to reinvent anything, does such a thing exist anywhere
> that
> anyone knows of:
>
> I'm looking for a php script that will read any xml file, display the
> contents in html, with the option of adding an entry (in the same
> scheme,
> whatever that might be) or deleting existing entries.
>
> I think I could write this, but it would take a while.

If nothing else comes up, you could for sure use MySQL with the XML
storage engine and phpMyAdmin as a front-end.

It would be serious overkill and the front-end would be daunting to a
naive user, but it does fulfill the requirements, technically.

For that matter, *ANY* MySQL front-end you like for a simple table
editing with the XML Storage Engine should work...

Another choice might be to just import/export the XML to a DB and
choose your front end and DB of choice.  At that point, you're not
even in the realm of unknown technology for anything, and dozens of
solutions are "out there" almost for sure.

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

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



Re: [PHP] why?

2007-08-27 Thread Gustav Wiberg

Hi!

Yes, a single sign-on it is... It doesn't work together with Windows (and 
PHP) you mean?


Best regards
/Gustav Wiberg

- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Jay Blanchard" <[EMAIL PROTECTED]>; "Gustav Wiberg" 
<[EMAIL PROTECTED]>; "PHP General" 

Sent: Monday, August 27, 2007 9:26 PM
Subject: RE: [PHP] why?


[snip]
... be the same as using computer locally on the network, but I have
to
enter username and password. I'm sure I have checked the "Windows
Integreated authenication" - checkbox for the website it's about.

When I have entered username and password I can go on and do whatever I
want on that site...

I've tested with both IE6, and IE7. What could be the problem?

http://us.php.net/features.http-auth
[/snip]

I hit send before I finished my thoughts

Are you trying to do single sign-on? This would be one of the holy
grails of the PHP on Linux, Windows clients operations. This is
available with .Net and with legacy ASP/Jscript apps but not with
PHPeven on windows

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



Re: [PHP] A simple PHP script to generate a Pie Chart based on SQL query

2007-08-27 Thread Richard Lynch
On Mon, August 27, 2007 12:44 pm, Ali, Saqib wrote:
> I am looking for a simple PHP script that can generate Pie Chart based
> on SQL query resultset.

JP Graph

It requires GD extension.

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

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



Re: [PHP] move_uploaded_file fails randomly with open_basedir and upload_tmp_dir

2007-08-27 Thread Richard Lynch
On Mon, August 27, 2007 12:55 pm, Hugues De Keyzer wrote:
> I'm having a weird problem on my web hosting provider's server. I'm
> using drupal with the image module and the image_pub module to upload
> a
> series of pictures using Gallery Remote. This software uploads
> pictures
> one after the other using a classic HTTP POST method.
>
> The upload always succeeds, but the problem I have is that
> move_uploaded_file() randomly fails.
> open_basedir is set to /home/
> DOCUMENT_ROOT is /home/myuser
> upload_tmp_dir is set to ./tmp-php/, which exists is /home/myuser and
> has full 777 permission

Set upload_tmp_dir to /home/myuser/tmp-php/

> First, 2 times:
> move_uploaded_file() [function.move-uploaded-file]: open_basedir
> restriction in effect. File(/var/tmp/phpNN2JDd) is not within the
> allowed path(s): (/home/)

because clearly PHP has decided to use the default system tmp dir for
some reason, and relying on relative paths is always inherently
suspect.

Not that it seems to matter here, but there it is. :-v

> then:
> move_uploaded_file(/var/tmp/phpNN2JDd) [function.move-uploaded-file]:
> failed to open stream: Operation not permitted
>
> move_uploaded_file() [function.move-uploaded-file]: Unable to move
> '/var/tmp/phpNN2JDd' to 'files/tmp/res-2108703551.jpg'
>
> When it succeeds, the file is correctly uploaded in ./tmp-php. When it
> fails, it goes to /var/tmp although upload_tmp_dir is still set to
> "./tmp-php/". is_uploaded_file() returns true even when
> move_uploaded_file() fails.
>
> What seems really strange to me is that it fails *randomly*. It works
> for a couple of picture, then fails, then succeeds again, etc.

You could try to log all your php.ini settings in your debug file, so
see if there is anything tell-tale other than upload_tmp_dir to figure
out WHY it randomly uses the default system tmp dir.

Perhaps there is a rogue apache child left laying around that has some
old php.ini setting, or was unable to read php.ini at startup and has
fallen back to the default default values.

> My web hosting provider doesn't really seem to care about such
> problems,
> so if I can point out this is a PHP bug and ask them for an update, it
> would be great.

It really sounds more like you are getting hit by something more
random, say by some OTHER application screwing with upload_tmp_dir and
then you inherit their setting...

You'd think PHP would restore that one to php.ini setting, but...

Alas, you can't just set this at the top of your script or anything,
as the effect of the setting has already happened long before your PHP
code starts running.

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

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



RE: [PHP] Adding text before last paragraph

2007-08-27 Thread Brian Rue
Sure, I'll break it apart a little:

'{(?=|\s)(?!.*|\s)))}is'

$regex = '{' . // opening delimeter
 '(?=' .   // positive lookahead: match the beginning of a position 
   // that matches the following pattern:
 ' tag
 '(?:' . // non-capturing parenthesis (same as normal 
 // parenthesis, but a bit faster since we don't 
 // need to capture what they match for use later
 '>|\s' . // match a closing > or a space
 ')' . // end capturing paranthesis
 '(?!' . // negative lookahead: the match will fail if the
//following pattern matches from the current position
 '.*' .  // match until the end of the string
 '|\s)' . // same as above - look for another  tag
 ')' .  // end negative lookahead
 ')' .  // end positive lookahead
 '}is';   // ending delimeter, and use modifiers s and i

About the modifiers: i makes it case-insensitive, and s turns on
dot-matches-all-mode (including newlines)--otherwise, the . would only match
until the next newline.

The regex has two parts: matching a  tag, and then making sure there
aren't any more  tags in the string following it. The positive lookahead
is (hopefully) pretty straightforward. The negative lookahead works by using
a greedy (regular) .*, which forces the regex engine to match all the way to
the end of the haystack. Then it encounters the \s) part, forcing it
to backtrack until it finds a  tag. If it doesn't find one before
returning to the 'current' position (directly after the  tag we just
matched), then we know we have found the last  tag.

The positive and negative lookahead are 'zero-width' requirements, which
means they don't advance the regex engine's pointer in the haystack string.
Since the entire regex is zero-width, the replacement string gets inserted
at the matched position. 

I hope that made at least a little bit of sense :) If you're doing a lot of
regex work, I would strongly recommend reading the book Mastering Regular
Expressions by Jeffrey Friedl... it's very well written and very helpful.

-Brian

-Original Message-
From: Dotan Cohen [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 27, 2007 3:45 PM
To: Brian Rue
Cc: php-general@lists.php.net
Subject: Re: [PHP] Adding text before last paragraph

On 27/08/07, Brian Rue <[EMAIL PROTECTED]> wrote:
> Dotan, try this:
>
> $text="First paragraph\nMore text\nSome more
> text\nEnd of story";
>
> $story = preg_replace('{(?=|\s)(?!.*|\s)))}is', "new
> paragraph goes here\n", $text);
>
> This matches a position that has an opening  tag (with or without
> parameters), which is NOT followed anywhere in $text by another opening

> tag. The replacement string will be inserted at the matched position,
which
> will be directly before the last  tag. Not sure if this is the most
> efficient regex, but it should get the job done. Let me know how it
goes...
> I'd also be interested to hear any comments on that regex's efficiency.
>
> -Brian Rue
>

Thank you Brian. This most certainly works. I'm having a very hard
time decyphering your regex, as I'd like to learn from it. I'm going
over PCRE again, but I think that I may hit google soon. Thank you
very, very much for the working code. As usual, I have another night
of regex waiting for me...

Dotan Cohen

http://lyricslist.com/
http://what-is-what.com/

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



Re: [PHP] Delete row in a lookup table

2007-08-27 Thread nitrox .
Wow, I actually managed to get this working now. Thanks to Richard and stut 
I realized I was on the right track but had my code screwed up. Richard your 
right, a primary key column was silly but was a temporary fix. It allowed me 
to delete with one column and not have to reference a second. So I dropped 
the primary key column and have Game_id and Member_id setup as composite 
key. The trick was to have type twice in the URL and call them both. Thanks 
for taking time to reply. As simple as that was I wouldnt have done it 
without a little instruction from yous guys lol.



Here is the code:
The URL:
?action=remove&type=Game&gid={$record->Game_id}&type=Member&mid={$record->Member_id}

The Code:
   case "remove":
 switch ($_GET['type']) {
   case "Game":
case "Member":
 if (!isset($_GET['do']) || $_GET['do'] != 1) {
?>
 
   Are you sure you want to delete this ?
   yes
   or Index
 
  WHERE Game_id = '" . mysql_real_escape_string((int)$_GET['gid']) 
. "' AND Member_id = '" . mysql_real_escape_string((int)$_GET['mid']) . "'";

   }
 }


On Sat, August 18, 2007 6:31 pm, nitrox . wrote:
Is it not considered good practice to have a primary key on a lookup
table for a database?
I have 3 tables setup, games, memberleagues and members. The
memberleagues table holds the id of the games table and members table.
The problem I have is that Im not sure how to delete a row from the
memberleagues table without a primary key. If its not considered bad
practice I could add a primary key to the memberleagues table and be
done. Anybody have any tutorials on how to write the php for this?

You can add the primary key, no problem.

However, it might be kind of silly...

For a lookup table, you probably have:

member_id   |game_id

1   | 1
1   | 3
1   | 17
2   | 1
2   | 5




USUALLY you can just have the unique key be the composite key of
member_id, game_id and you just delete "where member_id = $m and
game_id = $g"

The data itself is the key, so to speak, because there can only be one
of each member/game combo, and it's unique all by itself.

Using an extra field for a key is only a "problem" if you have a
zillion members/games to the point where the "extra" space matters on
your hard drive.  In this day and age, you'd have to have a LOT of
members and games for an INT or even BIGINT to make that much
difference on the hard drive.

_
Find a local pizza place, movie theater, and more….then map the best route! 
http://maps.live.com/default.aspx?v=2&ss=yp.bars~yp.pizza~yp.movie%20theater&cp=42.358996~-71.056691&style=r&lvl=13&tilt=-90&dir=0&alt=-1000&scene=950607&encType=1&FORM=MGAC01


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



RE: [PHP] A simple PHP script to generate a Pie Chart based on SQL query

2007-08-27 Thread Bastien Koert

http://www.aditus.nu/jpgraph/

bastien





> Date: Mon, 27 Aug 2007 10:44:01 -0700
> From: [EMAIL PROTECTED]
> To: php-general@lists.php.net
> Subject: [PHP] A simple PHP script to generate a Pie Chart based on SQL query
> 
> Hello All,
> 
> I am looking for a simple PHP script that can generate Pie Chart based
> on SQL query resultset.
> 
> I don't want a reporting system, as we are already using Crystal
> Reports for that.
> 
> Any suggestions?
> 
> Saqib Ali
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Adding text before last paragraph

2007-08-27 Thread Dotan Cohen
On 27/08/07, Brian Rue <[EMAIL PROTECTED]> wrote:
> Dotan, try this:
>
> $text="First paragraph\nMore text\nSome more
> text\nEnd of story";
>
> $story = preg_replace('{(?=|\s)(?!.*|\s)))}is', "new
> paragraph goes here\n", $text);
>
> This matches a position that has an opening  tag (with or without
> parameters), which is NOT followed anywhere in $text by another opening 
> tag. The replacement string will be inserted at the matched position, which
> will be directly before the last  tag. Not sure if this is the most
> efficient regex, but it should get the job done. Let me know how it goes...
> I'd also be interested to hear any comments on that regex's efficiency.
>
> -Brian Rue
>

Thank you Brian. This most certainly works. I'm having a very hard
time decyphering your regex, as I'd like to learn from it. I'm going
over PCRE again, but I think that I may hit google soon. Thank you
very, very much for the working code. As usual, I have another night
of regex waiting for me...

Dotan Cohen

http://lyricslist.com/
http://what-is-what.com/

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



Re: [PHP] Regular expression - URL validator

2007-08-27 Thread Jim Lucas

Wagner Garcia Campagner wrote:
> Hello,
>
> I found this regular expression on a web site.
> It is basicaly an URL validator.
>
> I'm trying to implement this in my web site, but i receive errors.
>
> I think this is a PERL REGEX so what should i do to make it work in php?
>
>
> $valid =
> (preg_match('^H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\://)?(www.|[a-zA-Z0-9]
> .)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\:[0-9]{1,5})*(/($|[a-zA-Z0-9\.\,\;\?\'\\\
> +&%\$#\=~_\-]+))*$', $_POST['website']));

This should be preg_match('/.../i', $_POST['website'])

your regex should look something like this.

^((ftp|(http(s)?))://)?(\.?([a-z0-9-]+))+\.[a-z]{2,6}(:[0-9]{1,5})?(/[a-zA-Z0-9.,;\?|\'+&%\$#=~_-]+)*$

So, put it all together and it should look like this.

if ( 
preg_match('!^((ftp|(http(s)?))://)?(\.?([a-z0-9-]+))+\.[a-z]{2,6}(:[0-9]{1,5})?(/[a-zA-Z0-9.,;\?|\'+&%\$#=~_-]+)*$!i', 
$url) ) {

echo "Matched";
} else {
echo "Did not match";
}




>
> if ($valido == 0) {
> something here;
> }
> else {
> something else here;
> }
>
>
> Thanks a lot in advance,
> Wagner.
>



--
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Database includes

2007-08-27 Thread Wouter van Vliet / Interpotential
On 27/08/07, Stut <[EMAIL PROTECTED]> wrote:

> I use a slightly different approach to prevent the need to mess about
> with files when moving to production. At the end on config.php I have
> this...
>
> if (file_exists('config_dev.php'))
>  require 'config_dev.php';


I've got my own variation on this, came to use it to prevent overwriting
config files for stage/dev/live or other versions of a site. I've got a
general purpose constants file, which defines a lot of constants which are
generally used a lot in my applications (file rootdir, DAY, HOUR, database
passwords, some regexes, these things). Instead of just defining them there,
I define them using a simple conditional define function (if
(!defined($constantName) define($constantName, $value)). On top of my
constants.inc.php (as I chose to call it) I use the following:

if (isset($_SERVER['SERVER_NAME'])) {
$_config_file =
dirname(__FILE__).'/../eg/'.$_SERVER['SERVER_NAME'].'.inc.php';
@include($_config_file);
}

The included hostname specific config file would then define some constants,
and because they are already defined the default values from
constants.inc.php don't get set anymore.

Hope this is of help to anybody, it has certainly relaxed my deployment
process..

Wouter


In config_dev.php I override anything defined in config.php that needs
> to be different on the current server. The config_dev.php file is *not*
> in source control so it doesn't exist in production but each development
> and test environment has a version that modifies the production
> environment.
>
> There is a hit involved in the call to file_exists, but PHP caches it so
> the effect is minimal.
>
> -Stut
>
> --
> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Interpotential.com
Phone: +31615397471


Re: [PHP] why?

2007-08-27 Thread mike
On 8/27/07, Jay Blanchard <[EMAIL PROTECTED]> wrote:
> Are you trying to do single sign-on? This would be one of the holy
> grails of the PHP on Linux, Windows clients operations. This is
> available with .Net and with legacy ASP/Jscript apps but not with
> PHPeven on windows

there's an apache module that might be able to be used in concert with PHP...

apache-ntlm i think it is, something like that. it's perl-based iirc.
it would be great if it was available for PHP. i looked at the
internals, and it was way too confusing for me to bother with. i'm
sure someone could whip up a PECL, PEAR or core PHP module for it
though, someone has reverse engineered it in perl already. iirc it's a
challenge/response mechanism that has a lot of bit shifting stuff, and
i didn't need it that badly :)

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



RE: [PHP] why?

2007-08-27 Thread Jay Blanchard
[snip]
... be the same as using computer locally on the network, but I have
to
enter username and password. I'm sure I have checked the "Windows
Integreated authenication" - checkbox for the website it's about.

When I have entered username and password I can go on and do whatever I
want on that site...

I've tested with both IE6, and IE7. What could be the problem?

http://us.php.net/features.http-auth
[/snip]

I hit send before I finished my thoughts

Are you trying to do single sign-on? This would be one of the holy
grails of the PHP on Linux, Windows clients operations. This is
available with .Net and with legacy ASP/Jscript apps but not with
PHPeven on windows

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



RE: [PHP] why?

2007-08-27 Thread Jay Blanchard
[snip]
I can't figure the thing with Windows Integrated authentication... I
have 
checked a website for doing this. I still have to enter username and 
password even if I'm on the local computer (through a VPN though) This
would 
be the same as using computer locally on the network, but I have to
enter 
username and password. I'm sure I have checked the "Windows Integreated 
authenication" - checkbox for the website it's about.

When I have entered username and password I can go on and do whatever I
want 
on that site...

I've tested with both IE6, and IE7. What could be the problem?
[/snip]

http://us.php.net/features.http-auth

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



Re: [PHP] windows auth with php

2007-08-27 Thread Stut

Gustav Wiberg wrote:

I read
"The HTTP Authentication hooks in PHP are only available when it is 
running as an Apache module and is hence not available in the CGI 
version. In an Apache module PHP script, it is possible to use the 
header() function to send an "Authentication Required" message to the 
client browser causing it to pop up a Username/Password input window. 
Once the user has filled in a username and a password, the URL 
containing the PHP script will be called again with the predefined 
variables PHP_AUTH_USER, PHP_AUTH_PW, and AUTH_TYPE set to the user 
name, password and authentication type respectively. These predefined 
variables are found in the $_SERVER and $HTTP_SERVER_VARS arrays. Both 
"Basic" and "Digest" (since PHP 5.1.0) authentication methods are 
supported. See the header() function for more information."


Transparent authentication *does not* use HTTP authentication. It falls 
back to HTTP authentication if it has to.


I'm checking Windows Integrated Authentication in IIS 6.0 and I'm using 
PHP 5.0.1.


PHP is working as an ISAPI-module. Is this the problem? Is that why the 
authentication is not working automatically? (without logging in with 
username and password at first)


Or is the version of PHP the problem? Should it be larger than 5.1.0 ? 
Is that why the authentication is not working automatically? (without 
logging in with username and password at first)


I'm trying with IE6 and IE7...


5.0.1 is very old now, you really should upgrade to the latest version. 
However, I highly doubt that's the cause of your issue.


You need to understand that with transparent authentication PHP does not 
get involved at all - everything happens before PHP gets called. As I 
said in my other email, get it working with ASP, then try it with PHP. 
You'll find the support around ASP far more helpful with this problem 
than the PHP community.


-Stut

--
http://stut.net/

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



Re: [PHP] why?

2007-08-27 Thread Gustav Wiberg

Hi!

Ok. Of course Why didn't I think of that? Thanx! :-)

Best regards
/Gustav Wiberg


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

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, August 27, 2007 8:59 PM
Subject: Re: [PHP] why?



Gustav Wiberg wrote:
No it doesn't seem to work locally either (I haven't tested myself, but 
a working-friend did)


I suggest you find a Windows Server mailing list and ask there. This is 
almost certainly not an issue with PHP.


You might also want to find/write an ASP script that will show the 
username of the logged in user so you can take PHP out of the equation. 
Once it's working with ASP it should work with PHP.


-Stut


- Original Message - From: "Stut" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, August 27, 2007 8:51 PM
Subject: Re: [PHP] why?



Gustav Wiberg wrote:
I can't figure the thing with Windows Integrated authentication... I 
have checked a website for doing this. I still have to enter username 
and password even if I'm on the local computer (through a VPN though) 
This would be the same as using computer locally on the network, but 
I have to enter username and password. I'm sure I have checked the 
"Windows Integreated authenication" - checkbox for the website it's 
about.


When I have entered username and password I can go on and do whatever 
I want on that site...


I've tested with both IE6, and IE7. What could be the problem?


Transparent authentication between IE and IIS may not work over a VPN 
depending on a huge number of factors, but mainly how the VPN server 
has been configured.


Does it work when on the same network as the web server and AD server?


-Stut

--
http://stut.net/



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



Re: [PHP] why?

2007-08-27 Thread Stut

Gustav Wiberg wrote:
No it doesn't seem to work locally either (I haven't tested myself, but 
a working-friend did)


I suggest you find a Windows Server mailing list and ask there. This is 
almost certainly not an issue with PHP.


You might also want to find/write an ASP script that will show the 
username of the logged in user so you can take PHP out of the equation. 
Once it's working with ASP it should work with PHP.


-Stut


- Original Message - From: "Stut" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, August 27, 2007 8:51 PM
Subject: Re: [PHP] why?



Gustav Wiberg wrote:
I can't figure the thing with Windows Integrated authentication... I 
have checked a website for doing this. I still have to enter username 
and password even if I'm on the local computer (through a VPN though) 
This would be the same as using computer locally on the network, but 
I have to enter username and password. I'm sure I have checked the 
"Windows Integreated authenication" - checkbox for the website it's 
about.


When I have entered username and password I can go on and do whatever 
I want on that site...


I've tested with both IE6, and IE7. What could be the problem?


Transparent authentication between IE and IIS may not work over a VPN 
depending on a huge number of factors, but mainly how the VPN server 
has been configured.


Does it work when on the same network as the web server and AD server?


-Stut

--
http://stut.net/

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



[PHP] Regular expression - URL validator

2007-08-27 Thread Wagner Garcia Campagner
Hello,

I found this regular expression on a web site.
It is basicaly an URL validator.

I'm trying to implement this in my web site, but i receive errors.

I think this is a PERL REGEX so what should i do to make it work in php?


$valid =
(preg_match('^H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\://)?(www.|[a-zA-Z0-9]
.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\:[0-9]{1,5})*(/($|[a-zA-Z0-9\.\,\;\?\'\\\
+&%\$#\=~_\-]+))*$', $_POST['website']));

if ($valido == 0) {
something here;
}
else {
something else here;
}


Thanks a lot in advance,
Wagner.

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



Re: [PHP] why?

2007-08-27 Thread Gustav Wiberg

Hi!

No it doesn't seem to work locally either (I haven't tested myself, but a 
working-friend did)


Best regards
/Gustav Wiberg

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

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, August 27, 2007 8:51 PM
Subject: Re: [PHP] why?



Gustav Wiberg wrote:
I can't figure the thing with Windows Integrated authentication... I have 
checked a website for doing this. I still have to enter username and 
password even if I'm on the local computer (through a VPN though) This 
would be the same as using computer locally on the network, but I have to 
enter username and password. I'm sure I have checked the "Windows 
Integreated authenication" - checkbox for the website it's about.


When I have entered username and password I can go on and do whatever I 
want on that site...


I've tested with both IE6, and IE7. What could be the problem?


Transparent authentication between IE and IIS may not work over a VPN 
depending on a huge number of factors, but mainly how the VPN server has 
been configured.


Does it work when on the same network as the web server and AD server?

-Stut

--
http://stut.net/



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



[PHP] windows auth with php

2007-08-27 Thread Gustav Wiberg

Hi again!

I read
"The HTTP Authentication hooks in PHP are only available when it is running 
as an Apache module and is hence not available in the CGI version. In an 
Apache module PHP script, it is possible to use the header() function to 
send an "Authentication Required" message to the client browser causing it 
to pop up a Username/Password input window. Once the user has filled in a 
username and a password, the URL containing the PHP script will be called 
again with the predefined variables PHP_AUTH_USER, PHP_AUTH_PW, and 
AUTH_TYPE set to the user name, password and authentication type 
respectively. These predefined variables are found in the $_SERVER and 
$HTTP_SERVER_VARS arrays. Both "Basic" and "Digest" (since PHP 5.1.0) 
authentication methods are supported. See the header() function for more 
information."



I'm checking Windows Integrated Authentication in IIS 6.0 and I'm using PHP 
5.0.1.


PHP is working as an ISAPI-module. Is this the problem? Is that why the 
authentication is not working automatically? (without logging in with 
username and password at first)


Or is the version of PHP the problem? Should it be larger than 5.1.0 ? Is 
that why the authentication is not working automatically? (without logging 
in with username and password at first)


I'm trying with IE6 and IE7...


Best regards
/Gustav Wiberg






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



Re: [PHP] why?

2007-08-27 Thread Stut

Gustav Wiberg wrote:
I can't figure the thing with Windows Integrated authentication... I 
have checked a website for doing this. I still have to enter username 
and password even if I'm on the local computer (through a VPN though) 
This would be the same as using computer locally on the network, but I 
have to enter username and password. I'm sure I have checked the 
"Windows Integreated authenication" - checkbox for the website it's about.


When I have entered username and password I can go on and do whatever I 
want on that site...


I've tested with both IE6, and IE7. What could be the problem?


Transparent authentication between IE and IIS may not work over a VPN 
depending on a huge number of factors, but mainly how the VPN server has 
been configured.


Does it work when on the same network as the web server and AD server?

-Stut

--
http://stut.net/

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



[PHP] why?

2007-08-27 Thread Gustav Wiberg

Hi!

I can't figure the thing with Windows Integrated authentication... I have 
checked a website for doing this. I still have to enter username and 
password even if I'm on the local computer (through a VPN though) This would 
be the same as using computer locally on the network, but I have to enter 
username and password. I'm sure I have checked the "Windows Integreated 
authenication" - checkbox for the website it's about.


When I have entered username and password I can go on and do whatever I want 
on that site...


I've tested with both IE6, and IE7. What could be the problem?

Best regards
/Gustav Wiberg

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



RE: [PHP] xml reader/writer

2007-08-27 Thread Jay Blanchard
[snip]
So I don't have to reinvent anything, does such a thing exist anywhere
that 
anyone knows of:

I'm looking for a php script that will read any xml file, display the
contents in html, with the option of adding an entry (in the same
scheme,
whatever that might be) or deleting existing entries.

I think I could write this, but it would take a while.
[/snip]

http://www.php.net/xmlreader
http://www.php.net/xmlwriter

You will have to use some XSLT to do the content display

http://www.php.net/xslt

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



Re: [PHP] A simple PHP script to generate a Pie Chart based on SQL query

2007-08-27 Thread mike
> > Hello All,
> >
> > I am looking for a simple PHP script that can generate Pie Chart based
> > on SQL query resultset.
> >
> > I don't want a reporting system, as we are already using Crystal
> > Reports for that.
> >
> > Any suggestions?

one word is all you need:

jpgraph

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



[PHP] move_uploaded_file fails randomly with open_basedir and upload_tmp_dir

2007-08-27 Thread Hugues De Keyzer

Hi all,

I'm having a weird problem on my web hosting provider's server. I'm 
using drupal with the image module and the image_pub module to upload a 
series of pictures using Gallery Remote. This software uploads pictures 
one after the other using a classic HTTP POST method.


The upload always succeeds, but the problem I have is that 
move_uploaded_file() randomly fails.

open_basedir is set to /home/
DOCUMENT_ROOT is /home/myuser
upload_tmp_dir is set to ./tmp-php/, which exists is /home/myuser and 
has full 777 permission
the script is called from the DOCUMENT_ROOT directory: /test.php which 
is in fact /home/myuser/test.php


In the script, just before calling move_uploaded_file, I created a file 
in the current directory with debug values in it. It is indeed created 
in the DOCUMENT_ROOT directory.


The errors I have are:

First, 2 times:
move_uploaded_file() [function.move-uploaded-file]: open_basedir 
restriction in effect. File(/var/tmp/phpNN2JDd) is not within the 
allowed path(s): (/home/)


then:
move_uploaded_file(/var/tmp/phpNN2JDd) [function.move-uploaded-file]: 
failed to open stream: Operation not permitted


move_uploaded_file() [function.move-uploaded-file]: Unable to move 
'/var/tmp/phpNN2JDd' to 'files/tmp/res-2108703551.jpg'


When it succeeds, the file is correctly uploaded in ./tmp-php. When it 
fails, it goes to /var/tmp although upload_tmp_dir is still set to 
"./tmp-php/". is_uploaded_file() returns true even when 
move_uploaded_file() fails.


What seems really strange to me is that it fails *randomly*. It works 
for a couple of picture, then fails, then succeeds again, etc.


My web hosting provider doesn't really seem to care about such problems, 
so if I can point out this is a PHP bug and ask them for an update, it 
would be great.


Running PHP version 5.1.6 on FreeBSD 5.4-RELEASE-p13

Configure Command  './configure' '--enable-fastcgi' 
'--prefix=/usr/local/php5' 
'--with-config-file=/usr/local/php5/lib/php.ini' 
'--with-config-file-path=/usr/local/php5/lib' '--enable-versioning' 
'--with-openssl' '--with-zlib' '--with-zlib-dir=/usr' '--enable-bcmath' 
'--with-bz2' '--enable-calendar' '--with-jpeg-dir=/usr/local' 
'--with-tiff-dir=/usr/local' '--with-curl=/usr/local' '--enable-exif' 
'--enable-ftp' '--with-gd=/usr/local' '--with-png-dir=/usr/local' 
'--with-xpm-dir=/usr/local' '--with-ttf' 
'--with-freetype-dir=/usr/local' '--with-t1lib' '--enable-gd-native-ttf' 
'--with-gdbm' '--with-gettext' '--with-imap-ssl' '--enable-mbstring' 
'--with-mcrypt' '--with-mhash' '--with-mysql=/usr/local' 
'--with-unixODBC' '--with-dom=/usr/local' '--with-dom-xslt=/usr/local' 
'--with-dom-exslt=/usr/local' '--with-mcal' '--with-xsl' '--enable-xslt' 
'--with-xslt-sablot' '--with-iconv-dir=/usr/local' '--enable-trans-sid' 
'--enable-memory-limit' '--enable-zend-multibyte'


Server API  CGI/FastCGI

Apache/1.3.37 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0404142202

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



Re: [PHP] A simple PHP script to generate a Pie Chart based on SQL query

2007-08-27 Thread Ludovic André



I am looking for a simple PHP script that can generate Pie Chart based
on SQL query resultset.
  

http://www.aditus.nu/jpgraph/

This lib works great!

Ludo

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



Re: [PHP] A simple PHP script to generate a Pie Chart based on SQL query

2007-08-27 Thread Wolf
http://www.hotscripts.com/PHP/Scripts_and_Programs/Graphs_and_Charts/index.html

or 

http://www.phpclasses.org/browse/package/1063.html

or

http://www.google.com/search?q=PHP%3A+Pie+Chart&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

I've used the PHP classes one onces before, and used the one on hotscripts for 
another project.  There are some pay-for ones as well, but either of those 2 
should give you a good starting point even if you want to roll your own.

Robert


 "Ali wrote: 
> Hello All,
> 
> I am looking for a simple PHP script that can generate Pie Chart based
> on SQL query resultset.
> 
> I don't want a reporting system, as we are already using Crystal
> Reports for that.
> 
> Any suggestions?
> 
> Saqib Ali
> 
> -- 
> 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] xml reader/writer

2007-08-27 Thread Sam Baker
So I don't have to reinvent anything, does such a thing exist anywhere that 
anyone knows of:

I'm looking for a php script that will read any xml file, display the
contents in html, with the option of adding an entry (in the same scheme,
whatever that might be) or deleting existing entries.

I think I could write this, but it would take a while.

Thanks
-§

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



[PHP] A simple PHP script to generate a Pie Chart based on SQL query

2007-08-27 Thread Ali, Saqib
Hello All,

I am looking for a simple PHP script that can generate Pie Chart based
on SQL query resultset.

I don't want a reporting system, as we are already using Crystal
Reports for that.

Any suggestions?

Saqib Ali

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



[PHP] [Job] Developer Position [50-100k] (New Hope, PA)

2007-08-27 Thread Gavin M. Roy
Are you tired of working on the same types of web apps?  Are you
looking for more of a challenge where you can put your code-fu to its
test working in a high-traffic, open-source friendly environment?  Can
you tackle any problem put in front of you, hacking your way through
problems you've not previously encountered?

myYearbook.com is looking to fill a primarily PHP development position
that reports directly to the CTO.  Applicant should have a strong
development background and problem solving skills, be a good
communicator and be willing to take direction.  This position is out
of our mainline development team and is for working on special
projects, be it infrastructure related, working on pre-existing open
source applications we use, bleeding edge development or
proof-of-concept applications.

Perks include being paid well to work on open source projects, free
gym membership, company stock options, health & dental insurance, and
don't forget pushing your development skills and knowledge in
different directions.

Requirements:

 * Strong knowledge of PHP and PostgreSQL
 * Some background in database design
 * Ability to demonstrate more than a base level knowledge of XML,
XSL, XHTML, CSS, JavaScript
 * Familiarity with Linux as a server or desktop
 * Past experience with SVN or other version control systems
 * Knowledge of C, C++ and other languages such as Ruby or Java a plus
 * Should not be intimidated by doing things you haven't done before
 * Solid work record with excellent references

This job is full-time, on-site in New Hope, PA.  Unfortunately we can
not sponsor H1-B visas.  We have a great office atmosphere and
benefits to match.  We are very invested in the Open Source community
and this position is a great way to leverage your open-source interest
into a important role in our organization.  You should be willing to
relocate and if you fit this role, we'll help pay for you to do  so.

Salary commensurate with experience.

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



Re: [PHP] Why not user...?

2007-08-27 Thread Gustav Wiberg

Hi!

Thanx!
I figured it out. The username wasn't in server-variable PHP_AUTH_USER but 
in AUTH_USER 


Best regards
/Gustav Wiberg


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

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, August 27, 2007 3:51 PM
Subject: Re: [PHP] Why not user...?



Gustav Wiberg wrote:
Why is it so that I get this error. I'm using Windows Integrated 
authorization-method for actual webb I'm testing on.


Notice: Undefined index: PHP_AUTH_USER in C:\www\utveckling\username.php 
on line 2


For some reason it's not getting set. This could be because you've not 
configured IIS correctly, are you sure you've disabled anonymous 
authentication?


If you're sure it's configured correctly try var_dump'ing $_SERVER - it's 
possible (though unlikely) the username is in another place.


-Stut

--
http://stut.net/



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



Re: [PHP] Why not user...?

2007-08-27 Thread Stut

Gustav Wiberg wrote:
Why is it so that I get this error. I'm using Windows Integrated 
authorization-method for actual webb I'm testing on.


Notice: Undefined index: PHP_AUTH_USER in C:\www\utveckling\username.php 
on line 2


For some reason it's not getting set. This could be because you've not 
configured IIS correctly, are you sure you've disabled anonymous 
authentication?


If you're sure it's configured correctly try var_dump'ing $_SERVER - 
it's possible (though unlikely) the username is in another place.


-Stut

--
http://stut.net/

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



RE: [PHP] Why not user...?

2007-08-27 Thread Jay Blanchard
[snip]
Why is it so that I get this error. I'm using Windows Integrated 
authorization-method for actual webb I'm testing on.

Notice: Undefined index: PHP_AUTH_USER in C:\www\utveckling\username.php
on 
line 2
[/snip]

Hmm, can only take a guess since we do not see what sets PHP_AUTH_USER,
but line 2 is trying to use it and it appears not to be set.

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



Re: [PHP] Why not user...?

2007-08-27 Thread Robert Cummings
On Mon, 2007-08-27 at 09:56 +0200, Gustav Wiberg wrote:
> Hi!
> 
> Why is it so that I get this error. I'm using Windows Integrated 
> authorization-method for actual webb I'm testing on.
> 
> Notice: Undefined index: PHP_AUTH_USER in C:\www\utveckling\username.php on 
> line 2

Because on line 2 of C:\www\utveckling\username.php an attempt is made
to access that variable or a key in an array by that name when the
variable (or key) does not exist. Probably the page wasn't requested
with any auth but the script expects it.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-27 Thread Nathan Nobbe
Stut wrote:

> Just wanted to pick you up on this. PHP is the only language you've
> listed that only has a single implementation. There are implementations
> of C++ compilers that are writting in other languages. I can't speak for
> Java since I have little experience but I'd be surprised if all
> implementations are written in C.


one thing thats nice about java is it has a formal specification.  so in
creating
alternative implementations they can be certified against the spec by sun.
i
think thats another big plus of java.


> they are high level, and although php allows you to write proceedrual
> > code, i think it is best used from an oop paradigm.
>
> This would be a personal choice. Just like C++ "allows you to write
> procedural code" there are times when OOP makes sense and times when
> procedural is "better". It's a choice that should be left up to the
> developer, and the argument over whether OOP is better than procedural
> is not winnable. It's in the same league as PHP vs Python.
>

unfortunately im a bit rusty w/ my c++; but looking a java the only way to
write
procedural code is to place it in a method called main inside of a class.
does that
count as procedural or does it count as oop ??
when i say oop paradigm i refer to the overall design of an application, or
framework.
said app consists largely of objects; each w/ a focused purpose, the methods
of
which are also small and have a focused purpose.
*sigh*  i dont care to get into this debate again.  in my mind its clear oop
is superior to
strictly procedural programming, but alas you are probably right.  so whats
the use in
arguing ..?

-nathan


Re: [PHP] Database includes

2007-08-27 Thread Stut

Chris wrote:

Bruce Cowin wrote:

I'm curious as to how everyone organises and includes their classes in
PHP5.  Let's take a simple example that has 3 classes: customer, order,
and database.  The database class has a base sql db class (I know there
is PDO and other things but this class is already written and working)
and classes that inherit from the base class for dev, test, and prod,
passing the associated logins.  The customer and order will both use the
appropriate database class depending on which environment its in (e.g.,
SalesDevDB, SalesTestDB, SalesProdDB).

I don't want to have to go into the customer and order class code and
change which db class it uses when I move it from dev to test and from
test to prod.  What's the proper way to handle this?  Or am I way off
base?


Could you just have 3 config files and use the appropriate one in each 
environment?


The settings are in 'config.php'. When it's in dev:

cp dev.php config.php

when it's in test:

cp test.php config.php


I use a slightly different approach to prevent the need to mess about 
with files when moving to production. At the end on config.php I have 
this...


if (file_exists('config_dev.php'))
require 'config_dev.php';

In config_dev.php I override anything defined in config.php that needs 
to be different on the current server. The config_dev.php file is *not* 
in source control so it doesn't exist in production but each development 
and test environment has a version that modifies the production environment.


There is a hit involved in the call to file_exists, but PHP caches it so 
the effect is minimal.


-Stut

--
http://stut.net/

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



Re: [PHP] Adding text before last paragraph

2007-08-27 Thread Brian Rue
Dotan, try this:

$text="First paragraph\nMore text\nSome more
text\nEnd of story";

$story = preg_replace('{(?=|\s)(?!.*|\s)))}is', "new
paragraph goes here\n", $text);

This matches a position that has an opening  tag (with or without
parameters), which is NOT followed anywhere in $text by another opening 
tag. The replacement string will be inserted at the matched position, which
will be directly before the last  tag. Not sure if this is the most
efficient regex, but it should get the job done. Let me know how it goes...
I'd also be interested to hear any comments on that regex's efficiency.

-Brian Rue


Dotan Cohen wrote:

> On 27/08/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>> On Sun, August 26, 2007 3:41 pm, Dotan Cohen wrote:
>> > I have a string with some HTML paragraphs, like so:
>> > $text="First paragraph\nMore text\nSome more
>> > text\nEnd of story";
>> >
>> > I'd like to add an image before the last paragraph. I know that
>> > preg_replace can replace only the first n occurrences of a string, but
>> > how can I replace the _last_ occurrence of a string? My initial idea
>> > was to do this:
>> > 1) Count how many  times "\n" occurs as $n
>> > 2) Replace them all with  "\n\n"
>> > 3) Replace $n-1 replacements back to "\n"
>> >
>> > Is there a cleaner way? Thanks in advance.
>>
>> If the string really really ENDS on that LAST "", then you can key
>> off of that:
>>
>> $story = preg_replace("|(.*\$|Umsi",
>> "$new_paragraph\n\\1", $story;
>>
>> You may have to fiddle with the DOT_ALL setting to only match the true
>> end of string and not just any old "\n" within the string...
>> http://php.net/pcre
>>
> 
> Thanks, Richard, I was also trying to use a regex with pre_replace and
> getting nowhere. In the manual page for strrpos, there is a
> user-comment function for finding the last occurrence of a string:
> http://il2.php.net/manual/en/function.strrpos.php#56735
> 
> However, I am unable to piece 2 and 2 together.
> 
> Note that I'm adding a paragraph before the last paragraph, so I'm
> searching for the last instance of "\n".
> 
> This is what I've done to your code, but I'm unable to get much further:
> $text = preg_replace("|(\n)\$|Umsi", "\nTest\n",
> $text);
> 
> Dotan Cohen
> 
> http://lyricslist.com/
> http://what-is-what.com/

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



[PHP] Why not user...?

2007-08-27 Thread Gustav Wiberg

Hi!

Why is it so that I get this error. I'm using Windows Integrated 
authorization-method for actual webb I'm testing on.


Notice: Undefined index: PHP_AUTH_USER in C:\www\utveckling\username.php on 
line 2



?

Best regards
/Gustav Wiberg 


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



Re: [PHP] PHP and SOAP calls

2007-08-27 Thread Angelo Zanetti



Richard Lynch wrote:

On Fri, August 24, 2007 12:55 am, Angelo Zanetti wrote:
  

Dear All

I have been using nusoap to development a client that makes SOAP calls
to a server. I have however been stuck on a  small issue but can't
seem
to solve it and therefore I need to relook at using another package to
get a solution.

So I have read that PEAR also has a package that makes SOAP calls
(PEAR::SOAP). And there is PHP-SOAP.

Now Im running PHP 4.4xxx and I need to get this up and running ASAP.
What would you suggest I use as the package to make the client calls?

I have read that the PEAR::SOAP thing is fairly easy to use?

Does anyone have suggestions or recommendations or what not to use and
why?



I have fought with SOAP in PHP 5, and PHP 4, and I think maybe even
PHP 3 (shudder).

I've used nuSoap, and I think I used PEAR::SOAP once.  I also tried to
use some other SOAP package once, I think, that failed miserably.

My recommendations:

#1
If you can move to PHP 5 and use the built-in SOAP there, do it ASAP.
It's like night and day.

#2
If you are stuck in PHP 4, try the PEAR::SOAP.
I believe it will handle the whatsit tag namespace-y thingie you are
getting with that  business better than nuSoap, as I recall.  I
won't swear to it in court, though, as I only use PEAR::SOAP once
before I moved to PHP 5 and my SOAP life was way way way cleaner.
  

Thanks Richard.

I've pretty much got it working with nuSoap but lack of documentation 
and support makes it difficult to progress quickly and is very frustrating.


Angelo

--

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



Re: [PHP] Capturing shell command output.

2007-08-27 Thread shiplu
On 8/27/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
> You could look into using "named pipes" in PHP.
>
> I think PHP is already folding stderr into stdout (2>&1) for you.
>
> You could also try using http://php.net/exec instead of the backticks
> to get a separate error code if there is an error.
>
> On Sat, August 18, 2007 3:26 pm, shiplu wrote:
> > HI,
> > I am working on a PHP project that interacts with command  line
> > utilities.
> > My php is running by apache. Means I am not running any php CLI.
> >
> > here is the function that I am using for capturing command output.
> >
> > function run_command($comamnd){
> > $ret=`$command 1> COMMAND.OUT 2>1`;
> > $contents=get_file_contents("COMMAND.OUT");
> > return $contents;
> > }
> >
> > The function does not work. If I use any shell command like ls, cat,
> > echo, set. it works.
> > But If I use any utility like, mpg321, cd-info. It does not work. It
> > outputs a blank string.
> > I used system(), passthru() with both "2&>1" and "2>1". But no out
> > put.
> > All the time, its blank.
> > Even I used a shell script "run.sh"
> > run.sh contents:
> > =
> > #!/bin/sh
> > sh COMMAND 1> COMMAND.OUT 2&>1
> > cat COMMAND.OUT
> > echo 0 > COMMAND
> > =
> >
> > I called this script by this function
> > function run_command($command){
> >$h=fopen("COMMAND","w");
> >fwrite($h,$command);
> >fclose($h);
> >ob_start();
> >passthru("./run.sh");
> >$ret = ob_get_contents();
> >ob_end_clean();
> >return $ret;
> > }
> >
> > and by this.
> >
> > function run_command($command){
> >$h=fopen("COMMAND","w");
> >fwrite($h,$command);
> >fclose($h);
> >return system("./run.sh");
> > }
> >
> > Please help me. or show me some way.
> >
> >
> > --
> > shout at http://shiplu.awardspace.com/
> >
> > Available for Hire/Contract/Full Time
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some indie artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
>
I have tried same file as cli and as webpage. I don't know why only
cli version works nicely.  There may be some issue. But my technique
has some advantages. It can run command asynchronously. Thats what i
need for my application. I can create command queue. I and I can get
the completion percentage from there.
Whatever, I wish I could know those issues.
Rather it could happen that, php-apache framework is doing something
that I am unaware of.

-- 
shout at http://shiplu.awardspace.com/

Available for Hire/Contract/Full Time

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