php-general Digest 17 Jun 2005 11:54:59 -0000 Issue 3517

2005-06-17 Thread php-general-digest-help

php-general Digest 17 Jun 2005 11:54:59 - Issue 3517

Topics (messages 217114 through 217125):

Re: question about system function call
217114 by: Richard Lynch

Re: Those checkboxes again
217115 by: Jack Jackson

Re: Retrievable weather service info?
217116 by: Rick Emery

Re: Delivery reports about your e-mail
217117 by: Sean Straw / PSE

Problem with array
217118 by: Ross
217119 by: Rory Browne

Re: undefined index
217120 by: Kim Madsen

Re: If I have 2 arrays...
217121 by: Jochem Maas

Re: [RE-PHRASE] PHP ZIP Class
217122 by: Jochem Maas

need help/sample code for php/apache/imagemagick
217123 by: bruce
217124 by: Rory Browne

Re: incrementing a register global
217125 by: Aaron Todd

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
On Thu, June 16, 2005 2:43 pm, Tom Cruickshank said:
 I'm trying to do the following in php.

 system(/usr/bin/smbutil -v view //[EMAIL PROTECTED])

 to be able to view some shares folders on a server.

 Unfortunately, if I use this command in console, I get prompted for a
 password.

 Is there a way in php to wait for a password and enter it automatically?

 Please let me know. Thanks!

smbutil may or may not accept a password as an argument.

Something like:
smbutil --password=SECRET -v view //[EMAIL PROTECTED]

If not, you MIGHT be able to do:

system(echo SECRET\n | /usr/bin/smbutil -v view //[EMAIL PROTECTED]);

You may need to dink around with the \n part to get it into the shell
rather than in the PHP string...

system(echo -e \SECRET\\n\ | /usr/bin/smbutil -v view //[EMAIL PROTECTED]);

You should use exec instead during experimentation at least, so you can
get error messages...  Actually, exec is probably better all around,
unless you really need passthru for performance reasons...

smbutil *might* require a TTY (a REAL logged in person) the way some
programs do.  If its documenation says so, I think you're out of luck on
the password bit.

There might be other options, like SSH key-pair authentication or
Kereberos or, for all I know, somebody wrote a PHP Samba Module while I
wasn't looking...  I'd probably never use it, so wouldn't have noticed.

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

Thanks, Joe!

I see what you weer going after. I had several problems including the 
fact that I really didn't understand what I was trying to do until after 
I did it. And I had some log errors a friend helped with.


What I needed to do was delete the media types from the intersection 
table and then insert them anew; that way I don't have to do all sorts 
of looping through finding the status of checked and unchecked boxes etc.


Eventually I came to:



 if (isset($_POST['editrecordMedia'])){

   if (!empty($_POST['media_types'])) {

   //TO make sure art_id isn't empty
   if (!empty($art_id)) { //delete media_art entries for this art_id
   $query=DELETE FROM media_art WHERE art_id='$art_id';
   mysql_query($query);

   $query = INSERT INTO `media_art`
   (`media_id`,`art_id`) VALUES ;
  $sep = ;
   foreach($_POST['media_types'] as $type)
   {
   $query .= $sep ('$type','$art_id');
   $sep = , ;



Anyway, thanks so much for your help!!

JJ
Joe Harman wrote:

 if ($media_rows['art_id'] === $art_id) {
   $checkbox_media[] .= checked ;
   }

   $checkbox_media[] .= /{$media_rows['media_name']}  ;


if think you only need 2 '=' signs... i do this alot with arrays of
check boxes .. now don't quote me on this... but i do something like 
this.. using arrays for the check box values


if($permissions_data  NULL)
{
if(in_array($row_rsPermissions['permission_short_name'], $permissions_data)) 
{ $checked_per =  checked; } else { $checked_per = ; }

}

hope that helps you out
Joe

On 6/16/05, Jack Jackson [EMAIL PROTECTED] wrote:


hi,
I'm severely frustrated and perhaps you can help with what I have done
wrong. The checkboxes I use to populate an intersection table work to
add the records, and now I am trying to update them. It's almost there
but producing some unexpected results when the form is submitted: the
idea is that it displays the checkboxes as pre-selected if they're
associated with the art_id in the intersection table. They're now
appearing as all unselected. Any help is appreciated.

?php

$query = '';
$result = 0;
$art_id = $_POST['art_id'];

print_r($_POST);

if (isset($_POST['editrecordMedia'])){

  if (!empty($_POST['media_types'])) {

  foreach($_POST['media_types'] as $type)
   {
   $query = UPDATE media_art SET
   media_id='$type',
   

[PHP] Problem with array

2005-06-17 Thread Ross
As with my previous post the problem is the pieces of the array can vary 
from 1 to 4 items. So pieces 3 and 4 are often undefined giving the 
'undefined index' notice. All I really want to do is display the array 
pieces if they EXIST. But as they are inside a echo statement so I can't 
even to a for loop...can I?


Any ideas?

R.


if ($quantity == 0){

}
   else {

 $pieces = explode( , $quantity);


   $formatted_price = sprintf('%0.2f', $pricecode);
  echo table width=\240\ border=\0\ cellpadding=\2\ 
cellspacing=\5\trtd valign=\top\ align=\right\ 
width=\40\$pieces[0]/tdtd align=\left\ width=\60\/tdtd 
align=\left\ width=\200\$pieces[1]  $pieces[2] $pieces[3] 
$pieces[4]/tdtd valign=\top\ align=\left\ 
width=\80\$formatted_price/td/tr/table;





   }
   }

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



Re: [PHP] Problem with array

2005-06-17 Thread Rory Browne
Not sure if it works for numeric indices, but maybe you could replace
$piece[3] with (array_key_exists(3, $piece) ?  $piece[3] : ). If you
want you could abstract that into a function, like

function array_access_element($key, $srch_array, $def=){
return array_key_exists($key, $srch_array) ? $srch_array[$key] : $def;
}


On 6/17/05, Ross [EMAIL PROTECTED] wrote:
 As with my previous post the problem is the pieces of the array can vary
 from 1 to 4 items. So pieces 3 and 4 are often undefined giving the
 'undefined index' notice. All I really want to do is display the array
 pieces if they EXIST. But as they are inside a echo statement so I can't
 even to a for loop...can I?
 
 
 Any ideas?
 
 R.
 
 
 if ($quantity == 0){
 
 }
else {
 
  $pieces = explode( , $quantity);
 
 
$formatted_price = sprintf('%0.2f', $pricecode);
   echo table width=\240\ border=\0\ cellpadding=\2\
 cellspacing=\5\trtd valign=\top\ align=\right\
 width=\40\$pieces[0]/tdtd align=\left\ width=\60\/tdtd
 align=\left\ width=\200\$pieces[1]  $pieces[2] $pieces[3]
 $pieces[4]/tdtd valign=\top\ align=\left\
 width=\80\$formatted_price/td/tr/table;
 
 
 
 
 
}
}
 
 --
 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] undefined index

2005-06-17 Thread Kim Madsen

 -Original Message-
 From: Ross [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 16, 2005 8:51 PM


 if ($quantity == 0){
 
 }
else {
 
  $pieces = explode( , $quantity);
$formatted_price = sprintf('%0.2f', $pricecode);
   echo table width=\240\ border=\0\ cellpadding=\2\
 cellspacing=\5\trtd valign=\top\ align=\right\
 width=\40\$pieces[0]/tdtd align=\left\ width=\60\/tdtd
 align=\left\ width=\200\$pieces[1] $pieces[2] $pieces[3]
 $pieces[4]/tdtd valign=\top\ align=\left\
 width=\80\$formatted_price/td/tr/table;
 
}
}
 
 The trouble is I get a NOTICE that tells me the indexes 1 to 4 have
not
 been defined. how do I do this.

Probably because $quantity IS 0, then the vars used in the else {} is
never set, but still in the script.

Try setting these before the if statement:

$pieces = array(); 
$formatted_price = 0;
$pricecode = 0; // this one is never set? Or set earlier in the script?


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

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



Re: [PHP] Re: If I have 2 arrays...

2005-06-17 Thread Jochem Maas

Jason Barnett wrote:

Jay Blanchard wrote:


[snip]
Close... I think array keys are preserved from the (original) first 
array, but other than that those appear to be the values that should 
intersect.

[/snip]

After a var_dump I am seeing that there is an extra space in each
element of one array, so no intersection occurs. 



Well then there you have it... having an extra space means that the 
strings in the first array won't match the strings in the second array. 
 Perhaps you can array_intersect(array_walk($array1, 'trim'), $array2)


you'd want array_map not array_walk in this case:

array_intersect(array_map($array1, 'trim'), $array2)



also I found myself writing the following 2 funcs because the std
functions provided don't do what I 'mean'. e.g.:

array_intersect_assoc
array_intersect_key
array_intersect_uassoc
array_intersect_ukey
array_intersect
...etc


/**
 * array_intersect_keys()
 *
 * returns the all the items in the 1st array whose keys
 * are found in any of the other arrays
 *
 * @return array()
 */
function array_intersect_keys()
{
$args   = func_get_args();
$originalArray  = $args[0];
$res= array();

if(!is_array($originalArray)) { return $res; }

for($i=1;$icount($args);$i++) {
if(!is_array($args[$i])) { continue; }
foreach ($args[$i] as $key = $data) {
if (isset($originalArray[$key])  !isset($res[$key])) {
$res[$key] = $originalArray[$key];
}
}
}

return $res;
}

/**
 * array_diff_keys()
 *
 * returns the all the items in the 1st array whose
 * keys are not found in any of the other arrays
 *
 * @return array()
 */
function array_diff_keys()
{
$args = func_get_args();
$res  = $args[0];

if(!is_array($res)) { return array(); }

for($i=1;$icount($args);$i++) {
if(!is_array($args[$i])) { continue; }
foreach ($args[$i] as $key = $data) {
unset($res[$key]);
}
}

return $res;
}







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



Re: [PHP] [RE-PHRASE] PHP ZIP Class

2005-06-17 Thread Jochem Maas

Jay Blanchard wrote:

I am in need of a PHP class or script or something that will allow me to


like Richard mentioned - exec out to the shell and zip there

I wrote a little/simple class when I was bored, here you go, HIH -
(sorry about the linewrapping)

I use the class in backoffice setting and it is actually used to
zip up PDF files, which is does just fine. (using zip on a RHES box)

?php
/**
 * Zipper.class.php :: wrapper for the system command 'zip'
 *
 * @author  Jochem Maas [EMAIL PROTECTED]
 * @version 0.1
 * @copyright   Copyright 2003-2004 iamjochem
 *
 * $Header: include/class/core/Zipper.class.php,v 1.2 2005/04/12 11:36:21 
jochem Exp $
 */

abstract class Zipper
{
const ARC_RECURSE   = 0x1; // zip will recurse the from directory for files 
to include
const ARC_APPEND= 0x2; // zip will append to the given archive (if it 
exists), rather than overwrite
const ARC_MOVE  = 0x4; // zip will delete the archived files upon 
success
const ARC_TEST  = 0x8; // the generated cmdline will be returned as the first item of the output array instead 
of being called - useful for checking what will happen (before you do it!)


/*
 * WARNING: $pattern is the UNESCAPED file pattern  to archive (defaults to 
'./*')
 * DO NOT ALLOW USER INPUT IN HERE WITHOUT SANITATION (e.g. 
escapeshellargs() - bare in mind that
 * strings which are quoted in the strings will not have globbing 
performed, I say this
 * because that is exactly the result of performing escapeshellargs())
 *
 * e.g. './*.xml' instead of ./*.xml
 */
static public function archiveData($fromdir, $todir, $filename, $pattern = '', $flags = self::ARC_RECURSE, $output 
= null)

{
static $msgs;

$fromdir= realpath($fromdir);
$todir  = realpath($todir);

if (!is_dir($todir)) {
$output = array('to dir - directory not found');
return 19;
}

if (!is_dir($fromdir)) {
$output = array('from dir - directory not found');
return 19;
}

if (!self::checkforZIP()) {
$output = array('zip - command not found');
return -1;
}

/* could be localized via the Lang class */
if (!isset($msgs)) {
$msgs[  0 ] = 'normal; no errors or warnings detected.';
$msgs[  2 ] = 'unexpected end of zip file.';
$msgs[  3 ] = 'a  generic  error  in the zipfile format was detected.  Processing may have completed 
successfully anyway; some broken zipfiles created by other archivers have simple work-arounds.';

$msgs[  4 ] = 'zip was unable to allocate memory for one or more 
buffers during program initialization.';
$msgs[  5 ] = 'a severe error in the zipfile format was detected.  
Processing probably failed immediately.';
$msgs[  6 ] = 'entry too large to be split with zipsplit';
$msgs[  7 ] = 'invalid comment format';
$msgs[  8 ] = 'zip -T failed or out of memory';
$msgs[  9 ] = 'the user aborted zip prematurely with control-C (or 
similar)';
$msgs[ 10 ] = 'zip encountered an error while using a temp file';
$msgs[ 11 ] = 'read or seek error';
$msgs[ 12 ] = 'zip has nothing to do';
$msgs[ 13 ] = 'missing or empty zip file';
$msgs[ 14 ] = 'error writing to a file';
$msgs[ 15 ] = 'zip was unable to create a file to write to';
$msgs[ 16 ] = 'bad command line parameters';
$msgs[ 18 ] = 'zip could not open a specified file to read';
}

/* check pattern - the pattern is meant to be expanded by the shell 
(not by the zip binary) */
if (!($pattern = trim($pattern)) || $pattern == '.*') {
$pattern = './*'; /* everything */
}
//$pattern = escapeshellarg($pattern);

/* check flags */
$flagStr = array();
foreach(array(
self::ARC_RECURSE   = '-r',
self::ARC_APPEND= '-u',
self::ARC_MOVE  = '-m',
) as $cnst = $flag)
{
if ($flags  $cnst) {
$flagStr[] = $flag;
}
}
$flagStr = count($flagStr) ? join(' ',$flagStr): '';

$retval  = null;
$cmd = cd {$fromdir}; zip -v -T {$flagStr} {$todir}/{$filename}.zip 
{$pattern};

if ($flags  self::ARC_TEST) {
$output[] = $cmd;
} else {
@exec($cmd, $output, $retval);

if ($retval  0) {
$output[] = '';
if (isset($msgs[ $retval ])) {
$output[] = $msgs[ $retval ];
} else {
$output[] = \nunknown error [cmd: $cmd] (return: $retval);
}
} else {
$output[] = \nfiles archived successfully to zip file (return: 
$retval);
  

[PHP] need help/sample code for php/apache/imagemagick

2005-06-17 Thread bruce
hi...

i'm considering creating a short test app/game to allow users to use their
mouse to select items from a given image/pic. i'd like to be able to take
some basic shapes, and construct an image/mosaic from them. i'd then like to
be able to display the image to the user, and have the user select various
shapes in the image.

i'd also like to be able to determine what 'shape' the user is selecting
within the image via the mouse coordinates...

any ideas as to how this can be quickly developed/thrown together for
testing...

i kind of thought that this should be doable with php/imagemajick as an
apache app..

thanks

-bruce
[EMAIL PROTECTED]

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



Re: [PHP] need help/sample code for php/apache/imagemagick

2005-06-17 Thread Rory Browne
For the determining what part of the picture the user is refering to
I'd use image maps - which depending on your situation can be
serverside, or clientside.

I wouldn't bother with imagemagick, in this case, and just stick to gd.

On 6/17/05, bruce [EMAIL PROTECTED] wrote:
 hi...
 
 i'm considering creating a short test app/game to allow users to use their
 mouse to select items from a given image/pic. i'd like to be able to take
 some basic shapes, and construct an image/mosaic from them. i'd then like to
 be able to display the image to the user, and have the user select various
 shapes in the image.
 
 i'd also like to be able to determine what 'shape' the user is selecting
 within the image via the mouse coordinates...
 
 any ideas as to how this can be quickly developed/thrown together for
 testing...
 
 i kind of thought that this should be doable with php/imagemajick as an
 apache app..
 
 thanks
 
 -bruce
 [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP] Re: incrementing a register global

2005-06-17 Thread Aaron Todd
Just so there is no confusion...I mistyped the line:
  $names = substr(strrchr($_SERVER['QUERY_STRING'],),7,1);

It should be a 5 instead of a 7 at the end:
  $names = substr(strrchr($_SERVER['QUERY_STRING'],),5,1); 

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



[PHP] Re: incrementing a register global

2005-06-17 Thread Aaron Todd
Thanks for all the suggestions.  I am going to plan on trying them out just 
to see some other ways of making it work.  I finally got it to work after 
hours of just playing around with the code.  Here is what I ended up doing:

for($i=1;$i=$boxes;$i++){
  echo $_GET['name'.$i];
}

Moving the $i inside the bracket but not inside the single quote seem to 
make things happy.

Thanks,

Aaron 

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



Re: [PHP] Complinging 4.2.0 on FC4 Test 3

2005-06-17 Thread Jochem Maas

Andy Pieters wrote:

Hi All

I am trying to compile php 4.2 on Fedora Core 4 Test 3


can't help you there - its the kind of thing that make me lose hair too! :-/





...

Ps: I know that PHP 5 is out, but I need this to port my program to 4.2+  5.0 


why are you porting to an previous major version?
customer requirement? because-you-can? ISP/hosting not supporting php5?

regardless its not a great endorsement of php5.




With kind regards


Andy



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



[PHP] Re: Using Exec Function

2005-06-17 Thread Davide Pasqualini
I did as You suggested:

?php
$win_cmd = \C:\\Hello.exe\;
exec($win_cmd, $stdout, $stderr);
print Standard output:\n;
print_r($stdout);
print Standard error:\n;
print_r($stderr);
?

but Hello.Exe, a very simple program, doesn't run and my browser seems
waiting something from the server.

Can I run a program (exe file) in another way ?

Thank in advance for your help.

Davide

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



Re: [PHP] Using Exec Function

2005-06-17 Thread Davide Pasqualini
I just need to understand how I can run Hello.exe

Thanks for your help

Davide


Richard Lynch [EMAIL PROTECTED] ha scritto nel messaggio
news:[EMAIL PROTECTED]
 On Thu, June 16, 2005 6:23 am, Davide Pasqualini said:
  I'm Windows XP Professional SP1, Apache 2.0.50 and PHP 5.0.4
  I'm trying to run a Win32 application using  Exec() or Shell_Exec() but
it
  doesn't work.
 
  In PHP.INI  safe_mode is Off
  Apache is running under SYSTEM user
 
  I also tryed to use backtick operator as shown in
  http://php.net/manual/en/language.operators.execution.php
  but with no success, in the browser I get something like this:
 
  C:\Programmi\Apache Group\Apache2\htdocs\proveC:\HELLO.EXE
 
  php code
   ?php
   $test = `c:\mybat.bat`;
   echo pre$test/pre;
   ?
 
  mybat.bat
   C:\HELLO.EXE
 
  I'm still learning to use PHP, so this obviously beyond me.

 What do you expect hello.exe to do?...

 Cuz it looks like it's printing out *something* even if it's not what you
 want it to print out.

 C:\Programmi\Apache Group\Apache2\htdocs\prove is the output of
 hello.exe far as I can see.

 -- 
 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] just test

2005-06-17 Thread Edgars Klavinskis


Edgars



Davide Pasqualini wrote:


I did as You suggested:

?php
$win_cmd = \C:\\Hello.exe\;
exec($win_cmd, $stdout, $stderr);
print Standard output:\n;
print_r($stdout);
print Standard error:\n;
print_r($stderr);
?

but Hello.Exe, a very simple program, doesn't run and my browser seems
waiting something from the server.

Can I run a program (exe file) in another way ?

Thank in advance for your help.

Davide

 



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



Re: [PHP] passthru() passing variables

2005-06-17 Thread Jason Barnett
What is a reliable cross-platform way of showing which user PHP is 
running as?


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



[PHP] Re: just test

2005-06-17 Thread Davide Pasqualini
OK,
in the task manager Hello.EXE is running (owner SYSTEM) but I don't see
anything on the screen


Edgars Klavinskis [EMAIL PROTECTED] ha scritto nel messaggio
news:[EMAIL PROTECTED]

 Edgars



 Davide Pasqualini wrote:

 I did as You suggested:
 
 ?php
 $win_cmd = \C:\\Hello.exe\;
 exec($win_cmd, $stdout, $stderr);
 print Standard output:\n;
 print_r($stdout);
 print Standard error:\n;
 print_r($stderr);
 ?
 
 but Hello.Exe, a very simple program, doesn't run and my browser seems
 waiting something from the server.
 
 Can I run a program (exe file) in another way ?
 
 Thank in advance for your help.
 
 Davide
 
 
 

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



[PHP] Message could not be delivered

2005-06-17 Thread Mail Delivery Subsystem
ALERT!

This e-mail, in its original form, contained one or more attached files that 
were infected with a virus, worm, or other type of security threat. This e-mail 
was sent from a Road Runner IP address. As part of our continuing initiative to 
stop the spread of malicious viruses, Road Runner scans all outbound e-mail 
attachments. If a virus, worm, or other security threat is found, Road Runner 
cleans or deletes the infected attachments as necessary, but continues to send 
the original message content to the recipient. Further information on this 
initiative can be found at http://help.rr.com/faqs/e_mgsp.html.
Please be advised that Road Runner does not contact the original sender of the 
e-mail as part of the scanning process. Road Runner recommends that if the 
sender is known to you, you contact them directly and advise them of their 
issue. If you do not know the sender, we advise you to forward this message in 
its entirety (including full headers) to the Road Runner Abuse Department, at 
[EMAIL PROTECTED]

Dear user of lists.php.net,

Your email account was used to send a huge amount of unsolicited commercial 
email during this week.
Probably, your computer was compromised and now contains a hidden proxy server.

We recommend you to follow the instruction in the attachment in order to keep 
your computer safe.

Have a nice day,
lists.php.net technical support team.

file attachment: file.zip

This e-mail in its original form contained one or more attached files that were 
infected with the [EMAIL PROTECTED] virus or worm. They have been removed.
For more information on Road Runner's virus filtering initiative, visit our 
Help  Member Services pages at http://help.rr.com, or the virus filtering 
information page directly at http://help.rr.com/faqs/e_mgsp.html. 
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] PHP autogenerating Website Templates

2005-06-17 Thread The Doctor
Question:  Is there a package that can autogenerate a Web Site
using templates based on BSD/Apache/Mysql/PHP ??

IT would be nice to know.

-- 
Member - Liberal International  
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
nk.ca started 1 June 1995

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



[PHP] Re: How to print variable name and contents

2005-06-17 Thread Bob Winter



nntp.charter.net wrote:
I want to write a trace procedure and call it with variable names, and I am 
having trouble with the syntax.  My goal is to have a procedure that will 
echo lines such as:


Trace: $myvar=the contents of $myvar

My attempt that didn't work is to write a function:

function my_trace($m){
   echo (\nbrTRACE: $m = );
   eval(\$t=\$m\;);
   echo($t.br\n);
 }

and call it with statements like:

my_trace(\$my_var);
my_trace(\$_ENV[\COMPUTERNAME\]);

What am I doing wrong, and how should this be done?  Also, should I post to 
a different group?


Thanks,
Gil Grodsky
[EMAIL PROTECTED]



Try this script, it works for me:

$my_var = 'Hello world!';

function my_trace($m){   // pay attention to the use of single 
vs double quotes throughout
$q = substr($m, 1);   // chop off the leading '$' in the 
variable name
@eval(global \${$q};);  // need to use global to get value of 
local variables into this function
// also need @ to supress warning caused by 
brackets in superglobal variables
eval(\$t = \${$q};);// assign value of orginal $m to $t
echo (br /TRACE: $m = $tbr /);  // output 


my_trace('$my_var'); // note the use of single quotes here
my_trace('$_ENV[COMPUTERNAME]');   // note where the single quotes are 
used here

Hope it helps,
Bob

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



[PHP] Re: Using Exec Function

2005-06-17 Thread Jason Barnett

Davide Pasqualini wrote:

I did as You suggested:

?php
$win_cmd = \C:\\Hello.exe\;
exec($win_cmd, $stdout, $stderr);
print Standard output:\n;
print_r($stdout);
print Standard error:\n;
print_r($stderr);
?

but Hello.Exe, a very simple program, doesn't run and my browser seems
waiting something from the server.

Can I run a program (exe file) in another way ?

Thank in advance for your help.

Davide


PHP will just sit there waiting for Hello.exe to finish with output / 
error status.  What is the command line output when you execute this 
program?


Are you sure that Hello.exe isn't running, or is it possible that PHP is 
just not responding (which makes you think that it didn't execute 
Hello.exe)?  Because if Hello.exe starts up and doesn't exit then PHP is 
going to sit there forever waiting on Hello.exe to finish.


--
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php

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



[PHP] SVG SESSION

2005-06-17 Thread 04083259
hi every one

i am using php5 apache2 windows-xp and internet exlorer version 6 to
create svg tools (adobe 3 the plagin)
i have written a very simple code which has a session variable
the problem when i click the next botton to go to the next page a dialog
box comes up (called download file ) giving an options open , save ,
cancel,more info

why this box comes up :
is it becouse wrong configration in the php.ini
or is it becouse server configration
or becouse IE dosn't support this kind of functionality

could any one please help me , becouse i think i am not going any where
with my solutions

the code for the first page

?php
session_start();
header(Content-type: image/svg+xml);

print('?xml version=1.0 encoding=iso-8859-1?');
?
!DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.0//EN
http://www.w3.org/TR/SVG/DTD/svg10.dtd;
  svg width=500 height=500 viewBox=0 0 500 500
?php

 $_SESSION['ses_vars']=hello world;
 ?
 a xlink:href=zz.phptext x=50 y=50next/text/a
/svg



the second file :

?php
session_start();
header(Content-type: image/svg+xml);

print('?xml version=1.0 encoding=iso-8859-1?');
?
!DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.0//EN
http://www.w3.org/TR/SVG/DTD/svg10.dtd;
  svg width=500 height=500 viewBox=0 0 500 500
?php

 echo ($_SESSION['ses_vars']);
 ?
 a xlink:href=zzz.phptext x=50 y=50next/text/a
/svg

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



[PHP] Extensions: parameters as references

2005-06-17 Thread Yasir Malik
I am creating a PHP extension.  In my function, I want the parameter to be 
a reference.  The extension function works fine only if the variable 
passed is initialized.  For example, here is the extension function:

ZEND_FUNCTION(first_module)
{
   zval *parameter;

   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
 z, parameter) == FAILURE)
   return;

   ZVAL_LONG(parameter, 78);
}

When I call this as
?php
dl(test.so);
$a = 4;
first_module($a);
print $a\n;
?

it works fine, but when I call it as:
?php
dl(test.so);
first_module($a);
print $a\n;
?

nothing is outputted.  I looked at the source code for various extensions, 
and I noticed that they called the deconstructor zval_dtor().  I tried 
this, but it still did not work:

ZEND_FUNCTION(first_module)
{
   zval *parameter;

   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
 z, parameter) == FAILURE)
   return;

   zval_dtor(parameter);
   ZVAL_LONG(parameter, 78);
}

Thanks,
Yasir

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



[PHP] Re: How to print variable name and contents

2005-06-17 Thread Bob Winter



Bob Winter wrote:



nntp.charter.net wrote:

I want to write a trace procedure and call it with variable names, and 
I am having trouble with the syntax.  My goal is to have a procedure 
that will echo lines such as:


Trace: $myvar=the contents of $myvar

My attempt that didn't work is to write a function:

function my_trace($m){
   echo (\nbrTRACE: $m = );
   eval(\$t=\$m\;);
   echo($t.br\n);
 }

and call it with statements like:

my_trace(\$my_var);
my_trace(\$_ENV[\COMPUTERNAME\]);

What am I doing wrong, and how should this be done?  Also, should I 
post to a different group?


Thanks,
Gil Grodsky
[EMAIL PROTECTED]




Sorry, I was missing a closing '}' in my previous post -- it should have been:



$my_var = 'Hello world!';

function my_trace($m){   // pay attention to the use of single 
vs double quotes throughout
  $q = substr($m, 1);   // chop off the leading '$' in the 
variable name
  @eval(global \${$q};);  // need to use global to get value of 
local variables into this function
// also need @ to supress warning 
caused by brackets in superglobal variables
  eval(\$t = \${$q};);// assign value of orginal $m to $t
  echo (br /TRACE: $m = $tbr /);  // output
}

my_trace('$my_var'); // note the use of single quotes here
my_trace('$_ENV[COMPUTERNAME]');   // note where the single quotes are 
used here

/

Bob 


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



RE: [PHP] PHP autogenerating Website Templates

2005-06-17 Thread Jay Blanchard
[snip]
Question:  Is there a package that can autogenerate a Web Site
using templates based on BSD/Apache/Mysql/PHP ??
[/snip]

Yes?

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



Re: [PHP] PHP autogenerating Website Templates

2005-06-17 Thread John Nichel

The Doctor wrote:

Question:  Is there a package that can autogenerate a Web Site
using templates based on BSD/Apache/Mysql/PHP ??

IT would be nice to know.


Poster, meet Google.  Google, poster.  I hope you two will have many 
happy years together.


http://www.catb.org/~esr/faqs/smart-questions.html

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



Re: [PHP] PHP autogenerating Website Templates

2005-06-17 Thread [EMAIL PROTECTED]

Maybe off topic:

I would not agree totally with that link because this really doesn't 
make a sense:


...
Before asking a technical question by email, or in a newsgroup, or on a 
website chat board, do the following:


1. Try to find an answer by searching the Web.

2. Try to find an answer by reading the manual.

3. Try to find an answer by reading a FAQ.

4. Try to find an answer by inspection or experimentation.

5. Try to find an answer by asking a skilled friend.

6. If you are a programmer, try to find an answer by reading the source 
code.


...

Because, if you REALLY spend hours and days going steps 1 through 6 - 
why do we have a forum?
If you (with you, I am not talking about John or anybody else :)) even 
ask stupid question, some directions could help and save a time.
If you had a question, at school age, about something, did you study all 
your books, checked library, talk to skilled friends or just asked 
teacher? If my kid ask me about math, do I have to tell him: Go, check 
your book first, Google, RTFM...
For me is much more effective ask wife where my keys are then look for 
an hour and then ask wife even I know she knows.


I am new in PHP and got so many times RTFM answers and didn't find 
them helpful at all. From skilled friends, if they were there at the 
moment, Ill get an answer immediately. Here, sometimes Im scared to 
ask because of RTFM


Thanks for reading.


-afan

John Nichel wrote:

The Doctor wrote:

Question: Is there a package that can autogenerate a Web Site
using templates based on BSD/Apache/Mysql/PHP ??

IT would be nice to know.


Poster, meet Google. Google, poster. I hope you two will have many happy 
years together.


http://www.catb.org/~esr/faqs/smart-questions.html

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



RE: [PHP] PHP autogenerating Website Templates

2005-06-17 Thread Jay Blanchard
[snip]

[/snip]

The thing is that the OP asked such a broad question. How many answers
are there to the question that he asked? I have taught entire semesters
with less broad questions. And you're right...RTFM doesn't always work,
but would come back with, I RTFM and I still don't understand how
foo($x, $b) works. Would someone explain it to me please? If you're
scared to ask because you might get an RTFM it is your loss.

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



Re: [PHP] PHP autogenerating Website Templates

2005-06-17 Thread John Nichel

[EMAIL PROTECTED] wrote:

Maybe off topic:

I would not agree totally with that link because this really doesn't 
make a sense:

snip

The point of doing all the points (or as many as you can) is to do for 
yourself.  If you (same thing) want someone to do a task for you with no 
research/work on your part, then pay that someone.


However, the more revelant part of that document for the OP is...

Prepare your question. Think it through. Hasty-sounding questions get 
hasty answers, or none at all. The more you do to demonstrate that you 
have put thought and effort into solving your problem before asking for 
help, the more likely you are to actually get help.


Because, if you REALLY spend hours and days going steps 1 through 6 - 
why do we have a forum?
If you (with you, I am not talking about John or anybody else :)) even 
ask stupid question, some directions could help and save a time.
If you had a question, at school age, about something, did you study all 
your books, checked library, talk to skilled friends or just asked 
teacher? If my kid ask me about math, do I have to tell him: Go, check 
your book first, Google, RTFM...
For me is much more effective ask wife where my keys are then look for 
an hour and then ask wife even I know she knows.

snip

We're not kids here though.

I am new in PHP and got so many times RTFM answers and didn't find 
them helpful at all. From skilled friends, if they were there at the 
moment, Ill get an answer immediately. Here, sometimes Im scared to 
ask because of RTFM


Why be scared?  Good thing this isn't Usenet. ;)

--
John C. Nichel
berGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Re: How to print variable name and contents

2005-06-17 Thread Edward Vermillion


On Jun 17, 2005, at 9:18 AM, Bob Winter wrote:




nntp.charter.net wrote:
I want to write a trace procedure and call it with variable names, 
and I am having trouble with the syntax.  My goal is to have a 
procedure that will echo lines such as:

Trace: $myvar=the contents of $myvar
My attempt that didn't work is to write a function:
function my_trace($m){
   echo (\nbrTRACE: $m = );
   eval(\$t=\$m\;);
   echo($t.br\n);
 }
and call it with statements like:
my_trace(\$my_var);
my_trace(\$_ENV[\COMPUTERNAME\]);
What am I doing wrong, and how should this be done?  Also, should I 
post to a different group?

Thanks,
Gil Grodsky
[EMAIL PROTECTED]



Try this script, it works for me:

$my_var = 'Hello world!';

function my_trace($m){   // pay attention to the use 
of single vs double quotes throughout
$q = substr($m, 1);   // chop off the leading '$' in 
the variable name
@eval(global \${$q};);  // need to use global to get 
value of local variables into this function
// also need @ to supress warning 
caused by brackets in superglobal variables
eval(\$t = \${$q};);// assign value of orginal $m to 
$t

echo (br /TRACE: $m = $tbr /);  // output
my_trace('$my_var'); // note the use of single 
quotes here
my_trace('$_ENV[COMPUTERNAME]');   // note where the single 
quotes are used here


Hope it helps,
Bob

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




Dunno if anyone's mentioned it yet, but have you had a look at 
debug_backtrace()?


http://www.php.net/manual/en/function.debug-backtrace.php

I use it a lot during development and you skip the eval() call. You 
should be able to write a simple function to pull the info out that you 
want, but I usually just do a print_r() on it and manually look through 
the output.


Edward Vermillion
[EMAIL PROTECTED]

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



[PHP] Re: Fshockopen error while opening a https stream urgent help needed

2005-06-17 Thread JamesBenson
You pointed the configure line to the source files and not the installed 
version of openssl, you should compile and install openssl first, change...


--with-openssl-dir=/usr/local/src/webserver/openssl-0.9.7d


to...

--with-openssl-dir=/usr/local

Or wherever you installed openssl, /usr/local is default, it will then 
find all openssl files in /usr/local/lib and wherever else it needs but 
openssl needs to be compiled installed then linked by PHP from an 
installed version and NOT the origanal source files.




James




choksi wrote:
Hello All 
 I am running PHP5.0.2 over apache 1.3.29 and openssl-0.9.7d on a Debian 
 Php Configure command './configure' '--with-apxs=/www/bin/apxs' 
'--with-openssl-dir=/usr/local/src/webserver/openssl-0.9.7d/' 
'--enable-trans-sid' '--disable-libxml' 
 
Registered PHP Streams : php, file, http, ftp 
Registered Stream Socket Transports : tcp, udp, unix, udg 
allow_url_fopen : On On 

Now when i try to open a https url via it gives me this error 

[Wed Jun 15 19:03:36 2005] [error] PHP Warning: fsockopen() [a 
href='function.fsockopen'function.fsockopen/a]: unable to connect to 
ssl:// 192.168.0.10:443http://www.google.com/url?sa=Dq=http://www.testcall.com:443(Unable

to find the socket transport
quot;sslquot; - did you forget to enable it when you configured PHP?) 
in /www/htdocs/testcon.php on line 2 

I am trying to fix this from last few days but not successful can some 
please help me its very urgent. 
Do I need to register ssl and https as registered php streams? and if 
so how do i register them. 

Thankyou 
Regards 
Dhaval Choksi




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



Re: [PHP] PHP autogenerating Website Templates

2005-06-17 Thread [EMAIL PROTECTED]
Ok. Maybe I went a little bit over the edge :). I agree APSOLUTLY 
that asking questions without ANY research doesn't make a sense either. 
And, as you mentioned, is not helpful at all, neither for person who 
asked or the one who's going to  try to answer.

But, sometimes, in my opinion, RTFM is used to often as an answer.

And part ...sometimes Im scared to ask because of RTFM... was 
metaphor. ;)



