[PHP] Content Management Systems

2004-05-21 Thread Jed R. Brubaker
Hey all -
I was hoping that I could get some advice! I am setting up a site that will
be quazi-portal-ish in nature. As such, a lot of different people in a lot
of different departments will be making contributions and editing parts of
the site.

I have never done something like this before, but I think what I am looking
for is a content management system (CMS). Is this correct?

I have been looking at a bunch of the packages from the list on HotScripts,
and I have to admit I am overwhelmed and confused. It seems that packages
such as Midgard, Typo3, etc. would need to be set up by the server admin..
This will not work for my situation. I am looking for a system that:

1. Allows multiple users.
2. Gives me complete design control.
3. Has a non-HTML editor interface (my clients are not so savvy), and
4. Can run just off of a PHP/MySQL interface that I can setup without access
to anything but my server space and database.

Does anyone have any suggestions?

Thanks a bunch - you guys are the best!

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



[PHP] want to buy second hand books online - cant remember site

2004-05-21 Thread Brent Clark
Hi all

a while ago someone on the list was kind enough to mention where he or she
buys books online.
The URL im looking for is a site that sells second hand IT books.
I know the site is someone where in the US.

For the likes of my I cant remember it.
If someone could assist it would greatly be appreciated.

Kind Regards
Brent Clark

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



[PHP] Re: Content Management Systems

2004-05-21 Thread David Robley
[EMAIL PROTECTED] (Jed R. Brubaker) wrote in
news:[EMAIL PROTECTED]: 

> Hey all -
> I was hoping that I could get some advice! I am setting up a site that
> will be quazi-portal-ish in nature. As such, a lot of different people
> in a lot of different departments will be making contributions and
> editing parts of the site.
> 
> I have never done something like this before, but I think what I am
> looking for is a content management system (CMS). Is this correct?
> 
> I have been looking at a bunch of the packages from the list on
> HotScripts, and I have to admit I am overwhelmed and confused. It
> seems that packages such as Midgard, Typo3, etc. would need to be set
> up by the server admin.. This will not work for my situation. I am
> looking for a system that: 
> 
> 1. Allows multiple users.
> 2. Gives me complete design control.
> 3. Has a non-HTML editor interface (my clients are not so savvy), and
> 4. Can run just off of a PHP/MySQL interface that I can setup without
> access to anything but my server space and database.
> 
> Does anyone have any suggestions?
> 
> Thanks a bunch - you guys are the best!
> 

Content Management System can mean different things to different people :-) 
I can't give a specific recommendation but I can point you to

http://opensourcecms.com/

which has a pretty comprehensive listing of options.

Cheers

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



[PHP] Creating mail accounts

2004-05-21 Thread mustafa ocak
Hi,

Is there a way to create new email accounts with PHP?
Server is RedHat Linux 8.

Thank you

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



Re: [PHP] Creating mail accounts

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, mustafa ocak wrote:

> Hi,
>
> Is there a way to create new email accounts with PHP?
> Server is RedHat Linux 8.
>

What mailserver are we talking about?

-- 
Jeroen

The only thing more frightening than a programmer with a screwdriver or a hardware 
engineer with a program
is a user with a pair of wire cutters and the root password.
-- Elizabeth Zwicky

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



[PHP] php and java applets

2004-05-21 Thread Tom Playford
Dear all knowing list,

I am trying to control the movement of a camera in real time from the web. But I also 
need to make sure that only the user I specify can have control.

What I though I could do was this: launch a java applet from a php page parsing the 
session id. Then when the user adjusts the controls on the applet, a php page is 
loaded by the applet, sets the user session with the session id, then sends the 
control details back to the server and on to the camera.

I've given this a go with no luck. When I try to set the session id on the php script 
that the Java applet loads I get a permissions error (the perms on /tmp are fine). I'm 
not 100% sure I understand sessions, is my method utterly implausible? Does anyone 
have any better suggestions?


Thanks,

Tom Playford

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



RE: [PHP] want to buy second hand books online - cant remember site

2004-05-21 Thread php chucker
Give this a shot:

http://dogbert.abebooks.com/servlet/SearchResults?sortby=0&sn=Programming&ph
=2&sts=t 

-Original Message-
From: Brent Clark [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 21, 2004 4:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP] want to buy second hand books online - cant remember site

Hi all

a while ago someone on the list was kind enough to mention where he or she
buys books online.
The URL im looking for is a site that sells second hand IT books.
I know the site is someone where in the US.

For the likes of my I cant remember it.
If someone could assist it would greatly be appreciated.

Kind Regards
Brent Clark

--
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] Showing weekly activity reports from Php / MySql script

2004-05-21 Thread Dave Carrera
Hi List,

How do I group rows from a MySql table and show them as a list of activity
by week numbers.

I.e.:

WEEK 1:
This happened, this happened...

WEEK 2:
This happened, this happened...

And so on.

I hope this makes sense and one of you clever guys (or girls) can advise me
on this one.

Thank you in advance

Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.688 / Virus Database: 449 - Release Date: 18/05/2004
 

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



[PHP] Re: Showing weekly activity reports from Php / MySql script

2004-05-21 Thread David Robley
[EMAIL PROTECTED] (Dave Carrera) wrote in
news:[EMAIL PROTECTED]: 

> Hi List,
> 
> How do I group rows from a MySql table and show them as a list of
> activity by week numbers.
> 
> I.e.:
> 
> WEEK 1:
> This happened, this happened...
> 
> WEEK 2:
> This happened, this happened...
> 
> And so on.
> 
> I hope this makes sense and one of you clever guys (or girls) can
> advise me on this one.
> 

Can you give us an idea of your table structure?

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



[PHP] array_push

2004-05-21 Thread Edward Peloke
Ok,
 
I am having a brain cramp for some reason but I need to pass in an array
to my form class to build select boxes.  The array is ("id"=>"John
Doe"), I need to dynamically build this array from a query but I am
getting errors using array_push.do I need to use array_merge?  Example:
 
$sql=new Database();
$sql->query("select fname,lname, id from clients");
$clients[]=array();
while($sql->nextRecord()){
   array_push($clients, $sql->getField('id')=>$sql->getField('fname'));
 } // while
 
Parse error: parse error, unexpected T_DOUBLE_ARROW in
C:\obox\Apache2\htdocs\nh_vacdest\admin\test.php on line 38
 
How can I dynamically create my array?
 
Thanks,
Eddie


Re: [PHP] array_push

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, Edward Peloke wrote:

>
> $sql=new Database();
> $sql->query("select fname,lname, id from clients");
> $clients[]=array();
> while($sql->nextRecord()){
>array_push($clients, $sql->getField('id')=>$sql->getField('fname'));
>  } // while
>
> Parse error: parse error, unexpected T_DOUBLE_ARROW in
> C:\obox\Apache2\htdocs\nh_vacdest\admin\test.php on line 38
>

If you want to do it the way you're doing now you should do ik like this:
array_push($clients, array($sql->getField('id')=>$sql->getField('fname')));

Another possible solution is like this:
$clients[$sql->getField('id')] = $sql->getField('fname');

-- 
Jeroen

There are only two kinds of programming languages: those people always bitch about and 
those nobody uses.
-- Bjarne Stroustrup

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



Re: [PHP] array_push

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, Edward Peloke wrote:

>
> $clients[]=array();
>

Here you should probably use $clients = array();

-- 
Jeroen

Anybody who thinks a little 9,000-line program [Java] that's distributed free and can 
be cloned by anyone
is going to affect anything we do at Microsoft  has his head screwed on wrong.
-- Bill Gates

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



[PHP] Cpanel accounting library

2004-05-21 Thread Jordi Canals
Hi all,
Cpanel is a control panel to manage accounts for ISP's (And espcially 
ISP's resellers). I knnow there is some librarys to directly manage the 
accounts from PHP-Scripts and I got some very small and undocummented 
samples.

I'm working on some scripts to manage the accounts directly from PHP 
(Scripts will be GNU/GPL licensed).

After STFW, I've not found any good documentation on it, just the short 
samples on http://www.cpanel.net/remoteaccess-php.html

At this moment, I have access to some servers with the accounting libs 
installed, but I have no access to the fonts (Which could help to make 
it work).

If anyone can post a link where to find good docs about this cpanel lib, 
and, if possible the source code for it, it will help me so much.

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


[PHP] Re: php and java applets

2004-05-21 Thread Aidan Lister
I'd implement access control in the java object if possible, sounds easier.

"Tom Playford" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dear all knowing list,
>
> I am trying to control the movement of a camera in real time from the web.
But I also need to make sure that only the user I specify can have control.
>
> What I though I could do was this: launch a java applet from a php page
parsing the session id. Then when the user adjusts the controls on the
applet, a php page is loaded by the applet, sets the user session with the
session id, then sends the control details back to the server and on to the
camera.
>
> I've given this a go with no luck. When I try to set the session id on the
php script that the Java applet loads I get a permissions error (the perms
on /tmp are fine). I'm not 100% sure I understand sessions, is my method
utterly implausible? Does anyone have any better suggestions?
>
>
> Thanks,
>
> Tom Playford

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



[PHP] How to insert, change and remove fields like Enum

2004-05-21 Thread Andre

Hello...
Someone now or have script's about   insert, change and remove fields
like Enum in one table.
Thanks .







[PHP] CONSTANTS and good coding practice

2004-05-21 Thread Al
Can someone explain to me the value of using defined custom constants, 
in the context of good coding practice.

I don't recall ever seeing define() used in the scripts I've seen and 
only the characteristics are described in the my php book and the php 
manual; but, not the use.

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


Re: [PHP] Re: php and java applets

2004-05-21 Thread Tom Playford
That was my original plan. The problem is that if someone works out the commands 
needed to
communicate with the php control page, they will be able to bypass the Java access 
control systems.
I suppose I could use https, but does that encrypt the url and post data?
Tom
Aidan Lister wrote:
> I'd implement access control in the java object if possible, sounds easier.
>
> "Tom Playford" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
>>Dear all knowing list,
>>
>>I am trying to control the movement of a camera in real time from the web.
>
> But I also need to make sure that only the user I specify can have control.
>
>>What I though I could do was this: launch a java applet from a php page
>
> parsing the session id. Then when the user adjusts the controls on the
> applet, a php page is loaded by the applet, sets the user session with the
> session id, then sends the control details back to the server and on to the
> camera.
>
>>I've given this a go with no luck. When I try to set the session id on the
>
> php script that the Java applet loads I get a permissions error (the perms
> on /tmp are fine). I'm not 100% sure I understand sessions, is my method
> utterly implausible? Does anyone have any better suggestions?
>
>>
>>Thanks,
>>
>>Tom Playford
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php cgi, apache suexec, filesystem problems

2004-05-21 Thread Peter Risdon
Hi,
I am having a lot of problems with any PHP routines that have to access 
the filesystem - things like exec(), shell_exec(), system(), backticked 
shell commands, copy(), move_uploaded_file() and so on.

I have a non-standard setup with CLI, CGI and mod_php all installed. 
These scripts are using the cgi php executable and the webserver is 
running suexec. I have confirmed that it isn't permissions issues both 
by running identical commands to those in the scripts from the uid in 
use by the suexec'd apache virtual host, and by blowing open permissions 
to 777 temporarily. No difference. Example code from the manual also fails.

Before I post a specific example to see if anyone can spot a problem in 
my code, does anyone know whether there's a fundamental problem with my 
server setup?

TIA.
PWR.
FreeBSD 4.9-STABLE
#/usr/local/bin/php -v
PHP 4.3.4 (cgi) (built: Feb 28 2004 13:43:25)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
#tail /var/log/httpd-error.log
[Wed May 19 10:34:43 2004] [notice] Apache/1.3.29 (Unix) mod_perl/1.28 
PHP/4.3.4 mod_ssl/2.8.16 OpenSSL/0.9.7c configured -- resuming normal 
operations
[Wed May 19 10:34:43 2004] [notice] suEXEC mechanism enabled (wrapper: 
/usr/local/sbin/suexec)
[Wed May 19 10:34:43 2004] [notice] Accept mutex: flock (Default: flock)

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


Re: [PHP] Re: php and java applets

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, Tom Playford wrote:

>
> I suppose I could use https, but does that encrypt the url and post data?
>

Your data is encrypted when using ssl.

-- 
Jeroen

Describing the difference between computer hardware and software:
"Those parts of the system that you can hit with a hammer (not advised) are called 
hardware;
those program instructions that you can only curse at are called software."
-- From Levitating Trains and Kamikaze Genes

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
Constants are useful when a variable will remain exactly the same (constant)
through
the life of a script.  e.g a script I wrote to calculate dates be it in the
past or future
would have constant values for how many seconds are in a day or a week. to
be used
in calculations.
e.g:

define("SECONDSINWEEK", 604800); // Number of seconds in week
 define("SECONDSINDAY", 86400); // Number of seconds in day
 $iDayOfWeek = 1; // 0 to 6 - 0 being Sunday
 $iNumWeeks = 12; // Number of weeks to lookback
 $iOffsetTimestamp = 0; // Initialize this var
 $iCurTime = time();
 $iCurDay = date("w", $iCurTime);

^^^ The above constants will always be what they are defined as. Constant
:-)
Also another advantage of using constants, is that it can make your code
easier
to read. Usually constant names are declare in uppercase, which helps to
break
up your code.

