[PHP] Session management

2004-10-22 Thread Herman Scheepers
Hi

I am a PHP newbie from a Java/C/Oracle background. I
cannot seem to get session management with PHP
working.

?php

  #echo 1;

  $old = ini_set('session.use_cookies', 0);

  session_start();
  $username = $_REQUEST[username];
  session_register($username);

  echo old=.$old;

  echo $username;

  include_once(db_security.inc);

  echo PHPSESSID=.$PHPSESSID.\n;


  $Postfrom = $_REQUEST[username];
  $Postpass = $_REQUEST[password];


  if (__user_authenticate($Postfrom,$Postpass))
  {
$display = 'Welcome '.$Postfrom.' !';

echo 'a href=ht_next.phpNext/a';

echo $display;
  } else {
echo Login Failed!;
  }

?


In ht_next.php I have:

?php


  session_start();
  
  echo $username;


?


$username seems to be empty at this point. 

echo PHPSESSID=.$PHPSESSID.\n;

in the first script does not produce any output
either. 


Any help would be appreciated.

Herman






___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



RE: [PHP] Sessions question

2004-10-22 Thread Reinhart Viane
I do not think this causes the problem.
It's just redundant.

Thx anyway

-Original Message-
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: donderdag 21 oktober 2004 22:11
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Sessions question


* Thus wrote Reinhart Viane:
 PHP Code
 // Register some session variables!
 session_register('userid');
 $_SESSION['userid'] = $userid;

Do not use session_register with $_SESSION.

http://php.net/session-register

Curt
-- 
Quoth the Raven, Nevermore.

-- 
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] Sessions question

2004-10-22 Thread Reinhart Viane
Owkee here goes:

* Removing the foreach loop only supplied me with not being able to log
in.
  But again I dunnot think this is the problem.
  The variables are stored correctly.
  At certain times the user_id sessions were just swapped...

* Now I've seen that 

session_register('email');
$_SESSION['email'] = $email;

  Did not supply any output when listing my session variables with

echo pre\n;
print_r($_SESSION);
echo /pre\n;

  When I removed this line (and I am testing 2 hours already now) I have
not ecountered any problems so far.
  Could this be logical?
  Could a session variable with no value at all cause the earlier
mentioned problems?

* Also when a file was uploaded and it's parameters were inputed in the
database I used this code to do it:

//get the id of the current logged in user
$submit_user_id=$_SESSION['user_id'];
//set the file url
$url= (documents/.$file_name);
$sql4 = insert into documents (document_name,
document_description, document_submit_date,
document_submitter_user_id, document_folder_id, document_url,
document_ext, document_author) values ('$_POST  [documentname]',
'$_POST[documentdescription]', '$inputdate', '$submit_user_id',
'$_POST[folderid]', '$url', '$ext', '$_POST[documentauthor]' );

  Which I now changed into:

//get the id of the current logged in user
//$submit_user_id=$_SESSION['user_id'];
//set the file url
$url= (documents/.$file_name);
$sql4 = insert into documents (document_name,
document_description, document_submit_date,
document_submitter_user_id, document_folder_id, document_url,
document_ext, document_author) values ('$_POST  [documentname]',
'$_POST[documentdescription]', '$inputdate', $_SESSION['user_id'],
'$_POST[folderid]', '$url', '$ext', '$_POST[documentauthor]' );

  Maybe for some bizarre reason sometimes the value of the last
$submit_user_id was given to $_SESSION[user_id].
  As you can see I'm getting very suspecious about everything hehe. 



* Secondly I now use this: 

$sql = mysql_query(SELECT * FROM users WHERE
username='$username' AND password='$password' AND activated='1');
$login_check = mysql_num_rows($sql);

if($login_check  0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key = $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('user_id');
$_SESSION['user_id'] = $user_id;
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
//session_register('email');
//$_SESSION['email'] = $email;
session_register('user_level');
$_SESSION['user_level'] = $user_level;
}

  should it be better when I use this??

$sql = mysql_query(SELECT * FROM users WHERE
username='$username' AND password='$password' AND activated='1');
$login_check = mysql_num_rows($sql);

if($login_check  0){
while($row = mysql_fetch_array($sql)){

// Register some session variables!
session_register('user_id');
$_SESSION['user_id'] = $row-user_id;
session_register('first_name');
$_SESSION['first_name'] = $row-first_name;
session_register('last_name');
$_SESSION['last_name'] = $row-last_name;
//session_register('email');
//$_SESSION['email'] = $email;
session_register('user_level');
$_SESSION['user_level'] = $row-user_level;
}

* last question.
  Very soon I will need a good and secure usersystem preferabbly with no
cookies. So I think sessions are the way to go.
  Maybe you can supply me with some good tutorials or scripts which can
help me create a well closed usersystem.
  After these encounters with security problems, I'm not really sure no
more what to use or to do. 

Thx again for all the efforts you are doing to help me out.
It's highly appreciated (if I would be a girl I would give you a kiss).

Greetings,
Reinhart Viane

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



Re: [PHP] Session management

2004-10-22 Thread Tom Rogers
Hi,

Friday, October 22, 2004, 4:10:50 PM, you wrote:
HS Hi

HS I am a PHP newbie from a Java/C/Oracle background. I
HS cannot seem to get session management with PHP
HS working.

HS ?php

HS   #echo 1;

HS   $old = ini_set('session.use_cookies', 0);

HS   session_start();
HS   $username = $_REQUEST[username];
HS   session_register($username);

HS   echo old=.$old;

HS   echo $username;

HS   include_once(db_security.inc);

HS   echo PHPSESSID=.$PHPSESSID.\n;


HS   $Postfrom = $_REQUEST[username];
HS   $Postpass = $_REQUEST[password];


HS   if (__user_authenticate($Postfrom,$Postpass))
HS   {
HS $display = 'Welcome '.$Postfrom.' !';

HS echo 'a href=ht_next.phpNext/a';

HS echo $display;
HS   } else {
HS echo Login Failed!;
HS   }

?


HS In ht_next.php I have:

HS ?php


HS   session_start();
  
HS   echo $username;


?


HS $username seems to be empty at this point. 

HS echo PHPSESSID=.$PHPSESSID.\n;

HS in the first script does not produce any output
HS either. 


It is best to use
session_start();
.
.//get username
.
$_SESSION['username'] = $username;

then on the next page

session_start();
echo (isset($_SESSION['username']))? $_SESSION['username'] : 'Not in session';

PHP does not fill global variables by default.

-- 
regards,
Tom

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



[PHP] DOMXML html_dump_mem question

2004-10-22 Thread franco bevilacqua
 Hello,
I have a question regarding the html_dump_mem function. I build an xml 
tree with HTML tags. When I dump it, I expect that my brother interpret 
HTML tag procduced by the dump. But the dump produce only a text with my 
html tag. Does someone knows how to do HTML interpretation with using 
DOMXML print

The following example explains exactly what whant to do.
(Inspired from html_dump_mem example )
?php
// Creates the document
$doc = domxml_new_doc(1.0);
$root = $doc-create_element(html);
$root = $doc-append_child($root);
$body = $doc-create_element(body);
$body = $root-append_child($head);
$h1 = $doc-create_element(h1);
$h1 = $head-append_child($h1);
$text = $doc-create_text_node(This is the header1);
$text = $title-append_child($text);
echo $doc-html_dump_mem();
?
The following dump is produced:
htmlbodyh1This is the title/h1/body/html
But I expect the following result:
This is the title : formated as HTML header1
Thanks for your help.
Best regards
Franco
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Apache2 + PHP problem

2004-10-22 Thread Marco Stranieri








Hi,

Ive a problem when I start apaci on my server:



[EMAIL PROTECTED] bin]$ ./apachectl start

Syntax error on line 232 of
/usr/local/apache2/conf/httpd.conf:

Cannot load /usr/lib/apache/libphp4.so into server:
/usr/lib/apache/libphp4.so: undefined symbol: ap_block_alarms



The config param are following:



cd /usr/local/httpd

./configure --prefix=/usr/local/apache2
--enable-module=so --enable-cache --enable-disk-cache --enable-mem-cache
--enable-mime-magic --enable-expires --enable-headers --enable-usertrack
--enable-unique-id --enable-ssl --enable-http --enable-info --disable-cgi
--enable-vhost-alias --enable-shared=max --enable-rule=SHARED_CORE; make; make
install

cd /usr/local/php

./configure --prefix=/usr/local/php
--with-apache2=/usr/local/httpd --without-mysql --with-xml --with-pgsql
--with-zlib-dir=/usr/lib/ --enable-sysvshm=yes --enable-sysvsem=yes
--enable-track-vars --enable-force-cgi-redirect --enable-safe-mode
--enable-magic-quotes --disable-ipv6 --enable-libgcc --enable-bcmath
--enable-calendar --enable-ftp --enable-sockets --with-pgsql --with-pear;
make; make install

cp php.ini-dist /usr/local/lib/php.ini



If I make --with-apxs2=/usr/local/apache2/bin/apxs
the PHP config it gives back an error.



How I can do it?



Best redgards.








smime.p7s
Description: S/MIME cryptographic signature


[PHP] Apache2 + PHP problem

2004-10-22 Thread Marco Stranieri















Marco Stranieri
Net.Software Division


NETHOUSE S.p.A.
C.so Re Umberto I, 57 - 10128 Torino - Italy
Tel. +39-011-227.227 - Fax +39-011-227.228
http://www.nethouse.it - mailto:[EMAIL PROTECTED]

Il presente
messaggio non costituisce un impegno contrattuale tra NETHOUSE S.p.A. ed il
destinatario. Le opinioni ivi espresse sono quelle dell'autore. NETHOUSE S.p.A.
non assume alcuna responsabilit riguardo al contenuto del presente
messaggio. Ai sensi dellart. 13 del D.Lgs 30/06/2003 n 196 si precisa che le informazioni contenute nel
presente messaggio sono riservate ad uso esclusivo del destinatario. Il
contenuto e gli allegati sono da considerarsi di natura confidenziale. Nel caso
abbiate ricevuto il presente messaggio per errore, chiediamo cortesemente di
telefonare immediatamente al numero 011.227.227.