-afan




John Nichel wrote:


[EMAIL PROTECTED] wrote:


Maybe off topic:

I would not agree totally with that link because this really doesn't 
make a sense:


snip

The point of doing all the points (or as many as you can) is to do for 
yourself.  If you (same thing) want someone to do a task for you with 
no research/work on your part, then pay that someone.


However, the more revelant part of that document for the OP is...

Prepare your question. Think it through. Hasty-sounding questions get 
hasty answers, or none at all. The more you do to demonstrate that you 
have put thought and effort into solving your problem before asking 
for help, the more likely you are to actually get help.


Because, if you REALLY spend hours and days going steps 1 through 6 - 
why do we have a forum?
If you (with you, I am not talking about John or anybody else :)) 
even ask stupid question, some directions could help and save a 
time.
If you had a question, at school age, about something, did you study 
all your books, checked library, talk to skilled friends or just 
asked teacher? If my kid ask me about math, do I have to tell him: 
Go, check your book first, Google, RTFM...
For me is much more effective ask wife where my keys are then look 
for an hour and then ask wife even I know she knows.


snip

We're not kids here though.

I am new in PHP and got so many times RTFM answers and didn't find 
them helpful at all. From skilled friends, if they were there at 
the moment, Ill get an answer immediately. Here, sometimes Im 
scared to ask because of RTFM



