[PHP] Looking up, deleting and inserting array values

2006-05-10 Thread Jonas Rosling
Hi,
I'm trying to do something that I know works when you build an array like a
map with elements and values. One of the problems with this is that I only
get out the values from the array from the last row. And the other problem
is it looks like I can't delete desired values within the array. Is anyone
able to tell me if it's really possible? And if it is, how?
A snip of my code follows bellow:

($$row[3] contains single values that apear in the rows and are decleared
higher up on the page)

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

// If var based named as value in $row[3]
if ($$row[3]) {

// Splits keys and values
foreach($$row[3] AS $key = $value) {

// If $value is the same as $row[2]
if ($value == $row[2]) {
   
// Sum old value within the array with the new value
$new_value = $value+$row[2];

// Delete the old value from the array
unset($$row[3][$key]);

// Insert the new value
array_push($$row[3], $new_value);
   
}

}

}

}

Thanks in advance // Jonas
(Yes, I try to read the manual - but it's not allways good enough for me)

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



Re: [PHP] tired of referencing static variables/constants with 'self ::'

2006-05-10 Thread Jochem Maas

D. Dante Lorenso wrote:

...

I mean, I was forced to write 'self ::' like 11 times in that 
constructor.  THAT is annoying.


would it help to consider that the annoyance is a matter of subjection
rather than fact? ;-)

I realize I am probably just venting since it's unlikely I can get 
anything changed/done on this list.  I'm just hoping some internals 
developer might see my rants and think it might be something which needs 
to be addressed within the language.  I can't be alone in my dislikes, 
can I?


I'm sure there are other with you POV. I'm even more sure that none of the
php devs consider it something to be addressed. like I said the decision to
do it this way was done on purpose.

the answer to the problem is a good code completion tool :-)



Dante



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



Re: [PHP] Looking up, deleting and inserting array values

2006-05-10 Thread Jochem Maas

Jonas Rosling wrote:

Hi,
I'm trying to do something that I know works when you build an array like a
map with elements and values. One of the problems with this is that I only
get out the values from the array from the last row. And the other problem
is it looks like I can't delete desired values within the array. Is anyone
able to tell me if it's really possible? And if it is, how?
A snip of my code follows bellow:

($$row[3] contains single values that apear in the rows and are decleared
higher up on the page)

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

// If var based named as value in $row[3]