Da: Marco Stranieri 
Inviato: venerd 22 ottobre
2004 9.39
A: '[EMAIL PROTECTED]'
Oggetto: Apache2 + PHP problem





Hi,

Ive a problem when I start apaci on my server:



[EMAIL PROTECTED] bin]$ ./apachectl start

Syntax error on line 232 of
/usr/local/apache2/conf/httpd.conf:

Cannot load /usr/lib/apache/libphp4.so into server: /usr/lib/apache/libphp4.so:
undefined symbol: ap_block_alarms



The config param are following:



cd /usr/local/httpd

./configure --prefix=/usr/local/apache2
--enable-module=so --enable-cache --enable-disk-cache --enable-mem-cache
--enable-mime-magic --enable-expires --enable-headers --enable-usertrack
--enable-unique-id --enable-ssl --enable-http --enable-info --disable-cgi
--enable-vhost-alias --enable-shared=max --enable-rule=SHARED_CORE; make; make
install

cd /usr/local/php

./configure --prefix=/usr/local/php
--with-apache2=/usr/local/httpd --without-mysql --with-xml --with-pgsql
--with-zlib-dir=/usr/lib/ --enable-sysvshm=yes --enable-sysvsem=yes
--enable-track-vars --enable-force-cgi-redirect --enable-safe-mode
--enable-magic-quotes --disable-ipv6 --enable-libgcc --enable-bcmath
--enable-calendar --enable-ftp --enable-sockets --with-pgsql --with-pear;
make; make install

cp php.ini-dist /usr/local/lib/php.ini



If I make --with-apxs2=/usr/local/apache2/bin/apxs
the PHP config it gives back an error.



How I can do it?



Best redgards.








smime.p7s
Description: S/MIME cryptographic signature


Re: [PHP] Thanks but problem Again! (MySQL PHP database script PLEASE)

2004-10-22 Thread Ramil Sagum
On Fri, 22 Oct 2004 16:13:07 +0900, Sugimoto [EMAIL PROTECTED] wrote:
 Thank you for two of you.

dou itashimashite.

This is your problem:

 Bad query: You have an error in your SQL syntax near 'and Tit like and Aut
 like and Auty like ' at line 4

The SQL query you formed may have an invalid syntax. Dakara, $result
does not contain a  valid MySQL resource. Mochiron, next operations
with $result will produce errors:

 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result...
 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

What you can do is to debug first your SQL statement:

$sql = select * from gen_table   where GO like . $_GET[go].
and ym like . $_GET[dt] .
   and Tit like .$_GET[ti]. .
   and Aut like .$_GET[au]. 
  and Auty like .$_GET[ay];

print_r($sql);  //show the SQL statement, (remove this when everything
is working)

$result = mysql_query($sql);

print_r to var_dump ha php de debug no ni yaku ni tachimasu!



ramil

http://ramil.sagum.net


-- 


ramil

http://ramil.sagum.net

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



Re: [PHP] Thanks but problem Again! (MySQL PHP database script PLEASE)

2004-10-22 Thread M. Sokolewicz
Ramil Sagum wrote:
On Fri, 22 Oct 2004 16:13:07 +0900, Sugimoto [EMAIL PROTECTED] wrote:
Thank you for two of you.

dou itashimashite.
This is your problem:

Bad query: You have an error in your SQL syntax near 'and Tit like and Aut
like and Auty like ' at line 4

The SQL query you formed may have an invalid syntax. Dakara, $result
does not contain a  valid MySQL resource. Mochiron, next operations
with $result will produce errors:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result...
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

What you can do is to debug first your SQL statement:
$sql = select * from gen_table   where GO like . $_GET[go].
and ym like . $_GET[dt] .
   and Tit like .$_GET[ti]. .
   and Aut like .$_GET[au]. 
  and Auty like .$_GET[ay];

print_r($sql);  //show the SQL statement, (remove this when everything
is working)
$result = mysql_query($sql);
print_r to var_dump ha php de debug no ni yaku ni tachimasu!

ramil
http://ramil.sagum.net

and now in english...? I don't think I understood even half of what you 
said... what does ha php de debug no ni yaku ni tachimasu mean? or 
dou itashimashite not to mention dakara and mochiron

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


Re: [PHP] DOMXML html_dump_mem question

2004-10-22 Thread Christian Stocker
On Fri, 22 Oct 2004 09:07:46 +0200, franco bevilacqua
[EMAIL PROTECTED] wrote:
   Hello,
 I have a question regarding the html_dump_mem function. I build an xml
 tree with HTML tags. When I dump it, I expect that my brother interpret
 HTML tag procduced by the dump. But the dump produce only a text with my
 html tag. Does someone knows how to do HTML interpretation with using
 DOMXML print
 
 The following example explains exactly what whant to do.
 (Inspired from html_dump_mem example )

I see nothing wrong with the output, what exactly did you expect?

chregu
 
 ?php
 
 // Creates the document
 $doc = domxml_new_doc(1.0);
 
 $root = $doc-create_element(html);
 $root = $doc-append_child($root);
 
 $body = $doc-create_element(body);
 $body = $root-append_child($head);
 
 $h1 = $doc-create_element(h1);
 $h1 = $head-append_child($h1);
 
 $text = $doc-create_text_node(This is the header1);
 $text = $title-append_child($text);
 
 echo $doc-html_dump_mem();
 
 ?
 The following dump is produced:
 
 htmlbodyh1This is the title/h1/body/html
 
 But I expect the following result:
 
 This is the title : formated as HTML header1
 
 Thanks for your help.
 
 Best regards
 Franco
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
http://www.bitflux.ch  |  [EMAIL PROTECTED]  |  gnupg-keyid 0x5CE1DECB

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



RE: [PHP] Question: Validation on select boxes and lists.

2004-10-22 Thread Stuart Felenstein
I just remembered something (smacks myself in the
head)
In both my multi select and select menus I use dynamic
options (meaning the options available come from a
table. So:
Table for states would look like this:
+--+---+
| StateID  |   State [Label|
+--+---+
|   1  |Arkansas   |
+--+---+
|   2  |Alabama|
+--+---+
|   3  +Arizona|
+--+---+

What gets stored in the database is the StateID, the
column is an int.  My understanding is the database
just won't accept anything but an int. I mean I'm
jamming on my keys now and the only thing the column
will take is a real number.

Based on this I think a hacker can do whatever they
want by saving the page and altering the input but all
it would do is fail on insertion.

This make sense ?
And I'm not trying to be lazy here , only practical.
Of course, should I still be polite to hackers by
still testing for invalid characters :)

Stuart


--- Graham Cossey [EMAIL PROTECTED] wrote:

 [snip]
 
  How would a hacker pass an HTTP message ?
  That is interesting.
 
 read the off-list posted message from
 [EMAIL PROTECTED]
 
 (reproduced below for the benefit of other list
 members)
 
 Graham
 --

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



Re: [PHP] DOMXML html_dump_mem question

2004-10-22 Thread franco bevilacqua
Christian Stocker wrote:
On Fri, 22 Oct 2004 09:07:46 +0200, franco bevilacqua
[EMAIL PROTECTED] wrote:
 Hello,
I have a question regarding the html_dump_mem function. I build an xml
tree with HTML tags. When I dump it, I expect that my brother interpret
HTML tag procduced by the dump. But the dump produce only a text with my
html tag. Does someone knows how to do HTML interpretation with using
DOMXML print
The following example explains exactly what whant to do.
(Inspired from html_dump_mem example )

I see nothing wrong with the output, what exactly did you expect?
I expect to have the text This is the title printed as H1 by the 
brother, ( without the tags around the text ). I want that the brother 
interpret the dumped text as html and not as text. Do you have an idea 
to do that ?
Thanks
chregu
?php
// Creates the document
$doc = domxml_new_doc(1.0);
$root = $doc-create_element(html);
$root = $doc-append_child($root);
$body = $doc-create_element(body);
$body = $root-append_child($head);
$h1 = $doc-create_element(h1);
$h1 = $head-append_child($h1);
$text = $doc-create_text_node(This is the header1);
$text = $title-append_child($text);
echo $doc-html_dump_mem();
?
The following dump is produced:
htmlbodyh1This is the title/h1/body/html
But I expect the following result:
This is the title : formated as HTML header1
Thanks for your help.
Best regards
Franco
--
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] Question: Validation on select boxes and lists.

2004-10-22 Thread M. Sokolewicz
Stuart Felenstein wrote:
I just remembered something (smacks myself in the
head)
In both my multi select and select menus I use dynamic
options (meaning the options available come from a
table. So:
Table for states would look like this:
+--+---+
| StateID  |   State [Label|
+--+---+
|   1  |Arkansas   |
+--+---+
|   2  |Alabama|
+--+---+
|   3  +Arizona|
+--+---+
What gets stored in the database is the StateID, the
column is an int.  My understanding is the database
just won't accept anything but an int. I mean I'm
jamming on my keys now and the only thing the column
will take is a real number.
Based on this I think a hacker can do whatever they
want by saving the page and altering the input but all
it would do is fail on insertion.
This make sense ?
Yes, this makes sense, it's a commonly used technique aswell =/
And I'm not trying to be lazy here , only practical.
Of course, should I still be polite to hackers by
still testing for invalid characters :)
Stuart
--- Graham Cossey [EMAIL PROTECTED] wrote:

[snip]
How would a hacker pass an HTTP message ?
That is interesting.
read the off-list posted message from
[EMAIL PROTECTED]
(reproduced below for the benefit of other list
members)
Graham
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] DOMXML html_dump_mem question