HTH

Craig



"Al" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can someone explain to me the value of using defined custom constants,
> in the context of good coding practice.
>
> I don't recall ever seeing define() used in the scripts I've seen and
> only the characteristics are described in the my php book and the php
> manual; but, not the use.
>
> Thanks.

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
Have a look here also: http://ie2.php.net/define


"Al" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can someone explain to me the value of using defined custom constants,
> in the context of good coding practice.
>
> I don't recall ever seeing define() used in the scripts I've seen and
> only the characteristics are described in the my php book and the php
> manual; but, not the use.
>
> Thanks.

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



Re: [PHP] Cpanel accounting library

2004-05-21 Thread Travis Low
Jordi Canals wrote:
I'm working on some scripts to manage the [cpanel] accounts directly from PHP 
(Scripts will be GNU/GPL licensed).

After STFW, I've not found any good documentation on it, just the short 
samples on http://www.cpanel.net/remoteaccess-php.html
I haven't found anything more detailed on their site.  I just ended up looking 
at the scripts themselves.  They are just wrappers around the scripts that are 
part of the cpanel installation.  If you find more documentation, I'd love to 
know about it.

At this moment, I have access to some servers with the accounting libs 
installed, but I have no access to the fonts (Which could help to make 
it work).
I didn't have to do anything with the fonts.  What problems are you having?
If anyone can post a link where to find good docs about this cpanel lib, 
and, if possible the source code for it, it will help me so much.
Here's a snippet:
  # cpanel idiotically outputs html rather than
  # programmatically-useful error codes.  Thus, we have to manipluate
  # the output before and after calling cpanel function.
  flush();
  ob_start();
  # You can get the $cpkey from the WHM.  The rest are yours to fill in.
  createacct( "localhost", "root", $cpkey, 0, $domain, $acctuser, $acctpass, 
"packagename" );
  ob_end_clean();

  # Now we check after the fact to see if account was created.
  # This is a VERY WEAK test, needs improvement.
  $accounts = listaccts( "localhost", "root", $cpkey , 0);
  $keys = array_keys( $accounts );
  $account_found = NULL;
  for( $i = 0; $i < count( $keys ); $i++ )
  {
  if( in_array( $domain, $accounts[$keys[$i]] ) )
  {
  $account_found = TRUE;
  break;
  }
  }
There are a few gotchas with this API.  For one thing, createacct() always 
returns the string "Account Creation Complete" no matter if the account was 
created or not.  You have to verify the creation some other way.

For another thing, the createacct() function writes directly to the output 
stream.  So all of the stuff you see when you create an account the normal way 
(using the Cpanel web interface) will be displayed unless you stop it.  That's 
what the flush() and the ob_* stuff does.

If you find more information, that would be great.  We can trade notes.
cheers,
Travis
--
Travis Low


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