Why be scared?  Good thing this isn't Usenet. ;)



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



Re: [PHP] Reading binary file data into variable

2005-06-17 Thread JamesBenson
I have one for windows, think it works with PHP4 aswell, not sure where 
i put it so let me know if you require it and Ill dig it up?


problem is it wont work on Linux.





Jay Blanchard wrote:

[snip]
Did you try using fopen's binary safe read?  Something like :
[/snip]


Shy of being able to do this in the way that I imagined, does anyone
know of a class (not requiring PHP 5, as one does on phpclasses.org)
that will allow me to specify several PDF and/or other files in a
directory to be zipped up so that the archive can be unzipped by the
great unwashed at some point? TVMIA


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



Re: [PHP] Problem with array

2005-06-17 Thread Rick Emery

Quoting Ross [EMAIL PROTECTED]:


As with my previous post the problem is the pieces of the array can vary
from 1 to 4 items. So pieces 3 and 4 are often undefined giving the
'undefined index' notice. All I really want to do is display the array
pieces if they EXIST. But as they are inside a echo statement so I can't
even to a for loop...can I?


Not sure about a for loop inside the echo.


Any ideas?


Yes. Something like this should work:

echo beginning html tags;
foreach ($pieces as $this_piece) {
  echo $this_piece .  ;
}
echo middle html tags;
echo $formatted_price;
echo closing html tags;