2004-10-22 Thread franco bevilacqua
Christian Stocker wrote:
 On Fri, 22 Oct 2004 09:07:46 +0200, franco bevilacqua
 [EMAIL PROTECTED] wrote:

  Hello,
 I have a question regarding the html_dump_mem function. I build an xml
 tree with HTML tags. When I dump it, I expect that my brother interpret
 HTML tag procduced by the dump. But the dump produce only a text with my
 html tag. Does someone knows how to do HTML interpretation with using
 DOMXML print

 The following example explains exactly what whant to do.
 (Inspired from html_dump_mem example )



 I see nothing wrong with the output, what exactly did you expect?
I expect to have the text This is the title printed as H1 by the 
brother, ( without the tags around the text ). I want that the brother 
interpret the dumped text as html and not as text. Do you have an idea 
to do that ?
Thanks


 chregu

 ?php

 // Creates the document
 $doc = domxml_new_doc(1.0);

 $root = $doc-create_element(html);
 $root = $doc-append_child($root);

 $body = $doc-create_element(body);
 $body = $root-append_child($head);

 $h1 = $doc-create_element(h1);
 $h1 = $head-append_child($h1);

 $text = $doc-create_text_node(This is the header1);
 $text = $title-append_child($text);

 echo $doc-html_dump_mem();

 ?
 The following dump is produced:

 htmlbodyh1This is the title/h1/body/html

 But I expect the following result:

 This is the title : formated as HTML header1

 Thanks for your help.

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


Re: [PHP] DOMXML html_dump_mem question

2004-10-22 Thread Christian Stocker
On Fri, 22 Oct 2004 10:44:48 +0200, franco bevilacqua
[EMAIL PROTECTED] wrote:
 Christian Stocker wrote:
  On Fri, 22 Oct 2004 09:07:46 +0200, franco bevilacqua
  [EMAIL PROTECTED] wrote:
 
   Hello,
 I have a question regarding the html_dump_mem function. I build an xml
 tree with HTML tags. When I dump it, I expect that my brother interpret
 HTML tag procduced by the dump. But the dump produce only a text with my
 html tag. Does someone knows how to do HTML interpretation with using
 DOMXML print
 
 The following example explains exactly what whant to do.
 (Inspired from html_dump_mem example )
 
 
  I see nothing wrong with the output, what exactly did you expect?
 I expect to have the text This is the title printed as H1 by the
 brother, ( without the tags around the text ). I want that the brother
 interpret the dumped text as html and not as text. Do you have an idea
 to do that ?

Aaah, brother == printer ;)

No, that's not possible. PHP doesn't have a built in HTML renderer ...

chregu

 Thanks
 
 
 
  chregu
 
 ?php
 
 // Creates the document
 $doc = domxml_new_doc(1.0);
 
 $root = $doc-create_element(html);
 $root = $doc-append_child($root);
 
 $body = $doc-create_element(body);
 $body = $root-append_child($head);
 
 $h1 = $doc-create_element(h1);
 $h1 = $head-append_child($h1);
 
 $text = $doc-create_text_node(This is the header1);
 $text = $title-append_child($text);
 
 echo $doc-html_dump_mem();
 
 ?
 The following dump is produced:
 
 htmlbodyh1This is the title/h1/body/html
 
 But I expect the following result:
 
 This is the title : formated as HTML header1
 
 Thanks for your help.
 
 Best regards
 Franco
 
 --
 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
 
 


-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
http://www.bitflux.ch  |  [EMAIL PROTECTED]  |  gnupg-keyid 0x5CE1DECB

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



[PHP] PHP CLI Forking Problem

2004-10-22 Thread John McKerrell
Hi,
   We've got a script setup that forks a number of child processes,
using pcntl_fork. When a child finishes we capture the SIGCHLD, do
pcntl_wait, and then fork of another child. This has worked fine in one
script but now using exactly the same forking code in another script has
resulted in problems.
   Now it seems, the child will get to the exit but the exit function
will not actually complete. I'm not sure what's likely to be causing
this, I was wondering if the child was waiting for the parent to finish
with resources perhaps? But the other forking script has similar
resources setup too. I tried stracing the running child process and got
nothing out. I tried gdb on the running process and got the following:
q = p;
(gdb)
554 p = p-pListNext;
(gdb)
555 if (ht-pDestructor) {
(gdb)
556 ht-pDestructor(q-pData);
(gdb)
558 if (!q-pDataPtr  q-pData) {
(gdb)
561 pefree(q, ht-persistent);
(gdb)
555 if (ht-pDestructor) {

Basically it's looping on those commands over and over... Now I think
about it that could just be it freeing up each individual allocated bit
of memory, but I've left it running for ten minutes and the children
still didn't manage to finish. Anyone got any thoughts?
Thanks,
John McKerrell

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



RE: [PHP] Simple Time Question

2004-10-22 Thread David Robley
On Fri, 22 Oct 2004 03:51, Mike Ford wrote:

 To view the terms under which this email is distributed, please go to
 http://disclaimer.leedsmet.ac.uk/email.htm
 
 
 
 On 21 October 2004 18:01, Robert Cummings wrote:

 Believe me, I have researched this extensively -- you will find that the
 same timestamp represents all these times:
 
 12:00 1-Dec-2004 GMT (London, England)
 07:00 1-Dec-2004 -0500 (New York)
 20:30 1-Dec-2004 +0830 (Darwin, Australia)

The people in Darwin (and all the other places on Central Standard time in
Australia) will be pretty pissed off if they have to change their clocks
back an hour :-) Its GMT +0930 for NT and South Australia, except for
daylight saving time.

Cheers
-- 
David Robley

Don't hate yourself in the morning - sleep till noon.

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



[PHP] Serializing objects with protected members

2004-10-22 Thread Francisco M. Marzoa Alonso
Hi,
I'm trying to wrote my own serialization routines and I've found a 
previsible problem: protected members are not visible to my 
serialization routine. This is ok and it should be as is, but I've seen 
that PHP's serialize function have access to that members anyway, so the 
question is: Is there any kind of hack that I can use to access those 
variables from my own serialization routine?

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


Re: [PHP] Thanks but problem Again! (MySQL PHP database script PLEASE)

2004-10-22 Thread Dan McCullough
Its been awhile since I did any PHP but I would look at if you need to excape some of 
those double quote or encapsulate your sql in a single quote.

Sugimoto [EMAIL PROTECTED] wrote:Thank you for two of you. Im amazed how quick the 
replys were. Very pleased.
When I simply inserted the PHP sentense, it worked.
But as I turned off register_globals,
and changed as Matthew suggested, it looked like this:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in c:\apache\htdocs\momatlib\gen_search1.php on line 49
Records Available

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in c:\apache\htdocs\momatlib\gen_search1.php on line 52
BTW

When I added this (or die(Bad query: .mysql_error()); ) in this part
($result = mysql_query...)

Ive got this.

Bad query: You have an error in your SQL syntax near 'and Tit like and Aut
like and Auty like ' at line 4



Oh NO! Whats wrong with the script??

Any mistype or anything else? Or am I just stupid?

Arigato thank you.

Sugimoto

--










ID
Volume
Date
Title
Author
Page
Page
Image


mysql_connect(localhost,root,love);
mysql_select_db(gendai);
if (empty($_GET[go]) 
empty($_GET[dt]) 
empty($_GET[ti]) 
empty($_GET[au]) 
empty($_GET[ay])) {
echo 'Please type something';
}
elseif ($_GET[go] == % |
$_GET[dt] == % |
$_GET[ti] == % |
$_GET[au] == % |
$_GET[ay] == %) {
echo 'Not Valid';
}
else {
foreach ($_GET as $value) {
if (empty($value)) $value = %;
}

$result = mysql_query(select * from gen_table
where GO like .$_GET[go].
and ym like .$_GET[dt].
and Tit like .$_GET[ti].
and Aut like .$_GET[au].
and Auty like .$_GET[ay].);

$rows = mysql_num_rows($result);
echo $rows Records Available
;

while($row = mysql_fetch_array($result)){
?


?
?







.pdfpdf



}

}
?




--

HTML file here










Search FieldsInput Valuealign=centertips
ID [input] maxlength= 10

Volume [input] 10 maxlength= 10

Date [input] maxlength= 10

Title [input] maxlength=60

Author [input] maxlength=60

Yomi [input] maxlength=60

Search Another
Way








 [input] 
 [input] 






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





Theres no such thing as a problem unless the servers are on fire!


-
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.

RE: [PHP] Simple Time Question

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



On 22 October 2004 11:53, David Robley wrote:

 On Fri, 22 Oct 2004 03:51, Mike Ford wrote:
 
  To view the terms under which this email is distributed, please go
  to http://disclaimer.leedsmet.ac.uk/email.htm
  
  
  
  On 21 October 2004 18:01, Robert Cummings wrote:
 
  Believe me, I have researched this extensively -- you will find
  that the same timestamp represents all these times:
  
  12:00 1-Dec-2004 GMT (London, England)
  07:00 1-Dec-2004 -0500 (New York)
  20:30 1-Dec-2004 +0830 (Darwin, Australia)
 
 The people in Darwin (and all the other places on Central
 Standard time in
 Australia) will be pretty pissed off if they have to change
 their clocks
 back an hour :-) Its GMT +0930 for NT and South Australia, except for
 daylight saving time. 

Yes, I realised that after I'd gone home last night.  I've had to be able to
calculate that one correctly since my sister moved there (15 years or so
ago), so I can't imagine why I would have got it wrong on this occasion...
;(  My only, somewhat feeble, excuse is that it's +8.5 right now, and I must
have failed to allow properly for the intervening DST change.

She'd certainly be pissed off if I phoned her at 06:30 local instead of
07:30!

Cheers!

Mike

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

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



[PHP] Multiple permisions, different sessions.

2004-10-22 Thread Pablo D Marotta
Hi, I´m developing an intranet on Apache-PHP-Mssql.
I need to know if there´s any way of managing users to have access to specific
areas inside my site, and at the same time, managing other users, giving them
permision to acces other areas only, because all of the codes and information
I´ve found (at least for Windows), simply give permission to acces and pass
the login screen, but don´t limitate the users navigation priviledges.
Thanks in advance!

Paul from Argentina.



American Express made the following
 annotations on 10/22/04 06:06:01
--
**

 This message and any attachments are solely for the intended recipient and may 
contain confidential or privileged information. If you are not the intended recipient, 
any disclosure, copying, use, or distribution of the information included in this 
message and any attachments is prohibited.  If you have received this communication in 
error, please notify us by reply e-mail and immediately and permanently delete this 
message and any attachments.  Thank you.

**

==

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



Re: [PHP] Thanks but problem Again! (MySQL PHP database script PLEASE)

2004-10-22 Thread Ramil Sagum
sorry, M. Sokolewicz, everyone, reposting in english :)
(previous post had some japanese text.)



Arigato thank you.

It was my pleasure.


This is your problem:

 Bad query: You have an error in your SQL syntax near 'and Tit like and Aut
 like and Auty like ' at line 4

The SQL query you formed may have an invalid syntax.  Because of this,
$result does not contain a valid resource. Of course, subsequent 
operations using $result will produce errors:

 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result...
 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result


What you can do is to debug first your SQL statement:

$sql = select * from gen_table   where GO like . $_GET[go].
   and ym like . $_GET[dt] .
  and Tit like .$_GET[ti]. .
  and Aut like .$_GET[au].
 and Auty like .$_GET[ay];

//print_r() and var_dump() functions are very helpful in debugging in PHP!
print_r($sql);  //show the SQL statement, (remove this when everything
is working)