Re: [PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Richard Davey
Hello Craig,

Friday, May 21, 2004, 2:30:20 PM, you wrote:

C> Constants are useful when a variable will remain exactly the same
C> (constant) through the life of a script.

Absolutely - and one of the best features of constants is their scope
- being global in nature you can use them ANYWHERE which is very handy
indeed!

-- 
Best regards,
 Richard Davey
 http://www.launchcode.co.uk / PHP Development Services
 http://www.phpcommunity.org/wiki/296.html / PHP Community

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



Re: [PHP] CONSTANTS and good coding practice

2004-05-21 Thread Matt
> From: "Al" [EMAIL PROTECTED]   Friday, May 21, 2004 9:02 AM
> Subject: [PHP] CONSTANTS and good coding practice


> Can someone explain to me the value of using defined custom constants,
> in the context of good coding practice.

Constants are useful anywhere you find yourself typing a constant (i.e. 20,
'Ralph') and the value is used in more than one place in the code.  Say you
have a script that fetches 10 articles from a db, and then loads them into
an html table.  You could hard code the 10 into the sql statement, for loop,
while loop or what ever logic used to fetch and load the table. If you
instead used a constant, then when the client asks that the table now list
15 rows, all you need to do is change the value in one place in the code
instead of searching for 10 everywhere and evaluating if the 10 found has
anything to do with the logic. Arguably, you could use a variable for the
same purpose, but constants can't change value, and thus you protect
yourself from self inflicted coding injuries (as well as injection of values
over get, post, etc).

The only oddity I find in using constants in php, is that you can't use them
inside single or double quotes and always have to break out and use
concatenation.

---
The future will be better tomorrow
---
http://www.spiceplace.com/


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



Re: [PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Greg Donald
On Fri, 2004-05-21 at 08:37, Richard Davey wrote:
> Absolutely - and one of the best features of constants is their scope
> - being global in nature you can use them ANYWHERE which is very handy
> indeed!

ANYWHERE except in code you plan to eval().

Funny how get_defined_constants() knows about all your CONSTANTS, but
eval() doesn't.

I made this little function so I could use defined CONSTANTS in HTML
templates that get eval()'d.

function makeConstants() {
  foreach(get_defined_constants() as $k=>$v) $GLOBALS[$k] = $v;
}

-- 
Greg Donald
[EMAIL PROTECTED]

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
yes, constants have global scope also :-)

"Craig" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Have a look here also: http://ie2.php.net/define
>
>
> "Al" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Can someone explain to me the value of using defined custom constants,
> > in the context of good coding practice.
> >
> > I don't recall ever seeing define() used in the scripts I've seen and
> > only the characteristics are described in the my php book and the php
> > manual; but, not the use.
> >
> > Thanks.

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



Re: [PHP] php and java applets

2004-05-21 Thread jon
Can you just send a command line java app commands from php?
-- jon
Tom Playford wrote:
Dear all knowing list,
I am trying to control the movement of a camera in real time from the web. But I also 
need to make sure that only the user I specify can have control.
What I though I could do was this: launch a java applet from a php page parsing the 
session id. Then when the user adjusts the controls on the applet, a php page is 
loaded by the applet, sets the user session with the session id, then sends the 
control details back to the server and on to the camera.
I've given this a go with no luck. When I try to set the session id on the php script 
that the Java applet loads I get a permissions error (the perms on /tmp are fine). I'm 
not 100% sure I understand sessions, is my method utterly implausible? Does anyone 
have any better suggestions?
Thanks,
Tom Playford
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php and java applets

2004-05-21 Thread Tom Playford
jon wrote:
Can you just send a command line java app commands from php?
I'm not sure what you're getting at.
Do you mean writing the Java code in the php page? I didn't know php could compile the code on the 
fly, can it? Or do you mean something else?

Tom
-- jon
Tom Playford wrote:
Dear all knowing list,
I am trying to control the movement of a camera in real time from the 
web. But I also need to make sure that only the user I specify can 
have control.

What I though I could do was this: launch a java applet from a php 
page parsing the session id. Then when the user adjusts the controls 
on the applet, a php page is loaded by the applet, sets the user 
session with the session id, then sends the control details back to 
the server and on to the camera.

I've given this a go with no luck. When I try to set the session id on 
the php script that the Java applet loads I get a permissions error 
(the perms on /tmp are fine). I'm not 100% sure I understand sessions, 
is my method utterly implausible? Does anyone have any better 
suggestions?

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


Re: [PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Curt Zirzow
* Thus wrote Greg Donald ([EMAIL PROTECTED]):
> On Fri, 2004-05-21 at 08:37, Richard Davey wrote:
> > Absolutely - and one of the best features of constants is their scope
> > - being global in nature you can use them ANYWHERE which is very handy
> > indeed!
> 
> ANYWHERE except in code you plan to eval().
> 
> Funny how get_defined_constants() knows about all your CONSTANTS, but
> eval() doesn't.

Works fine:

define('A_DEFINE', 'This is defined value');
eval('echo A_DEFINE;');

You were trying to do this:

$val = "Defind {A_DEFINE}";
echo $val;

Which wont work. Only variables can be expanded inside strings.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] How to make program execution go to another file?

2004-05-21 Thread michael young
Thank you for your help.
This should do nicely.
Michael
Vail, Warren wrote:
This is a common problem for people coming from other languages where the
file structures are the same as the execution structure.  A few of at least
50 answers is as follows;
Force the browser to invoke your next program;
If(1==a) {
header("Location: this.php");
 exit;  //stop this script
}
If(1==b) {
 header("Location: that.php");
exit;
}
If(1==c) {
header("Location: other.php");
}
Another option would be to take advantage of conditional includes to bring
the code into the current script;
If(1==a) {
   include("this.php");
   exit;
}
If(1==b) {
include("that.php");
exit;
}
If(1==c) {
include("other.php");
}
Include will issue a warning if executed and the file does not exist.
Require is fatal if executed and the file does not exist.
You can, of course use;
if(file_exists("this.php")) include("this.php"); 

to suppress any warning at all.

Warren Vail
-Original Message-
From: michael young [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 20, 2004 2:12 PM
To: [EMAIL PROTECTED]
Subject: [PHP] How to make program execution go to another file?

Hi,
  I want program execution to go to one of several other files 
based on a decision.
For Example.

if (1==a)
  go to this .php file
if (1==b)
  go to that .php file
if (1==c)
  go to the other .php file
Thank you for your time.
  Michael
 

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


[PHP] Detect if a file is hidden or not (win32)

2004-05-21 Thread Simon Fredriksson
Is there any built-in function to find out if a file/directory is hidden 
in Win32?

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


Re: [PHP] php and java applets

2004-05-21 Thread jon
Nah... Maybe we're both confused. Is this a java app you wrote or one 
that you found somewhere? If you know how to control the camera from 
java and you know how to work in java, you could build yourself a quick 
and dirty command-line java application, then feed it commands from php 
using exec or something similar.

-- jon
--
jon roig
web developer

Tom Playford wrote:
jon wrote:
Can you just send a command line java app commands from php?

I'm not sure what you're getting at.
Do you mean writing the Java code in the php page? I didn't know php 
could compile the code on the fly, can it? Or do you mean something else?

Tom
-- jon
Tom Playford wrote:
Dear all knowing list,
I am trying to control the movement of a camera in real time from the 
web. But I also need to make sure that only the user I specify can 
have control.

What I though I could do was this: launch a java applet from a php 
page parsing the session id. Then when the user adjusts the controls 
on the applet, a php page is loaded by the applet, sets the user 
session with the session id, then sends the control details back to 
the server and on to the camera.

I've given this a go with no luck. When I try to set the session id 
on the php script that the Java applet loads I get a permissions 
error (the perms on /tmp are fine). I'm not 100% sure I understand 
sessions, is my method utterly implausible? Does anyone have any 
better suggestions?

Thanks,
Tom Playford

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


[PHP] Where to change upload_tmp_dir ini setting

2004-05-21 Thread Peter Risdon
Hi,
This page:
http://www.php.net/manual/en/function.ini-set.php
tells me that upload_tmp_dir is of level PHP_INI_SYSTEM and can 
therefore only be altered in php.ini or httpd.conf

I want to be able to set this by virtual host. My httpd.conf s 
a directory which contains seperate files for each virtual host and in 
one of these I have added:


AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
php_admin_value upload_tmp_dir "/path/to/upload/directory/"

... and it has absolutely no effect. I have restarted apache using 
apachectl graceful and stop/start but it makes no difference. Files 
uploaded using POST get put in /var/tmp

I also tried it with php_value instead of php_admin_value.
Any guidance would be appreciated.
PWR.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] curl + ssl and invalid certificate

2004-05-21 Thread Richard Davey
Hi all,

This is a very specific problem so I'm not holding out too much luck,
but I am working on a script that must POST data to a secure server so
I'm using curl for this.

curl works perfectly including on ssl sites like PayPal.com - but the
test server I am connecting to has an invalid site certificate warning
come up (saying that the domain doesn't match the issuer, etc).

My PHP script is pretty straight forward and doesn't have much beyond
the standard setopts needed for curl but when I access it in a browser
it is actually causing Apache (2.0.49) on to crash!

Does anyone know how to get curl to accept the ssl cert *regardless*
of how ballsed-up it is?

-- 
Best regards,
 Richard Davey
 http://www.launchcode.co.uk / PHP Development Services
 http://www.phpcommunity.org/wiki/296.html / PHP Community

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



Re: [PHP] curl + ssl and invalid certificate

2004-05-21 Thread Curt Zirzow
* Thus wrote Richard Davey ([EMAIL PROTECTED]):
> Hi all,
> 
> Does anyone know how to get curl to accept the ssl cert *regardless*
> of how ballsed-up it is?

I've nver tried it but perhaps:

CURLOPT_SSL_VERIFYPEER 0

and/or

CURLOPT_SSL_VERIFYHOST 0

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] array_push

2004-05-21 Thread Edward Peloke
How do I then cycle through this array to build the select box?  I
currently use this which works fine when I hard code the values..ie.
$yesno=array("Yes"=>"1","No"=>"0")  but doesn't seem to work using your
first option.

Here is the form select box code
while($value=each($array))
{   
$res .= "".$value['key']."\n";
}

Thanks,
Eddie

-Original Message-
From: Jeroen Serpieters [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 21, 2004 12:16 AM
To: Edward Peloke
Cc: 'php-general'
Subject: Re: [PHP] array_push

On Fri, 21 May 2004, Edward Peloke wrote:

>
> $sql=new Database();
> $sql->query("select fname,lname, id from clients");
> $clients[]=array();
> while($sql->nextRecord()){
>array_push($clients,
$sql->getField('id')=>$sql->getField('fname'));
>  } // while
>
> Parse error: parse error, unexpected T_DOUBLE_ARROW in
> C:\obox\Apache2\htdocs\nh_vacdest\admin\test.php on line 38
>

If you want to do it the way you're doing now you should do ik like
this:
array_push($clients,
array($sql->getField('id')=>$sql->getField('fname')));

Another possible solution is like this:
$clients[$sql->getField('id')] = $sql->getField('fname');

-- 
Jeroen

There are only two kinds of programming languages: those people always
bitch about and those nobody uses.
-- Bjarne Stroustrup

-- 
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] array_push

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, Edward Peloke wrote:

> How do I then cycle through this array to build the select box?  I
> currently use this which works fine when I hard code the values..ie.
> $yesno=array("Yes"=>"1","No"=>"0")  but doesn't seem to work using your
> first option.
>
> Here is the form select box code
> while($value=each($array))
> {
> $res .= " ? " selected=\"selected\"" : '') . "
> value=".$value['value'].">".$value['key']."\n";
> }
>

I'm not sure about what you mean, cause these variables have other names
than before :-)

But what I think you mean is this:

foreach( $clients as $id => $name )
echo "{$name}";

Correct me if this isn't what you meant.

-- 
Jeroen

Like the creators of sitcoms or junk food or package tours, Java's designers were 
consciously designing
a product for people not as smart as them.
-- Paul Graham

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



Re: [PHP] Where to change upload_tmp_dir ini setting

2004-05-21 Thread Peter Risdon
Peter Risdon wrote:
Hi,
This page:
http://www.php.net/manual/en/function.ini-set.php
tells me that upload_tmp_dir is of level PHP_INI_SYSTEM and can 
therefore only be altered in php.ini or httpd.conf

I want to be able to set this by virtual host. My httpd.conf 
s a directory which contains seperate files for each virtual 
host and in one of these I have added:


AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
php_admin_value upload_tmp_dir "/path/to/upload/directory/"

... and it has absolutely no effect.

I assume that PHP_INI_SYSTEM means this is a system-wide variable, and 
so can only be set in the default host settings in httpd.conf or in 
php.ini. If this is right, is it documented anywhere? I'd be grateful 
for a steer.

PWR.

I have restarted apache using apachectl graceful and stop/start but it 
makes no difference. Files uploaded using POST get put in /var/tmp

I also tried it with php_value instead of php_admin_value.
Any guidance would be appreciated.
PWR.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] CONSTANTS and good coding practice

2004-05-21 Thread Jordi Canals
Al wrote:
Can someone explain to me the value of using defined custom constants, 
in the context of good coding practice.

I don't recall ever seeing define() used in the scripts I've seen and 
only the characteristics are described in the my php book and the php 
manual; but, not the use.

Talking about constants. I've seen the most scripts and web pages, (like 
some Open Source projects) They declare the database access values as 
vars not constants. I mean Username, Password, DataBase Name or Host.

In my point of view, this info is always constant on the script life, so 
it will be better to declare it as constants not as vars.

I normally declare as constants anything that will not change in the 
scripts life. Parhaps can change from one installation to another, but 
no more. Specially if I'm not completly sure that the value is correct 
for my purposes, I prefer to declare a constant and not directly write 
the value everywhere. It makes me easier to read and remember, and 
easier to change  in future if I need it.

For example, I think that :
if ($user_level == USR_LEVEL_WEBMASTER) {
// do stuff
}
is a lot easier to read and to imagine what we are looking for than:
if ($user_level == 255) {
// do stuff
}
Another way I use constants is when I want to pass to a function a sum 
of options. In this case imagine that function (Perhaps inside a class):

function draw_box($options) {
// do stuff
}
and this constants:
define('BOX_DRAW_BORDER', 1);
define('BOX_FILL_BACKGROUND', 2);
define('BOX_SHOW_TITLE', 4);
define('BOX_MAKE_LINKS' 8);
Then, I can call the function like this:
$box_options = BOX_DRAW_BORDER + BOX_FILL_BACKGROUND + BOX_MAKE_LINKS;
draw_box($box_options);
Finally, I normally use constants to declare all literal values that 
must be shown in the users browser. This is a need for me, beacuse in my 
country (Catalunya) we are bilinguals, and I have to be able to show 
literals in one or other language depending on the preferences. This 
makes scripts translation more easy, because I have all strings in one 
(or two) file.