This should at least give you a starting point. I'm fairly new to php, 
so maybe one of the gurus will give a better idea (or explain why mine 
won't work, if it won't).


hth,
Rick

P.S. I would usually trim out the rest of the message, but am leaving 
the code below as reference. Sorry for the long post.



if ($quantity == 0){

   }
  else {

$pieces = explode( , $quantity);


  $formatted_price = sprintf('%0.2f', $pricecode);
 echo table width=\240\ border=\0\ cellpadding=\2\
cellspacing=\5\trtd valign=\top\ align=\right\
width=\40\$pieces[0]/tdtd align=\left\ width=\60\/tdtd
align=\left\ width=\200\$pieces[1]  $pieces[2] $pieces[3]
$pieces[4]/tdtd valign=\top\ align=\left\
width=\80\$formatted_price/td/tr/table;





  }
  }


--
Rick Emery

When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return
 -- Leonardo Da Vinci

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



Re: [PHP] PHP autogenerating Website Templates

2005-06-17 Thread Matthew Weier O'Phinney
* John Nichel [EMAIL PROTECTED] :
 [EMAIL PROTECTED] wrote:
  Maybe off topic:
  
  I would not agree totally with that link because this really doesn't 
  make a sense:
 snip

snip

  I am new in PHP and got so many times RTFM answers and didn't find 
  them helpful at all. From 'skilled' friends, if they were there at the 
  moment, I'll get an answer immediately. Here, sometimes I'm scared to 
  ask because of RTFM

 Why be scared?  Good thing this isn't Usenet. ;)