if ($$row[3]) {


if (${$row[3]}) {

// i.e. help php to figure out how to exactly what you mean
// with curlie braces.

// the for ease of viewing make a reference:

$myArr = ${$row[3]};

// Splits keys and values

foreach($$row[] AS $key = $value) {


foreach($myArr AS $key = $value) {


// If $value is the same as $row[2]

if ($value == $row[2]) {
   
// Sum old value within the array with the new value

$new_value = $value+$row[2];

// Delete the old value from the array
unset($$row[3][$key]);


unset($myArr[$key]); // unset(${$row[3]}[$key]);


// Insert the new value

array_push($$row[3], $new_value);


$myArr[] = $newValue;

   
}

}

}

}


Thanks in advance // Jonas
(Yes, I try to read the manual - but it's not allways good enough for me)



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



[PHP] Is there an easier way of doing this?

2006-05-10 Thread Chris Grigor

morning all,

Is there an easier way of doing the following??

form1 submitting to form1.php
input type=checkbox name=1
input type=checkbox name=2
input type=submit

form1.php

?php

$link = mysql_connect('host', 'user', 'pass') or die (Connection 
failed: . mysql_error());


mysql_select_db('yourdbname', $link) or die (selection failed:  . 
mysql_error());


if(isset($_POST[1])) {
   mysql_query(INSERT INTO menu (label) VALUES ('item 1 selected'));
   }
else {
   mysql_query(INSERT INTO menu (label) VALUES ('item 1 not selected'));
   }
if(isset($_POST[2])) {
   mysql_query(INSERT INTO menu (label) VALUES ('item 2 selected'));
   }
else {
   mysql_query(INSERT INTO menu (label) VALUES ('item 2 not selected'));
   }

mysql_close($link);
?

So my question is, if I have a form with 20 + items which can be 
checkboxes, when submitted do I need to go through each one and add it 
to the datasbase or maybe some kind of loop?.


Thank you

Chris

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



[PHP] Re: Is there an easier way of doing this?

2006-05-10 Thread Barry

Chris Grigor schrieb:

morning all,

Is there an easier way of doing the following??

form1 submitting to form1.php
input type=checkbox name=1
input type=checkbox name=2
input type=submit

form1.php

?php

$link = mysql_connect('host', 'user', 'pass') or die (Connection 
failed: . mysql_error());


mysql_select_db('yourdbname', $link) or die (selection failed:  . 
mysql_error());


if(isset($_POST[1])) {
   mysql_query(INSERT INTO menu (label) VALUES ('item 1 selected'));
   }
else {
   mysql_query(INSERT INTO menu (label) VALUES ('item 1 not selected'));
   }
if(isset($_POST[2])) {
   mysql_query(INSERT INTO menu (label) VALUES ('item 2 selected'));
   }
else {
   mysql_query(INSERT INTO menu (label) VALUES ('item 2 not selected'));
   }

mysql_close($link);
?

So my question is, if I have a form with 20 + items which can be 
checkboxes, when submitted do I need to go through each one and add it 
to the datasbase or maybe some kind of loop?.


Thank you

Chris

SELECT ... INTO
http://dev.mysql.com/doc/refman/4.1/en/ansi-diff-select-into-table.html

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] To capture Http Headers

2006-05-10 Thread Stut

Please reply to the list and not just directly to me.

Kaushal Shriyan wrote:


Thanks Stut

I have put the below script in test.php

?php
var_dump($_REQUEST);
var_dump($_ENV);
?

I am getting the below information which is not formatted

array(5) { [RSP_COOKIE]= string(28) type=1name=YW1pdA==stype=0
[RSP_DAEMON]= string(32) 9d07e725d2294db468407bb19badd8c2
[MC_CMP_ESK]= string(8) NonSense [SNS_AA]= string(21)
asrc=2sst=1147240052 [RSP_LOCAL_BDC31096E_IN_OFFICE_AOL_COM]=
string(69) 
djEgMFM=-TmmsenypEfMWJkDnPN+CQxyGILJnPlmYy1ajY1AHte/f7vUdwz9J0QOyI8E=

} array(27) { [HOSTNAME]= string(9) bdc31096e [SHELL]=
string(9) /bin/bash [TERM]= string(5) xterm [HISTSIZE]=
string(4) 1000 [CATALINA_HOME]= string(39)
/usr/local/tomcat/jakarta-tomcat-4.1.31 [SSH_CLIENT]= string(22)
10.146.145.159 3786 22 [QTDIR]= string(15) /usr/lib/qt-3.1
[SSH_TTY]= string(10) /dev/pts/1 [USER]= string(4) root
[LD_LIBRARY_PATH]= string(23) /usr/local/apache//lib:
[LS_COLORS]= string(440)
no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35: 


[USERNAME]= string(4) root [PATH]= string(114)
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/usr/local/j2sdk1.4.2_10/bin 


[MAIL]= string(20) /var/spool/mail/root [PWD]= string(22)
/usr/local/apache/conf [INPUTRC]= string(12) /etc/inputrc
[JAVA_HOME]= string(25) /usr/local/j2sdk1.4.2_10/ [LANG]=
string(11) en_US.UTF-8 [SSH_ASKPASS]= string(38)
/usr/libexec/openssh/gnome-ssh-askpass [HOME]= string(5) /root
[SHLVL]= string(1) 2 [BASH_ENV]= string(13) /root/.bashrc
[LOGNAME]= string(4) root [SSH_CONNECTION]= string(37)
10.146.145.159 3786 10.146.144.147 22 [LESSOPEN]= string(24)
|/usr/bin/lesspipe.sh %s [G_BROKEN_FILENAMES]= string(1) 1
[_]= string(28) /usr/local/apache//bin/httpd }



Yes, this is called HTML. Output in a pre tag to get it formatted.


Actually If I run my test.cgi file I get well formatted one I am
attaching the screenshot also If you can see from the output
HTTP_USERNAME  
nick=amit,Master=0,acct_no_hash=1B2M2Y8AsgTpgAmY7PhCfg==,EMAIL=[EMAIL PROTECTED] 


which is missing from test.php script output



I see no screenshot (which is a good thing, so please *don't* repost 
with the screenshot). What type of authentication is HTTP_USERNAME 
supposed to be coming from?


-Stut

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



Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Chris

Chris Grigor wrote:

morning all,

Is there an easier way of doing the following??

form1 submitting to form1.php
input type=checkbox name=1
input type=checkbox name=2
input type=submit


make this into:

input type=checkbox name=blah[1] value=1
input type=checkbox name=blah[2] value=1

then you can:

foreach($_POST['blah'] as $p = $x) {
  if (!isset($_POST['blah'][$p])) {
   echo item $p was not selected;
  } else {
   echo item $p was selected;
  }
}


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Peter Hoskin


Chris Grigor wrote:
 morning all,

 Is there an easier way of doing the following??

 form1 submitting to form1.php
 input type=checkbox name=1
 input type=checkbox name=2
 input type=submit

 form1.php

 ?php

 $link = mysql_connect('host', 'user', 'pass') or die (Connection
 failed: . mysql_error());

 mysql_select_db('yourdbname', $link) or die (selection failed:  .
 mysql_error());

 if(isset($_POST[1])) {
mysql_query(INSERT INTO menu (label) VALUES ('item 1 selected'));
}
 else {
mysql_query(INSERT INTO menu (label) VALUES ('item 1 not
 selected'));
}
 if(isset($_POST[2])) {
mysql_query(INSERT INTO menu (label) VALUES ('item 2 selected'));
}
 else {
mysql_query(INSERT INTO menu (label) VALUES ('item 2 not
 selected'));
}

 mysql_close($link);
 ?
Thats a very poor method of storing values in SQL. I believe MySQL now
has a boolean datatype (at long last, postgre has had it for ages) and
it does have integers. Why not a combination of a boolean and an
integer, and no storage of text. It makes a hell of alot more sense.
 So my question is, if I have a form with 20 + items which can be
 checkboxes, when submitted do I need to go through each one and add it
 to the datasbase or maybe some kind of loop?.
http://pear.php.net/package/HTML_QuickForm/ may be of use. You could use
a combination of exportValues() and foreach. Its added validation makes
it even nicer. Also, I do believe your reference to $_POST is incorrect.
What if the variable does not exist? You get an error, thats what.
array_key_exists('1',$_POST) should be used.

Regards,
Peter Hoskin

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



[PHP] To Capture HTTP Headers

2006-05-10 Thread Kaushal Shriyan

I have put the below in test.php

?php
var_dump($_REQUEST);
var_dump($_ENV);
?

I am getting the below information which is not formatted

array(5) { [RSP_COOKIE]= string(28) type=1name=YW1pdA==stype=0
[RSP_DAEMON]= string(32) 9d07e725d2294db468407bb19badd8c2
[MC_CMP_ESK]= string(8) NonSense [SNS_AA]= string(21)
asrc=2sst=1147240052 [RSP_LOCAL_BDC31096E_IN_OFFICE_AOL_COM]=
string(69) 
djEgMFM=-TmmsenypEfMWJkDnPN+CQxyGILJnPlmYy1ajY1AHte/f7vUdwz9J0QOyI8E=
} array(27) { [HOSTNAME]= string(9) bdc31096e [SHELL]=
string(9) /bin/bash [TERM]= string(5) xterm [HISTSIZE]=
string(4) 1000 [CATALINA_HOME]= string(39)
/usr/local/tomcat/jakarta-tomcat-4.1.31 [SSH_CLIENT]= string(22)
10.146.145.159 3786 22 [QTDIR]= string(15) /usr/lib/qt-3.1
[SSH_TTY]= string(10) /dev/pts/1 [USER]= string(4) root
[LD_LIBRARY_PATH]= string(23) /usr/local/apache//lib:
[LS_COLORS]= string(440)
no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
[USERNAME]= string(4) root [PATH]= string(114)
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/usr/local/j2sdk1.4.2_10/bin
[MAIL]= string(20) /var/spool/mail/root [PWD]= string(22)
/usr/local/apache/conf [INPUTRC]= string(12) /etc/inputrc
[JAVA_HOME]= string(25) /usr/local/j2sdk1.4.2_10/ [LANG]=
string(11) en_US.UTF-8 [SSH_ASKPASS]= string(38)
/usr/libexec/openssh/gnome-ssh-askpass [HOME]= string(5) /root
[SHLVL]= string(1) 2 [BASH_ENV]= string(13) /root/.bashrc
[LOGNAME]= string(4) root [SSH_CONNECTION]= string(37)
10.146.145.159 3786 10.146.144.147 22 [LESSOPEN]= string(24)
|/usr/bin/lesspipe.sh %s [G_BROKEN_FILENAMES]= string(1) 1
[_]= string(28) /usr/local/apache//bin/httpd }

Actually If I run my test.cgi file I get well formatted one and also
If you can see from the output
HTTP_USERNAME  
nick=amit,Master=0,acct_no_hash=1B2M2Y8AsgTpgAmY7PhCfg==,EMAIL=[EMAIL PROTECTED]

which is missing from test.php script

Thanks Again

Kaushal

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



Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread viraj

definitely a loop will do the job.

on a form submission, you can get all the submitted fields/ values in
$_POST or $_GET array.

just, try 'print_r($_POST)', on top of your receiving script. you will
realise the scene behind. :)

then, get the size of the $_POST array and loop through the array
elements. a common data base function to insert the data will ease
your life further.


~viraj

On 5/10/06, Chris Grigor [EMAIL PROTECTED] wrote:

morning all,

Is there an easier way of doing the following??

form1 submitting to form1.php
input type=checkbox name=1
input type=checkbox name=2
input type=submit

form1.php

?php

$link = mysql_connect('host', 'user', 'pass') or die (Connection
failed: . mysql_error());

mysql_select_db('yourdbname', $link) or die (selection failed:  .
mysql_error());

if(isset($_POST[1])) {
mysql_query(INSERT INTO menu (label) VALUES ('item 1 selected'));
}
else {
mysql_query(INSERT INTO menu (label) VALUES ('item 1 not selected'));
}
if(isset($_POST[2])) {
mysql_query(INSERT INTO menu (label) VALUES ('item 2 selected'));
}
else {
mysql_query(INSERT INTO menu (label) VALUES ('item 2 not selected'));
}

mysql_close($link);
?

So my question is, if I have a form with 20 + items which can be
checkboxes, when submitted do I need to go through each one and add it
to the datasbase or maybe some kind of loop?.

Thank you

Chris

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




Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Angelo Zanetti


Peter Hoskin wrote:


Chris Grigor wrote:


morning all,

Is there an easier way of doing the following??

form1 submitting to form1.php
input type=checkbox name=1
input type=checkbox name=2
input type=submit

form1.php

?php

$link = mysql_connect('host', 'user', 'pass') or die (Connection
failed: . mysql_error());

mysql_select_db('yourdbname', $link) or die (selection failed:  .
mysql_error());

if(isset($_POST[1])) {
  mysql_query(INSERT INTO menu (label) VALUES ('item 1 selected'));
  }
else {
  mysql_query(INSERT INTO menu (label) VALUES ('item 1 not
selected'));
  }
if(isset($_POST[2])) {
  mysql_query(INSERT INTO menu (label) VALUES ('item 2 selected'));
  }
else {
  mysql_query(INSERT INTO menu (label) VALUES ('item 2 not
selected'));
  }

mysql_close($link);
?


Thats a very poor method of storing values in SQL. I believe MySQL now
has a boolean datatype (at long last, postgre has had it for ages) and
it does have integers. Why not a combination of a boolean and an
integer, and no storage of text. It makes a hell of alot more sense.


So my question is, if I have a form with 20 + items which can be
checkboxes, when submitted do I need to go through each one and add it
to the datasbase or maybe some kind of loop?.


http://pear.php.net/package/HTML_QuickForm/ may be of use. You could use
a combination of exportValues() and foreach. Its added validation makes
it even nicer. Also, I do believe your reference to $_POST is incorrect.
What if the variable does not exist? You get an error, thats what.
array_key_exists('1',$_POST) should be used.

Regards,
Peter Hoskin




why not make the checkbox an array checkbox and just loop through the values that come through the POST and insert those into the DB. I would definitely recommend using integer rather than what you 
have above for the DB value.


HTH

Angelo

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



[PHP] internal operation

2006-05-10 Thread Luke Cole

Do the file system and directory functions, perform the file system command 
relative to your OS.

e.g.
does the internal code of the function:
rename(oldname, newname);

do exactly (in unix file systems):
`mv oldname newname`

do exactly (in windows file systems):
`ren oldname newname`

If not, how does it do it? Also, if one disables users from using ``, are all 
file system and directory functions disabled to?

Regards,
Luke Cole
--
http://rsise.anu.edu.au/~cole | http://lc.homedns.org/~cole

Research Assistant
Robotics Systems Lab, Systems Engineering
RSISE/NICTA, Building 115 ANU

--
This email and any attachments are confidential. They may contain
legally privileged information or copyright material. You should not
read, copy, use or disclose them without authorisation. If you are not
an intended recipient, please contact us at once by return email and
then delete both messages. We do not accept liability in connection
with computer virus, data corruption, delay, interruption,
unauthorised access or unauthorised amendment. This notice should not
be removed.

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



Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Chris

Chris Grigor wrote:

Hi Chris

While this works, it only posts the checkboxes that have been selected. 
How would I get a list of ones not checked?


Always reply to the list as well.


Checkboxes aren't submitted if they are not checked. It's not a PHP 
thing that does this.



That's why you have to check it this way.


. if it's in the post array, it was checked.
if (isset($_POST['blah'][$p])) {
.
}

. if it's not in the post array, it was not checked.
if (!isset($_POST['blah'][$p])) {
.
}


notice the isset and !isset (not isset).



Chris wrote:


Chris Grigor wrote:


morning all,

Is there an easier way of doing the following??

form1 submitting to form1.php
input type=checkbox name=1
input type=checkbox name=2
input type=submit




make this into:

input type=checkbox name=blah[1] value=1
input type=checkbox name=blah[2] value=1

then you can:

foreach($_POST['blah'] as $p = $x) {
  if (!isset($_POST['blah'][$p])) {
   echo item $p was not selected;
  } else {
   echo item $p was selected;
  }
}







--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Cannot suppress fsockopen errors

2006-05-10 Thread Nick Wilson
Hi, 

Im having a hard time surpressing fsckopen() errors. I've looked at the
manual and searched around, but what i am doing /appears/ to be correct,
yet im still geting warnings...

here's the code:

// open a socket to the server
if($handle = @fsockopen($bits['host'], 80, $errno, $errstr, 10) or die(die)) {
  return true;
}

and here are the warnings:

warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name
or service not known in
/var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/includes/validateBlog.inc
on line 53.

warning: fsockopen(): unable to connect to www.ivana.dk:80 in
/var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/includes/validateBlog.inc
on line 53.


I've even tried looking though php.ini for any clues and i dont see
anything useful. Does anyone have an idea of what im missing here?

Many thanks!
-- 
Nick Wilson
Tel:+45 3311 2250

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



[PHP] Re: To Capture HTTP Headers

2006-05-10 Thread M. Sokolewicz

Kaushal Shriyan wrote:

I have put the below in test.php

?php
var_dump($_REQUEST);
var_dump($_ENV);
?

I am getting the below information which is not formatted


[snip] ...[/snip]


Actually If I run my test.cgi file I get well formatted one and also
If you can see from the output
HTTP_USERNAME  
nick=amit,Master=0,acct_no_hash=1B2M2Y8AsgTpgAmY7PhCfg==,EMAIL=[EMAIL PROTECTED] 


which is missing from test.php script

Thanks Again

Kaushal



and thank you aswell. May I ask why you posted to this mailinglist? did 
you actually have a question? or did you just want to share your headers 
with the world...?


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



[PHP] file Upload - checking file size before uploading

2006-05-10 Thread James Nunnerley
Is there anyway to check the size of a file before it starts uploading it?
For instance, if the file is huge, and takes ages to upload, and is then
rejected by the server, the user will be somewhat annoyed!

 

I'm not even sure this is a php question!

 

Cheers

Nunners



Re: [PHP] file Upload - checking file size before uploading

2006-05-10 Thread Barry

James Nunnerley schrieb:

Is there anyway to check the size of a file before it starts uploading it?
For instance, if the file is huge, and takes ages to upload, and is then
rejected by the server, the user will be somewhat annoyed!

 


I'm not even sure this is a php question!


No you can't.
Not with PHP.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



RE: [PHP] file Upload - checking file size before uploading

2006-05-10 Thread Jay Blanchard
[snip]
Is there anyway to check the size of a file before it starts uploading
it?
For instance, if the file is huge, and takes ages to upload, and is then
rejected by the server, the user will be somewhat annoyed!
[/snip]

PHP is server-side and cannot check anything client-side. You cold use
something client-side, like JavaScript, to check the file size and then
deliver a warning if the file is too large.

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



Re: [PHP] file Upload - checking file size before uploading

2006-05-10 Thread Duncan Hill
On Wednesday 10 May 2006 13:39, Jay Blanchard wrote:
 [snip]
 Is there anyway to check the size of a file before it starts uploading
 it?
 For instance, if the file is huge, and takes ages to upload, and is then
 rejected by the server, the user will be somewhat annoyed!
 [/snip]

 PHP is server-side and cannot check anything client-side. You cold use
 something client-side, like JavaScript, to check the file size and then
 deliver a warning if the file is too large.

Alternately ... This service only accepts files up to 10 MB.  Uploading 
anything larger will fail.

Assumes comprehension unfortunately.

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



Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread tedd

At 10:49 AM +0200 5/10/06, Chris Grigor wrote:

morning all,

Is there an easier way of doing the following??


Try:

http://www.weberdev.com/get_example-3754.html

HTH's

tedd
--

http://sperling.com

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



Re: [PHP] throttle output streamed from a file?

2006-05-10 Thread tedd

At 10:56 PM -0500 5/9/06, D. Dante Lorenso wrote:


 to a client who may be very slow.


Aren't they all. :-)

tedd
--

http://sperling.com

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



[PHP] Uploading Image File

2006-05-10 Thread Renzo Clavijo

Morning all.

I would like to know if anybody could e-mail an example of code to upload
files into a MySQL server using PHP from
a form.

Thanks a lot.

Best Regards,

RENZO CLAVIJO


Re: [PHP] tired of referencing static variables/constants with 'self ::'

2006-05-10 Thread John Wells

On 5/9/06, D. Dante Lorenso [EMAIL PROTECTED] wrote:

As an OOP programmer, I would expect the scope search to be as follows:

   1. LOCAL: current method
   2. THIS: current instance ($this)
   3. SELF: current class  parent classes, in order of inheritance
   4. GLOBAL: globals



Ok, so this is interesting Dante, you have me thinking... Perhaps this
is all a result of PHP being a procedural language first, and an OOP
language second?  Indeed, even if our PHP applications are fully
abstracted into objects, they still begin their lives in a procedural
way...

[thinking_aloud]
I have little experience with pure OOP, short of a quick dive into
Java, but I do recall that any J2EE web application that runs does so
as an instance of a class (which is a child of some base listener
class that handles web requests).  So your initial scope sort of is
at a local object level.  So then it would make perfect sense as a
programmer to want the ability to call an object constant or static
property without having to say hey, look for  in the same place
that I am right now. Because there's nowhere else you'd be, anyway.

But with PHP, every script starts out procedurally, and hence at the
global level.  Then we instantiate a class, step into that object,
and do our thing.  But still, we _started_ outside, and our scope
ladder does too.
[/thinking_aloud]

Yes? No? Maybe so?

-John W

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



[PHP] PHP suddenly stops working on FreeBSD

2006-05-10 Thread Paul Waring

I restarted Apache this morning in order to allow some new virtual
hosts to be recognised, and now I've got a problem whereby all of my
PHP scripts are being served up as source code instead of being
executed by the web server. I don't know why this is, as far as I'm
aware I haven't changed anything PHP-related for a while and
everything was running fine until this morning. Running

grep php /usr/local/etc/apache2/httpd.conf

Gives me:

#LoadModule php4_modulelibexec/apache2/libphp4.so
DirectoryIndex index.html index.htm index.php
#AddType application/x-httpd-php .php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

So there's definitely an AddType directive for PHP scripts. If I
uncomment the LoadModule line I get the error:

Cannot load /usr/local/libexec/apache2/libphp4.so into server: Cannot
open /usr/local/libexec/apache2/libphp4.so

But I think that line has always been uncommented (and libphp4.so
doesn't exist anywhere on the machine). I've tried rebuilding PHP, but
it hasn't made any difference.

Does anyone have any ideas as to what might have gone wrong? I'm at a
loss as to how things could suddenly have broken when they were
working fine before.

Some version numbers in case it helps:

php -v
PHP 4.4.2 (cli) (built: May 10 2006 14:40:03)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

httpd -v
Server version: Apache/2.0.58
Server built:   May  7 2006 10:42:02

Thanks in advance,

Paul

--
Data Circle
http://datacircle.org

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



Re: [PHP] Uploading Image File

2006-05-10 Thread gustav
 Morning all.

 I would like to know if anybody could e-mail an example of code to upload
 files into a MySQL server using PHP from
 a form.

 Thanks a lot.

 Best Regards,

 RENZO CLAVIJO

What exactly do you mean?

Best regards
/Gustav Wiberg

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



Re: [PHP] PHP suddenly stops working on FreeBSD

2006-05-10 Thread rouvas
On Wednesday 10 May 2006 16:58, Paul Waring wrote:
 I restarted Apache this morning in order to allow some new virtual
 hosts to be recognised, and now I've got a problem whereby all of my
 PHP scripts are being served up as source code instead of being
 executed by the web server. I don't know why this is, as far as I'm
 aware I haven't changed anything PHP-related for a while and
 everything was running fine until this morning. Running

 grep php /usr/local/etc/apache2/httpd.conf

 Gives me:

 #LoadModule php4_modulelibexec/apache2/libphp4.so

If PHP isn't loaded, PHP scripts will not be recognized by Apache as such, but 
will be regarded as regualr files. The above line must be uncommented either 
directly in httpd.conf or in an included file.

If liphp4.so cannot be found, you have to create it by compiling from source 
or restoring from an installation medium.

Addype directive instructs Apache that files ending in .php will be handled 
differently. Alas the handler (i.e. PHP interpreter) is not loaded 
(commented-out LoadModule directive) so Apache ends up serving .php files as 
is.

-Stathis

 DirectoryIndex index.html index.htm index.php
 #AddType application/x-httpd-php .php
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps

 So there's definitely an AddType directive for PHP scripts. If I
 uncomment the LoadModule line I get the error:

 Cannot load /usr/local/libexec/apache2/libphp4.so into server: Cannot
 open /usr/local/libexec/apache2/libphp4.so

 But I think that line has always been uncommented (and libphp4.so
 doesn't exist anywhere on the machine). I've tried rebuilding PHP, but
 it hasn't made any difference.

 Does anyone have any ideas as to what might have gone wrong? I'm at a
 loss as to how things could suddenly have broken when they were
 working fine before.

 Some version numbers in case it helps:

 php -v
 PHP 4.4.2 (cli) (built: May 10 2006 14:40:03)
 Copyright (c) 1997-2006 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

 httpd -v
 Server version: Apache/2.0.58
 Server built:   May  7 2006 10:42:02

 Thanks in advance,

 Paul

 --
 Data Circle
 http://datacircle.org

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



Re: [PHP] PHP suddenly stops working on FreeBSD

2006-05-10 Thread Jochem Maas

Paul Waring wrote:

I restarted Apache this morning in order to allow some new virtual
hosts to be recognised, and now I've got a problem whereby all of my
PHP scripts are being served up as source code instead of being
executed by the web server. I don't know why this is, as far as I'm
aware I haven't changed anything PHP-related for a while and
everything was running fine until this morning. Running

grep php /usr/local/etc/apache2/httpd.conf

Gives me:

#LoadModule php4_modulelibexec/apache2/libphp4.so
DirectoryIndex index.html index.htm index.php
#AddType application/x-httpd-php .php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

So there's definitely an AddType directive for PHP scripts. If I
uncomment the LoadModule line I get the error:


the php may be being loaded in via an include conf file 
do you havbe a line in httpd.conf that start with 'Include' ?



Cannot load /usr/local/libexec/apache2/libphp4.so into server: Cannot
open /usr/local/libexec/apache2/libphp4.so

But I think that line has always been uncommented (and libphp4.so
doesn't exist anywhere on the machine). I've tried rebuilding PHP, but
it hasn't made any difference.


what is the configure line used to build php? (does it contain a configure 
option
'--with-apxs2' ?)



Does anyone have any ideas as to what might have gone wrong? I'm at a
loss as to how things could suddenly have broken when they were
working fine before.


does the php error log OR the apache error log mention anything related to
php start up when you have the 'LoadModule' in httpd.conf commented out?



Some version numbers in case it helps:

php -v
PHP 4.4.2 (cli) (built: May 10 2006 14:40:03)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

httpd -v
Server version: Apache/2.0.58
Server built:   May  7 2006 10:42:02

Thanks in advance,

Paul

--
Data Circle
http://datacircle.org



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



Re: [PHP] PHP suddenly stops working on FreeBSD

2006-05-10 Thread Paul Waring

On 10/05/06, Jochem Maas [EMAIL PROTECTED] wrote:

the php may be being loaded in via an include conf file 
do you havbe a line in httpd.conf that start with 'Include' ?


Only one, and that includes some virtual host files (I don't think
those are the problem, as Apache usually complains if there's an
actual error in the configs).


what is the configure line used to build php? (does it contain a configure 
option
'--with-apxs2' ?)


I don't know, I'm building it with FreeBSD ports so I don't see the
configure line. I do see this in the log though:

Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no
checking for mod_charset compatibility option... no
checking for Apache 2.0 filter-module support via DSO through APXS... no
checking for Apache 2.0 handler-module support via DSO through APXS... no


does the php error log OR the apache error log mention anything related to
php start up when you have the 'LoadModule' in httpd.conf commented out?


The Apache log has:

[Wed May 10 14:15:50 2006] [notice] caught SIGTERM, shutting down
[Wed May 10 14:15:53 2006] [notice] mod_python: Creating 8 session
mutexes based on 150 max processes and 0 max threads.
[Wed May 10 14:15:54 2006] [notice] Apache/2.0.58 (FreeBSD)
mod_python/3.2.8 Python/2.4.3 configured -- resuming normal operations
[Wed May 10 14:27:25 2006] [notice] caught SIGTERM, shutting down
[Wed May 10 14:27:28 2006] [notice] mod_python: Creating 8 session
mutexes based on 150 max processes and 0 max threads.
[Wed May 10 14:27:29 2006] [notice] Apache/2.0.58 (FreeBSD)
mod_python/3.2.8 Python/2.4.3 configured -- resuming normal operations
[Wed May 10 14:48:01 2006] [notice] caught SIGTERM, shutting down
[Wed May 10 14:48:04 2006] [notice] mod_python: Creating 8 session
mutexes based on 150 max processes and 0 max threads.
[Wed May 10 14:48:05 2006] [notice] Apache/2.0.58 (FreeBSD)
mod_python/3.2.8 Python/2.4.3 configured -- resuming normal operations
[Wed May 10 14:49:52 2006] [notice] caught SIGTERM, shutting down

Which isn't terribly helpful.

Paul

--
Data Circle
http://datacircle.org

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



Re: [PHP] PHP suddenly stops working on FreeBSD

2006-05-10 Thread Jochem Maas

Paul Waring wrote:

On 10/05/06, Jochem Maas [EMAIL PROTECTED] wrote:


the php may be being loaded in via an include conf file 
do you havbe a line in httpd.conf that start with 'Include' ?



Only one, and that includes some virtual host files (I don't think
those are the problem, as Apache usually complains if there's an
actual error in the configs).

what is the configure line used to build php? (does it contain a 
configure option

'--with-apxs2' ?)



I don't know, I'm building it with FreeBSD ports so I don't see the
configure line. I do see this in the log though:

Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no


one of the above should be saying yes - although how you get the FreeBSD
ports to do that I don't know.

the mystery remains as to why php was working before. maybe it was running
as a CGI - but then there should be the relevant declarations in the httpd.conf.


checking for mod_charset compatibility option... no
checking for Apache 2.0 filter-module support via DSO through APXS... no
checking for Apache 2.0 handler-module support via DSO through APXS... no

does the php error log OR the apache error log mention anything 
related to

php start up when you have the 'LoadModule' in httpd.conf commented out?



The Apache log has:

[Wed May 10 14:15:50 2006] [notice] caught SIGTERM, shutting down
[Wed May 10 14:15:53 2006] [notice] mod_python: Creating 8 session
mutexes based on 150 max processes and 0 max threads.


ah snake oil ;-) not that that has anything to do with it :-)


[Wed May 10 14:15:54 2006] [notice] Apache/2.0.58 (FreeBSD)
mod_python/3.2.8 Python/2.4.3 configured -- resuming normal operations
[Wed May 10 14:27:25 2006] [notice] caught SIGTERM, shutting down
[Wed May 10 14:27:28 2006] [notice] mod_python: Creating 8 session
mutexes based on 150 max processes and 0 max threads.
[Wed May 10 14:27:29 2006] [notice] Apache/2.0.58 (FreeBSD)
mod_python/3.2.8 Python/2.4.3 configured -- resuming normal operations
[Wed May 10 14:48:01 2006] [notice] caught SIGTERM, shutting down
[Wed May 10 14:48:04 2006] [notice] mod_python: Creating 8 session
mutexes based on 150 max processes and 0 max threads.
[Wed May 10 14:48:05 2006] [notice] Apache/2.0.58 (FreeBSD)
mod_python/3.2.8 Python/2.4.3 configured -- resuming normal operations
[Wed May 10 14:49:52 2006] [notice] caught SIGTERM, shutting down

Which isn't terribly helpful.

Paul

--
Data Circle
http://datacircle.org



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



Re: [PHP] PHP suddenly stops working on FreeBSD

2006-05-10 Thread Richard Collyer

Paul Waring wrote:

Some version numbers in case it helps:

php -v
PHP 4.4.2 (cli) (built: May 10 2006 14:40:03)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

httpd -v
Server version: Apache/2.0.58
Server built:   May  7 2006 10:42:02


Does this do the same with PHP5? Remember mod_php5 has gone from ports 
so lang/php5 then make config and select build apache option.


Regards,
Richard

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



[PHP] How to get incoming emails captured by PHP ?

2006-05-10 Thread Adrian
Hi All

 

I have been trying to have PHP capture incoming emails sent to a specific
email account and have not been able to achieve this, I have searched high
and low on the internet and the same article
(http://www.evolt.org/article/Incoming_Mail_and_PHP/18/27914/index.html) is
plastered everywhere I have done everything it says, and still no joy, 

 

When I send an email to be captured I receive this bounce back email when
sending an email to [EMAIL PROTECTED] (see below)

 

Can any one let a hand?

 

Bounce back email:

--

   - The following addresses had permanent fatal errors -

|/wwwroot/www.domain.com/ade/email.php

(reason: 255)

(expanded from: [EMAIL PROTECTED])

 

   - Transcript of session follows -

Status: 404

Content-type: text/html

X-Powered-By: PHP/4.3.11

 

No input file specified.

554 5.3.0 unknown mailer error 255

Content-type: text/html

X-Powered-By: PHP/4.3.11

--

 

Here is how I have everything setup.

 

I have my aliases file set up with the line: ade: |/usr/bin/php,
|/wwwroot/www.domain.com/ade/email.php

(The path to my PHP is correct)

 

And the script it calls (email.php) the code is:

 

#!/usr/bin/php 

?php

$fd = fopen(php://stdin, r);

$email = ;

while (!feof($fd)) {

$email .= fread($fd, 1024);

}

fclose($fd);

?

 

Adrian



Re: [PHP] PHP suddenly stops working on FreeBSD

2006-05-10 Thread Paul Waring

On 10/05/06, Riemer Palstra [EMAIL PROTECTED] wrote:

These are rather recent versions of both, so I'm suspecting an upgrade
was done recently which didn't make PHP all that happy. This is PHP
built from the port /usr/ports/lang/php4? Go to that dir, type 'make
config', make sure the APACHE knob is checked, en deinstall/reinstall
that port. Be sure the LoadModule line above is then uncommented and try
a restart again.


Cheers, I checked make config (highly useful command, didn't know you
could do that) and for some reason the APACHE option wasn't checked -
I have absolutely no idea why because it's always worked in the past,
perhaps it's disabled by default now or something. Anyway, after
rebuilding PHP it created the shared object file and a quick
shutdown/restart of Apache later everything was working.

Thanks for the help everyone, especially the FreeBSD-specific stuff
that I probably wouldn't have seen otherwise. :)

Paul

--
Data Circle
http://datacircle.org

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



Re: [PHP] PHP suddenly stops working on FreeBSD

2006-05-10 Thread Paul Waring

On 10/05/06, Richard Collyer [EMAIL PROTECTED] wrote:

Does this do the same with PHP5? Remember mod_php5 has gone from ports
so lang/php5 then make config and select build apache option.


I've no idea whether it does that with PHP5, but I'm not ready to
upgrade to that version yet (perhaps over the summer when I have a bit
more spare time I'll attempt it).

Paul

--
Data Circle
http://datacircle.org

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



Re: [PHP] How to get incoming emails captured by PHP ?

2006-05-10 Thread Stut

Adrian wrote:


I have my aliases file set up with the line: ade: |/usr/bin/php,
|/wwwroot/www.domain.com/ade/email.php

(The path to my PHP is correct)
 



There should only be one | on that line. It should read...

ade: /usr/bin/php /wwwroot/www.domain.com/ade/email.php


And the script it calls (email.php) the code is:

#!/usr/bin/php 


?php

$fd = fopen(php://stdin, r);

$email = ;

while (!feof($fd)) {

   $email .= fread($fd, 1024);

}

fclose($fd);

?



Hopefully you realise this script is just reading the email into $email 
and then not doing anything with it. Mail sent to this script will be 
lost, so here's hoping that's not the finished article.


-Stut

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



[PHP] Re: Upload File

2006-05-10 Thread Renzo Clavijo

hi all..

I'm gonna be more precise:

I wrote a form with fields text type=file  , then i need to know how
to upload the files to the MySQL server (postgreSQL wold be appreciated). It
implies: Which field(s) must have the table where I'll save the image?. Is
there an example code to upload the file(s)?

Thanks a lot.

Best Regards

RENZO CLAVIJO


Re: [PHP] How to get incoming emails captured by PHP ?

2006-05-10 Thread John Nichel

Adrian wrote:

Hi All

 


I have been trying to have PHP capture incoming emails sent to a specific
email account and have not been able to achieve this, I have searched high
and low on the internet and the same article
(http://www.evolt.org/article/Incoming_Mail_and_PHP/18/27914/index.html) is
plastered everywhere I have done everything it says, and still no joy, 

 


When I send an email to be captured I receive this bounce back email when
sending an email to [EMAIL PROTECTED] (see below)

 


Can any one let a hand?

 


Bounce back email:

--

   - The following addresses had permanent fatal errors -

|/wwwroot/www.domain.com/ade/email.php

(reason: 255)

(expanded from: [EMAIL PROTECTED])

 


   - Transcript of session follows -

Status: 404

Content-type: text/html

X-Powered-By: PHP/4.3.11

 


No input file specified.

554 5.3.0 unknown mailer error 255

Content-type: text/html

X-Powered-By: PHP/4.3.11

--

 


Here is how I have everything setup.

 


I have my aliases file set up with the line: ade: |/usr/bin/php,
|/wwwroot/www.domain.com/ade/email.php


Why are you passing it to the php binary?  Pass it directly to your 
script (make sure it's executable).  For shits and giggles, do a 'which 
php' at the command line to make sure the binary is in /usr/bin.



(The path to my PHP is correct)

 


And the script it calls (email.php) the code is:

 

#!/usr/bin/php 


?php

$fd = fopen(php://stdin, r);


There's also an easier way to do this.  Check the manual:
http://us2.php.net/manual/en/features.commandline.php



$email = ;

while (!feof($fd)) {

$email .= fread($fd, 1024);

}
fclose($fd);

?



--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] How to get incoming emails captured by PHP ?

2006-05-10 Thread Stut

Stut wrote:


Adrian wrote:


I have my aliases file set up with the line: ade: |/usr/bin/php,
|/wwwroot/www.domain.com/ade/email.php

(The path to my PHP is correct)



There should only be one | on that line. It should read...

ade: /usr/bin/php /wwwroot/www.domain.com/ade/email.php



D'oh, meant...

ade: |/usr/bin/php /wwwroot/www.domain.com/ade/email.php

Soz.

-Stut


And the script it calls (email.php) the code is:

#!/usr/bin/php
?php

$fd = fopen(php://stdin, r);

$email = ;

while (!feof($fd)) {

   $email .= fread($fd, 1024);

}

fclose($fd);

?



Hopefully you realise this script is just reading the email into 
$email and then not doing anything with it. Mail sent to this script 
will be lost, so here's hoping that's not the finished article.


-Stut



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



[PHP] Re: Browser displays blank page, while request still being handled

2006-05-10 Thread Rolf Wouters

Yet another update.

Strange thing happened.  I fixed the problem...  It's not a clean 
solution, it's not the right solution, but for now, it'll (have to) do :-)


I changed my little test-script to include directives like 
max_input_time, set_time_limit(0) etc.  Than I thought, why not try to 
generate some output when copying files!??!  So I did...  and you know 
what, all of a sudden I'm seeing my response page every single time I 
call my script :-D


So our quick-n-dirty-but-we-know-its-wrong-solution is gonna be to have 
the script generate some output (a single space) for each file it has 
copied (i.e. print( )).
After testing it with the problem-app, we feel confident this is a 
viable, temporary, solution.  At least untill we complete our PHP5 
rewrite of the Photofresher :-)


I would like to thank all of you for your time, patience and advice.

If anyone has any ideas on why this is working, feel free to let me know :-)


greetz

Rolf

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



Re: [PHP] Uploading Image File

2006-05-10 Thread Jochem Maas

Renzo Clavijo wrote:

Morning all.

I would like to know if anybody could e-mail an example of code to upload
files into a MySQL server using PHP from
a form.


recently a new phenomenon has appeared online, namely search engines:

http://www.google.com/search?num=100q=php+upload+image+example+mysql



Thanks a lot.

Best Regards,

RENZO CLAVIJO



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



RE: [PHP] How to get incoming emails captured by PHP ?

2006-05-10 Thread Adrian
Thanks, I changed the line to:

ade: |/usr/bin/php /wwwroot/www.domain.com/ade/email.php

And get this message back different but in essence the same I believe.   I
know the email.php doesn't do anything, I would love to get it there :)
proving to be difficult :)



   - The following addresses had permanent fatal errors -
|/usr/bin/php /wwwroot/www.domain.com/ade/email.php
(reason: 255)
(expanded from: [EMAIL PROTECTED])

   - Transcript of session follows -
Status: 404
Content-type: text/html
X-Powered-By: PHP/4.3.11

No input file specified.
554 5.3.0 unknown mailer error 255





-Original Message-
From: Stut [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 10, 2006 10:51 AM
To: Adrian
Cc: php-general@lists.php.net
Subject: Re: [PHP] How to get incoming emails captured by PHP ?

Adrian wrote:

I have my aliases file set up with the line: ade: |/usr/bin/php,
|/wwwroot/www.domain.com/ade/email.php

(The path to my PHP is correct)
  


There should only be one | on that line. It should read...

ade: /usr/bin/php /wwwroot/www.domain.com/ade/email.php

And the script it calls (email.php) the code is:

#!/usr/bin/php 

?php

$fd = fopen(php://stdin, r);

$email = ;

while (!feof($fd)) {

$email .= fread($fd, 1024);

}

fclose($fd);

?


Hopefully you realise this script is just reading the email into $email 
and then not doing anything with it. Mail sent to this script will be 
lost, so here's hoping that's not the finished article.

-Stut

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



[PHP] Re: Upload File

2006-05-10 Thread Barry

Renzo Clavijo schrieb:

hi all..

I'm gonna be more precise:

I wrote a form with fields text type=file  , then i need to know 
how
to upload the files to the MySQL server (postgreSQL wold be 
appreciated). It

implies: Which field(s) must have the table where I'll save the image?. Is
there an example code to upload the file(s)?

Thanks a lot.

Best Regards

RENZO CLAVIJO


Add a BLOB field in Database and make an INSERT
Best way would be to BASE64 encode your imagefile so you wont have any 
encoding problems (UTF-8 or such).

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] How to get incoming emails captured by PHP ?

2006-05-10 Thread Stut

Adrian wrote:


Thanks, I changed the line to:

ade: |/usr/bin/php /wwwroot/www.domain.com/ade/email.php

And get this message back different but in essence the same I believe.   I
know the email.php doesn't do anything, I would love to get it there :)
proving to be difficult :)



  - The following addresses had permanent fatal errors -
|/usr/bin/php /wwwroot/www.domain.com/ade/email.php
   (reason: 255)
   (expanded from: [EMAIL PROTECTED])

  - Transcript of session follows -
Status: 404
Content-type: text/html
X-Powered-By: PHP/4.3.11

No input file specified.
554 5.3.0 unknown mailer error 255
 




Try..

ade: |/usr/bin/php /wwwroot/www.domain.com/ade/email.php

Looks to me like PHP is not getting the argument.

-Stut

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



Re: [PHP] Re: Upload File

2006-05-10 Thread Peter Hoskin
Renzo Clavijo wrote:
 hi all..

 I'm gonna be more precise:

 I wrote a form with fields text type=file  , then i need to
 know how
 to upload the files to the MySQL server (postgreSQL wold be
 appreciated). It
 implies: Which field(s) must have the table where I'll save the
 image?. Is
 there an example code to upload the file(s)?
Despite common belief, SQL is not suited to the storage of binary files.
SQL is based on ASCII.
Store your files on the filesystem, not SQL.

 Thanks a lot.

 Best Regards

 RENZO CLAVIJO


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



Re: [PHP] Re: Browser displays blank page, while request still being handled

2006-05-10 Thread Eric Butera

On 5/10/06, Rolf Wouters [EMAIL PROTECTED] wrote:

Yet another update.

Strange thing happened.  I fixed the problem...  It's not a clean
solution, it's not the right solution, but for now, it'll (have to) do :-)

I changed my little test-script to include directives like
max_input_time, set_time_limit(0) etc.  Than I thought, why not try to
generate some output when copying files!??!  So I did...  and you know
what, all of a sudden I'm seeing my response page every single time I
call my script :-D

So our quick-n-dirty-but-we-know-its-wrong-solution is gonna be to have
the script generate some output (a single space) for each file it has
copied (i.e. print( )).
After testing it with the problem-app, we feel confident this is a
viable, temporary, solution.  At least untill we complete our PHP5
rewrite of the Photofresher :-)

I would like to thank all of you for your time, patience and advice.

If anyone has any ideas on why this is working, feel free to let me know :-)


greetz

Rolf

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



Just for my curiosity... do you know for a fact that the script didn't
finish all the way before outputting data?

Others have mentioned that the browser timeout could be a problem.  So
I'm wondering if your script really was completing all the way, but
the browser just gave up on waiting.  Could you try a little test to
take the spaces back out, and write the output of
connection_status() http://us2.php.net/manual/en/function.connection-status.php
to a file to see during each of the copies to see if the browser does go away?

If you've spent too much time on this already that is fine, I was just
curious for future reference. :)

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



Re: [PHP] Re: Upload File

2006-05-10 Thread Barry

Peter Hoskin schrieb:

Renzo Clavijo wrote:

hi all..

I'm gonna be more precise:

I wrote a form with fields text type=file  , then i need to
know how
to upload the files to the MySQL server (postgreSQL wold be
appreciated). It
implies: Which field(s) must have the table where I'll save the
image?. Is
there an example code to upload the file(s)?

Despite common belief, SQL is not suited to the storage of binary files.
SQL is based on ASCII.
Store your files on the filesystem, not SQL.


But mysql can be quite a good spool though.

That way you don't have to code one for yourself.

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



RE: [PHP] How to get incoming emails captured by PHP ?

2006-05-10 Thread Adrian
THANK YOU!

That did it, its now working, thank you for your help.

-Original Message-
From: Stut [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 10, 2006 11:03 AM
To: Adrian
Cc: php-general@lists.php.net
Subject: Re: [PHP] How to get incoming emails captured by PHP ?

Adrian wrote:

Thanks, I changed the line to:

ade: |/usr/bin/php /wwwroot/www.domain.com/ade/email.php

And get this message back different but in essence the same I believe.   I
know the email.php doesn't do anything, I would love to get it there :)
proving to be difficult :)



   - The following addresses had permanent fatal errors -
|/usr/bin/php /wwwroot/www.domain.com/ade/email.php
(reason: 255)
(expanded from: [EMAIL PROTECTED])

   - Transcript of session follows -
Status: 404
Content-type: text/html
X-Powered-By: PHP/4.3.11

No input file specified.
554 5.3.0 unknown mailer error 255
  



Try..

ade: |/usr/bin/php /wwwroot/www.domain.com/ade/email.php

Looks to me like PHP is not getting the argument.

-Stut

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



Re: [PHP] Re: Upload File

2006-05-10 Thread Peter Hoskin

 But mysql can be quite a good spool though.

 That way you don't have to code one for yourself.

That does not mean that there are not SIGNIFICANT ADVANTAGES to coding
something to use the filesystem - such as seek speed. When dealing with
large datasets of binary, filesystems are much quicker at seeking.

As I said, images are binary and sql is ascii - does it sound suited to you?

Google, don't argue - many will agree with me.

Regards,
Peter Hoskin

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



Re: [PHP] Re: Upload File

2006-05-10 Thread Barry

Peter Hoskin schrieb:

But mysql can be quite a good spool though.

That way you don't have to code one for yourself.


That does not mean that there are not SIGNIFICANT ADVANTAGES to coding
something to use the filesystem - such as seek speed. When dealing with
large datasets of binary, filesystems are much quicker at seeking.


I was talking about a spool not a filesystem.
Do you actually read my comments?


As I said, images are binary and sql is ascii - does it sound suited to you?


No Problem with that.



Google, don't argue - many will agree with me.



No need to cry. ;)


Best wishes
Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Re: How to get incoming emails captured by PHP ?

2006-05-10 Thread Adrian
Hi John
 
Thank you, I have just got it working now, will look into the different ways 
you suggested.
 
Adrian wrote:
 Hi All
 
  
 
 I have been trying to have PHP capture incoming emails sent to a specific
 email account and have not been able to achieve this, I have searched high
 and low on the internet and the same article
 ( http://www.evolt.org/article/Incoming_Mail_and_PHP/18/27914/index.html 
 http://www.evolt.org/article/Incoming_Mail_and_PHP/18/27914/index.html) is
 plastered everywhere I have done everything it says, and still no joy, 
 
  
 
 When I send an email to be captured I receive this bounce back email when
 sending an email to [EMAIL PROTECTED] (see below)
 
  
 
 Can any one let a hand?
 
  
 
 Bounce back email:
 
 --
 
- The following addresses had permanent fatal errors -
 
 |/wwwroot/www.domain.com/ade/email.php
 
 (reason: 255)
 
 (expanded from: [EMAIL PROTECTED])
 
  
 
- Transcript of session follows -
 
 Status: 404
 
 Content-type: text/html
 
 X-Powered-By: PHP/4.3.11
 
  
 
 No input file specified.
 
 554 5.3.0 unknown mailer error 255
 
 Content-type: text/html
 
 X-Powered-By: PHP/4.3.11
 
 --
 
  
 
 Here is how I have everything setup.
 
  
 
 I have my aliases file set up with the line: ade: |/usr/bin/php,
 |/wwwroot/www.domain.com/ade/email.php
 
Why are you passing it to the php binary?  Pass it directly to your 
script (make sure it's executable).  For shits and giggles, do a 'which 
php' at the command line to make sure the binary is in /usr/bin.
 
 (The path to my PHP is correct)
 
  
 
 And the script it calls (email.php) the code is:
 
  
 
 #!/usr/bin/php 
 
 ?php
 
 $fd = fopen(php://stdin, r);
 
There's also an easier way to do this.  Check the manual:
 http://us2.php.net/manual/en/features.commandline.php 
http://us2.php.net/manual/en/features.commandline.php
 
 
 $email = ;
 
 while (!feof($fd)) {
 
 $email .= fread($fd, 1024);
 
 }
 fclose($fd);
 
 ?
 
 
-- 
John C. Nichel IV
Programmer/System Admin (ܢerGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

 



[PHP] check socket status

2006-05-10 Thread Antanas Vipartas

Hi

I need to check if socket on some port is listened by some service.

How could I do this ?

thanks,
Antanas Vipartas

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



[PHP] Re: check socket status

2006-05-10 Thread Barry

Antanas Vipartas schrieb:

Hi

I need to check if socket on some port is listened by some service.

How could I do this ?

thanks,
Antanas Vipartas

Knock at the port door ;)

Nah just kidding. you can try to connect via fsockopen.
I hope that port gives something back you can read out. because every 
port allows connections if it's not blocked or firewalled.


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



RE: [PHP] check socket status

2006-05-10 Thread Jim Moseby
 Hi
 
 I need to check if socket on some port is listened by some service.
 
 How could I do this ?
 


Your server is *nix?  You could:
 
$netstat_info=`netstat -l`; // notice back-tics

...then parse through the output.

JM

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



Re: [PHP] Re: Upload File

2006-05-10 Thread Jochem Maas

Peter Hoskin wrote:

Renzo Clavijo wrote:


hi all..

I'm gonna be more precise:

I wrote a form with fields text type=file  , then i need to
know how
to upload the files to the MySQL server (postgreSQL wold be
appreciated). It
implies: Which field(s) must have the table where I'll save the
image?. Is
there an example code to upload the file(s)?


Despite common belief, SQL is not suited to the storage of binary files.
SQL is based on ASCII.


wtf? ASCII is a codeset, SQL is a theoretical language specification.
it's like saying 'software is based on computers.' - completely besides the 
point.

from a performance angle I would never suggest putting image/binary data
into a DB. but to say it's not technically suitable is silly - a 'BLOB' field
is designed specifically for the storage of binary data.


Store your files on the filesystem, not SQL.


in practice that is indeed a sound recommendation - what many people do do is
use the DB to store information about the files that have been uploaded
(original size, original name, location on disk, etc) - which can be very
handy indeed.

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



Re: [PHP] check socket status

2006-05-10 Thread Antanas Vipartas

Jim Moseby wrote:

Your server is *nix?  You could:
 
$netstat_info=`netstat -l`; // notice back-tics


...then parse through the output.

JM


`netstat -l | grep 5514` gives me information about listening service on 
port 5514. That's all I needed but I only can get this from *nix 
console. How could I test it on PHP server side ?


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



Re: [PHP] Re: Upload File

2006-05-10 Thread Peter Hoskin


Jochem Maas wrote:
 Peter Hoskin wrote:
 Renzo Clavijo wrote:

 hi all..

 I'm gonna be more precise:

 I wrote a form with fields text type=file  , then i need to
 know how
 to upload the files to the MySQL server (postgreSQL wold be
 appreciated). It
 implies: Which field(s) must have the table where I'll save the
 image?. Is
 there an example code to upload the file(s)?

 Despite common belief, SQL is not suited to the storage of binary files.
 SQL is based on ASCII.

 wtf? ASCII is a codeset, SQL is a theoretical language specification.
 it's like saying 'software is based on computers.' - completely
 besides the point.
GOOGLE DO NOT ARGUE

So, if ASCII and Binary are both codesets... which does SQL use to store
its data?

Regards,
Peter Hoskin

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



Re: [PHP] Re: Browser displays blank page, while request still being handled

2006-05-10 Thread Edward Vermillion


On May 10, 2006, at 10:54 AM, Rolf Wouters wrote:


Yet another update.

Strange thing happened.  I fixed the problem...  It's not a clean  
solution, it's not the right solution, but for now, it'll (have to)  
do :-)


I changed my little test-script to include directives like  
max_input_time, set_time_limit(0) etc.  Than I thought, why not try  
to generate some output when copying files!??!  So I did...  and  
you know what, all of a sudden I'm seeing my response page every  
single time I call my script :-D


So our quick-n-dirty-but-we-know-its-wrong-solution is gonna be to  
have the script generate some output (a single space) for each file  
it has copied (i.e. print( )).
After testing it with the problem-app, we feel confident this is a  
viable, temporary, solution.  At least untill we complete our PHP5  
rewrite of the Photofresher :-)


I would like to thank all of you for your time, patience and advice.

If anyone has any ideas on why this is working, feel free to let me  
know :-)




Wild guess is the browser is receiving *something* before it times out?

I've only been following this off and on so slap me if I say  
something stupid, but as I understand it the script you're having  
problems with creates a 'gallery/page/something' for photogs by  
copying a lot of files around?


Why are you just outputting a space then? Why not output something  
useful to the person sitting and staring at their screen, like Image  
so-and-so processed...br /\n so they have a clue as to what's  
going on behind the scenes and an idea of how long it's going to take  
to finish? Just a thought.


Ed

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



Re: [PHP] file Upload - checking file size before uploading

2006-05-10 Thread Phillip S. Baker

James Nunnerley wrote:

Is there anyway to check the size of a file before it starts uploading it?
For instance, if the file is huge, and takes ages to upload, and is then
rejected by the server, the user will be somewhat annoyed!

 


I'm not even sure this is a php question!


Nope not a PHP question.
However you can set the max file size within the form tag of HTML.
I forget the proper snytax and tag off the top of my head.
I am not sure the error it spits out as I have never tested that.
you can also use javascript or the like to check the file size.

Bless Be

Phillip

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



Re: [PHP] Re: Upload File

2006-05-10 Thread Edward Vermillion


On May 10, 2006, at 10:53 AM, Peter Hoskin wrote:



GOOGLE DO NOT ARGUE


o_O?



So, if ASCII and Binary are both codesets... which does SQL use to  
store

its data?



ASCII is a codeset, utf* is a codeset binary is a, um... , binary  
data.


varchar, etc = ASCII/utf*/whatever = stored as text
int, etc = integer = stored as integer or long or whatever
BLOB = Binary Large OBject = stored as binary data

While you're right that it's better performance and maintenance wise  
to use the filesystem to store binary objects, especially very large  
ones, it's not necessarily 'wrong' to use MySQL.


http://dev.mysql.com/doc/refman/5.1/en/index.html

Ed

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



[PHP] Re: check socket status

2006-05-10 Thread Antanas Vipartas

Barry wrote:
  Knock at the port door ;)


Nah just kidding. you can try to connect via fsockopen.
I hope that port gives something back you can read out. because every 
port allows connections if it's not blocked or firewalled.


actually, it helps. I can sense if the socked is listened. But the 
program, listening on that port, senses the fsockopen connection which 
I don't want to be.


Is there another way to sense if the socked is listened by some service?

thanks
Antanas Vipartas

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



RE: [PHP] check socket status

2006-05-10 Thread Jim Moseby
 
 Jim Moseby wrote:
  Your server is *nix?  You could:
   
  $netstat_info=`netstat -l`; // notice back-tics
  
  ...then parse through the output.
  
  JM
 
 `netstat -l | grep 5514` gives me information about listening 
 service on 
 port 5514. That's all I needed but I only can get this from *nix 
 console. How could I test it on PHP server side ?
 

Maybe I misunderstand what you are trying to do.  Run this on your server:

?PHP
$netstat_info=`netstat -l`;
echo $netstat_info;
?

Assuming it has permissions, and all the stars are aligned, you should get
the output of the 'netstat -l' command echoed to the screen.

Once you have that, you can parse through the text in $netstat_info for what
you want, or modify the command more to your liking (ie
$netstat_info=`netstat -l | grep 5514`;) or whatever.

JM

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



[PHP] Re: check socket status

2006-05-10 Thread Antanas Vipartas

Jim Moseby solved the problem

I didn't even known that I can exec *nix commands straight from php file.

?php
$netstat_info = `netstat -l | grep 5514`; // notice back-tics
echo $netstat;
?

this gave me what I wanted.

Thanks guys for the help

Antanas Vipartas

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



Re: [PHP] check socket status

2006-05-10 Thread Antanas Vipartas

Jim Moseby wrote:

?PHP
$netstat_info=`netstat -l`;
echo $netstat_info;
?
Assuming it has permissions, and all the stars are aligned, you should get
the output of the 'netstat -l' command echoed to the screen.


Thanks Jim, this really solved the problem up.

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



Re: [PHP] file Upload - checking file size before uploading

2006-05-10 Thread Jochem Maas

Jay Blanchard wrote:

[snip]
Is there anyway to check the size of a file before it starts uploading
it?
For instance, if the file is huge, and takes ages to upload, and is then
rejected by the server, the user will be somewhat annoyed!
[/snip]

PHP is server-side and cannot check anything client-side. You cold use
something client-side, like JavaScript, to check the file size and then
deliver a warning if the file is too large.


please, how do you do that with javascript - given the sandbox that javascript
runs in which doesn't allow access to the file system (IE security bugs and v.
special browser settings not with standing)?





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



[PHP] PHP URL query

2006-05-10 Thread IraqiGeek

Hi all,

I'm somewhat new to php, though I have played a bit with the language. I'm 
currently learning the language, and I'm having a problem passing variables 
through URL query. Here is what I have:


A simple HTML file that contains:
A HREF=test.php?var=test Hi, this is a test! /A

and a php file that contains:
?php
echo( Welcome to our Web site, $var! );
?

However, when I click on the link on the HTML file, I dont get the value of 
$var passed to the php script. I have also tried passing multiple variables 
separated by , and none of those gets passed to the php script.


The files are hosted on a local Debian etch server running apache 2.0.54 and 
php 4.3.10.


Is there something I need to check/change in the config files of apache or 
php?



Regards,
IraqiGeek
www.iraqigeek.com

Boat: A hole in the water surrounded by wood into which one pours money.

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



Re: [PHP] PHP URL query

2006-05-10 Thread Jason Gerfen

IraqiGeek wrote:


Hi all,

I'm somewhat new to php, though I have played a bit with the language. 
I'm currently learning the language, and I'm having a problem passing 
variables through URL query. Here is what I have:


A simple HTML file that contains:
A HREF=test.php?var=test Hi, this is a test! /A

and a php file that contains:
?php
echo( Welcome to our Web site, $var! );
?


try
echo Welcome to our website, $_GET['var'];

However, when I click on the link on the HTML file, I dont get the 
value of $var passed to the php script. I have also tried passing 
multiple variables separated by , and none of those gets passed to 
the php script.


The files are hosted on a local Debian etch server running apache 
2.0.54 and php 4.3.10.


Is there something I need to check/change in the config files of 
apache or php?



Regards,
IraqiGeek
www.iraqigeek.com

Boat: A hole in the water surrounded by wood into which one pours money.




--
Jason Gerfen
Student Computing Labs, University Of Utah
[EMAIL PROTECTED]

I will never tolerate your innocence
~ Blood has been shed

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



Re: [PHP] PHP URL query

2006-05-10 Thread Brad Bonkoski

?php
$var = $_GET['var'];
echo( Welcome to our Web site, $var! );
?

-B

IraqiGeek wrote:


Hi all,

I'm somewhat new to php, though I have played a bit with the language. 
I'm currently learning the language, and I'm having a problem passing 
variables through URL query. Here is what I have:


A simple HTML file that contains:
A HREF=test.php?var=test Hi, this is a test! /A

and a php file that contains:
?php
echo( Welcome to our Web site, $var! );
?

However, when I click on the link on the HTML file, I dont get the 
value of $var passed to the php script. I have also tried passing 
multiple variables separated by , and none of those gets passed to 
the php script.


The files are hosted on a local Debian etch server running apache 
2.0.54 and php 4.3.10.


Is there something I need to check/change in the config files of 
apache or php?



Regards,
IraqiGeek
www.iraqigeek.com

Boat: A hole in the water surrounded by wood into which one pours money.



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



Re: [PHP] PHP URL query

2006-05-10 Thread Eric Butera

On 5/10/06, IraqiGeek [EMAIL PROTECTED] wrote:

Hi all,

I'm somewhat new to php, though I have played a bit with the language. I'm
currently learning the language, and I'm having a problem passing variables
through URL query. Here is what I have:

A simple HTML file that contains:
A HREF=test.php?var=test Hi, this is a test! /A

and a php file that contains:
?php
echo( Welcome to our Web site, $var! );
?

However, when I click on the link on the HTML file, I dont get the value of
$var passed to the php script. I have also tried passing multiple variables
separated by , and none of those gets passed to the php script.

The files are hosted on a local Debian etch server running apache 2.0.54 and
php 4.3.10.

Is there something I need to check/change in the config files of apache or
php?


Regards,
IraqiGeek
www.iraqigeek.com

Boat: A hole in the water surrounded by wood into which one pours money.

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




Try $_GET['var'].

echo( Welcome to our Web site, {$_GET['var']}! );

Two things you should note:
- using $var would be using register_globals which is depricated.
(http://us2.php.net/register_globals)
- echoing out get variables can lead to a XSS attack. (read
http://ha.ckers.org/xss.html)

As many like to point out, please read http://phpsec.org/ for some
security articles since most tutorials always strip any security
related code for simplicity.

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



Re: [PHP] PHP URL query

2006-05-10 Thread Dave Goodchild

register_globals is disabled on your system, which is a good thing. So you
have to reference all values sent via a form using GET with the $_GET
superglobal array as follows:

Welcome to our web site, {$_GET[var]}

or

'Welcome to our web site, ' . $_GET['var']

etc etc

On 10/05/06, IraqiGeek [EMAIL PROTECTED] wrote:


Hi all,

I'm somewhat new to php, though I have played a bit with the language. I'm
currently learning the language, and I'm having a problem passing
variables
through URL query. Here is what I have:

A simple HTML file that contains:
A HREF=test.php?var=test Hi, this is a test! /A

and a php file that contains:
?php
echo( Welcome to our Web site, $var! );
?

However, when I click on the link on the HTML file, I dont get the value
of
$var passed to the php script. I have also tried passing multiple
variables
separated by , and none of those gets passed to the php script.

The files are hosted on a local Debian etch server running apache 2.0.54and
php 4.3.10.

Is there something I need to check/change in the config files of apache or
php?


Regards,
IraqiGeek
www.iraqigeek.com

Boat: A hole in the water surrounded by wood into which one pours money.

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





--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


Re: [PHP] PHP URL query

2006-05-10 Thread John Nichel

IraqiGeek wrote:

Hi all,

I'm somewhat new to php, though I have played a bit with the language. 
I'm currently learning the language, and I'm having a problem passing 
variables through URL query. Here is what I have:


A simple HTML file that contains:
A HREF=test.php?var=test Hi, this is a test! /A

and a php file that contains:
?php
echo( Welcome to our Web site, $var! );
?

However, when I click on the link on the HTML file, I dont get the value 
of $var passed to the php script. I have also tried passing multiple 
variables separated by , and none of those gets passed to the php script.


The files are hosted on a local Debian etch server running apache 2.0.54 
and php 4.3.10.


Is there something I need to check/change in the config files of apache 
or php?




register_globals is off (leave it off)

http://us2.php.net/manual/en/language.variables.external.php

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] PHP URL query

2006-05-10 Thread IraqiGeek

On Wednesday, May 10, 2006 6:08 PM GMT,
Jason Gerfen [EMAIL PROTECTED] wrote:


IraqiGeek wrote:


Hi all,

I'm somewhat new to php, though I have played a bit with the
language. I'm currently learning the language, and I'm having a
problem passing variables through URL query. Here is what I have:

A simple HTML file that contains:
A HREF=test.php?var=test Hi, this is a test! /A

and a php file that contains:
?php
echo( Welcome to our Web site, $var! );





try
echo Welcome to our website, $_GET['var'];


Jason, brad, Eric, Dave, and John,

Thank you all for pointing $_GET and register_globals. The tutorial I'm 
reading is from 2000 and references PHP 4.1.





However, when I click on the link on the HTML file, I dont get the
value of $var passed to the php script. I have also tried passing
multiple variables separated by , and none of those gets passed to
the php script.

The files are hosted on a local Debian etch server running apache
2.0.54 and php 4.3.10.

Is there something I need to check/change in the config files of
apache or php?


Regards,
IraqiGeek
www.iraqigeek.com

Boat: A hole in the water surrounded by wood into which one pours
money.



Regards,
IraqiGeek
www.iraqigeek.com

The trouble with doing something right the first time is that nobody 
appreciates how difficult it was. 


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



[PHP] New: Browser based editor of WIN.INI files (on Windows)

2006-05-10 Thread Jeremy C O'Connor
Hi

This is an announcement of a new browser based editor for the
C:\WINDOWS\PHP.INI file. It lets you uncomment or comment lines by clicking
a checkbox, and alter the values of configuration settings. You can also
insert, edit and delete lines. It is in the Beta stage of release, so please
let me know of any bugs at [EMAIL PROTECTED] . I will probably not
implement new features for the moment, so please don't email me feature
requests. Just bugs/ Also note that it only edits the PHP.INI file in
$_ENV['WINDIR'], not in any other path. Also, each time you click on the
Update button, it makes a backup copy of PHP.INI as PHP.INI.BAK.

To install, download the zip file, unzip it, and copy the phpEditIni folder
to
your webroot.

Enjoy! It can be downloaded from:
http://mysite.mweb.co.za/residents/net07350/

--
net07350

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



[PHP] Update: That is to say PHP.INI, not WIN.INI

2006-05-10 Thread Jeremy C O'Connor
phpEditIni project.

That is to say PHP.INI, not WIN.INI

-- 
net07350

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



RE: [PHP] PHP URL query

2006-05-10 Thread Vedanta Barooah
Try this :
?php
$foo=$_GET['var'];
echo ($foo);
?

Refer: http://www.zend.com/zend/art/art-sweat4.php

- Vedanta Barooah

-Original Message-
From: IraqiGeek [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 10, 2006 10:14 PM
To: php-general@lists.php.net
Subject: [PHP] PHP URL query

Hi all,

I'm somewhat new to php, though I have played a bit with the language. I'm 
currently learning the language, and I'm having a problem passing variables 
through URL query. Here is what I have:

A simple HTML file that contains:
A HREF=test.php?var=test Hi, this is a test! /A

and a php file that contains:
?php
echo( Welcome to our Web site, $var! );
?

However, when I click on the link on the HTML file, I dont get the value of 
$var passed to the php script. I have also tried passing multiple variables 
separated by , and none of those gets passed to the php script.

The files are hosted on a local Debian etch server running apache 2.0.54 and

php 4.3.10.

Is there something I need to check/change in the config files of apache or 
php?


Regards,
IraqiGeek
www.iraqigeek.com

Boat: A hole in the water surrounded by wood into which one pours money.

-- 
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] Good Answers

2006-05-10 Thread Richard Lynch
Hey y'all...

In the spirit of improving the mailing list, I'd like to suggest that
we, as a group, attempt to not provide answers with Bad Practices, or
at least always to point out that the Sample is Bad Practice for
production sites?

For example, an answer to a question about ?php echo $foo? where it
is clear that register_globals is off should either specifically
sanitize the data, or make reference to the need to sanitize the data,
or link to http://phpsec.org or something along those lines.

Otherwise, we merely perpetuate the problems of Bad Code with our
answers to newbies, who then run off and write insecure sites and
cause us more grief down the road.

Hmmm.  Maybe this should be part of a Netiquette document How to give
good answers right next to that How to ask good questions document
:-^

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Good Answers

2006-05-10 Thread Jay Blanchard
[snip]
In the spirit of improving the mailing list, I'd like to suggest that
we, as a group, attempt to not provide answers with Bad Practices, or
at least always to point out that the Sample is Bad Practice for
production sites?

For example, an answer to a question about ?php echo $foo? where it
is clear that register_globals is off should either specifically
sanitize the data, or make reference to the need to sanitize the data,
or link to http://phpsec.org or something along those lines.

Otherwise, we merely perpetuate the problems of Bad Code with our
answers to newbies, who then run off and write insecure sites and
cause us more grief down the road.

Hmmm.  Maybe this should be part of a Netiquette document How to give
good answers right next to that How to ask good questions document
:-^
[/snip]

I vote for that. I need to find that doc...curt z had it on a site

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



Re: [PHP] Re: Upload File

2006-05-10 Thread Richard Lynch
On Wed, May 10, 2006 9:52 am, Renzo Clavijo wrote:
 I'm gonna be more precise:

 I wrote a form with fields text type=file  , then i need to

Should be input

And don't forget to use FORM attribute: enctype=multipart/form-data

 know how
 to upload the files to the MySQL server (postgreSQL wold be
 appreciated). It
 implies: Which field(s) must have the table where I'll save the
 image?. Is
 there an example code to upload the file(s)?

Are you going to write queries that involve the data *IN* the file as
part of the search, sort, or filtering?

If not, then just toss the files in the file-system and store the path
to the file in the db.  Much cleaner/easier.

If you MUST store the data in the db, the size of the data determines
the type of the field:
varchar, text, blob, bigblob, humungousblob

And, of course, this all depends on WHICH database you are using...
Some call it memo some call it blob some call it something else.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Good Answers

2006-05-10 Thread Eric Butera

On 5/10/06, Richard Lynch [EMAIL PROTECTED] wrote:

Hey y'all...

In the spirit of improving the mailing list, I'd like to suggest that
we, as a group, attempt to not provide answers with Bad Practices, or
at least always to point out that the Sample is Bad Practice for
production sites?

For example, an answer to a question about ?php echo $foo? where it
is clear that register_globals is off should either specifically
sanitize the data, or make reference to the need to sanitize the data,
or link to http://phpsec.org or something along those lines.

Otherwise, we merely perpetuate the problems of Bad Code with our
answers to newbies, who then run off and write insecure sites and
cause us more grief down the road.

Hmmm.  Maybe this should be part of a Netiquette document How to give
good answers right next to that How to ask good questions document
:-^

--
Like Music?
http://l-i-e.com/artists.htm

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



I agree with this 100%.  I know as I started with PHP years ago I
though Great! Here is a perfect snipplet that works for what I need
to make my site wrapper!  Didn't take long to learn that snipplet
that I found on Google was just screaming to include remote code. ;)

How was I to know when I was just playing around for the first time
making a dynamic site that passing ?page=x could allow people to run
PHP code on my site through an include.  Nowhere in the tutorial did
it mention anything about remote including.  My guess is that the
author wasn't aware of it either since it was such a small easy thing.

After I realized what was going on I made it a point to read as much
as I could understand into code security.  The hardest part for me is
trying to get out of the mindset of making the script work, but rather
into the mindset of if someone were trying to exploit my script, what
can they possibly do?  Once I did that I was able to see that not
forcing ?id=x to use $id = (int)$_GET['id'] could get me into trouble
if I wasn't fortunate enough to have mod_security enabled on our
server.

I'm sure this is very obvious to most of you and that is great.  But
people asking for help really aren't up there yet and need guidance in
these issues because they don't even know to consider these things.  I
still see so many examples passed on that have the ability to inject
SQL or spam via E-Mail Header injection.  I mean to be fair the php
manual never mentions that if you don't protect the parameters going
into mail() injection is possible.

I know the argument always ends up being The language is there, you
need to protect yourself from shooting your own foot.  But isn't PHP
so popular because the barrier into programming with it so low?

I guess all I can say is thank you for this mail Richard and I'll try
and do my part. :)

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



Re: [PHP] file Upload - checking file size before uploading

2006-05-10 Thread Richard Lynch
On Wed, May 10, 2006 11:09 am, Phillip S. Baker wrote:
 James Nunnerley wrote:
 However you can set the max file size within the form tag of HTML.
 I forget the proper snytax and tag off the top of my head.
 I am not sure the error it spits out as I have never tested that.
 you can also use javascript or the like to check the file size.

AFAIK, the browsers never did get around to using this to do anything
useful with it...

It is a weird sort of check, from those halcyon days when users didn't
do things like hack POST data to try and break your server...

So, pretty much, it's a useless bit of cruft, really.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Cannot suppress fsockopen errors

2006-05-10 Thread Richard Lynch
On Wed, May 10, 2006 5:30 am, Nick Wilson wrote:
 Im having a hard time surpressing fsckopen() errors. I've looked at
 the
 manual and searched around, but what i am doing /appears/ to be
 correct,
 yet im still geting warnings...

 here's the code:

 // open a socket to the server
 if($handle = @fsockopen($bits['host'], 80, $errno, $errstr, 10) or
 die(die)) {
   return true;
 }

 and here are the warnings:

 warning: fsockopen(): php_network_getaddresses: getaddrinfo failed:
 Name
 or service not known in
 /var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/includes/validateBlog.inc
 on line 53.

 warning: fsockopen(): unable to connect to www.ivana.dk:80 in
 /var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/includes/validateBlog.inc
 on line 53.

 I've even tried looking though php.ini for any clues and i dont see
 anything useful. Does anyone have an idea of what im missing here?

@ should suppress those, I would think...

You may want to try using http://php.net/set_error_handler

And on your production server, the errors should be going to an
error_log and not the browser anyway.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] internal operation

2006-05-10 Thread Richard Lynch
On Wed, May 10, 2006 4:11 am, Luke Cole wrote:
 Do the file system and directory functions, perform the file system
 command relative to your OS.

 e.g.
 does the internal code of the function:
 rename(oldname, newname);

 do exactly (in unix file systems):
 `mv oldname newname`

 do exactly (in windows file systems):
 `ren oldname newname`

I believe there are C libraries from, say, stdlib that they are
using, which, under the hood, are what the shells use.

So, in reality, it's more like:

PHP --\
   + C library to rename file
DOS/Shell-/

 If not, how does it do it?

I could be wrong.  Maybe it's just magic. :-)

 Also, if one disables users from using ``,
 are all file system and directory functions disabled to?

I don't think so.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: Good Answers

2006-05-10 Thread Jo�o C�ndido de Souza Neto
I agree.

Some times i don´t put my questions here because i don´t know how to ask.
But, many people do.

Richard Lynch [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 Hey y'all...

 In the spirit of improving the mailing list, I'd like to suggest that
 we, as a group, attempt to not provide answers with Bad Practices, or
 at least always to point out that the Sample is Bad Practice for
 production sites?

 For example, an answer to a question about ?php echo $foo? where it
 is clear that register_globals is off should either specifically
 sanitize the data, or make reference to the need to sanitize the data,
 or link to http://phpsec.org or something along those lines.

 Otherwise, we merely perpetuate the problems of Bad Code with our
 answers to newbies, who then run off and write insecure sites and
 cause us more grief down the road.

 Hmmm.  Maybe this should be part of a Netiquette document How to give
 good answers right next to that How to ask good questions document
 :-^

 -- 
 Like Music?
 http://l-i-e.com/artists.htm 

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



Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Richard Lynch


for ($i = 1; $i = 20; $i++){
  if (isset($_POST[$i])){
//insert blah blah blah
  }
}

Also, I don't think '1' is valid NAME for HTML specification.

You could use:

NAME=menu[1]

Then in PHP:

$menu = $_POST['menu'];

for ($i = 1; $i = 20; $i++){
  if (isset($menu[$i])){
  }
}

And, of course, you need to scrub your data.

http://phpsec.org

On Wed, May 10, 2006 3:49 am, Chris Grigor wrote:
 morning all,

 Is there an easier way of doing the following??

 form1 submitting to form1.php
 input type=checkbox name=1
 input type=checkbox name=2
 input type=submit

 form1.php

 ?php

 $link = mysql_connect('host', 'user', 'pass') or die (Connection
 failed: . mysql_error());

 mysql_select_db('yourdbname', $link) or die (selection failed:  .
 mysql_error());

 if(isset($_POST[1])) {
 mysql_query(INSERT INTO menu (label) VALUES ('item 1
 selected'));
 }
 else {
 mysql_query(INSERT INTO menu (label) VALUES ('item 1 not
 selected'));
 }
 if(isset($_POST[2])) {
 mysql_query(INSERT INTO menu (label) VALUES ('item 2
 selected'));
 }
 else {
 mysql_query(INSERT INTO menu (label) VALUES ('item 2 not
 selected'));
 }

 mysql_close($link);
 ?

 So my question is, if I have a form with 20 + items which can be
 checkboxes, when submitted do I need to go through each one and add it
 to the datasbase or maybe some kind of loop?.

 Thank you

 Chris

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Good Answers

2006-05-10 Thread Richard Lynch
On Wed, May 10, 2006 2:16 pm, Eric Butera wrote:
 On 5/10/06, Richard Lynch [EMAIL PROTECTED] wrote:

 these issues because they don't even know to consider these things.  I
 still see so many examples passed on that have the ability to inject
 SQL or spam via E-Mail Header injection.  I mean to be fair the php
 manual never mentions that if you don't protect the parameters going
 into mail() injection is possible.

 I know the argument always ends up being The language is there, you
 need to protect yourself from shooting your own foot.  But isn't PHP
 so popular because the barrier into programming with it so low?

I understand that the Manual and our answers could not possibly
anticipate, much less provide advice to avoid, every possible
combination of events that leads to losing one's foot.

That said, if we didn't care about keeping our feet, wouldn't we all
be writing CGI scripts and custom Apache Modules in C?

PHP *has* lowered the entry barrier ridiculously low, to the point
where we've got idiots and English majors writing really cool
software -- complete with a total lack of any security features
whatsoever.

We've made it so damn easy -- Isn't it our responsibility, to some
degree, to warn users that they really do need to buy those trigger
guards and locked cabinets and store the ammo separately from the
weapon?

This is always a judgement call, but do we really want to spend the
next decade living with the consequences of NOT providing Security
advice to newbies?

zillions of web forms for email feedback with header injections
zillions of XSS attacks

We have to be pragmatic about this and inform users what NOT to do of
the most common mistakes, if only to protect ourselves from the
collateral damage of them shooting their foot off

It's our own inboxes and our own bandwidth, and, ultimately, the
quality of the Internet itself at stake.

If we can document for beginners the most common security mistakes,
and have that documentation in their face when they first encounter
the answer to what they perceive as their current problem surely
that's worth a little effort and the blurring of the line drawn at
just providing the function and leaving the responsibility on the user
to be responsible.

I sometimes think PHP is a like a loaded gun in the hands of a child,
it's just too damn easy to use and to get yourself into serious
trouble SO quickly and easily.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: Upload File

2006-05-10 Thread Rory Browne

There are names for people who use the blob field of a MySQL db to store
images.
Moron, and Idiot are just two examples, but if other circumstances exist,
you can say newbie as well. As a newbie I thought myself that storing images
in a DB would be a nice clean solution. Voices of experience said otherwise.
Over the years as I grew more experienced I began to understand myself, why
putting images into a MySQL Db is a Bad Thing[tm].

Use blobs to store small amounts of transient data. Use the FS to store
something as large and semi-static as images.

Sorry if this seems rough / harsh, but if it causes a person to think twice
before using MySQL as a file storage solution, then it's justified.

There are a few less polite names for people who develop software like this
that I have to maintain later.



Are you going to write queries that involve the data *IN* the file as
part of the search, sort, or filtering?

PHP has the facilities built-in to perform this search/sort/filter - while
their use isn't always the cleanest solution, anything is better than
putting files in a db.

If you can't find the features you require, then feel free to use external
tools - anything to avoid db file storage.


Re: [PHP] internal operation

2006-05-10 Thread Rory Browne

www.php.net/streams

On 5/10/06, Richard Lynch [EMAIL PROTECTED] wrote:


On Wed, May 10, 2006 4:11 am, Luke Cole wrote:
 Do the file system and directory functions, perform the file system
 command relative to your OS.

 e.g.
 does the internal code of the function:
 rename(oldname, newname);

 do exactly (in unix file systems):
 `mv oldname newname`

 do exactly (in windows file systems):
 `ren oldname newname`

I believe there are C libraries from, say, stdlib that they are
using, which, under the hood, are what the shells use.

So, in reality, it's more like:

PHP --\
   + C library to rename file
DOS/Shell-/

 If not, how does it do it?

I could be wrong.  Maybe it's just magic. :-)

 Also, if one disables users from using ``,
 are all file system and directory functions disabled to?

I don't think so.

--
Like Music?
http://l-i-e.com/artists.htm

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




Re: [PHP] Good Answers

2006-05-10 Thread Micky Hulse

Good thread. Great points.

I always thought this Sitepoint thread was very helpful:

http://snipurl.com/qafg

Cheers,
Micky

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



Re: [PHP] Good Answers

2006-05-10 Thread tedd

Hmmm.  Maybe this should be part of a Netiquette document How to give
good answers right next to that How to ask good questions document
:-^



Yep, and right next to How to think good, How to Google, and How to RTFM

:-)

tedd
--

http://sperling.com

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



[PHP] question about using temporary named pipe in the string for system

2006-05-10 Thread Ginger Cheng

Hello, PHP gurus,
I have a command that I want to run using system function. The 
command exploits temporary named pipes in the place of temporary files.  

  my command is 


paste   (cut -f1  file1)  (cut -f2  file2) final_file

 It works perfectly well if I just type it in my interactive 
shell.  But if I do a


?php 
$cmd =  paste   (cut -f1  file1)  (cut -f2  file2) final_file;

system($cmd);
?

 I got the syntax error msg as
sh: -c: line 1: syntax error near unexpected token `('.   I have tried 
to 'escapeshellcmd' the  command and run it in system, then I got


paste: invalid option -- f
Try `paste --help' for more information.

Also tried exec.  I really want to take advantage of the 
temporary named pipes so I don't have to worry about the temporary files 
generated.  I've been googling around without much help.  Could anyone 
plz give me some hint? Thanks a lot

 ginger



Re: [PHP] question about using temporary named pipe in the string for system

2006-05-10 Thread Joe Henry
On Wednesday 10 May 2006 4:02 pm, Ginger Cheng wrote:
 Hello, PHP gurus,
  I have a command that I want to run using system function. The
 command exploits temporary named pipes in the place of temporary files.

my command is

 paste   (cut -f1  file1)  (cut -f2  file2) final_file

   It works perfectly well if I just type it in my interactive
 shell.  But if I do a

 ?php
 $cmd =  paste   (cut -f1  file1)  (cut -f2  file2) final_file;
 system($cmd);
 ?

   I got the syntax error msg as
 sh: -c: line 1: syntax error near unexpected token `('.   I have tried
 to 'escapeshellcmd' the  command and run it in system, then I got

 paste: invalid option -- f
 Try `paste --help' for more information.

  Also tried exec.  I really want to take advantage of the
 temporary named pipes so I don't have to worry about the temporary files
 generated.  I've been googling around without much help.  Could anyone
 plz give me some hint? Thanks a lot
   ginger

Think you might want the shell_exec() command instead.

http://us2.php.net/manual/en/function.shell-exec.php

HTH
-- 
Joe Henry
www.celebrityaccess.com
[EMAIL PROTECTED]

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



Re: [PHP] Good Answers

2006-05-10 Thread Jochem Maas

As usual, Richard shows the quality of his mettle! :-)

I absolutely agree, some ideas:

1. have the mailing list automatically add a single line to the
mailing list sig that promotes security/good-practice and points to phpsec.org?
(I guess only someone like Rasmus could say whether this was even an
acceptable proposition)

2. promote 'hacking ethos' in general - which starts with RTFM but goes
further in that 'newbies' should be encouraged to broaden their understanding
of a problem area beyond 'getting it to work'

3. dish out more praise to those 'newbies' that do go the extra mile to
enrich their own skills beyond what is strictly necessary to get their
job done. encourage research and problem solving.

4. conversely I do believe we can [keep] making it clear that certain
attitudes don't cut it - I'm referring to the 'please do my job for me
crowd' - (in the end you can't save the all ;-) - maybe we can 'nominate'
certain experienced people to reply to messages which are blatantly bad
questions (and/or show blatant signs of not being interested in the 'why's)
encouraging people not to answer until the OP until he/she shows signs
of wanting to expand their own understanding and researching their own
problems. for instance the only reason I hardly ever have reason to
ask a question on the list is because the information/answers I'm looking
for have 99% of the time already been documented in articles/tutorials/etc
on web - (i.e. I'm always saying 'how the  does that work' and almost
always someone 'out there' has already written something that explains it!
it's a matter of finding it and taking the time to read/re-read)

[quite probably point 4 does not come accross the way I meant - in which
please ignore :-)]

in short I stand by you notion and will try to do my part.

[the kind is dead, long live php]

Richard Lynch wrote:

Hey y'all...

In the spirit of improving the mailing list, I'd like to suggest that
we, as a group, attempt to not provide answers with Bad Practices, or
at least always to point out that the Sample is Bad Practice for
production sites?

For example, an answer to a question about ?php echo $foo? where it
is clear that register_globals is off should either specifically
sanitize the data, or make reference to the need to sanitize the data,
or link to http://phpsec.org or something along those lines.

Otherwise, we merely perpetuate the problems of Bad Code with our
answers to newbies, who then run off and write insecure sites and
cause us more grief down the road.

Hmmm.  Maybe this should be part of a Netiquette document How to give
good answers right next to that How to ask good questions document
:-^



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



Re: [PHP] question about using temporary named pipe in the string for system

2006-05-10 Thread Jochem Maas

Ginger Cheng wrote:

Hello, PHP gurus,
I have a command that I want to run using system function. The 
command exploits temporary named pipes in the place of temporary files. 
  my command is

paste   (cut -f1  file1)  (cut -f2  file2) final_file

 It works perfectly well if I just type it in my interactive 
shell.  But if I do a


?php $cmd =  paste   (cut -f1  file1)  (cut -f2  file2) 
final_file;

system($cmd);
?

 I got the syntax error msg as
sh: -c: line 1: syntax error near unexpected token `('.   I have tried 


I notice that the 'sh' shell is being used according to your error output,
I'm guessing that maybe your interactive shell is running something like 'bash'
and that this discrepency might the root cause of the problem. just a guess -
I don't know how you would define another shell for php to use either :-/.

another thing to try is the backticks operator, as described on the following
page:

http://php.net/manual/en/language.operators.execution.php


to 'escapeshellcmd' the  command and run it in system, then I got

paste: invalid option -- f
Try `paste --help' for more information.

Also tried exec.  I really want to take advantage of the 
temporary named pipes so I don't have to worry about the temporary files 
generated.  I've been googling around without much help.  Could anyone 
plz give me some hint? Thanks a lot

 ginger




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



Re: [PHP] Re: Upload File

2006-05-10 Thread Jochem Maas

thank you Edward.

Edward Vermillion wrote:

 On May 10, 2006, at 10:53 AM, Peter Hoskin wrote:


 GOOGLE DO NOT ARGUE


 o_O?

yeah! I did figure it really was about time they changed their
'Do No Evil' slogan given their escapades in china

funnily enough I watched a documentary the other day about the
potential for information/propaganda abuse given the way major
search engines operator and dominate.

'Google: do not argue' is pretty fitting all in all. lol.



 So, if ASCII and Binary are both codesets... which does SQL use to  store
 its data?


 ASCII is a codeset, utf* is a codeset binary is a, um... , binary
 data.

 varchar, etc = ASCII/utf*/whatever = stored as text
 int, etc = integer = stored as integer or long or whatever
 BLOB = Binary Large OBject = stored as binary data

there is a funny little story about where the name BLOB came from:
http://www.cvalde.net/misc/blob_true_history.htm


 While you're right that it's better performance and maintenance wise  to
 use the filesystem to store binary objects, especially very large  ones,
 it's not necessarily 'wrong' to use MySQL.

 http://dev.mysql.com/doc/refman/5.1/en/index.html

 Ed


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



Re: [PHP] PHP URL query

2006-05-10 Thread Jochem Maas

IraqiGeek wrote:

Hi all,



...

two things which have nothing to do with your original question
(that seems to have been covered rather well)



Regards,
IraqiGeek
www.iraqigeek.com


try viewing your site in firefox - notice all those question marks
in the content? might be interesting to find out why that is. :-)



Boat: A hole in the water surrounded by wood into which one pours money.


that really made me laugh :-)





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



Re: [PHP] Re: Upload File

2006-05-10 Thread Jochem Maas

Jochem Maas wrote:

thank you Edward.



...



there is a funny little story about where the name BLOB came from:
http://www.cvalde.net/misc/blob_true_history.htm


just to note that BLOBs where invented by the guy that designed Interbase
which just happens to be the ancestor of the coolest DBMS you can connect
to php with ;-) namely firebird. of course I'm biased - a friend of mine
wrote the php ibase/fbird extension :-)

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



Re: [PHP] file Upload - checking file size before uploading

2006-05-10 Thread Wolf
In your form uploading script:
# individual file size limit - in bytes (102400 bytes = 100KB)
$file_size_ind = 838860800; // 819.2 MB


$weight=$_FILES[fileupload][size];

if ($weight$file_size_ind)
{
 echobrimg src=\$dir_img/error.gif\ width=\15\
height=\15\nbsp;bfont size=\2\ERROR: please get the file size
less than .$file_size_ind. BYTES  (.round(($file_size_ind/1024),2).
KB)/font/bbr»a href=\$_SERVER[PHP_SELF]\back/a;
}


James Nunnerley wrote:
 Is there anyway to check the size of a file before it starts uploading it?
 For instance, if the file is huge, and takes ages to upload, and is then
 rejected by the server, the user will be somewhat annoyed!
 
  
 
 I'm not even sure this is a php question!
 
  
 
 Cheers
 
 Nunners
 
 

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



Re: [PHP] PHP suddenly stops working on FreeBSD

2006-05-10 Thread Matt

Just in case you ever need to check the configure line again in the
future, you can get at it (even if you've built through the FreeBSD
ports) through a phpinfo page.  The third section on that page is
labeled Configure Command and lists all the options used during the
build.

Matt

On 5/10/06, Paul Waring [EMAIL PROTECTED] wrote:

On 10/05/06, Richard Collyer [EMAIL PROTECTED] wrote:
 Does this do the same with PHP5? Remember mod_php5 has gone from ports
 so lang/php5 then make config and select build apache option.

I've no idea whether it does that with PHP5, but I'm not ready to
upgrade to that version yet (perhaps over the summer when I have a bit
more spare time I'll attempt it).

Paul

--
Data Circle
http://datacircle.org

--
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] Good Answers

2006-05-10 Thread Ligaya Turmelle

Jay Blanchard wrote:

[snip]
In the spirit of improving the mailing list, I'd like to suggest that
we, as a group, attempt to not provide answers with Bad Practices, or
at least always to point out that the Sample is Bad Practice for
production sites?

For example, an answer to a question about ?php echo $foo? where it
is clear that register_globals is off should either specifically
sanitize the data, or make reference to the need to sanitize the data,
or link to http://phpsec.org or something along those lines.

Otherwise, we merely perpetuate the problems of Bad Code with our
answers to newbies, who then run off and write insecure sites and
cause us more grief down the road.

Hmmm.  Maybe this should be part of a Netiquette document How to give
good answers right next to that How to ask good questions document
:-^
[/snip]

I vote for that. I need to find that doc...curt z had it on a site


here is the link for the improved newbie doc -
http://zirzow.dyndns.org/php-general/NEWBIE

--

life is a game... so have fun.

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

Re: [PHP] Good Answers

2006-05-10 Thread Ligaya Turmelle

Richard Lynch wrote:

Hey y'all...

In the spirit of improving the mailing list, I'd like to suggest that
we, as a group, attempt to not provide answers with Bad Practices, or
at least always to point out that the Sample is Bad Practice for
production sites?

For example, an answer to a question about ?php echo $foo? where it
is clear that register_globals is off should either specifically
sanitize the data, or make reference to the need to sanitize the data,
or link to http://phpsec.org or something along those lines.

Otherwise, we merely perpetuate the problems of Bad Code with our
answers to newbies, who then run off and write insecure sites and
cause us more grief down the road.

Hmmm.  Maybe this should be part of a Netiquette document How to give
good answers right next to that How to ask good questions document
:-^

Might I make a suggestion for an addition to the newbie email - in the 
where to find more information section - add a link either to the 
manual security section or phpsec.org


--

life is a game... so have fun.

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

[PHP] php parsing and db content

2006-05-10 Thread Schalk

Greetings All,

I have the following problem. I load certain links and breadcrumbs from 
the database into a external .php file which I include on various pages 
within the site. Due to this I have defined a constant '_root' and 
precede all links with this to ensure that the links will work no matter 
from where inside the site structure they are called.


My problem is this, when I load these links from the database into the 
external .php file and the load the page that includes this, the line 
?php echo _root ? is not parsed and shows up in the links, for example:


/our_work/?php echo _root ?/our_work/index.php when it should be 
/site_root/our_work/index.php


How can I ensure that these calls to ?php echo _root ? are parsed 
before sent to the browser?


Thanks!

--
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers

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



Re: [PHP] file Upload - checking file size before uploading

2006-05-10 Thread Chris

Wolf wrote:

In your form uploading script:
# individual file size limit - in bytes (102400 bytes = 100KB)
$file_size_ind = 838860800; // 819.2 MB


$weight=$_FILES[fileupload][size];

if ($weight$file_size_ind)
{
 echobrimg src=\$dir_img/error.gif\ width=\15\
height=\15\nbsp;bfont size=\2\ERROR: please get the file size
less than .$file_size_ind. BYTES  (.round(($file_size_ind/1024),2).
KB)/font/bbr»a href=\$_SERVER[PHP_SELF]\back/a;
}


That has already attempted to upload the file to the server.. which is 
what the OP didn't want.


Would be handy to be able to do this but *shrug*..

--
Postgresql  php tutorials
http://www.designmagick.com/

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



  1   2   >