I think, we should use constants always when we have a constant value 
(wich not will change on scrits' life).

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


[PHP] Sessions still do not persist

2004-05-21 Thread Michael R. Wayne

I've posted several times mentioning that I am completely unable
to cause sessions to persist.  Over the intervening time, I have
replicated this problem to a different machine, with the same
results.  Here's a recap of the problem.

I am not using cookies.  Sessions are automatically created (and
changing that makes no difference)  The relevant session variables
(copied from phpinfo) are:
   Session Support  enabled
   session.auto_start   On  <- hence no session_start 
   session.name PHPSESSID
   session.use_cookies  Off <- no cookies
   session.use_trans_sidOn

Environment is FreeBSD4.8.  phpinfo for apache says:
   Apache/1.3.29 (Unix) mod_perl/1.28 PHP/4.3.4 mod_ssl/2.8.16 OpenSSL/0.9.6d 


Here is a cut/paste of the borwser screen for the code below:

   Stage:0 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619 
   _ [Submit]
   Stage:1 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619 Request: Array ( ) 

So I type "foo" into the box and hit submit.  And the session variable
is NOT preserved:

   Stage:0 SessionID: 55c70989b7279d6a18edfd81b28d67a6 
   foo___ [Submit]
   Stage:1 SessionID: 55c70989b7279d6a18edfd81b28d67a6 Request: Array ( [PHPSESSID] => 
04ace04b1fe0bc81d2cd678c9bab1619 [field] => foo ) 

The session directory IS writable and I see the expected information
being written there:
   -rw---  1 nobody   wheel  10 May 21 13:35 
sess_04ace04b1fe0bc81d2cd678c9bab1619
   -rw---  1 nobody   wheel  10 May 21 13:38 
sess_55c70989b7279d6a18edfd81b28d67a6

Apache runs as user "nobody" on this server.  Both session files contain:
   stage|i:1;
but the files never seem to be being read back!

Help!?


Here's the entire php code I'm testing with:


 
PHP Test page


   
  
  
   

 

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



[PHP] Re: Sessions still do not persist

2004-05-21 Thread Torsten Roehr
"Michael R. Wayne" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I've posted several times mentioning that I am completely unable
> to cause sessions to persist.  Over the intervening time, I have
> replicated this problem to a different machine, with the same
> results.  Here's a recap of the problem.
>
> I am not using cookies.  Sessions are automatically created (and
> changing that makes no difference)  The relevant session variables
> (copied from phpinfo) are:
>Session Support  enabled
>session.auto_start   On <- hence no session_start
>session.name PHPSESSID
>session.use_cookies  Off <- no cookies
>session.use_trans_sidOn
>
> Environment is FreeBSD4.8.  phpinfo for apache says:
>Apache/1.3.29 (Unix) mod_perl/1.28 PHP/4.3.4 mod_ssl/2.8.16
OpenSSL/0.9.6d
>
>
> Here is a cut/paste of the borwser screen for the code below:
>
>Stage:0 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619
>_ [Submit]
>Stage:1 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619 Request: Array ( )
>
> So I type "foo" into the box and hit submit.  And the session variable
> is NOT preserved:
>
>Stage:0 SessionID: 55c70989b7279d6a18edfd81b28d67a6
>foo___ [Submit]
>Stage:1 SessionID: 55c70989b7279d6a18edfd81b28d67a6 Request: Array
 [PHPSESSID] => 04ace04b1fe0bc81d2cd678c9bab1619 [field] => foo )
>
> The session directory IS writable and I see the expected information
> being written there:
>-rw---  1 nobody   wheel  10 May 21 13:35
sess_04ace04b1fe0bc81d2cd678c9bab1619
>-rw---  1 nobody   wheel  10 May 21 13:38
sess_55c70989b7279d6a18edfd81b28d67a6
>
> Apache runs as user "nobody" on this server.  Both session files contain:
>stage|i:1;
> but the files never seem to be being read back!
>
> Help!?
>
>
> Here's the entire php code I'm testing with:
>
>  if (!isset($_SESSION['stage'])) {
>$_SESSION['stage'] = 0;
>}
> if (!isset($_POST['field'])) { $_POST['field'] = ""; }
> ?>
> 
> PHP Test page
> 
>echo "Stage:"; echo $_SESSION['stage'];
>   echo " SessionID: "; echo session_id();
>   $_SESSION['stage'] = 1;
> ?>
>
>   
>   
>
>echo "Stage:"; echo $_SESSION['stage']; echo " ";
>   echo " SessionID: "; echo session_id(); echo " ";
>   echo " Request: "; print_r($_REQUEST);
> ?>
>  

As far as I remember session.use_trans_sid does NOT work with forms (action
attribute). Have you tried appending it manually to the action?:



Regards, Torsten

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



Re: [PHP] Sessions still do not persist

2004-05-21 Thread Daniel Clark
Try a session_start() at the top of pages, see if that works.
Maybe the auto_start does not work.

>
> I've posted several times mentioning that I am completely unable
> to cause sessions to persist.  Over the intervening time, I have
> replicated this problem to a different machine, with the same
> results.  Here's a recap of the problem.
>
> I am not using cookies.  Sessions are automatically created (and
> changing that makes no difference)  The relevant session variables
> (copied from phpinfo) are:
>Session Support  enabled
>session.auto_start   On<- hence no session_start
>session.name   PHPSESSID
>session.use_cookies  Off   <- no cookies
>session.use_trans_sidOn
>
> Environment is FreeBSD4.8.  phpinfo for apache says:
>Apache/1.3.29 (Unix) mod_perl/1.28 PHP/4.3.4 mod_ssl/2.8.16
> OpenSSL/0.9.6d
>
>
> Here is a cut/paste of the borwser screen for the code below:
>
>Stage:0 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619
>_ [Submit]
>Stage:1 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619 Request: Array ( )
>
> So I type "foo" into the box and hit submit.  And the session variable
> is NOT preserved:
>
>Stage:0 SessionID: 55c70989b7279d6a18edfd81b28d67a6
>foo___ [Submit]
>Stage:1 SessionID: 55c70989b7279d6a18edfd81b28d67a6 Request: Array (
> [PHPSESSID] => 04ace04b1fe0bc81d2cd678c9bab1619 [field] => foo )
>
> The session directory IS writable and I see the expected information
> being written there:
>-rw---  1 nobody   wheel  10 May 21 13:35
> sess_04ace04b1fe0bc81d2cd678c9bab1619
>-rw---  1 nobody   wheel  10 May 21 13:38
> sess_55c70989b7279d6a18edfd81b28d67a6
>
> Apache runs as user "nobody" on this server.  Both session files contain:
>stage|i:1;
> but the files never seem to be being read back!
>
> Help!?
>
>
> Here's the entire php code I'm testing with:
>
>  if (!isset($_SESSION['stage'])) {
>$_SESSION['stage'] = 0;
>}
> if (!isset($_POST['field'])) { $_POST['field'] = ""; }
> ?>
> 
> PHP Test page
> 
>echo "Stage:"; echo $_SESSION['stage'];
>   echo " SessionID: "; echo session_id();
>   $_SESSION['stage'] = 1;
> ?>
>
>   
>   
>
>echo "Stage:"; echo $_SESSION['stage']; echo " ";
>   echo " SessionID: "; echo session_id(); echo " ";
>   echo " Request: "; print_r($_REQUEST);
> ?>
>  

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



Re: [PHP] Re: Sessions still do not persist

2004-05-21 Thread Michael R. Wayne
On Fri, May 21, 2004 at 08:04:00PM +0200, Torsten Roehr wrote:
> 
> As far as I remember session.use_trans_sid does NOT work with forms (action
> attribute). Have you tried appending it manually to the action?:

Well, this certainly seems to be progress in the correct direction.
So session.use_trans_sid used to work with forms in 4.1.2 (I'm
suffering from an upgrade here) but no longer does?  This really
helps.

> 

This ALMOST works.  Looks like a seperator is needed.  I get:
   "POST /xxx.phpPHPSESSID=3a2c0413ec84a00e36ea0317c193ccb2 HTTP/1.1"

Do I want ?=PHPSESSID= or just ?= or what?

Thanx!

/\/\ \/\/

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



Re: [PHP] Re: Sessions still do not persist

2004-05-21 Thread Torsten Roehr

"Michael R. Wayne" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Fri, May 21, 2004 at 08:04:00PM +0200, Torsten Roehr wrote:
> >
> > As far as I remember session.use_trans_sid does NOT work with forms
(action
> > attribute). Have you tried appending it manually to the action?:
>
> Well, this certainly seems to be progress in the correct direction.
> So session.use_trans_sid used to work with forms in 4.1.2 (I'm
> suffering from an upgrade here) but no longer does?  This really
> helps.
>
> > 
>
> This ALMOST works.  Looks like a seperator is needed.  I get:
>"POST /xxx.phpPHPSESSID=3a2c0413ec84a00e36ea0317c193ccb2 HTTP/1.1"
>
> Do I want ?=PHPSESSID= or just ?= or what?

Sorry, I'm an idiot! The ? was missing:



This should work. As far as I have seen trans_sid is not used very often -
obviously because of problems like yours. The best way is always to pass the
session ID yourself. Either with a cookie or via GET. I prefer GET because
with cookies you are reliant on the client supporting/allowing cookies.

Regards, Torsten

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



[PHP] what is the preferred method for outputting HTML?

2004-05-21 Thread Bob Lockie
PERL has the CGI library to build HTML.
print header;
print start_html('A Simple Example'),
h1('A Simple Example'),
start_form,
"What's your name? ",textfield('name'),
p,
"What's the combination?",
p,
checkbox_group(-name=>'words',
   -values=>['eenie','meenie','minie','moe'],
   -defaults=>['eenie','minie']),
p,
"What's your favorite color? ",
popup_menu(-name=>'color',
   -values=>['red','green','blue','chartreuse']),