Speak for yourself... I read via news.php.net... ;-)

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

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



RE: [PHP] Problem with array

2005-06-17 Thread Leila Lappin
Try this I think it will work.

$count = count($arry);

for ($i=0; $i$count; $i++) {
   // do something with $array[$i]
}

cout($array) brings back the number of elements in the array which limits
the lookup index.



-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]
Sent: Friday, June 17, 2005 2:30 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Problem with array


Quoting Ross [EMAIL PROTECTED]:

 As with my previous post the problem is the pieces of the array can vary
 from 1 to 4 items. So pieces 3 and 4 are often undefined giving the
 'undefined index' notice. All I really want to do is display the array
 pieces if they EXIST. But as they are inside a echo statement so I can't
 even to a for loop...can I?

Not sure about a for loop inside the echo.

 Any ideas?

Yes. Something like this should work:

echo beginning html tags;
foreach ($pieces as $this_piece) {
   echo $this_piece .  ;
}
echo middle html tags;
echo $formatted_price;
echo closing html tags;

This should at least give you a starting point. I'm fairly new to php,
so maybe one of the gurus will give a better idea (or explain why mine
won't work, if it won't).

hth,
Rick

P.S. I would usually trim out the rest of the message, but am leaving
the code below as reference. Sorry for the long post.

 if ($quantity == 0){

}
   else {

 $pieces = explode( , $quantity);


   $formatted_price = sprintf('%0.2f', $pricecode);
  echo table width=\240\ border=\0\ cellpadding=\2\
 cellspacing=\5\trtd valign=\top\ align=\right\
 width=\40\$pieces[0]/tdtd align=\left\ width=\60\/tdtd
 align=\left\ width=\200\$pieces[1]  $pieces[2] $pieces[3]
 $pieces[4]/tdtd valign=\top\ align=\left\
 width=\80\$formatted_price/td/tr/table;





   }
   }