$result = mysql_query($sql);



//add this code to check for $result's validity
if($result) {
   // do some error handling here
}

As the manual says, mysql_query returns a false when the statement is
invalid. Take a loot at  http://www.php.net/mysql_query , 
http://www.php.net/mysql_error , and http://www.php.net/mysql_errno
for more details on error handling.




---

ramil
http://ramil.sagum.net/blog

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



Re: [PHP] Multiple permisions, different sessions.

2004-10-22 Thread Brian V Bonini
On Fri, 2004-10-22 at 09:05, Pablo D Marotta wrote:
 Hi, I´m developing an intranet on Apache-PHP-Mssql.
 I need to know if there´s any way of managing users to have access to specific
 areas inside my site, and at the same time, managing other users, giving them
 permision to acces other areas only, because all of the codes and information
 I´ve found (at least for Windows), simply give permission to acces and pass
 the login screen, but don´t limitate the users navigation priviledges.
 Thanks in advance!

Assigning user levels that are stored in the db along with their other
user info comes to mind. Then you could just use if($usr_level == 'xx')
or something similar throughout the site.


-- 

s/:-[(/]/:-)/g


BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org
aGEhIGJldCB5b3UgdGhpbmsgeW91IHByZXR0eSBzbGljayBmb3IgZmlndXJpbmcgb3V0I
GhvdyB0byBkZWNvZGUgdGhpcy4gVG9vIGJhZCBpdCBoYXMgbm8gc2VjcmV0IGluZm8gaW
4gaXQgaGV5Pwo=

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



RE: [PHP] Re-compiling PHP

2004-10-22 Thread Mike R

 On Thu, 2004-10-21 at 16:05 -0400, Mike R wrote:
   On Thu, 21 Oct 2004 15:35:09 -0400, Mike R
   [EMAIL PROTECTED] wrote:
Even after re-compiling with the location of the mysql 
 headers, it still
won't work. :\
   
Pretty discouraging.  What version of PHP did they start 
 dropping the
libraries?  Maybe I need to just upgrade to that version..
  
   What does the --with-mysql portion of your ./configure 
 command look like?
  
   Do you actually have any files on your system named libmysql* ?  A
   quick check on two systems I have access to, Suse 9.1 and Debain
   Sarge, they are in the same place: /usr/lib/libmysqlclient*.  that
   means I would have installed PHP like --with-mysql=/usr .
  
   How is your MySQL installed?  From RPMs?  If so do you have the MySQL
   development RPMs installed?  What OS are you running?
  
  Redhat 7.3, I believe MySQL was installed with an RPM.  No, I 
 don't have any
  development RPMs installed.  Should I maybe recompile MySQL first?
  
  Thanks,
  
  -Mike
 
 find the mysql-devel package that matches the version you are running.
 
 tip: download apt from freshrpms.net
 
 http://ftp.freshrpms.net/pub/freshrpms/redhat/7.3/apt/
 
 install the rpm for apt... then run:
 apt-get update
 apt-get install mysql mysql-devel


This is what I got when I did that:

mysql is already the newest version.
mysql-devel is already the newest version.
0 packages upgraded, 0 newly installed, 0 removed and 75 not upgraded.

?

:\

-Mike
 

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



Re: [PHP] DOMXML html_dump_mem question

2004-10-22 Thread franco bevilacqua
Christian Stocker wrote:
On Fri, 22 Oct 2004 10:44:48 +0200, franco bevilacqua
[EMAIL PROTECTED] wrote:
Christian Stocker wrote:
On Fri, 22 Oct 2004 09:07:46 +0200, franco bevilacqua
[EMAIL PROTECTED] wrote:

Hello,
I have a question regarding the html_dump_mem function. I build an xml
tree with HTML tags. When I dump it, I expect that my brother interpret
HTML tag procduced by the dump. But the dump produce only a text with my
html tag. Does someone knows how to do HTML interpretation with using
DOMXML print
The following example explains exactly what whant to do.
(Inspired from html_dump_mem example )

I see nothing wrong with the output, what exactly did you expect?
I expect to have the text This is the title printed as H1 by the
brother, ( without the tags around the text ). I want that the brother
interpret the dumped text as html and not as text. Do you have an idea
to do that ?

Aaah, brother == printer ;)
Sorry for my english but print in this context means displayed by the 
brother...
How can I do the XML DOM tree printing ( ie displaying in brother ) as 
an HTML page. One solution should consist to save the XML DOM tree in a 
file, and then load it into the browser, but I think that is too heavy, 
do you have an other idea ?
Thanks
No, that's not possible. PHP doesn't have a built in HTML renderer ...
chregu

Thanks

chregu

?php
// Creates the document
$doc = domxml_new_doc(1.0);
$root = $doc-create_element(html);
$root = $doc-append_child($root);
$body = $doc-create_element(body);
$body = $root-append_child($head);
$h1 = $doc-create_element(h1);
$h1 = $head-append_child($h1);
$text = $doc-create_text_node(This is the header1);
$text = $title-append_child($text);
echo $doc-html_dump_mem();
?
The following dump is produced:
htmlbodyh1This is the title/h1/body/html
But I expect the following result:
This is the title : formated as HTML header1
Thanks for your help.
Best regards
Franco
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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



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


Re: [PHP] Multiple permisions, different sessions.

2004-10-22 Thread Silvio Porcellana
Hi Pablo
it really depends on what you want to do.
I mean, if you want a hierarchy of users (like: guest, normal, administrator, root) or you 
wnat to limit certain users to an area of your site and certain others to another area 
(no hierarchy here, just fences).

Anyway, in both cases I suggest you to check at the beginning of every script of the users 
is allowed on that page.
What differs is *how* you decide if the user is allowed on the page:
- for a hierarchy-based system, you could assing a number to every users (guest: 100; 
normal: 1000; administrator: 1; root: 10) and compare this number with the access 
number of your page (saying for example that your orders.php can only be accessed by 
users = 1, so only administrators and root)
- for fences, what I would suggest is to create groups, assing users to these groups 
(based on what they can see) and then check at the top of your PHP page if the current 
user belongs to an allowed group.

Obviously I made it quite simple here and there could be other twists to this thing (we 
are talking about a read-only system, but you could specify also edit permissions, kinda 
like the ones you have on files on Linux): anyway, I hope it helped a bit.

Silvio Porcellana
Pablo D Marotta wrote:
Hi, I´m developing an intranet on Apache-PHP-Mssql.
I need to know if there´s any way of managing users to have access to specific
areas inside my site, and at the same time, managing other users, giving them
permision to acces other areas only, because all of the codes and information
I´ve found (at least for Windows), simply give permission to acces and pass
the login screen, but don´t limitate the users navigation priviledges.
Thanks in advance!
Paul from Argentina.

American Express made the following
 annotations on 10/22/04 06:06:01
--
**
 This message and any attachments are solely for the intended recipient and may 
contain confidential or privileged information. If you are not the intended recipient, any 
disclosure, copying, use, or distribution of the information included in this message and any 
attachments is prohibited.  If you have received this communication in error, please notify us 
by reply e-mail and immediately and permanently delete this message and any attachments.  Thank 
you.
**
==
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Question: Simpler loop

2004-10-22 Thread Stuart Felenstein
I have rows of input fields
Each row contains 3 fields.  The user must fill out
the entire row (all 3 fields) for things to work
right. 

I want to generate an error in case they have only
filled in 1 or 2 of the boxes.

Thinking I might use something like this:

foreach($skills as $key = $skill)