p,
submit,
end_form,
hr;
Does PHP have something similar or do I have to write the raw HTML?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] MDB2 and single INSERT statement, prepare+execute or just query?

2004-05-21 Thread Michael Hanney
Hello,

I am ditching my own DB abstraction class in favour of MDB2.
When I need to do a sinlge INSERT, should I use MDB2_Driver_Common->prepare
like this..
$prep = $this->mdb2->prepare('INSERT INTO test (test_id, name) values
(?,?)', $types);
$result = $this->mdb2->executeParams($prep, $types, $data);
OR should I simply use MDB2_Driver_Common->query($sql)..
$res = $this->mdb2->query($sql);
where the $sql contains the pre-formatted INSERT statement? What I really
want to know is - does the prepare method offer any compatibility advantage
(escaping depending on types?),
or is it just for speeding up multiple inserts i.e. prepare once, execute
many. The docs explain how, but not always why. Inserts don't happen very
often in my apps so compatibility accross multiple dbs is more important to
me than speed. Finally, is this the right place to ask questions about MDB2,
or is there a more specific group for discussing Pear projects?

Thanks a lot.

Michael.



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



[PHP] Re: MDB2 and single INSERT statement, prepare+execute or just query?

2004-05-21 Thread Torsten Roehr
"Michael Hanney" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I am ditching my own DB abstraction class in favour of MDB2.
> When I need to do a sinlge INSERT, should I use
MDB2_Driver_Common->prepare
> like this..
> $prep = $this->mdb2->prepare('INSERT INTO test (test_id, name) values
> (?,?)', $types);
> $result = $this->mdb2->executeParams($prep, $types, $data);
> OR should I simply use MDB2_Driver_Common->query($sql)..
> $res = $this->mdb2->query($sql);
> where the $sql contains the pre-formatted INSERT statement? What I really
> want to know is - does the prepare method offer any compatibility
advantage
> (escaping depending on types?),
> or is it just for speeding up multiple inserts i.e. prepare once, execute
> many. The docs explain how, but not always why. Inserts don't happen very
> often in my apps so compatibility accross multiple dbs is more important
to
> me than speed. Finally, is this the right place to ask questions about
MDB2,
> or is there a more specific group for discussing Pear projects?
>

Please send your question to the PEAR mailing list php.pear.general

Regards, Torsten Roehr

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



Re: [PHP] what is the preferred method for outputting HTML?

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, Bob Lockie wrote:

>
> Does PHP have something similar or do I have to write the raw HTML?
>

You have to write the raw HTML, altough you have several packages from
the pear packages who deal with some specific html things, e.g. forms
http://pear.php.net/packages.php?catpid=10&catname=HTML

-- 
Jeroen

Programming today is a race between software engineers striving to build bigger and 
better idiot-proof programs,
and the Universe trying to produce bigger and better idiots. So far, the Universe is 
winning.
-- Rich Cook

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



Re: [PHP] Re: Sessions still do not persist

2004-05-21 Thread Michael R. Wayne
On Fri, May 21, 2004 at 08:35:37PM +0200, Torsten Roehr wrote:
> 
> Sorry, I'm an idiot! The ? was missing:
> 
> 

Thank you, thank you.  This does indeed seem to work in my test script.
Now to go work on the real version.

> This should work. As far as I have seen trans_sid is not used very often -
> obviously because of problems like yours. The best way is always to pass the
> session ID yourself. Either with a cookie or via GET. I prefer GET because
> with cookies you are reliant on the client supporting/allowing cookies.

Oddly, this all worked properly under 4.1.2.  When we upgraded,
things broke.  And I have a strong personal bias against cookies.

One again, thank you for the solution!

/\/\ \/\/

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



[PHP] Re: what is the preferred method for outputting HTML?

2004-05-21 Thread Torsten Roehr
"Bob Lockie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> PERL has the CGI library to build HTML.
> print header;
> print start_html('A Simple Example'),
>  h1('A Simple Example'),
>  start_form,
>  "What's your name? ",textfield('name'),
>  p,
>  "What's the combination?",
>  p,
>  checkbox_group(-name=>'words',
>-values=>['eenie','meenie','minie','moe'],
>-defaults=>['eenie','minie']),
>  p,
>  "What's your favorite color? ",
>  popup_menu(-name=>'color',
>-values=>['red','green','blue','chartreuse']),
>  p,
>  submit,
>  end_form,
>  hr;
>
> Does PHP have something similar or do I have to write the raw HTML?

Go to http://pear.php.net and search for 'HTML'. There are several classes
for outputting HTML.

Regards,

Torsten Roehr

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



[PHP] Re: how to verify PHP has been installed with ldap?

2004-05-21 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Bing,

Run 


If you don't see a section for LDAP, it's not installed.
In a Windows XP, PHP 4.3.6 environment, installed in C:/Program
Files/PHP,I had to change a working default installation as follows to get
it to work:

Add to php.ini:
extension_dir = C:/Program Files/PHP/extensions/  
extension=php_ldap.dll
ldap.max_links = -1

Copy C:\Program Files\PHP\php.ini   to C:\WINDOWS 

Restart Apache to make sure your new ini file controls. You should see the
options in your ini file reflected in the phpinfo display.
 
Copy C:\Program Files\PHP\php4ts.dll   to C:\WINDOWS.

Copy from C:\Program Files\PHP\extensions  to  C:\Windows\System32
php_ldap.dll
libeay32.dll
ssleay32.dll 

Copy all the dlls in C:/Program Files to C:\Windows\System32

Good luck!


Bing Du wrote:

> Greetings,

> I've installed PHP with ldap.  But I got this error "Fatal error: Call to
> undefined function: ldap_connect() in /home/me/public_html/test1.php on
> line 5".  Why ldap_connect() is undefined?

> This is what I did:

> ==
> # ./configure --with-apxs=/usr/local/apache/bin/apxs
> --with-config-file-path=/usr/local/apache/php.ini --with-mysql --with-zlib
> --with-ldap
> # make
> # make install
> ==

> It went through without obvious errors.

> And this is the PHP script test1.php that generates the above error:

> 
>  $dn="cn=john smith, ou=Users, ou=eng,dc=iastate, dc=edu";
> $password = "ok4now";

> if (!($ldap = ldap_connect("w2kdc1.eng.some.edu", 389))) {
> die ("Could not connect to LDAP server");
> }
> if (!($res = @ldap_bind($ldap, $dn, $password))) {
> die ("Could not bind to $dn");
> }
> echo "bind fine!";
> ?>
> 

> So my question is how to verify PHP has been installed with ldap support?

> Thanks in advance for any help,

> Bing

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



Re: [PHP] Re: Sessions still do not persist

2004-05-21 Thread Michael R. Wayne
On Fri, May 21, 2004 at 08:35:37PM +0200, Torsten Roehr wrote:
> Sorry, I'm an idiot! The ? was missing:
> 
> 
> 

Well, I spoke too soon.  It does work, but only the SECOND time the 
script is run!

   Stage:0 SessionID: 6c9a1819fe95fa6f08f385ee2afa71ca 
   __ [Submit]
   Stage:1 SessionID: 6c9a1819fe95fa6f08f385ee2afa71ca Request: Array ( ) 
Type "foo" into the form, hit submit and the session variable is not being
preserved:
   Stage:0 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9 
   foo___ [Submit]
   Stage:1 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9 Request: Array ( [PHPSESSID] => 
6c9a1819fe95fa6f08f385ee2afa71ca [field] => foo ) 
Type "bar" into the form, hit submit and the session variable
IS being preserved:
   Stage:1 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9 
   bar___ [Submit]
   Stage:1 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9 Request: Array ( [PHPSESSID] => 
ac429ad0086eb5b4d1130eb2e2fddcb9 [field] => bar ) 

So, what am I missing here?


Code, for reference:


PHP Test page


   
  
  
   

 

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



Re: [PHP] Re: Sessions still do not persist

2004-05-21 Thread Torsten Roehr
"Michael R. Wayne" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Fri, May 21, 2004 at 08:35:37PM +0200, Torsten Roehr wrote:
> > Sorry, I'm an idiot! The ? was missing:
> >
> > 
> >
>
> Well, I spoke too soon.  It does work, but only the SECOND time the
> script is run!
>
>Stage:0 SessionID: 6c9a1819fe95fa6f08f385ee2afa71ca
>__ [Submit]
>Stage:1 SessionID: 6c9a1819fe95fa6f08f385ee2afa71ca Request: Array ( )
> Type "foo" into the form, hit submit and the session variable is not being
> preserved:
>Stage:0 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9
>foo___ [Submit]
>Stage:1 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9 Request: Array
 [PHPSESSID] => 6c9a1819fe95fa6f08f385ee2afa71ca [field] => foo )
> Type "bar" into the form, hit submit and the session variable
> IS being preserved:
>Stage:1 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9
>bar___ [Submit]
>Stage:1 SessionID: ac429ad0086eb5b4d1130eb2e2fddcb9 Request: Array
 [PHPSESSID] => ac429ad0086eb5b4d1130eb2e2fddcb9 [field] => bar )
>
> So, what am I missing here?

You could try it without session.auto_start. Turn it off and put
session_start() at the top of the script (in all pages).

Regards, Torsten

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



Re: [PHP] Re: Sessions still do not persist

2004-05-21 Thread Michael R. Wayne
On Fri, May 21, 2004 at 09:12:02PM +0200, Torsten Roehr wrote:
> >
> > So, what am I missing here?
> 
> You could try it without session.auto_start. Turn it off and put
> session_start() at the top of the script (in all pages).

Tried that - makes no difference.  Still works properly on the second
call but not the first.

/\/\ \/\/

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



Re: [PHP] Sessions still do not persist

2004-05-21 Thread Michael R. Wayne
On Fri, May 21, 2004 at 11:02:49AM -0700, Daniel Clark wrote:
> Try a session_start() at the top of pages, see if that works.
> Maybe the auto_start does not work.

Done:
   session.auto_start = 0
added session_start to script.  No change in behaviour.

/\/\ \/\/

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