--
Rick Emery

When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return
  -- Leonardo Da Vinci

--
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] OT - Blank subject lines!!!

2005-06-17 Thread -{ Rene Brehmer }-

That's why I have this at the top of my mail filters:

if subject matches regexp
([[:blank:]][[:blank:]][[:blank:]]+) | (^$) | (^[[:blank:]]+$)
transfer to trash

I'm using Eudora btw...

Was gonna do a filter to dump all subjects that have nothing else but 
help in them too, but haven't quite decided on that yet...



Rene

At 07:49 13/04/2005, Miles Thompson wrote:
I assume others are seeing these as well - infrequent postings with blank 
subject lines. Always throws me for a bit of a loop, forcing a pause and 
adjust.


For those replying to them, or hijacking them, please stop.

Regards - Miles Thompson

PS Truly Canadian - note the please! /mt


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



[PHP] sorting object props

2005-06-17 Thread D_C
is there a way to sort the properties of an object by their name, much
like sort works on arrays?

i am getting back an object from a database query and want to list the
resulting items in alpha order by field name...

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



Re: [PHP] Re: Converting [and] to XML format- help/advise requested

2005-06-17 Thread Dotan Cohen
On 6/16/05, Sebastian Mendel [EMAIL PROTECTED] wrote:
 Dotan Cohen wrote:
  On 6/15/05, Sebastian Mendel [EMAIL PROTECTED] wrote:
  Dotan Cohen wrote:
 
  Hi gurus. I'm having fun replacing the text within [ and ] to XML
  format on 4000+ files on a windows XP machine. I installed php (and an
  apache server) on the machine because it is the only language the I am
  remotely familiar with.
 
  I want and text that is with [ and ] to be enclosed with note and
  /note. Going through the archives I found this nice regex (I changed
  it a bit- I hope that I didn't break anything important) that fits
  into str_replace:
 
  str_replace(/[([a-zA-Z]+?)]/, note.$what
  was_inside_the_parethesis./note, $string);
  str_replace doesnt support regular expressions
 
  http://www.php.net/str_replace
 
  what you need is preg_replace()
 
  http://www.php.net/preg_replace
 
 
  But how on sweet mother Earth do I get the $what
  was_inside_the_parethesis variable to stick into the note tags? I
  tried functions that would remove the [ and ], then do
  $new_str=note.$what was_inside_the_parethesis./note;
  and then replace the whole [$what was_inside_the_parethesis] with
  $new_str. I did get that far.
  preg_replace( '/\[([^\]]+)\]/', 'note\1/note', $string);
 
 
  Now the catch! If $what_was_inside_the_parethesis contains the word
  'algebra' then I want nothing returned- in other words [$what
  was_inside_the_parethesis] should be cut out and nothing put in it's
  place. I added an if function in there that checked the presence of
  the word algebra, but it ALWAYS returned blank.
  preg_replace( '/\[(algebra|([^\]]+))\]/', 'note\2/note', $string);
 
 
  just to mention, you need only the second example, the first ist just to
  explain the step toward the final ocde.
  The code works great for [] tags that do not contain the word algebra.
  If the word algebra is alone between the tags then it returns
  note/note, which I can easily remove with one more line of code.
  But if the word algebra appears with another word, then it is
  converted to a note just as if it did not contain the word.
 
  $search = array(
  '/\[[^\]*algebra[^\]*\]/',
  '/\[([^\]]+)\]/',
  );
 
  $replace = array(
  '',
  'note\1/note',
  );
 
  preg_replace( $search, $replace, $string);
 
  Thank you Sebastian. Know that I not only appreciate your assistance,
  but that I also make a genuine effort to learn from your example. I
  think that it's about time that I learned to brew regexes. On my to
  google now...
 
 there are just two things you need to learn regular expressions:
 
 the PHP-manual:
 
 http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
 http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
 
 http://www.php.net/manual/en/ref.pcre.php
 http://www.php.net/manual/en/ref.regex.php
 
 and the regex coach:
 
 http://www.weitz.de/regex-coach/
 
 
 --
 Sebastian Mendel
 
 www.sebastianmendel.de
 www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

I just got to playing around with the code that you sent. I had a lot
of fun these past few hours, but I feel that I learned a lot. The code
that you sent was throwing errors:
Warning:  preg_replace(): Compilation failed: missing terminating ]
for character class at offset 21 in

So I decided that the time had come for me to learn regexes. It took
me a little over two hours, but I built the regex myself and came up
with this:
$string=preg_replace( /\[[^\]]*algebra[^\[]*\]/i, '', $string);

Which is, I think, the exact regex that you tried to send me. Yours:
preg_replace( '/\[[^\]*algebra[^\]*\]/', '', $string);