{
if ($skill != ''  $skys[$key] = '' 
$slus[$key] = '')
{

}else if{
if ($skill = ''  $skys[$key] != '' 
$slus[$key] = '')

}else{
if ($skill = ''  $skys[$key] = ''  $slus[$key]
!= '')

. above only takes into account that 1 of that 3
has been filled in.  I would need another set to take
into account if 2 of the 3 have been filled in.

Is there a simpler way / shorter way to check
conditions to do this ?

Stuart

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



Re: [PHP] Question: Simpler loop

2004-10-22 Thread Marek Kilimajer
Stuart Felenstein wrote:
I have rows of input fields
Each row contains 3 fields.  The user must fill out
the entire row (all 3 fields) for things to work
right. 

I want to generate an error in case they have only
filled in 1 or 2 of the boxes.
Thinking I might use something like this:
foreach($skills as $key = $skill)
{
if ($skill != ''  $skys[$key] = '' 
$slus[$key] = '')
{
}else if{
if ($skill = ''  $skys[$key] != '' 
$slus[$key] = '')
BEWARE -  single equal sign assigns right operand to the left one, you 
need doulble, which compares and returns either false or true.

}else{
if ($skill = ''  $skys[$key] = ''  $slus[$key]
!= '')
. above only takes into account that 1 of that 3
has been filled in.  I would need another set to take
into account if 2 of the 3 have been filled in.
Is there a simpler way / shorter way to check
conditions to do this ?
foreach($skills as $key = $skill) {
  $filled_in = 0;
  if($skill != '') $filled_in++;
  if($skys[$key] != '') $filled_in++;
  if($slus[$key] != '') $filled_in++;
   if($filled_in  2) ERROR();
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Trying to Integrate PHP 4.3.4 w/ JDK 1.5.0

2004-10-22 Thread Andrew Hauger
Thanks Raditha. Unfortunately, I am still having
problems. I am new to building extensions, and now my
problem is an error during the java extension build
process.

I got the message :

configure.in:65: error: possibly undefined macro:
AC_PROG_LIBTOOL

when I ran phpize in the ext/java directory. I'm not
sure at this point how I managed to build the
extension the first time, because now I can't build
it.

I researched this message, and I found bug report
#16552. I followed the instructions in the bug report
that said the fix was to download the latest snapshot,
but no luck. I am still getting the error.

Here's my configuration:

OS: Solaris 9 on Sparc
PHP: 4.3.10-dev (as of this morning, was 4.3.4)
automake: 1.62
autoconf: 2.53

Again, I would appreciate any useful suggestions.

--- raditha dissanayake [EMAIL PROTECTED] wrote:

 Andrew Hauger wrote:
 
 Everything compiled okay, and I think everything is
 installed in the right places. When I try to run a
 test program, I get the error:
 
 [error] PHP Fatal error: 
 java.lang.UnsatisfiedLinkError: no php_java in
 java.library.path in
 /usr/local/apache/htdocs/java_test2.php on line 5
 
 The file php_java.jar is in that directory!
   
 
 And what is that directory? :-)
 
 here is what worked for me
 http://www.raditha.com/php/java.php  i 
 originally wrote it for version 1.4.2 but use thed
 same settings with 1.5.0
 
 
   
 
 
 
 -- 
 Raditha Dissanayake.


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

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



RE: [PHP] Re-compiling PHP

2004-10-22 Thread Robby Russell
On Fri, 2004-10-22 at 09:26 -0400, Mike R wrote:

  
  find the mysql-devel package that matches the version you are running.
  
  tip: download apt from freshrpms.net
  
  http://ftp.freshrpms.net/pub/freshrpms/redhat/7.3/apt/
  
  install the rpm for apt... then run:
  apt-get update
  apt-get install mysql mysql-devel
 
 
 This is what I got when I did that:
 
 mysql is already the newest version.
 mysql-devel is already the newest version.
 0 packages upgraded, 0 newly installed, 0 removed and 75 not upgraded.

Hmm. What version of PHP are you trying to install?

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


RE: [PHP] Question: Simpler loop

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



On 22 October 2004 15:34, Stuart Felenstein wrote:

 I have rows of input fields
 Each row contains 3 fields.  The user must fill out
 the entire row (all 3 fields) for things to work
 right.
 
 I want to generate an error in case they have only
 filled in 1 or 2 of the boxes.
 
 Thinking I might use something like this:
 
 foreach($skills as $key = $skill)
 
 {
 if ($skill != ''  $skys[$key] = '' 
 $slus[$key] = '')
 {
 
   }else if{
 if ($skill = ''  $skys[$key] != '' 
 $slus[$key] = '')
 
   }else{
 if ($skill = ''  $skys[$key] = ''  $slus[$key] != '')
 
 . above only takes into account that 1 of that 3
 has been filled in.  I would need another set to take
 into account if 2 of the 3 have been filled in.
 
 Is there a simpler way / shorter way to check
 conditions to do this ?

So, the entry is valid only if all three are non-blank?

In which case:

   if ($skill!=''  $skys[$key]!=''  $slus[$key] !='')
   {
  // row is valid -- do stuff
   }
   else
   {
  // entry has at least one value blank -- issue error
   }

If you prefer to have the error path come first, simply apply deMorgan's
laws to the Boolean expression, to get:

   if ($skills=='' || $skys[$key]=='' || $slus[$key]=='')
   {
  // entry has at least one value blank -- issue error
   }
   else
   {
  // row is valid -- do stuff
   }

Cheers!

Mike

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

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



RE: [PHP] Question: Simpler loop

2004-10-22 Thread Graham Cossey
Slightly simpler:

foreach(...)
{
  $count = 0;
  if ($skill != '')
$count++;
  if ($skys[$key] != '')
$count++;
  if ($slus[$key] != '')
$count++;
  if $count  3
echo 'Invalid';
  else
echo 'Valid';
}

Graham

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 22 October 2004 15:34
 To: [EMAIL PROTECTED]
 Subject: [PHP] Question: Simpler loop 
 
 
 I have rows of input fields
 Each row contains 3 fields.  The user must fill out
 the entire row (all 3 fields) for things to work
 right. 
 
 I want to generate an error in case they have only
 filled in 1 or 2 of the boxes.
 
 Thinking I might use something like this:
 
 foreach($skills as $key = $skill)
 
 {
 if ($skill != ''  $skys[$key] = '' 
 $slus[$key] = '')
 {
 
   }else if{
 if ($skill = ''  $skys[$key] != '' 
 $slus[$key] = '')
 
   }else{
 if ($skill = ''  $skys[$key] = ''  $slus[$key]
 != '')
 
 . above only takes into account that 1 of that 3
 has been filled in.  I would need another set to take
 into account if 2 of the 3 have been filled in.
 
 Is there a simpler way / shorter way to check
 conditions to do this ?
 
 Stuart
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



RE: [PHP] Question: Simpler loop

2004-10-22 Thread Graham Cossey
Yep, Mike's solution is simpler.

It's getting late on Friday and the brain is starting to slow down.
(That's my excuse anyway...)

[snip]
  
  Is there a simpler way / shorter way to check
  conditions to do this ?
 
 So, the entry is valid only if all three are non-blank?
 
 In which case:
 
if ($skill!=''  $skys[$key]!=''  $slus[$key] !='')
{
   // row is valid -- do stuff
}
else
{
   // entry has at least one value blank -- issue error
}
 
 If you prefer to have the error path come first, simply apply deMorgan's
 laws to the Boolean expression, to get:
 
if ($skills=='' || $skys[$key]=='' || $slus[$key]=='')
{
   // entry has at least one value blank -- issue error
}
else
{
   // row is valid -- do stuff
}
 
 Cheers!
 
 Mike
 
[snip]

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



[PHP] adding a new property to an object instance

2004-10-22 Thread Skrol29
Hello,

It's seems to be allowed to add a new property (a member ?) to an object
instance in both PHP 4 and 5.
For example:
**
class Test {
  var $Prop1 = 'anything';
}
$MyObj = new Test;
$MyObj-Prop2 = 'hello';
**

But I can't found any documentation saying that it's offcially supported or
not.
Do you have any information about this ?
Do you often use added properties ?

-
Skrol29
www.tinybutstrong.com
-

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



Re: [PHP] Trying to Integrate PHP 4.3.4 w/ JDK 1.5.0

2004-10-22 Thread raditha dissanayake
Andrew Hauger wrote:
Thanks Raditha. Unfortunately, I am still having
problems. I am new to building extensions, and now my
problem is an error during the java extension build
process.
I got the message :
configure.in:65: error: possibly undefined macro:
AC_PROG_LIBTOOL
 

Sorry haven't seen this particular error so i will not be in a position 
to comment.

--
Raditha Dissanayake.

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


[PHP] Re: adding a new property to an object instance

2004-10-22 Thread Matthew Weier O'Phinney
* Skrol29 [EMAIL PROTECTED]:
 It's seems to be allowed to add a new property (a member ?) to an object
 instance in both PHP 4 and 5.
 For example:
 **
 class Test {
   var $Prop1 = 'anything';
 }
 $MyObj = new Test;
 $MyObj-Prop2 = 'hello';
 **

 But I can't found any documentation saying that it's offcially supported or
 not.
 Do you have any information about this ?
 Do you often use added properties ?

I know that it's allowed, but now that I look through the official docs,
I don't see where that behaviour is explicitly made clear. But yes, you
can add properties on the fly at any time -- which is why it's good to
declare any that you KNOW will be used in the class via the 'var'
declarations. That way you have at least documented that those are
reserved.

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

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



Re: [PHP] Thanks but problem Again! (MySQL PHP database script PLEASE)

2004-10-22 Thread Matthew Sims
 Thank you for two of you. Im amazed how quick the replys were. Very
 pleased.
 When I simply inserted the PHP sentense, it worked.
 But as I turned off register_globals,
 and changed as Matthew suggested, it looked like this:

 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
 resource in c:\apache\htdocs\momatlib\gen_search1.php on line 49
 Records Available

 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
 result
 resource in c:\apache\htdocs\momatlib\gen_search1.php on line 52
 BTW

 When I added this  (or die(Bad query: .mysql_error()); ) in this part
 ($result = mysql_query...)

 Ive got this.

 Bad query: You have an error in your SQL syntax near 'and Tit like and Aut
 like and Auty like ' at line 4



Ramil and Dan are probably correct. There's something not right with your
query string.

A good test to try is to run the query from the mysql prompt and
substitute the vars with actual values and see if it returns correctly.

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

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



[PHP] Serial Communication

2004-10-22 Thread Ulrik Witschass
Hello List,

I am searching information about serial communication with PHP on Windows
machines.

I want to communicate with a colorimeter via a COM-Port, using a PHP-GTK
application.

Can anybody point me into the right direction (a webpage, a PHP
class/function, a PHP-GTK list) where I can find infos about this? I
searched the web for some hours now but didn't find anything worthy.

Any help is greatly appreciated!

thanks in advance!

best regards

Ulrik Witschass


RE: [PHP] Question: Simpler loop

2004-10-22 Thread Stuart Felenstein
Yes, I think that will work, as soon as I can figure
out where on the page it should go.  On error should
post to itself, on success it moves to next page. 
I put the loop on top and am getting an invalid
argument for the foreach.

Stuart
--- Ford, Mike [EMAIL PROTECTED] wrote:

 In which case:
 
if ($skill!=''  $skys[$key]!=''  $slus[$key]
 !='')
{
   // row is valid -- do stuff
}
else
{
   // entry has at least one value blank -- issue
 error
}
 

 Cheers!
 
 Mike
 

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

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



Re: [PHP] Serial Communication

2004-10-22 Thread Greg Donald
On Fri, 22 Oct 2004 18:11:43 +0200, Ulrik Witschass [EMAIL PROTECTED] wrote:
 Hello List,
 
 I am searching information about serial communication with PHP on Windows
 machines.

There's a simple example on this page:
http://www.php.net/function.fopen

Search for 'SERIAL'.


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

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



Re: [PHP] Serial Communication

2004-10-22 Thread Marek Kilimajer
Ulrik Witschass wrote:
Hello List,
I am searching information about serial communication with PHP on Windows
machines.
I want to communicate with a colorimeter via a COM-Port, using a PHP-GTK
application.
Can anybody point me into the right direction (a webpage, a PHP
class/function, a PHP-GTK list) where I can find infos about this? I
searched the web for some hours now but didn't find anything worthy.
Any help is greatly appreciated!
Check out http://pecl.php.net/WinBinder
Maybe there is a COM (common object model) interface, I don't know. In 
that case you could use http://www.php.net/com. Look at msdn.microsoft.com

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


Re: [PHP] Serial Communication

2004-10-22 Thread M. Sokolewicz
You can also use the DIO extension (built-in as of PHP 5.0.0).
using dio_open, dio_read, dio_write and dio_close you can do a lot of 
magical things ;)

http://www.php.net/manual/en/ref.dio.php
Greg Donald wrote:
On Fri, 22 Oct 2004 18:11:43 +0200, Ulrik Witschass [EMAIL PROTECTED] wrote:
Hello List,
I am searching information about serial communication with PHP on Windows
machines.

There's a simple example on this page:
http://www.php.net/function.fopen
Search for 'SERIAL'.

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


[PHP] Looping through results of pg_meta_data()

2004-10-22 Thread Ken Tozier
I'm trying to build an html table using the results from pg_meta_data() 
but none of the access functions seem to work. I am getting results but 
just can't seem to do anything with them.

Here's what I'm using to verify that results are being returned:
$connstring = dbname=pub_status user=postgres host=localhost 
port=5432;
$db = pg_connect($connstring);
$meta = pg_meta_data($db, 'table_definitions');
echo 'pre';
var_dump($meta);
echo '/pre';

Which yeilds:
array(2) {
  [field_id]=
  array(5) {
[num]=
int(1)
[type]=
string(4) int8
[len]=
int(8)
[not null]=
bool(true)
[has default]=
bool(true)
  }
  [field_name]=
  array(5) {
[num]=
int(2)
[type]=
string(4) text
[len]=
int(-1)
[not null]=
bool(true)
[has default]=
bool(false)
  }
}
But none of these seem to do anything:
$row_count = pg_num_rows($meta);
echo $row_count;
- result a blank web page
$row = pg_fetch_row($meta, 0);
echo $row;
- result a blank web page
$row = pg_fetch_array($meta, 0);
echo $row;
- result a blank web page
$row = pg_fetch_object($meta, 0);
echo $row;
- result a blank web page
What am I doing wrong?
Thanks for any help,
Ken
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] RE: Redirect - was Question: Simpler loop

2004-10-22 Thread Stuart Felenstein
I put the loop at the top of the next page, before any
output to the browser:

?php


if ($skill!=''  $skys[$key]!=''  $slus[$key] !='')
   {
  // row is valid -- do stuff
   }
   else
   {
   header(Location:
http://www.2soon2show.com/TestMulti4a.php; );
   print You have errors;
   }
  }
?

Before I added the redirect the print worked (and yes
it doesn't belong in that part of the loop)
Now the redirect is working , but the print isn't.
Do I do an exit first, then the redirect and print ?

Stuart

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



[PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
I'm not quite sure how to get an error message to
print out after a redirect.  I know it's possible.
Now page1 moves to page2, check below is on page2
If I leave it on page2 (without redirect), it prints
error to user fine.  Once it redirects no print.  
I also tried leaving it on form1, at the top it won't
work, since the variables haven't been set yet.  
Not sure how to let it post form 1 to form 1 check and
then on success move to form 2.



 {
  // valid - next -
   }
   else
   {
header(Location: http://www.xx.com/page1.php;
);
print You have errors;
exit;
   }
  
  }
?

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



RE: [PHP] Redirect then error message to user

2004-10-22 Thread Jay Blanchard
[snip]
   {
header(Location: http://www.xx.com/page1.php;
);
print You have errors;
exit;
   }
  
  }
[/snip]

You either need to carry info about the error in a session variable or
url string or something...above your redirect happens before any error
can be sent to the browser

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



RE: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
Now why didn't I think of that ! Thank you Jay!

Stuart
--- Jay Blanchard
[EMAIL PROTECTED] wrote:

 [snip]
{
 header(Location:
 http://www.xx.com/page1.php;
 );
 print You have errors;
 exit;
}
   
   }
 [/snip]
 
 You either need to carry info about the error in a
 session variable or
 url string or something...above your redirect
 happens before any error
 can be sent to the browser
 

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



Re: [PHP] Redirect then error message to user

2004-10-22 Thread Jason Wong
On Saturday 23 October 2004 01:25, Stuart Felenstein wrote:
 I'm not quite sure how to get an error message to
 print out after a redirect.  I know it's possible.

It's not possible. Think about it. How *can* you print something out when 
you've already told the browser to go somewhere else? BTW you ought to have 
an exit statement after the header() statement, some browsers will get 
confused if you continue printing stuff after a redirect.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Hey, diddle, diddle the overflow pdl
To get a little more stack;
If that's not enough then you lose it all
And have to pop all the way back.
*/

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



[PHP] COPY with PostgreSQL

2004-10-22 Thread Robert Fitzpatrick
I am using COPY for PostgreSQL and having problems now that the incoming
file contains more than approx 1500 lines. Is this an issue anyone is
aware of? Lot's of files over 1000 lines have worked fine, but after
getting a file over 1800 I began having problems. I have broke the file
down to a approx. 1500 line that works sometimes and not others. Here is
a snippet of what I'm trying to do:
 
  $result = pg_exec($dbh, COPY tblxrf FROM stdin USING DELIMITERS
',');
  fseek($temp_fh,0); // go to beginning of temp file
  while (($csv_line = fgets($temp_fh,1024))) {
   pg_put_line($dbh, $csv_line);
  }
  $stat = pg_put_line($dbh, \\.\n); // notify db finished or report
error
  if (!$stat) { echo ERROR: An error has occurred while putting last
line of copy databr\n; exit; }
  $stat = pg_end_copy($dbh); // post (sync data) or report error

The process just hangs with the large number of lines, I have to kill
the COPY process for postgresql on the server before trying again.
 
--
Robert

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



RE: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
This isn't working: 
Page2 (after page1 has been posted):

   else
   {
  $_SESSION['er'] = 'Please make sure to fill in all 3
corresponding values .';
header(Location:
http://www.x.com/TestMulti4a.php; );
exit;
   }
  
  }

Page1:
Opening after session_start

$_SESSION['er'] = $_POST['er'];

Then below in form area:

print $er; (tried also echo)

Am I do something wrong ?

Stuart

--- Jay Blanchard
[EMAIL PROTECTED] wrote:

 [snip]
{
 header(Location:
 http://www.xx.com/page1.php;
 );
 print You have errors;
 exit;
}
   
   }
 [/snip]
 
 You either need to carry info about the error in a
 session variable or
 url string or something...above your redirect
 happens before any error
 can be sent to the browser
 

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



[PHP] currency

2004-10-22 Thread Perry, Matthew (Fire Marshal's Office)
What is the best way to output 38884 as $38,884.00?



Re: [PHP] currency

2004-10-22 Thread Marek Kilimajer
Perry, Matthew (Fire Marshal's Office) wrote:
What is the best way to output 38884 as $38,884.00?

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


[PHP] $_FILES Not Populating On File Upload

2004-10-22 Thread ApexEleven
I've googled the question and found no answer that has fixed my
problem. I also searched this list to try and find the answer to no
avail.

My problem is that after my form submits data to another script the
$_FILES global returns nothing but array() when I try to print_r()
it. I coppied the scripts directly from one server to another. Here is
a sample of my form:
[snippet]

form action=dbt.php method=post name=form1 id=form1
enctype=multipart/form-data

input type=file name=file

input type=submit name=Submit value=Upload
input name=upload type=hidden id=upload value=true

/form

[/snippet]
All I could find was some posts saying that some php.ini settings
needed to be set correctly, and I believe they are on the server I'm
trying to run my script on.

file_uploads=On
max_execution_time=90
max_input_time=-1
memory_limit=8M
post_max_size=10M
register_globals=On
upload_max_filesize=10M
upload_tmp_dir=/tmp

NOTE: I got all those values off my phpinfo().

I have had this problem before but do not know how it got fixed, any
help would be much appreciated,

-- 

Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
---

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



Re: [PHP] currency

2004-10-22 Thread John Nichel
Perry, Matthew (Fire Marshal's Office) wrote:
What is the best way to output 38884 as $38,884.00?

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


Re: [PHP] currency

2004-10-22 Thread Matt M.
  What is the best way to output 38884 as $38,884.00?
 
 
 
 number_format()


or http://us2.php.net/money_format

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



RE: [PHP] COPY with PostgreSQL

2004-10-22 Thread Jay Blanchard
[snip]
I am using COPY for PostgreSQL and having problems...
[/snip]

So, is this a PHP problem, or a PostgreSQL problem?

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



Re: [PHP] COPY with PostgreSQL

2004-10-22 Thread John Nichel
Jay Blanchard wrote:
[snip]
I am using COPY for PostgreSQL and having problems...
[/snip]
So, is this a PHP problem, or a PostgreSQL problem?
Why does it matter???  Just answer the ding-dang question. ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Redirect then error message to user

2004-10-22 Thread Jason Wong
On Saturday 23 October 2004 02:38, Stuart Felenstein wrote:
 This isn't working:
 Page2 (after page1 has been posted):

else
{
   $_SESSION['er'] = 'Please make sure to fill in all 3
 corresponding values .';

If you want keep changes to any session variables (so that they're available 
on subsequent pages) you need to:

  session_write_close()

before you redirect.

 header(Location:
 http://www.x.com/TestMulti4a.php; );
 exit;
}

   }

 Page1:
 Opening after session_start

 $_SESSION['er'] = $_POST['er'];

 Then below in form area:

 print $er; (tried also echo)

 Am I do something wrong ?

What are you trying to do here?
Is 'Page1' == TestMulti4a.php?
Are you trying to display $_SESSION['er'] as set in Page2?
If so why are you assigning $_POST['er'] to $_SESSION['er']? All you need to 
do is echo $_SESSION['er'].

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
A witty saying proves nothing.
-- Voltaire
*/

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



RE: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
Sorry, all fixed now! 

Thank you for the help!

Stuart

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



RE: [PHP] COPY with PostgreSQL

2004-10-22 Thread Jay Blanchard
[snip]
Why does it matter???  Just answer the ding-dang question. ;)
[/snip]


Easy there Kemosabe', someone might mistake you for someone who wants to
help!

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



Re: [PHP] COPY with PostgreSQL

2004-10-22 Thread John Nichel
Jay Blanchard wrote:
[snip]
Why does it matter???  Just answer the ding-dang question. ;)
[/snip]
Easy there Kemosabe', someone might mistake you for someone who wants to
help!
*goes back to lurking*
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] COPY with PostgreSQL

2004-10-22 Thread Greg Donald
On Fri, 22 Oct 2004 14:34:39 -0400, Robert Fitzpatrick
[EMAIL PROTECTED] wrote:
 I am using COPY for PostgreSQL and having problems now that the incoming
 file contains more than approx 1500 lines. Is this an issue anyone is
 aware of? Lot's of files over 1000 lines have worked fine, but after
 getting a file over 1800 I began having problems. I have broke the file
 down to a approx. 1500 line that works sometimes and not others. Here is
 a snippet of what I'm trying to do:
 
   $result = pg_exec($dbh, COPY tblxrf FROM stdin USING DELIMITERS
 ',');

You might try COPY BINARY here in case you have some stray non-escaped
characters.


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

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



Re: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
See below:
--- Jason Wong [EMAIL PROTECTED] wrote:


 What are you trying to do here?
 Is 'Page1' == TestMulti4a.php?
 Are you trying to display $_SESSION['er'] as set in
 Page2?
 If so why are you assigning $_POST['er'] to
 $_SESSION['er']? All you need to 
 do is echo $_SESSION['er'].
 

Yes Page1 - TestMulti4a
So slightly changed and I thought it was working,
seems TestMulti4a (page1) displays the error when I go
to it directly (before input)

So on Page2 I have:
else
   {
   $_SESSION['oops'] = Use all 3 fields to set a
skill;
  header(Location:
http://www.lurkingforwork.com/TestMulti4a.php; );
exit;
   }
  
Page1:
?php print $_SESSION['oops'] ?

I even logged out of the session, thinking I was now
carrying it through the session. 

Stuart



 
 Jason Wong - Gremlins Associates -
 www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet
 Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 A witty saying proves nothing.
   -- Voltaire
 */
 
 -- 
 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] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
The only problem I'm having here is that if a user
goes backwards, the error from the session variable
will show up.  I put an unset $.. underneath the
echo but that seems to have no effect.


Stuart
--- Stuart Felenstein [EMAIL PROTECTED] wrote:

 See below:
 --- Jason Wong [EMAIL PROTECTED] wrote:
 
 
  What are you trying to do here?
  Is 'Page1' == TestMulti4a.php?
  Are you trying to display $_SESSION['er'] as set
 in
  Page2?
  If so why are you assigning $_POST['er'] to
  $_SESSION['er']? All you need to 
  do is echo $_SESSION['er'].
  
 
 Yes Page1 - TestMulti4a
 So slightly changed and I thought it was working,
 seems TestMulti4a (page1) displays the error when I
 go
 to it directly (before input)
 
 So on Page2 I have:
 else
{
$_SESSION['oops'] = Use all 3 fields to set a
 skill;
   header(Location:
 http://www.lurkingforwork.com/TestMulti4a.php; );
 exit;
}
   
 Page1:
 ?php print $_SESSION['oops'] ?
 
 I even logged out of the session, thinking I was now
 carrying it through the session. 
 
 Stuart
 
 
 
  
  Jason Wong - Gremlins Associates -
  www.gremlins.biz
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet
  Applications Development *
  --
  Search the list archives before you post
  http://marc.theaimsgroup.com/?l=php-general
  --
  /*
  A witty saying proves nothing.
  -- Voltaire
  */
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit:
 http://www.php.net/unsub.php
  
  
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] Redirect then error message to user

2004-10-22 Thread Brent Baisley
You can pass the error in the redirect URL:
header(Location: http://www.xx.com/page1.php?errmsg=You missed 
some stuff)

On your main page you just check if there is an errmsg to be displayed:
if(isset($_GET['errmsg'])) {
echo $_GET['errmsg'];
}
That a simplified version obviously. But that's the concept.
I design all my pages so that one file handles display, edit, 
validation and save. Then I don't have to worry about going back and 
forth between pages, doing redirects or retaining data through session 
variables. Most important, the user doesn't lose what they already 
entered just because they missed a field.

On Oct 22, 2004, at 3:58 PM, Stuart Felenstein wrote:
The only problem I'm having here is that if a user
goes backwards, the error from the session variable
will show up.  I put an unset $.. underneath the
echo but that seems to have no effect.
Stuart
--- Stuart Felenstein [EMAIL PROTECTED] wrote:
See below:
--- Jason Wong [EMAIL PROTECTED] wrote:

What are you trying to do here?
Is 'Page1' == TestMulti4a.php?
Are you trying to display $_SESSION['er'] as set
in
Page2?
If so why are you assigning $_POST['er'] to
$_SESSION['er']? All you need to
do is echo $_SESSION['er'].
Yes Page1 - TestMulti4a
So slightly changed and I thought it was working,
seems TestMulti4a (page1) displays the error when I
go
to it directly (before input)
So on Page2 I have:
else
   {
   $_SESSION['oops'] = Use all 3 fields to set a
skill;
  header(Location:
http://www.lurkingforwork.com/TestMulti4a.php; );
exit;
   }
Page1:
?php print $_SESSION['oops'] ?
I even logged out of the session, thinking I was now
carrying it through the session.
Stuart


Jason Wong - Gremlins Associates -
www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet
Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
A witty saying proves nothing.
-- Voltaire
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
http://www.php.net/unsub.php

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

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

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


Re: [PHP] Redirect then error message to user

2004-10-22 Thread Stuart Felenstein
Brent - Thank you I will try that method.

Can you elaborate more on below. I take it to mean you
have one page/script that your pages are going to do
all the checks.  

This form is 5 pages long.  So I chose session
variables just to keep it neat and maybe, more
secure.  

Stuart
--- Brent Baisley [EMAIL PROTECTED] wrote:

 I design all my pages so that one file handles
 display, edit, 
 validation and save. Then I don't have to worry
 about going back and 
 forth between pages, doing redirects or retaining
 data through session 
 variables. Most important, the user doesn't lose
 what they already 
 entered just because they missed a field.
 

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



AW: [PHP] Serial Communication

2004-10-22 Thread Ulrik Witschass
Thanks for the many great replies, since at the moment the project is based
on PHP4, I will try if the filesystem functions provide what I need. Opening
the port and sending doesn't seem to be a problem, I'll try it out tonight.

If for some reason it doesnt provide the functionality I need, I will take a
closer look at migrating to PHP 5 (which shouldn't be a problem) and using
the DIO functions.

Thanx to everybody for the help they provided!

best regards

Ulrik

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



RE: [PHP] COPY with PostgreSQL

2004-10-22 Thread Robert Fitzpatrick
On Fri, 2004-10-22 at 14:55, Jay Blanchard wrote:
 [snip]
 I am using COPY for PostgreSQL and having problems...
 [/snip]
 
 So, is this a PHP problem, or a PostgreSQL problem?

If I took the file it is trying to COPY into PostgreSQL and psql to
bring it in on the server directly, no issues.

Seems to be a PHP problem, at least with the pg libraries. I finally,
after trying many things have gotten this to work with the large files.
I found, if I issue a pg_connection_busy($dbh) before the
pg_put_line(...) in the while statement processing the lines of the temp
file handle, it works. Don't ask me why, that is what I'd like to know.
If I report back if busy is true, I get nothing. Maybe it is just giving
a millisecond to breathe or something while checking to see if the
connection is busy. But with that one line, all is well.

-- 
Robert

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



Re: [PHP] $_FILES Not Populating On File Upload

2004-10-22 Thread Rick Fletcher
ApexEleven wrote:
I've googled the question and found no answer that has fixed my
problem. I also searched this list to try and find the answer to no
avail.
My problem is that after my form submits data to another script the
$_FILES global returns nothing but array() when I try to print_r()
it. 
[snip]
upload_tmp_dir=/tmp
Check to make sure the server has permission to write to /tmp.  I just 
took away write permission to my upload_tmp_dir and tested this scenario 
on my machine, and it behaved the way you're describing.

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


[PHP] Customer is looking for packages as follows

2004-10-22 Thread The Doctor
A customer of mine is looking for the below package/requirements 
on a BSD/OS 4.3.1 running apache-ssl with perl 5.8.5 and php 4.3.9


Sorry for the delay getting back to you. Here are the requirements:

1. Form Content Security. (FormmailEncoder/Decoder)

As I understand it, on a secure website the content of a submitted form is
protected by SSL from the submitter to the server. The purpose of this
software is to protect the information while it travels as an e-mail from
your server to the client's computer. There seems to be plenty of
e-mail-to-email encryption software around, but this was to only
*form*-to-Email package I could find. Anything you find that will achieve
this goal is acceptable. 

2. Newsletter. (NewsLetterPro) We're looking for a high-end package here.
The requirements are:

- double opt-in
- double-opt out
- browser-based administration (sending, viewing lists , etc.)
- built-in HTML editor for creating newsletters
- ability to import and export mailing lists
- supports text and HTML formats, lets user choose
- free tech support
- full user tracking and reporting (who opens them, who unsubscribes, etc.)
- bounce filters (removes from list after X bounces)
- ability to schedule deliveries
- can collect information (name etc) when the user subscribes, and use it
to personalize emails
- database is fully secure

The only other package I found that could do all this was .asp...


If you can find alternatives that fully meet the objectives, great. I
expect to use these elements (appropriately licensed, of course) on other
sites in the future, so taking the time to get trouble-free packages now
will enhance the experience for both your customers and mine.

Thanks for your work on this.

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



RE: [PHP] Redirect then error message to user

2004-10-22 Thread Graham Cossey
I think what Brent is suggesting is a single script that will handle the
display and processing of all 5 form 'pages'. The code below is just to give
an idea of how I think the 'flow' could go, don't go copying the code and
expect anything (positive) to happen !!


if(!$_POST['step'] || $_POST['step']=='0')
{
  // Display form 1 or call appropriate function/method
  if ($_SESSION['errmsg'])
echo $errmsg;

  form  action=$PHP_SELF?step=1

}
if($_POST['step']=='1')
{
  // Validate form 1 or call appropriate function/method
  if (error found) {
$errmsg = ul;
$errmsg .= li  Field One is required /li;
// etc etc
$_SESSION['errmsg'] = $errmsg;
  }
  // Not sure about the following line ??
  Header(Location: http://mysite.com/path/to/myself?step=2;);
}

if ($_POST['step']=='2')
{
  ... etc...


Graham

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 22 October 2004 21:55
 To: Brent Baisley
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Redirect then error message to user


 Brent - Thank you I will try that method.

 Can you elaborate more on below. I take it to mean you
 have one page/script that your pages are going to do
 all the checks.

 This form is 5 pages long.  So I chose session
 variables just to keep it neat and maybe, more
 secure.

 Stuart
 --- Brent Baisley [EMAIL PROTECTED] wrote:

  I design all my pages so that one file handles
  display, edit,
  validation and save. Then I don't have to worry
  about going back and
  forth between pages, doing redirects or retaining
  data through session
  variables. Most important, the user doesn't lose
  what they already
  entered just because they missed a field.
 

 --
 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] MySQL scalability...

2004-10-22 Thread John Holmes
Kevin Grigorenko wrote:
Unfortunately, for some security
issues, I cannot get to the Apache statistics for the site, so I have to
create my own solution.  
I recommend you find a better host that gives you access to the raw logs 
and/or doesn't have safe_mode on.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] MySQL scalability...

2004-10-22 Thread Kevin Grigorenko
John Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Kevin Grigorenko wrote:

  Unfortunately, for some security
  issues, I cannot get to the Apache statistics for the site, so I have to
  create my own solution.

 I recommend you find a better host that gives you access to the raw logs
 and/or doesn't have safe_mode on.


I wish it was that easy.  I'm actually a college student working on the
dean's webpage, and there is a mammoth server which hosts all of the
university's sites, and so they have put really strict restrictions.
Perhaps it is not even a problem because of safe_mode, but I have tried many
different things to try to get around it, including ini_set(), but nothing
has worked. I get Permission Denied errors.

 -- 

 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 php|architect: The Magazine for PHP Professionals – www.phparch.com

Kevin Grigorenko

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



[PHP] Re: MySQL scalability...

2004-10-22 Thread Kevin Grigorenko
Kevin Grigorenko [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 Now, I just found out after implementing this whole solution locally that
 when I uploaded to the server, the PHP safe_mode options are on, and
 non-overwritable.  Therefore, fopen() doesn't even work!


Well, I just figured out my own problem.  The problem was these files didn't
exist, and it couldn't create them the first time because I guess the script
didn't have write access to the directory.  I thought I checked for this
possibility before by touching the file, but I must have forgotten to set
write permissions to the 'other' group.

Are there any pitfalls in setting the directory to write permissions for
other, or should I just create all of these files individually and set
their write permissions atomically?

Sorry about that,
Thanks,
Kevin Grigorenko

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



Re: [PHP] MySQL scalability...

2004-10-22 Thread Curt Zirzow
* Thus wrote Kevin Grigorenko:
 
 
 
 begin 666 hitcounter.doc

Please dont post attatchments, put the file up on weberver instead
and just reference it here.

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



Re: [PHP] mysql and the PHP transition from 4 to 5.

2004-10-22 Thread Curt Zirzow
* Thus wrote Nick Lane-Smith:
 Hello php-list,
 
 I'm curious to why default mysql support was dropped from PHP 5?

It was  due to the changes in the mysql license. Due to the changes
the PHP Team decided not to enable mysql by default.  MySQL had
modified there license but it was too late, the decision to leave
mysql out of default installation was already decided.


 
 The separation seems to have been done for license issues with the 
 mysql library.
 PHP 4.X uses a libmysql with an abandoned copyright for mysql access.
 
 Would the libmysql still work with PHP 5, or is PHP 5 dependent on the 
 Mysql AB mysqlclient library?

You can compile php with any MySQL version of your choice, the
license issues above only affected PHP's ability to bundle the
package with MySQL support included by default.

You just need to include in your unix configure script:

  --with-mysql=/install/dir/of/mysql

Or

Simply uncomment:

  ;extension=mysql.dll 

In the php.ini for windows.


HTH.

Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] compileproblem gd into php4.3.9 under gentoo

2004-10-22 Thread Curt Zirzow
* Thus wrote Patrick Fehr:
 
 For the definition of some needed graphical functions,
 I depend on gd compiled into php.
 As I am using a linux gentoo2.6.8.1 box, I use portage for that kind.
 I emerge'd php again, but with the USE-Flag +gd set, this seemed to work.
 
 But still the function php_info(); shows that php was compiled without gd
 support.
 
 What I did:
 emerge gd
 emerge php (+gd)
 emerge apache
 
 do I need the flag gd-external as well or what am I doing wrong?
 I tried to find a extension entry in the php.ini but all I could find was
 a .dll entry, and under linux, this can't be the right thing :)

You might want to seek a gentoo forum for the proper way to include
compile options into php.



Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] Session management

2004-10-22 Thread Curt Zirzow
* Thus wrote Herman Scheepers:
 Hi
 
 I am a PHP newbie from a Java/C/Oracle background. I
 cannot seem to get session management with PHP
 working.
 
 ?php
 
   #echo 1;
 
   $old = ini_set('session.use_cookies', 0);
 
   session_start();
   $username = $_REQUEST[username];
   session_register($username);

session_register() shouldn't be used, it relys on the php ini
setting register_globals to be on. As Tom pointed out you simply
just need to set the session var like:

  session_start();
  $username = $_REQUEST[username];
  $_SESSION['username'] = $username;

 In ht_next.php I have:
 
 ?php
 
 
   session_start();
   
   echo $username;

And here:
   session_start();
   $username = $_SESSION['username'];
   echo $username;


Curt
-- 
Quoth the Raven, Nevermore.

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



[PHP] Re: Referring Page

2004-10-22 Thread Ben
Trying to go the other way now - and maybe this isn't a PHP issue, but help 
would be appreciated anyway

Is there a way to block the referring page information, so that if I send 
someone to a site, that site doesn't see what page sent the visitor to them? 
Looking at this from a marketing stand point, not sharing any marketing 
information keeps me employed.  Thanks in advance all.

Ben


Ben [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I am trying to set up a script that will do different things based on the 
reffering page, without having to include the information in the URL.  Does 
PHP have a built in variable or function that would tell the rest of the 
script what page the user came from?  Any help is much appreciated.

 Ben 

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



[PHP] Question on mysql_fetch_object()

2004-10-22 Thread Walter Wojcik
I am trying to write a script that checks a table for a value in MySQL.  It opens the 
table and queries it fine but if my query returns nothing i have no way of testing to 
see if it returned anything.  I have tried testing for false and  and ! $result in 
a if statement but i don't know what to do.  How do I check to see if i got anything 
or not without getting this:  Notice: Trying to get property of non-object . This is 
my most current version of the code:
 

 $id = session_id();
 
 function logOut($session__id)
 {

  $link = mysql_connect( localhost, shopper, shopper );
  
  if ( ! $link )
  {
   die(Couldn't connect to MySQL);
  }  
  
  mysql_select_db( shopingsystem ) or die(Couldn't open Datatabase);
  
  $query1 = select * from userInfo WHERE session_id=\$session__id\;
  
  $result = mysql_query( $query1, $link );  // query for username of person with this 
session id
  
  if ( $result ) // Here i test for query failure but it does no good for empty but 
successful results
  {
   if (! $result)  // Here is where i want to test for empty result but it does no 
good!
   // I have tried ($result == false), ($result == ) and (! $result)
   // None do any good they all let an empty result pass.
   {
print Query failed for $session__id br;
   }

   print Query successful for $session__id br;
   
   $temp = mysql_fetch_object( $result );
   
   
   
   $un = $temp-username; // Here is where i get Notice: Trying to get property of 
non-object error!
   
   $query2 = UPDATE userinfo SET session_id='NULL', is_logged_on='F', 
last_logon='NULL' WHERE username='$un';
   
   $result = mysql_query( $query2, $link ); 
  
   if ( $result )
print Logout successful for $un;

   session_unset();
   session_destroy();  
  }
  else
   print Query Failed for $session__id;  
   
  mysql_close( $link );  
 }
Can you help me?


Knowledge is power, Those who have it must share with those who don't
  
-Walter Wojcik




-
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!