[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Al
Many thanks everyone. 

Seems like I should be using constants a lot of places where I've been 
using globals.

Al wrote:
Can someone explain to me the value of using defined custom constants, 
in the context of good coding practice.

I don't recall ever seeing define() used in the scripts I've seen and 
only the characteristics are described in the my php book and the php 
manual; but, not the use.

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


[PHP] session_start in php 4.3.6

2004-05-21 Thread Paul Godard
Hi

All my web sites suddenly stopped working after my ISP installed the newer php 4.3.6 
released.  The problem is when calling the session_start() function.  It seems that 
the warning message saying that the session has already started and that the function 
will be ignored makes the php script stop at this point although it is a warning.  
This worked perfectly in php 4.3.4.

What should I do to be compatible with php 4.3.6?
-- 

Kind regards, Paul.

Gondwana
[EMAIL PROTECTED]
http://www.gondwanastudio.com

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



Re: [PHP] session_start in php 4.3.6

2004-05-21 Thread Michael R. Wayne
On Fri, May 21, 2004 at 10:01:56PM +0200, Paul Godard wrote:
> Hi
> 
> All my web sites suddenly stopped working after my ISP installed the newer php 4.3.6 
> released.  The problem is when calling the session_start() function.  It seems that 
> the warning message saying that the session has already started and that the 
> function will be ignored makes the php script stop at this point although it is a 
> warning.  This worked perfectly in php 4.3.4.
> 
> What should I do to be compatible with php 4.3.6?

This is because your ISP has likely set 
   session.auto_start = 1
in php.ini

Either have the ISP set it to 0 or remove all session_start calls
from your scripts to eliminate the warnings.

/\/\ \/\/

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



[PHP] Decompressing files via php

2004-05-21 Thread Gerard Samuel
Looking for libraries that are capable of decompressing files, such as 
those in zip or tar format.
Im aware of PCL(Tar/Zip), and was wondering if there were any others out 
there.
Just want to see whats out there before I settle on one of them.

Thanks

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



Re: [PHP] session_start in php 4.3.6

2004-05-21 Thread Bob Lockie
On 05/21/04 16:08 Michael R. Wayne spoke:
On Fri, May 21, 2004 at 10:01:56PM +0200, Paul Godard wrote:
Hi
All my web sites suddenly stopped working after my ISP installed the newer php 4.3.6 
released.  The problem is when calling the session_start() function.  It seems that 
the warning message saying that the session has already started and that the function 
will be ignored makes the php script stop at this point although it is a warning.  
This worked perfectly in php 4.3.4.
What should I do to be compatible with php 4.3.6?

This is because your ISP has likely set 
   session.auto_start = 1
in php.ini

Either have the ISP set it to 0 or remove all session_start calls
from your scripts to eliminate the warnings.
Would putting an '@' in front of all session_start calls hide the problem?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] grabbing string from URL if URL is masked/forwarded

2004-05-21 Thread Ryan Schefke
I've tried this code and it works wonders.  

 

$string = "/tgwedding/users/client1/sites/testgrabid.php";
$thisarray = explode("/", $string);
foreach($thisarray as $item) {
  if(ereg('client', $item)) {
 $found = $item;
 $num = ereg_replace('client', '', $found);
  }
}

echo $num;

 

/// the above script will echo "1" from the string
(plan to substitute that string with $PHP_SELF

 

 

But I'm wondering if it will work when I setup a domain name with a
registrar and have that domain name MASKED and FORWARDED to a URL directory
that contains "/tgwedding/users/client1/sites/testgrabid.php".

 

Will this still work or will it not detect the "client1" in the string
because the URL is masked/forwarded.

 

I guess the question is with $PHP_SELF toowhen you echo $PHP_SELF in a
script that is run from a masked domain name will it echo the real directory
URL or the masked one.

 

Thanks,

Ryan



[PHP] Re: [PHP-ES] Proyecto GPL

2004-05-21 Thread Jordi Canals
Manuel González Noriega wrote:
El vie, 21-05-2004 a las 19:12, Jordi Canals escribió:
Queria comentar sobre un pequeño proyecto que tengo en mente:
 > sería interesante que comentaras la motivación detrás del proyecto. ¿Ves
carencias que solucionar en proyectos ya equivalentes a tu idea como
PEAR o las librerias Ez? ¿Simplemente por aprender?
Anque la idea la estoy madurando todavía, las motivaciones que me hacen 
pensar en ella son bastante simples ;)

La primera es un tema de convicción ... si yo aprovecho el código que 
otros facilitan en la red en numerosos proyectos, me parece razonable, 
que los que hemos aprovechado en algun momento parte de ellos, tambien 
contribuyamos a la filosofia del código libre.

La segunda, es la construcción de un CMS. Haberlos haylos, pero cada uno 
con su punto de vista, sus cosas buenas y otras no tanto. Recopilando y 
trabajando en ello, se podria contruir como mínimo una estructura básica 
para la creación de sitios dinamicos. Me refiero a algo del estilo del 
bien conocido PHP-Nuke (Por poner un ejemplo), pero con otra filosofía y 
otros enfoques.

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


Re: [PHP] Sessions still do not persist

2004-05-21 Thread Curt Zirzow
* Thus wrote Michael R. Wayne ([EMAIL PROTECTED]):
> 
> I've posted several times mentioning that I am completely unable
> to cause sessions to persist.  Over the intervening time, I have
> replicated this problem to a different machine, with the same
> results.  Here's a recap of the problem.
> 
> I am not using cookies.  Sessions are automatically created (and
> changing that makes no difference)  The relevant session variables
> (copied from phpinfo) are:
>Session Support  enabled
>session.auto_start   On<- hence no session_start 
>session.name   PHPSESSID
>session.use_cookies  Off   <- no cookies
>session.use_trans_sidOn

url_rewriter.tags?


> 
> Environment is FreeBSD4.8.  phpinfo for apache says:
>Apache/1.3.29 (Unix) mod_perl/1.28 PHP/4.3.4 mod_ssl/2.8.16 OpenSSL/0.9.6d 
> 
> 
> Here is a cut/paste of the borwser screen for the code below:
> 
>Stage:0 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619 
>_ [Submit]
>Stage:1 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619 Request: Array ( ) 
> 
> So I type "foo" into the box and hit submit.  And the session variable
> is NOT preserved:
> 
>Stage:0 SessionID: 55c70989b7279d6a18edfd81b28d67a6 
>foo___ [Submit]
>Stage:1 SessionID: 55c70989b7279d6a18edfd81b28d67a6 Request: Array ( [PHPSESSID] 
> => 04ace04b1fe0bc81d2cd678c9bab1619 [field] => foo ) 

It seems php isn't picking up that session that is in $_REQUEST..
which part of request is that variable in? do this?

  print_r($_GET);
  print_r($_POST);
  print_r($_COOKIE);

Also, is the PHPSESSID being written in the form output somewhere?
View source of form output.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] session_start in php 4.3.6

2004-05-21 Thread Curt Zirzow
* Thus wrote Bob Lockie ([EMAIL PROTECTED]):
> On 05/21/04 16:08 Michael R. Wayne spoke:
> >On Fri, May 21, 2004 at 10:01:56PM +0200, Paul Godard wrote:
> >
> >>Hi
> >>
> >>All my web sites suddenly stopped working after my ISP installed the 
> >>newer php 4.3.6 released.  The problem is when calling the 
> >>session_start() function.  It seems that the warning message saying that 
> >>the session has already started and that the function will be ignored 
> >>makes the php script stop at this point although it is a warning.  This 
> >>worked perfectly in php 4.3.4.
> >>
> >>What should I do to be compatible with php 4.3.6?
> >
> >
> >This is because your ISP has likely set 
> >   session.auto_start = 1
> >in php.ini
> >
> >Either have the ISP set it to 0 or remove all session_start calls
> >from your scripts to eliminate the warnings.
> 
> Would putting an '@' in front of all session_start calls hide the problem?

Hide? yeah... Good Idea? No

if (! session_id() ) session_start();

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



[PHP] empty connection string

2004-05-21 Thread AMC
Hi,

I'm using an include file to store the connection string to a mysql db.
Whenever I try to reference that a string to open a connection I get the
error 'empy connection string' . When I write the string to the page using
response.write(connectionstring) it shows up fine. Is the something else
that I need to do?

Thanks

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



[PHP] Re: Decompressing files via php

2004-05-21 Thread Justin Patrin
Gerard Samuel wrote:
Looking for libraries that are capable of decompressing files, such as 
those in zip or tar format.
Im aware of PCL(Tar/Zip), and was wondering if there were any others out 
there.
Just want to see whats out there before I settle on one of them.

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


Re: [PHP] empty connection string

2004-05-21 Thread Curt Zirzow
* Thus wrote AMC ([EMAIL PROTECTED]):
> Hi,
> 
> I'm using an include file to store the connection string to a mysql db.
> Whenever I try to reference that a string to open a connection I get the
> error 'empy connection string' . When I write the string to the page using
> response.write(connectionstring) it shows up fine. Is the something else
> that I need to do?

Are we talking about PHP here?

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] empty connection string

2004-05-21 Thread AMC
Yes
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote AMC ([EMAIL PROTECTED]):
> > Hi,
> >
> > I'm using an include file to store the connection string to a mysql db.
> > Whenever I try to reference that a string to open a connection I get the
> > error 'empy connection string' . When I write the string to the page
using
> > response.write(connectionstring) it shows up fine. Is the something else
> > that I need to do?
>
> Are we talking about PHP here?
>
> Curt
> -- 
> "I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] empty connection string

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, Curt Zirzow wrote:

>
> Are we talking about PHP here?
>

It smells like asp ;-)

-- 
Jeroen

Like the creators of sitcoms or junk food or package tours, Java's designers were 
consciously designing
a product for people not as smart as them.
-- Paul Graham

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



Re: [PHP] empty connection string

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, AMC wrote:

>
> Yes
>

It's the first time I hear response.write() and php together ... confused :S

-- 
Jeroen

Describing the difference between computer hardware and software:
"Those parts of the system that you can hit with a hammer (not advised) are called 
hardware;
those program instructions that you can only curse at are called software."
-- From Levitating Trains and Kamikaze Genes

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



Re: [PHP] Sessions still do not persist