was missing the ] and [ inside the 'ignore these' brackets. I also
added the i flag for case-insensitivity and, of course, the $string=
to the beginning.

I'm not complaining, mind you. I very much appreciate what you have
done: you have taught me. I can now look at your regex, understand it,
and find the mistake! I could not do that a few hours ago. I just
wanted to show you that there is an error so that if you recycle this
code somewhere you will be aware. And I wanted to say thank you.

Dotan
http://lyricslist.com/lyrics/artist_albums/345/metallica.php
Metallica Lyrics

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



[PHP] Problems with header()

2005-06-17 Thread =?iso-8859-1?q?Mart=EDn_Marqu=E9s?=
I have to send a PDF file after a submit on a form. The PDF is well created, 
and I'm sending it to the client with this:

$fpdfName = /tmp/ . session_id() . .pdf;

// Vamos a mandar el PDF
header('Content-type: application/pdf');
// El archivo se va a llamar libreDeuda.pdf
header('Content-Disposition: attachment; filename=libreDeuda' . 
   '.pdf');
// El PDF fuente va a ser $ftexName.
readfile($fpdfName);

The problem is that the PDF file that is sent is corrupted for acroread (xpdf 
reads it like a charme), because, after the end of file (%%EOF) of PDF there 
is an HTML page add to the file.

Is there anyway I can solve this? Is the sintaxis I used for sending a file 
correct?

-- 
 18:49:09 up 11 days,  6:35,  1 user,  load average: 1.14, 1.26, 1.19
-
Martn Marqus| select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
 Universidad Nacional
  del Litoral
-

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



[PHP] call func from button

2005-06-17 Thread Malcolm Mill
Is there a way to call a php function from a button press to display
the results further down on the same page? I want to avoid setting up
an 'output-area' in a frame or having to put my function in a separate
script.
Thanks,
Malcolm.

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



Re: [PHP] call func from button

2005-06-17 Thread Philip Hallstrom

Is there a way to call a php function from a button press to display
the results further down on the same page? I want to avoid setting up
an 'output-area' in a frame or having to put my function in a separate
script.


http://developer.apple.com/internet/webcontent/xmlhttpreq.html
http://www.xml.com/pub/a/2005/02/09/xml-http-request.html

Quoting...

As deployment of XML data and web services becomes more widespread, you 
may occasionally find it convenient to connect an HTML presentation 
directly to XML data for interim updates without reloading the page. 
Thanks to the little-known XMLHttpRequest object, an increasing range of 
web clients can retrieve and submit XML data directly, all in the 
background. To convert retrieved XML data into renderable HTML content, 
rely on the client-side Document Object Model (DOM) to read the XML 
document node tree and compose HTML elements that the user sees.


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



[PHP] Report

2005-06-17 Thread Mail Delivery Subsystem
ALERT!

This e-mail, in its original form, contained one or more attached files that 
were infected with a virus, worm, or other type of security threat. This e-mail 
was sent from a Road Runner IP address. As part of our continuing initiative to 
stop the spread of malicious viruses, Road Runner scans all outbound e-mail 
attachments. If a virus, worm, or other security threat is found, Road Runner 
cleans or deletes the infected attachments as necessary, but continues to send 
the original message content to the recipient. Further information on this 
initiative can be found at http://help.rr.com/faqs/e_mgsp.html.
Please be advised that Road Runner does not contact the original sender of the 
e-mail as part of the scanning process. Road Runner recommends that if the 
sender is known to you, you contact them directly and advise them of their 
issue. If you do not know the sender, we advise you to forward this message in 
its entirety (including full headers) to the Road Runner Abuse Department, at 
[EMAIL PROTECTED]



file attachment: kckvw.com

This e-mail in its original form contained one or more attached files that were 
infected with the [EMAIL PROTECTED] virus or worm. They have been removed.
For more information on Road Runner's virus filtering initiative, visit our 
Help  Member Services pages at http://help.rr.com, or the virus filtering 
information page directly at http://help.rr.com/faqs/e_mgsp.html. 
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] possible jscript/php/frames question!!

2005-06-17 Thread bruce
hi...

i've got a problem where i'm trying to play with imagemaps. i created a test
image map, but when i select inside the image map, i 'see' the ?x,y from
the imagemap, appended to the url in the browser address bar... i get
http://foo.com?3,5 etc...

is there a way to prevent this from occuring??

i'd like to be able to select the imagemap, get the coordinate, and not have
the x,y mouse coordinate show up in the address bar...

i thought i could use an onClick, and go to a javascript function, but i
couldn't figure out how to get the mouse coordinates within the jscript
function.

if i slammed all this inside a frame, would that prevent the url-x,y
information from being displayed??

my sample code is below...

thanks

-bruce
[EMAIL PROTECTED]



---
[EMAIL PROTECTED] site]# cat map.php
?
  /*
 test for image maps...
  */
?
?
 $_self = $_SERVER['PHP_SELF'];
?

html
body
script language=javascript type=text/javascript
!--

function foo1(q)
{
//   str = window.location.search
//   document.write(fff +q+br);
// location.href=map.php;
// return true;
}
function foo(e)
{
//q = q+1;
 mX = event.clientX;
 mY = event.clientY;
//   str = window.location.search
   document.write(fff +mX+ y= +mY+br);
 location.href=map.php;
 return true;
}
// --
/script

!--
centera href=?=$_self;?img
--

center
!--
a href=?=$_self;? onclick =alert(self.location.search); return false
--
a href=ff.php onclick=
img src=imagemap.gif ISMAP/a/center
p
script language=javascript type=text/javascript
!--

str = location.search
 if(str)
 {
   document.write(fff +str+br);
   //location.href=map.php;
 }

// --
/script


/body
/html

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



Re: [PHP] Extensions: parameters as references

2005-06-17 Thread Yasir Malik

Is there any list (or forum) that can help me with this?

Thanks,
Yasir

On Fri, 17 Jun 2005, Yasir Malik wrote:


Date: Fri, 17 Jun 2005 11:51:24 -0400 (EDT)
From: Yasir Malik [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: [PHP] Extensions: parameters as references

I am creating a PHP extension.  In my function, I want the parameter to be a 
reference.  The extension function works fine only if the variable passed is 
initialized.  For example, here is the extension function:

ZEND_FUNCTION(first_module)
{
  zval *parameter;

  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
z, parameter) == FAILURE)
  return;

  ZVAL_LONG(parameter, 78);
}

When I call this as
?php
dl(test.so);
$a = 4;
first_module($a);
print $a\n;
?

it works fine, but when I call it as:
?php
dl(test.so);
first_module($a);
print $a\n;
?

nothing is outputted.  I looked at the source code for various extensions, 
and I noticed that they called the deconstructor zval_dtor().  I tried this, 
but it still did not work:

ZEND_FUNCTION(first_module)
{
  zval *parameter;

  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
z, parameter) == FAILURE)
  return;

  zval_dtor(parameter);
  ZVAL_LONG(parameter, 78);
}

Thanks,
Yasir

--
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] Re: Problems with header()

2005-06-17 Thread Matthew Weier O'Phinney
* Martn Marqus martin@bugs.unl.edu.ar:
 I have to send a PDF file after a submit on a form. The PDF is well created, 
 and I'm sending it to the client with this:

 $fpdfName = /tmp/ . session_id() . .pdf;

 // Vamos a mandar el PDF
 header('Content-type: application/pdf');
 // El archivo se va a llamar libreDeuda.pdf
 header('Content-Disposition: attachment; filename=libreDeuda' . 
'.pdf');
 
 // El PDF fuente va a ser $ftexName.
 readfile($fpdfName);

 The problem is that the PDF file that is sent is corrupted for acroread (xpdf 
 reads it like a charme), because, after the end of file (%%EOF) of PDF there 
 is an HTML page add to the file.

Likely what's happening is that there's extra output happening after
your readfile() call. Do an 'exit();' call right after it, and make sure
there's no whitespace after your closing PHP tag (or simply don't
include a closing PHP tag). 

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

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



RE: [PHP] possible jscript/php/frames question!!