2004-05-21 Thread Michael R. Wayne
On Fri, May 21, 2004 at 08:41:00PM +, Curt Zirzow wrote:
> * Thus wrote Michael R. Wayne ([EMAIL PROTECTED]):
> > 
> > I've posted several times mentioning that I am completely unable
> > to cause sessions to persist.  Over the intervening time, I have
> > replicated this problem to a different machine, with the same
> > results.  Here's a recap of the problem.
> > 
> > I am not using cookies.  Sessions are automatically created (and
> > changing that makes no difference)  The relevant session variables
> > (copied from phpinfo) are:
> >Session Support  enabled
> >session.auto_start   On  <- hence no session_start 
> >session.name PHPSESSID
> >session.use_cookies  Off <- no cookies
> >session.use_trans_sidOn
> 
> url_rewriter.tags?

url_rewriter.tags  a=href,area=href,frame=src,input=src,form=fakeentry
session.use_trans_sid  Off


> It seems php isn't picking up that session that is in $_REQUEST..
> which part of request is that variable in? do this?
> 
>   print_r($_GET);
>   print_r($_POST);
>   print_r($_COOKIE);

Done - see below


> Also, is the PHPSESSID being written in the form output somewhere?
> View source of form output.

Done all 3 times


=== initial load =
Stage:0 SessionID: 86cc1b0a4dee900f85981e93bcc855b2   
Stage:1 SessionID: 86cc1b0a4dee900f85981e93bcc855b2 Request: Array ( ) 
GET: Array ( ) POST: Array ( [field] => ) COOKIE: Array ( ) 

 
PHP Test page

Stage:0 SessionID: 86cc1b0a4dee900f85981e93bcc855b2   
  
  
   
Stage:1  SessionID: 86cc1b0a4dee900f85981e93bcc855b2  Request: Array
(
)
GET: Array
(
)
 POST: Array
(
[field] => 
)
 COOKIE: Array
(
)
 


= type foo, hit submit. Note differing sesison IDs =
Stage:0 SessionID: 7c6cd5d1f965de3f134442600f60565a   
Stage:1 SessionID: 7c6cd5d1f965de3f134442600f60565a Request: Array ( [PHPSESSID] => 
86cc1b0a4dee900f85981e93bcc855b2 [field] => foo ) 
GET: Array ( [PHPSESSID] => 86cc1b0a4dee900f85981e93bcc855b2 ) POST: Array ( [field] 
=> foo ) COOKIE: Array ( ) 

 
PHP Test page

Stage:0 SessionID: 7c6cd5d1f965de3f134442600f60565a   
  
  
   
Stage:1  SessionID: 7c6cd5d1f965de3f134442600f60565a  Request: Array
(
[PHPSESSID] => 86cc1b0a4dee900f85981e93bcc855b2
[field] => foo
)
GET: Array
(
[PHPSESSID] => 86cc1b0a4dee900f85981e93bcc855b2
)
 POST: Array
(
[field] => foo
)
 COOKIE: Array
(
)
 

= type bar, hit submit.  Note same session IDs =
Stage:1 SessionID: 7c6cd5d1f965de3f134442600f60565a   
Stage:1 SessionID: 7c6cd5d1f965de3f134442600f60565a Request: Array ( [PHPSESSID] => 
7c6cd5d1f965de3f134442600f60565a [field] => bar ) 
GET: Array ( [PHPSESSID] => 7c6cd5d1f965de3f134442600f60565a ) POST: Array ( [field] 
=> bar ) COOKIE: Array ( ) 

 
PHP Test page

Stage:1 SessionID: 7c6cd5d1f965de3f134442600f60565a   
  
  
   
Stage:1  SessionID: 7c6cd5d1f965de3f134442600f60565a  Request: Array
(
[PHPSESSID] => 7c6cd5d1f965de3f134442600f60565a
[field] => bar
)
GET: Array
(
[PHPSESSID] => 7c6cd5d1f965de3f134442600f60565a
)
 POST: Array
(
[field] => bar
)
 COOKIE: Array
(
)
 


php code:

 
PHP Test page


   
  
  
   
GET: "; print_r($_GET); echo " POST: "; print_r($_POST); echo " COOKIE: "; 
print_r($_COOKIE);

?>
 

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



[PHP] Newbie error with cookies and headers already declared

2004-05-21 Thread GodFoca
I'm getting this error:

Warning: Cannot add header information - headers already sent by (output
started at /home/tiempodemaria/main.php:3) in /home/tiempodemaria/main.php
on line 11

With this code in "main.php":







.

Does anybody knows what's going on? I don't understand which header is being
sent before the setting of the cookie, and I don't understand the ":3" in
the error description. This page is a frame, so I don't have any head tag,
does that matter to php?

Thanks in advance,
Nicolas

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



Re: [PHP] Newbie error with cookies and headers already declared

2004-05-21 Thread Kevin Murphy
I'm a newbie to PHP too, but
I think its the HTML tag. Move it down below the PHP and see what 
happens.

--
Kevin Murphy
Web Designer - Stubborn Donkey Productions
www.stubborndonkey.com
On May 21, 2004, at 1:28 PM, GodFoca wrote:
I'm getting this error:
Warning: Cannot add header information - headers already sent by 
(output
started at /home/tiempodemaria/main.php:3) in 
/home/tiempodemaria/main.php
on line 11

With this code in "main.php":


 $has_visited = isset($_COOKIE["TdM_visited"]);
 if (!$has_visited) {
  setcookie("TdM_visited",
  (string) (time() + OFFSET_WITH_GMT),
  time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS);
  // the above (not blank) is line 11
 } else {
  $latestVisit = (int) $_COOKIE["TdM_visited"];
  setcookie("TdM_visited",
  (string) (time() + OFFSET_WITH_GMT),
  time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS);
 }
?>




.
Does anybody knows what's going on? I don't understand which header is 
being
sent before the setting of the cookie, and I don't understand the ":3" 
in
the error description. This page is a frame, so I don't have any head 
tag,
does that matter to php?

Thanks in advance,
Nicolas
--
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] Newbie error with cookies and headers already declared

2004-05-21 Thread Daniel Clark
Try putting your  below setting the cookie.

> I'm getting this error:
>
> Warning: Cannot add header information - headers already sent by (output
> started at /home/tiempodemaria/main.php:3) in /home/tiempodemaria/main.php
> on line 11
>
> With this code in "main.php":
>
> 
>   define(SECONDS_IN_THREE_MONTHS, 3600*24*90);
>  define(OFFSET_WITH_GMT, -3*3600);
>
>  $has_visited = isset($_COOKIE["TdM_visited"]);
>
>  if (!$has_visited) {
>   setcookie("TdM_visited",
>   (string) (time() + OFFSET_WITH_GMT),
>   time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS);
>
>   // the above (not blank) is line 11
>
>  } else {
>   $latestVisit = (int) $_COOKIE["TdM_visited"];
>   setcookie("TdM_visited",
>   (string) (time() + OFFSET_WITH_GMT),
>   time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS);
>  }
> ?>
> 
> 
>
> 
> .
>
> Does anybody knows what's going on? I don't understand which header is
> being
> sent before the setting of the cookie, and I don't understand the ":3" in
> the error description. This page is a frame, so I don't have any head tag,
> does that matter to php?
>
> Thanks in advance,
> Nicolas

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



RE: [PHP] Newbie error with cookies and headers already declared

2004-05-21 Thread Chris W. Parker
GodFoca 
on Friday, May 21, 2004 1:29 PM said:

> Warning: Cannot add header information - headers already sent by
> (output started at /home/tiempodemaria/main.php:3) in
> /home/tiempodemaria/main.php on line 11

[snip]

> Does anybody knows what's going on? I don't understand which header
> is being sent before the setting of the cookie, and I don't
> understand the ":3" in the error description. This page is a frame,
> so I don't have any head tag, does that matter to php?

headers != 

it's basically this:

1. you cannot create/write a cookie after you send any html output to
the client.
2. you cannot create/write a session value after you send any html
output to the client.

for one, you've got  at the very top of main.php. try rearranging
your file like this:







...



hope this helps,
chris.

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



Re: [PHP] empty connection string

2004-05-21 Thread Stephen Lake
Its a first for me to hear to...never thought PHP and MS were married :D

"Jeroen Serpieters" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Fri, 21 May 2004, AMC wrote:
>
> >
> > Yes
> >
>
> It's the first time I hear response.write() and php together ... confused
:S
>
> --
> Jeroen
>
> Describing the difference between computer hardware and software:
> "Those parts of the system that you can hit with a hammer (not advised)
are called hardware;
> those program instructions that you can only curse at are called
software."
> -- From Levitating Trains and Kamikaze Genes

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



Re: [PHP] Cpanel accounting library

2004-05-21 Thread Jordi Canals
Travis Low wrote:
Jordi Canals wrote:
I'm working on some scripts to manage the [cpanel] accounts directly 
from PHP (Scripts will be GNU/GPL licensed).

After STFW, I've not found any good documentation on it, just the 
short samples on http://www.cpanel.net/remoteaccess-php.html

I haven't found anything more detailed on their site.  I just ended up 
looking at the scripts themselves.  They are just wrappers around the 
scripts that are part of the cpanel installation.  If you find more 
documentation, I'd love to know about it.

At this moment, I have access to some servers with the accounting libs 
installed, but I have no access to the fonts (Which could help to make 
it work).
I didn't have to do anything with the fonts.  What problems are you having?
If anyone can post a link where to find good docs about this cpanel 
lib, and, if possible the source code for it, it will help me so much.

Here's a snippet:
  # cpanel idiotically outputs html rather than
  # programmatically-useful error codes.  Thus, we have to manipluate
  # the output before and after calling cpanel function.
  flush();
  ob_start();
  # You can get the $cpkey from the WHM.  The rest are yours to fill in.
  createacct( "localhost", "root", $cpkey, 0, $domain, $acctuser, 
$acctpass, "packagename" );
  ob_end_clean();

  # Now we check after the fact to see if account was created.
  # This is a VERY WEAK test, needs improvement.
  $accounts = listaccts( "localhost", "root", $cpkey , 0);
  $keys = array_keys( $accounts );
  $account_found = NULL;
  for( $i = 0; $i < count( $keys ); $i++ )
  {
  if( in_array( $domain, $accounts[$keys[$i]] ) )
  {
  $account_found = TRUE;
  break;
  }
  }
There are a few gotchas with this API.  For one thing, createacct() 
always returns the string "Account Creation Complete" no matter if the 
account was created or not.  You have to verify the creation some other 
way.

For another thing, the createacct() function writes directly to the 
output stream.  So all of the stuff you see when you create an account 
the normal way (using the Cpanel web interface) will be displayed unless 
you stop it.  That's what the flush() and the ob_* stuff does.

If you find more information, that would be great.  We can trade notes.
Thanks for your comments. At the moment I've just made a couple of 
tests, and my main problem is where fo find some info about it to be 
sure I will manage in the correct way.

I will continue looking for any document. It's not an urgent matter 
because is for a long time project ;)

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


Re: [PHP] Newbie error with cookies and headers already declared

2004-05-21 Thread Stephen Lake
All headers have to be sent before any output is sent to the browser.

"Chris W. Parker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
GodFoca 
on Friday, May 21, 2004 1:29 PM said:

> Warning: Cannot add header information - headers already sent by
> (output started at /home/tiempodemaria/main.php:3) in
> /home/tiempodemaria/main.php on line 11

[snip]

> Does anybody knows what's going on? I don't understand which header
> is being sent before the setting of the cookie, and I don't
> understand the ":3" in the error description. This page is a frame,
> so I don't have any head tag, does that matter to php?

headers != 

it's basically this:

1. you cannot create/write a cookie after you send any html output to
the client.
2. you cannot create/write a session value after you send any html
output to the client.

for one, you've got  at the very top of main.php. try rearranging
your file like this:







...



hope this helps,
chris.

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



Re: [PHP] Re: Decompressing files via php

2004-05-21 Thread Gerard Samuel
On Friday 21 May 2004 04:44 pm, Justin Patrin wrote:
> Gerard Samuel wrote:
> > Looking for libraries that are capable of decompressing files, such as
> > those in zip or tar format.
> > Im aware of PCL(Tar/Zip), and was wondering if there were any others out
> > there.
> > Just want to see whats out there before I settle on one of them.
> >
> > Thanks
>
> http://pear.php.net/package/Archive_Zip
>

I was aware of Archive_Zip.  I thought it was the same as PCLZip, as it was 
created by the same author.
But thanks...

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



[PHP] Cannot Get Session Variables nor Global variables to work

2004-05-21 Thread Joe Carr
Help. I am missing a MAJOR aspect of using either Session variables or
global variables. I am trying to set one variable on one page, and read it
on the other _without_ sending any information in the query string. Here is
the code for the two pages :

test1.php :

step 2

and test2.php looks like this:
";
 echo "HELP=". $GLOBALS["help"];
 echo "HELP2=". $GLOBALS["help2"];
?>

On test2.php, each of the echo statements indicate that the variables have
not been defined. I've read many posts which indicate that I should pass the
PHPSESSID through the query string, but when I look at the PHPSESSID in the
global array printed it is the same on both pages. I cannot seem to have
access to either session nor global variables outside the context of one
page. Any assistance would be fascinatingly appreciated. Thanks...

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



Re: [PHP] Cannot Get Session Variables nor Global variables to work

2004-05-21 Thread Jordi Canals
You need to place session_start() at the top of test2.php.
If you use session_start, you should not use using session_register(), 
just use $_SESSION. From Manual:  "If you are using $_SESSION and 
disable register_globals, do not use session_register(), 
session_is_registered() and session_unregister()"

Globals are limited to the scope of current script and do not carry the 
values betwen pages. You cannot pass values betwen scripts using 
globals. Use $_SESSION or cookies if you do not want to use get or post 
variables.

Take a look at:
http://www.php.net/manual/en/function.session-start.php
http://www.php.net/manual/en/ref.session.php
http://www.php.net/manual/en/language.variables.scope.php
Regards,
Jordi.
Joe Carr wrote:
Help. I am missing a MAJOR aspect of using either Session variables or
global variables. I am trying to set one variable on one page, and read it
on the other _without_ sending any information in the query string. Here is
the code for the two pages :
test1.php :

 session_register('var2');
 $var2="testing";
 // Trying to use a global variable
 global $help;
 $help = "howdy";
 $GLOBALS['help2']= "howdy again";
 print_r($GLOBALS);
?>
step 2
and test2.php looks like this:

 echo "COUNT=". $_SESSION["count"];
 echo "";
 echo "HELP=". $GLOBALS["help"];
 echo "HELP2=". $GLOBALS["help2"];
?>
On test2.php, each of the echo statements indicate that the variables have
not been defined. I've read many posts which indicate that I should pass the
PHPSESSID through the query string, but when I look at the PHPSESSID in the
global array printed it is the same on both pages. I cannot seem to have
access to either session nor global variables outside the context of one
page. Any assistance would be fascinatingly appreciated. Thanks...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: php and java applets

2004-05-21 Thread raditha dissanayake
Tom Playford wrote:
That was my original plan. The problem is that if someone works out 
the commands needed to
communicate with the php control page, they will be able to bypass the 
Java access control systems.
I suppose I could use https, but does that encrypt the url and post data?

I think you have found yourself trapped in the java applet sandbox. You 
need to create a signed applet. see 
http://www.radinks.com/java/sandbox/  for a brief guide.

all the best
--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] FreeBSD and phpize

2004-05-21 Thread Justin Hendrickson
FreeBSD and phpize have never cooperated with me. The phpize script 
requires a number of files, like automake, autoconf, libtool, ect, 
however FreeBSD installs these files as automake14, autoconf253 and 
libtool14. Has anyone out there found a good way to get around this 
problem without manually copying the files over to their respective 
locations?

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


Re: [PHP] Re: php and java applets

2004-05-21 Thread Travis Low
The link you provided seems broken -- here's another:
http://www.raditha.com/java/sandbox/
raditha dissanayake wrote:
Tom Playford wrote:
That was my original plan. The problem is that if someone works out 
the commands needed to
communicate with the php control page, they will be able to bypass the 
Java access control systems.
I suppose I could use https, but does that encrypt the url and post data?

I think you have found yourself trapped in the java applet sandbox. You 
need to create a signed applet. see 
http://www.radinks.com/java/sandbox/  for a brief guide.

all the best
--
Travis Low


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


[PHP] include $var

2004-05-21 Thread Bob Lockie
Should 'include $var;' work?
I need go to an HTML page after the form has been submitted.
page A -> program B (no output) -> page A
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] iconv with UTF-7-IMAP support

2004-05-21 Thread Bjai
I have recently found someone that has written a patch for iconv library to
support UTF-7-IMAP encoding (http://www.technoids.org/utf7imap/index.html).
Within the patching instruction it is required to edit the iconv library
file of PHP in order to handle idiosncrasies #2 (there is an example of
editing the Perl equivalent file), in that the end-of-string in UTF-7 IMAP
must include bytes that set the encoding back to the US-ASCII state (with a
hyphen). However I am a newbie in C programming and I have tried to edit the
iconv.c file without success. I would very much appreciate if someone could
give me some help in applying the changes so that the iconv library of PHP
can handle UTF-7 IMAP encoding.

To summarize I think it is required to add a null character to end each
UTF-7 IMAP encoded character:

result = iconv(cd, (char **) NULL, &in_left, (char **) &out_p, &out_left);

I have made several attempts to add the above line into the php_iconv_string
function, but it didn't work (compiling is ok).

I would very much appreciate if someone could provide some advice or help in
the above.

Thank you in advance

Bjai

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



Re: [PHP] Re: php and java applets

2004-05-21 Thread raditha dissanayake
Travis Low wrote:
The link you provided seems broken -- here's another:
http://www.raditha.com/java/sandbox/
gee thanx that's the link i meant ;-)
(my own site actually)
--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: include $var

2004-05-21 Thread Aidan Lister
Try it?

(Yes, it works)

"Bob Lockie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Should 'include $var;' work?
> I need go to an HTML page after the form has been submitted.
> page A -> program B (no output) -> page A

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



[PHP] Searching a file

2004-05-21 Thread Ian Barnes
Hi,

I have a file that looks like this:

#gc: Ian
eth0,1000,1100,1200,1300,1400
eth1,10,100,200
eth2,3000,3100,3200,3300

Okay, the numbers after the ethx are not static, there can be more and there
can be less depending on what the user selects.

Now my problem, I have a list of numbers that they can choose using
checkboxes, and I now want the checkboxes to be ticked if  the number+ethx
appear in the file.

How would I go about reading the file and then finding out if the
number+ethx are there ? I have tried something like this:
[code]
$file=file("/ian/testing.file");//Load the file into array
unset($file[0]);//Remove the first #gc line
foreach($file as $line){// Run through each array line
$array[]=explode(",", $line);   //Separate each line in key/variable.
}
[/code]
This gives me an output something like this (Dont take note of numbers, they
change per user:
Array
(
[0] => Array
(
[0] => eth0
[1] => 1100
[2] => 1200
[3] => 1300
)
[1] => Array
(
[0] => eth1
[1] => 1100
[2] => 1200
[3] => 1300
)
[2] => Array
(
[0] => eth2
[1] => 40
[2] => 50
[3] => 60
)
)

Okay, now for the difficult part. I run a global foreach($eth as $whatever)
to run through each eth and then another foreach loop within that to
determine the numbers for each eth. Great, that works no problem. Now when
it comes to the part of comparing that the eth+number are in the same array
(to determine wether the checkbox must be ticked or not) I cant figure out
how todo it. I have tried various options like.
[code]
foreach($file as $line){
if((in_array("1100", $line)) and (in_array("eth0", $line))){
echo "Found eth0 and 1100 in array. Checkbox can be checked";
}else{
echo "Not found";
}
}
[/code]

Now obviously, the first line should be returned as true, as eth0 and 1000
are in the same array. But it doesnt. It returns false the whole time. The
problem is that the ethx+number must be in the SAME array not only in the
whole global array, otherwise checkboxes that show up ticked are actually
not going to be in the file. Oh the page where you select is layed out
something like the diagram below. (Note there can be more numbers per ethx
these are just examples.

eth0
1000[]
1100[]
1200[]
1300[]
1400[]
6000[]
6500[]
2300[]
eth1
40  []
50  []
60  []
1000[]
eth2
1100[]
1200[]
1300[]

I hope I have not confused you now, please ask if something isnt clear.

Thanks a million for the help.

Ian

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



[PHP] RSS/RDF generator

2004-05-21 Thread electroteque
Hi there, I was wondering if there is a standard pear class like the
XML_Tree to build RSS/RDF documents from the database ? Let me know

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