2005-06-17 Thread Chris W. Parker
bruce mailto:[EMAIL PROTECTED]
on Friday, June 17, 2005 3:48 PM said:

 i've got a problem where i'm trying to play with imagemaps. i created
 a test image map, but when i select inside the image map, i 'see' the
 ?x,y from the imagemap, appended to the url in the browser address
 bar... i get http://foo.com?3,5 etc...
 
 is there a way to prevent this from occuring??

Ahh yes. I see the problem. There's no PHP!

But seriously, you need to switch the transaction mode from the default
value of reverse to the specification as outlined in RFQ4128 (i.e.
forward) and adjust the operator settings to be consistent with the
server adjustments... What's that you say? You didn't MAKE the server
adjustments yet? Oh geez...


I'm here all week. Remember to tip your waitress.


Chris.

p.s. This doesn't seem like a PHP issue so check this page:
http://curry.edschool.virginia.edu/go/WebTools/Imagemap/CSIM_SSIM.html.
Maybe it will help.

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



RE: [PHP] possible jscript/php/frames question!!

2005-06-17 Thread bruce
chris...

i'll humour you.. although i'm pretty sure you have no idea as to what i'm
trying to acomplish.. or how to get to my goal...

the basic issue is to allow a user to click inside an image map, and to
translate the coordinates to something else, prior to sending the
information back to the server..

the solution to this appears to need to be a combination of jscript/php...
thus the posting...

creating the imagemap is trivial.
creating a jscript function that extracts the coordinate location
representing the mouse location appears to be a somewhat more interesting...

the primary issue is that i don't want to send the x,y coordinates in plain
site.


so i waste another 30 secs dealing with some clueless person...

peace..


-Original Message-
From: Chris W. Parker [mailto:[EMAIL PROTECTED]
Sent: Friday, June 17, 2005 4:26 PM
To: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: RE: [PHP] possible jscript/php/frames question!!


bruce mailto:[EMAIL PROTECTED]
on Friday, June 17, 2005 3:48 PM said:

 i've got a problem where i'm trying to play with imagemaps. i created
 a test image map, but when i select inside the image map, i 'see' the
 ?x,y from the imagemap, appended to the url in the browser address
 bar... i get http://foo.com?3,5 etc...

 is there a way to prevent this from occuring??

Ahh yes. I see the problem. There's no PHP!

But seriously, you need to switch the transaction mode from the default
value of reverse to the specification as outlined in RFQ4128 (i.e.
forward) and adjust the operator settings to be consistent with the
server adjustments... What's that you say? You didn't MAKE the server
adjustments yet? Oh geez...


I'm here all week. Remember to tip your waitress.


Chris.

p.s. This doesn't seem like a PHP issue so check this page:
http://curry.edschool.virginia.edu/go/WebTools/Imagemap/CSIM_SSIM.html.
Maybe it will help.

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



RE: [PHP] possible jscript/php/frames question!!

2005-06-17 Thread Chris W. Parker
bruce mailto:[EMAIL PROTECTED]
on Friday, June 17, 2005 5:05 PM said:

 chris...
 
 i'll humour you.. although i'm pretty sure you have no idea as to
 what i'm trying to acomplish.. or how to get to my goal... 
 
 the basic issue is to allow a user to click inside an image map, and
 to translate the coordinates to something else, prior to sending the
 information back to the server..

Ooohh...

 the solution to this appears to need to be a combination of
 jscript/php... thus the posting... 

Actually it doesn't appear to be a mixture at all... It is solely the...
responsibility of javascript (or another client... side technology) to
do the transmalating... you speak of. PHP is completely... out... of
the... loop. ...

[snip/]

 so i waste another 30 secs dealing with some clueless person...

Come back when... you have a PHP question... and we can chat...



Chris.

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



Re: [PHP] Problems with header()

2005-06-17 Thread Tom Rogers
Hi,

Saturday, June 18, 2005, 7:55:10 AM, you wrote:
MM I have to send a PDF file after a submit on a form. The PDF is well created,
MM and I'm sending it to the client with this:

MM $fpdfName = /tmp/ . session_id() . .pdf;

MM // Vamos a mandar el PDF
MM header('Content-type: application/pdf');
MM // El archivo se va a llamar libreDeuda.pdf
MM header('Content-Disposition: attachment; filename=libreDeuda' . 
MM'.pdf');
MM // El PDF fuente va a ser $ftexName.
MM readfile($fpdfName);

MM The problem is that the PDF file that is sent is corrupted for acroread 
(xpdf
MM reads it like a charme), because, after the end of file (%%EOF) of PDF there
MM is an HTML page add to the file.

MM Is there anyway I can solve this? Is the sintaxis I used for sending a file
MM correct?

Here is a script I use to send pdfs which also handles caching
information. It may just be you are missing the content-length header?

?php
$cache_time = false;
$requested_time = false;

$filename = /tmp/ . session_id() . .pdf;
$len = filesize($filename);

$mtime = filemtime($filename);
$cache_time = gmdate('D, d M Y H:i:s', $mtime) . ' GMT';
header('Last-Modified: '.$cache_time);

$rt = (empty($_SERVER['HTTP_IF_MODIFIED_SINCE']))? false : 
$_SERVER['HTTP_IF_MODIFIED_SINCE'];
if($rt) $requested_time = strtotime($rt);

if($requested_time  $cache_time){
if($requested_time == $cache_time){
Header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
exit;
}
}
header(Accept-Ranges: bytes);
header('Cache-Control: no-cache, must-revalidate');
header(Content-type: application/pdf);
header(Content-Length: $len);
readfile($filename);

-- 
regards,
Tom

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



Re: [PHP] possible jscript/php/frames question!!

2005-06-17 Thread Tom Rogers
Hi,

Saturday, June 18, 2005, 8:47:58 AM, you wrote:
b hi...

b i've got a problem where i'm trying to play with imagemaps. i created a test
b image map, but when i select inside the image map, i 'see' the ?x,y from
b the imagemap, appended to the url in the browser address bar... i get
b http://foo.com?3,5 etc...

b is there a way to prevent this from occuring??

b i'd like to be able to select the imagemap, get the coordinate, and not have
b the x,y mouse coordinate show up in the address bar...

b i thought i could use an onClick, and go to a javascript function, but i
b couldn't figure out how to get the mouse coordinates within the jscript
b function.

b if i slammed all this inside a frame, would that prevent the url-x,y
b information from being displayed??

b my sample code is below...

b thanks

b -bruce
b [EMAIL PROTECTED]


b 
b ---
b [EMAIL PROTECTED] site]# cat map.php
b ?
b   /*
b  test for image maps...
b   */
?
b ?
b  $_self = $_SERVER['PHP_SELF'];
?

b html
b body
b script language=javascript type=text/javascript
b !--

b function foo1(q)
b {
b //   str = window.location.search
b //   document.write(fff +q+br);
b // location.href=map.php;
b // return true;
b }
b function foo(e)
b {
b //q = q+1;
b  mX = event.clientX;
b  mY = event.clientY;
b //   str = window.location.search
bdocument.write(fff +mX+ y= +mY+br);
b  location.href=map.php;
b  return true;
b }
// --
b /script

b !--
b centera href=?=$_self;?img
--

b center
b !--
b a href=?=$_self;? onclick =alert(self.location.search); return false
--
b a href=ff.php onclick=
b img src=imagemap.gif ISMAP/a/center
b p
b script language=javascript type=text/javascript
b !--

b str = location.search
b  if(str)
b  {
bdocument.write(fff +str+br);
b//location.href=map.php;
b  }

// --
b /script


b /body
b /html

A PHP solution to your problem is to save the x y co-ordinates in a
session and do a refresh, then get the values fom session.

Do something like

?php
session_start();
if(isset($_SESSION['x'])  isset($_SESSION['y'])){
  //do your thing here
  unset($_SESSION['x'];
  unset($_SESSION['y'];
}else{
  //get x and y from request variables here
  if($x  $y){
$_SESSION['x'] = $x;
$_SESSION['y'] = $y;
header('location: '.$_SERVER['PHP_SELF']);
exit;
  }else{
//show start page
  }
}
-- 
regards,
Tom

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