php-general Digest 23 Feb 2003 14:02:18 -0000 Issue 1900

Topics (messages 136692 through 136722):

Writing to COM-Port with PHP 4.3.0 on OS/2 with Apache 2.0.44
        136692 by: Thorolf Godawa

Re: Question about str_replace()
        136693 by: Hans Prins

Re: upgrade to 4.3.0 nearly doubled execution time
        136694 by: Rasmus Lerdorf

Re: Sitewide Header & Footer Includes || Trouble with Relative Paths..........
        136695 by: Tom Rogers

Permission Denied
        136696 by: Stephen Craton
        136697 by: Stephen Craton
        136703 by: John Taylor-Johnston
        136708 by: Joel Colombo

Re: flashing text possible on PDA?
        136698 by: John W. Holmes

Re: preg_match question: locating unmatched HTML tags
        136699 by: Tom Rogers
        136701 by: Tom Rogers

Re: Printer Friendly page
        136700 by: Justin French

University researcher's question
        136702 by: John Taylor-Johnston
        136715 by: Chris Hayes

Re: Question about replacing \r\n with <br>
        136704 by: John Taylor-Johnston

Re: sending results by email
        136705 by: John Taylor-Johnston

Re: Help with Multiple Checkboxes
        136706 by: John Taylor-Johnston
        136707 by: Matt Honeycutt
        136711 by: John Taylor-Johnston

Re: cookie problem..
        136709 by: Joel Colombo

Re: Why use persistent connections? || Data driven site
        136710 by: John Taylor-Johnston

Editors
        136712 by: Karl James
        136713 by: Pierre Vaudrey

using function()[subscript] directly
        136714 by: David T-G

PHP not supporting method overloading.
        136716 by: Jun

Re: preg_replace question
        136717 by: Phil Roberts

Dynamic combobox in Flash with PHP
        136718 by: pei_world

Re: OOP and object references, not copies - how to do?
        136719 by: Phil Roberts

Re: Tutorials on OOP
        136720 by: Phil Roberts

Re: Constant Arrays Possible?
        136721 by: Ernest E Vogelsinger

Downloading files
        136722 by: Anthony Rodriguez

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:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- Hi,

how can I write to a COM-Port on OS/2 using PHP 4.3.0 with Apache 2.0.44?

With

$fp = fopen ("COM1", "w+");
$string = chr($OutCmd) . chr($Platine) . chr($OutData) . chr($OutPruef);
fputs ($fp, $string );
fclose ($fp);

it seems not to work ($fp returns "Resource id #2"), and

$fp = fopen ("COM1:", "w+");
...
..
.

creates an error: "Warning: fopen(COM1:) [function.fopen]: failed to create stream: No such file or directory in x:\htdocs\test.php on line 3" :-(

The same functionality with Rexx is working!

Thanks a lot,

Thorolf


--- End Message ---
--- Begin Message ---
Assuming that you do want to replace "[p]" with "<br>", the code you posted
worked for me. The following printed: "leadingtext<br>trailingtext" to the
screen....

<?php
$find = array('& ','W&OD', '"&"', chr(146), '[p]');
$replace = array("&amp; ","W&amp;OD", '"&amp;"', "'", '<br>');
$text = "leadingtext[p]trailingtext";
$words = str_replace ($find, $replace, $text);
print $words;
?>

"Al" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> I have a simple str_replace function that obviously has a syntax
> problem.  The [p] in the $find array ignores the brackets.  Every "p" in
> my text is replaced by a <br>.  Just for the heck of it, I've tried "
> instead of ', and preg_replace(), etc.
>
> $find= array('& ','W&OD', '"&"', chr(146), '[p]');
> $replace= array("&amp; ","W&amp;OD", '"&amp;"', "'", '<br>');
>
> $words= str_replace ($find, $replace, $text);
>
> Thanks.....
>



--- End Message ---
--- Begin Message ---
Yes, I have noticed some performance issues as well, but we need to nail
it down better before we can start really going after this.  Could we call
on the collective masses of php-general users to run some benchmark tests?

Just build yourselves a libphp4.so for both 4.2.x and 4.3.x and switch the
LoadModule line back and forth to benchmark the two versions.  Then use
something like http_load (http://www.acme.com/software/http_load/) to
check various simple scripts.  We need to figure out if this is an
across-the-board performance problem or if it is one particular aspect
which has slowed down.

-Rasmus

On Sat, 22 Feb 2003, Jason k Larson wrote:

> I'm betting this is related...
>
> I upgraded to 4.3.0 on my production linux servers and began to have
> serious socket connection issues.  Rolling back to 4.2.3 cleared
> everything up.  I also saw an increase in script execution times with
> 4.3.0, which became much better using 4.2.3.  I noticed some very
> strange behavior which leads me to believe 4.3.0 is not stable, and
> shouldn't be used in a production environment.
>
> So, all I can suggest for now is to determine what it is you need, and
> if a newer version of PHP will suit, go for it.  But stay away from
> 4.3.0 and 4.3.1 (which I've read up on and hasn't addressed any of these
>   issues).
>
> Regards,
> Jason k Larson
>
>
> Rhett Livingston wrote:
> > I upgraded my development system from PHP 4.1.2 to PHP 4.3.0 last week and
> > the performance of my scripts took a dive.  Specifically, the average time
> > to parse my scripts (time from executing first line of code to executing
> > first line after includes) went from about 100ms to about 200ms, and, very
> > oddly, my times to connect to an Oracle database also went up by about the
> > same margin.
> >
> > Switching back to 4.1.2 clears the problem back up.
> >
> > What changed between 4.1.2 and 4.3.0 that could cause this?  File IO stuff
> > perhaps?  Any ideas to solve it?
> >
> > Thanks,
> > Rhett Livingston
> >
> > I'm running WinXP Pro, IIS, PHP as a CGI, and Oracle 9.2.
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hi,

Sunday, February 23, 2003, 9:13:16 AM, you wrote:
CH> Hey Tom.

CH> Thanks for the idea; however, since we're not hosting the site on our own
CH> server, we don't have permissions for altering the php.ini file..........

CH> --Noah


It only sets the ini path for the current document, it does not alter the site
wide php.ini

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
Hello,

I'm having a few problems with deleting items. When I do the unlink()
function, it gives me a permission denied error. For example..here's the
code:

    unlink($this->currentfolder().'/packs/'.$title.'/'.$intname);

Here's the error returned:

    Warning: unlink() failed (Permission denied) in
/usr/local/plesk/apache/vhosts/piw.melchior.us/httpdocs/phpiw/classes/class.
delete.php on line 45

The problem with all this is, I dynamically create the directories and files
and dynamically CHMOD them all to 777 with no problems. I don't see why I'm
getting all this! Please help ASAP! Thanks in advance!

Thanks,
Stephen Craton
http://www.melchior.us



--- End Message ---
--- Begin Message ---
Hello,

I'm having a few problems with deleting items. When I do the unlink()
function, it gives me a permission denied error. For example..here's the
code:

    unlink($this->currentfolder().'/packs/'.$title.'/'.$intname);

Here's the error returned:

    Warning: unlink() failed (Permission denied) in
/usr/local/plesk/apache/vhosts/piw.melchior.us/httpdocs/phpiw/classes/class.
delete.php on line 45

The problem with all this is, I dynamically create the directories and files
and dynamically CHMOD them all to 777 with no problems. I don't see why I'm
getting all this! Please help ASAP! Thanks in advance!

Thanks,
Stephen Craton
http://www.melchior.us



--- End Message ---
--- Begin Message ---
Stephen,

It seems like I wen tdown that road once?
I'm wondering/remembering two things to check?

First what are the permissions of the directory your are working in? Go up one level 
and see what the CHMOD was on that?

Second, it might be immaterial and I'm not sure how to do it on a command line, but 
who is the owner of the files you are trying to delete? Seriously! Maybe your script 
does not have the permission to delete them? With CuteFTP, I can read who the owner of 
a file is. I know this was an issue for me once, but I don't remember why.

Craton wrote:

> Hello,
>
> I'm having a few problems with deleting items. When I do the unlink()
> function, it gives me a permission denied error. For example..here's the
> code:
>
>     unlink($this->currentfolder().'/packs/'.$title.'/'.$intname);
>
> Here's the error returned:
>
>     Warning: unlink() failed (Permission denied) in
> /usr/local/plesk/apache/vhosts/piw.melchior.us/httpdocs/phpiw/classes/class.
> delete.php on line 45
>
> The problem with all this is, I dynamically create the directories and files
> and dynamically CHMOD them all to 777 with no problems. I don't see why I'm getting 
> all this! Please help ASAP! Thanks in advance!

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

Université de Sherbrooke:
http://compcanlit.ca/


--- End Message ---
--- Begin Message ---
u might have something on the ownership issue.

i ran into the same thing... play with php's "chown" command.
look it up php.net may help, i was having a similar issue a few months back.

Joel


"John Taylor-Johnston" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Stephen,
>
> It seems like I wen tdown that road once?
> I'm wondering/remembering two things to check?
>
> First what are the permissions of the directory your are working in? Go up
one level and see what the CHMOD was on that?
>
> Second, it might be immaterial and I'm not sure how to do it on a command
line, but who is the owner of the files you are trying to delete? Seriously!
Maybe your script does not have the permission to delete them? With CuteFTP,
I can read who the owner of a file is. I know this was an issue for me once,
but I don't remember why.
>
> Craton wrote:
>
> > Hello,
> >
> > I'm having a few problems with deleting items. When I do the unlink()
> > function, it gives me a permission denied error. For example..here's the
> > code:
> >
> >     unlink($this->currentfolder().'/packs/'.$title.'/'.$intname);
> >
> > Here's the error returned:
> >
> >     Warning: unlink() failed (Permission denied) in
> >
/usr/local/plesk/apache/vhosts/piw.melchior.us/httpdocs/phpiw/classes/class.
> > delete.php on line 45
> >
> > The problem with all this is, I dynamically create the directories and
files
> > and dynamically CHMOD them all to 777 with no problems. I don't see why
I'm getting all this! Please help ASAP! Thanks in advance!
>
> --
> John Taylor-Johnston
> --------------------------------------------------------------------------
---
> "If it's not open-source, it's Murphy's Law."
>
> Université de Sherbrooke:
> http://compcanlit.ca/
>



--- End Message ---
--- Begin Message ---
> I am developing some light pages on the web basically for access by
PDAs.
> I need to put and alert for some members so that as soon as they log
in,
> the next page will show a flashing alert on the page.
> 
> Can anyone suggest how I can make text flash on a PDA considering that
the
> PDA browsers do not support many Javascript commands?

This has nothing to do with PHP. Search google, but I'll wager it's not
possible. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
Hi,

Saturday, February 22, 2003, 12:35:15 PM, you wrote:
AC> My apologies in advance if this too basic or there's a solution easily
AC> found out there, but after lots of searching, I'm still lost.

 

AC> I'm trying to build a regexp that would parse user-supplied text and
AC> identify cases where HTML tags are left open or are not properly
AC> matched-e.g., <b> tags without closing </b> tags. This is for a sort of
AC> message board type of application, and I'd like to allow users to use
AC> some HTML, but just would like to check to ensure that no stray tags are
AC> input that would screw up the rest of the page's display. I'm new to
AC> regular expressions, and the one below is as far as I've gotten. If
AC> anyone has any suggestions, they'd be very much appreciated.

AC> Thanks,

AC> Andy

 

 

AC> $suspect_tags = "b|i|u|strong|em|font|a|ol|ul|blockquote ";

AC> $pattern = '/<(' . $suspect_tags . '[^>]*>)(.*)(?!<\/\1)/Ui';

AC> if (preg_match($pattern,$_POST['entry'],$matches)) {

AC>    //do something to report the unclosed tags

AC> } else {

AC>    echo 'Input looks fine. No unmatched tags.';

AC> }

The simplest is just to add </b></i></textarea></whatever else you allow> directly to 
the end of their
message, may not be technically correct but it won't do any harm either :)

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
Hi,

Saturday, February 22, 2003, 12:35:15 PM, you wrote:
AC> My apologies in advance if this too basic or there's a solution easily
AC> found out there, but after lots of searching, I'm still lost.

 

AC> I'm trying to build a regexp that would parse user-supplied text and
AC> identify cases where HTML tags are left open or are not properly
AC> matched-e.g., <b> tags without closing </b> tags. This is for a sort of
AC> message board type of application, and I'd like to allow users to use
AC> some HTML, but just would like to check to ensure that no stray tags are
AC> input that would screw up the rest of the page's display. I'm new to
AC> regular expressions, and the one below is as far as I've gotten. If
AC> anyone has any suggestions, they'd be very much appreciated.

AC> Thanks,

AC> Andy

 

 

AC> $suspect_tags = "b|i|u|strong|em|font|a|ol|ul|blockquote ";

AC> $pattern = '/<(' . $suspect_tags . '[^>]*>)(.*)(?!<\/\1)/Ui';

AC> if (preg_match($pattern,$_POST['entry'],$matches)) {

AC>    //do something to report the unclosed tags

AC> } else {

AC>    echo 'Input looks fine. No unmatched tags.';

AC> }

Here is a function that will fixup simple tags like <b> <i> ,it will add in the
missing /b tag at the next start/end tag or end of document.

function fix_mismatch($str){
        $match = array();
        $split = preg_split('!\<(.*?)\>!s', $str);
        $c = count($split);
        $r = ($c == 1)? $str : '';
        if($c > 1){
                $fix = '';
                preg_match_all('!\<(.*?)\>!s', $str,$match);
                for($x=0,$y=0;$x < $c;$x++){
                        $out = $split[$x].$fix;         //add in text + any fixup end 
tag
                        $fix = '';
                        if(isset($match[0][$x])){
                                $list = explode(' ',$match[1][$x]);     //split up 
compound tag like <img src="">
                                $t = trim(strtolower($list[0]));                //get 
the tag name
                                switch ($t){
                                        //add tags to check/fix here
                                        case 'b':
                                        case 'div':
                                        case 'i':
                                        case 'textarea':
                                                $st = '/'.$t;           //make an end 
tag to search for
                                                $rest = array_slice($match[1],$x+1); 
// get the remaining tags
                                                $found = false;
                                                while(!$found && list(,$v) = 
each($rest)){
                                                        $et = explode(' ',$v);
                                                        $found = ($st == 
trim(strtolower($et[0])))? True:False; //have we found it ?
                                                }
                                                if(!$found){
                                                        $fix = '<'.$st.'>'; //create 
an html end tag
                                                }
                                        break;
                                }
                                $out .= $match[0][$x]; //add in tag
                        }
                        $r .= $out; //build return string
                }
        }
        return $r;
}

//usage
$test1 = '<div>This is a <B >bold word <img src="hello.jpg"></b> and another <b>bold 
word </div>end of <b>test';
$test2 = '<b><b><i>frog';

echo fix_mismatch($test1);
echo '<br>';
echo fix_mismatch($test2);

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
if you're already building dynamic pages, just roll your own... set a GET
var to trigger a simple page view (simple layout, less HTML, very little
CSS, no tables, etc etc) which uses the same CONTENT but keeps it simple for
printing.


justin



on 23/02/03 8:28 AM, Sebastian ([EMAIL PROTECTED]) wrote:

> Greetings all.
> 
> I am looking for a simple print page script. I tried just about all the print
> scripts at hotscripts.com and not one works (at least for me).
> 
> Does anyone know of one that works under php v 4.2.3 with register globals
> off?
> 
> thanks in advance.
> 


--- End Message ---
--- Begin Message ---
[i] How or why do researchers adapt technology to their research projects? Should they 
adapt their projects to technology? Indeed, how often does the research assistant end 
up reinventing the wheel? [/i]

I know most of you are E-Commerce oriented, but I would appreciate your feedback. I 
use PHP & MySQL in a university research setting. I'm writing a conference paper on 
this problematic and I would appreciate your input.

Am I the only university type online tonight :) ?


--- End Message ---
--- Begin Message --- At 09:21 23-2-2003, you wrote:
[i] How or why do researchers adapt technology to their research projects? Should they adapt their projects to technology? Indeed, how often does the research assistant end up reinventing the wheel? [/i]

'Research' is an extremely broad field, with many places where technology can jump in: observation, data collection, data entry, making mathematical models, making statistics, making graphs or GIS pictures.... Walk through the average university corridor and most ppl will use something existing, like office, SPSS, MatLab... But you will also find ppl writing their own models, not in PHP but rather in other languages. I think your would need to make some very specific questions and ask at your local university whether they can help you.


I know most of you are E-Commerce oriented, but I would appreciate your feedback. I use PHP & MySQL in a university research setting. I'm writing a conference paper on this problematic and I would appreciate your input.

Am I the only university type online tonight :) ?

On courses you can have a look at the Moodle site: developer of the PHP course support sytem Moodle.org has written papers on this distant learning (and is writing his dissertation now). But 99% of universities and highschools buy Blackboard 'because everybody else does'.

I am only using PHP/MySQL to let researchers put their work online, and will use it to let PhD's administrate their own progress, which will be a big relief for the administration people. So it is university related but not really research related.



--- End Message ---
--- Begin Message ---
I think this is what you want?
http://www.php.net/manual/en/function.nl2br.php
John

Al wrote:

> I can't find a way to replace \r\n codes with <br> in a text file.
>
> I'm reading a text file that was prepared with windows notepad
> The hex code shows OD OA for CR/LF as I expect.
>
> I'd like to replace the OD/LF with <br>s.
>
> I spent hours trying every User Notes in the PHP Manual for this simple
> operation.  e.g.,
>
> $txt= preg_replace("\r\n", "<br>", $words);
>
> and this version
>   $txt = preg_replace("/(\015\012)|(\015)|(\012)/","<br />", $txt);
>
> I can substitute other characters and dec equivalents and the
> substations just won't work for \r\n [or just \r or just \n] or "\015"
> or "\15".
>
> And, I've tried using "10" and "010" and "13" and "013".
>
> And nl2br doesn't work either.
>
> Can anyone help?
>
> Thanks........

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064



--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/function.mail.php

<TEXTAREA NAME="MyText" ROWS="10" COLS="26" width ="15">
<input type="checkbox" name="checkbox2">

Note my changes in your HTML!

mail("[EMAIL PROTECTED]", "Subject: sending results by email", "MyText: \n$MyText 
\ncheckbox2: $checkbox2");

HTH?
John

> <form name="form1" method="post" action="">
>       <TEXTAREA NAME="" ROWS="10" COLS="26" width ="15">
>      </TEXTAREA> <input type="submit" name="Submit" value="Enviar">
>                     <table width="100%" border="0" height="27">
>                       <tr>
>                         <td><input type="checkbox" name="checkbox2" value="checkbox">
>                           no </td>
>                       </tr>
>                     </table>


--- End Message ---
--- Begin Message ---
><input name="add" type="checkbox" id="add[]" value="179">

Does id even exist?

HTH



--- End Message ---
--- Begin Message ---
Yup, id is a valid attribute for virtually every HTML tag.  I can't
remember for sure which W3C specification that was in, but you can refer
to most elements through JavaScript by using their ID's in both IE and
Netscape 6+.

---Matt

-----Original Message-----
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 23, 2003 2:42 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Help with Multiple Checkboxes

><input name="add" type="checkbox" id="add[]" value="179">

Does id even exist?

HTH



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





--- End Message ---
--- Begin Message ---
Style sheet stuff?

<style type="text/css">

Matt Honeycutt wrote:

> Yup, id is a valid attribute for virtually every HTML tag.  I can't
> remember for sure which W3C specification that was in, but you can refer
> to most elements through JavaScript by using their ID's in both IE and
> Netscape 6+.
>
> ---Matt
>
> -----Original Message-----
> From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
> Sent: Sunday, February 23, 2003 2:42 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Help with Multiple Checkboxes
>
> ><input name="add" type="checkbox" id="add[]" value="179">
>
> Does id even exist?
>
> HTH
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064



--- End Message ---
--- Begin Message ---
make sure u run a  session_start(); before anything on the page
u cant access any session vars without it.

Joel




"Terry Lau" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>      I want to set a cookie when I enter a text into the text field, and
it
> shows the text I submitted immediately, thus I write a sample php code
like
> this:
>
> <?php
> if (isset($HTTP_POST_VARS['Name'])) {
> setcookie("name", $HTTP_POST_VARS['Name'], time()+86400*10);
> }
> echo $name;
> ?>
> (I set the text field is Name and the data will be sent to another page)
>
> In another page, I insert <?php echo $HTTP_COOKIE_VARS['name']; ?> in the
> beginning of the code.
>
> Is the code right?
>
> Then I run the test, I enter a name into the text field and submit it. But
> it shows "Notice: Undefined index: name in ..", it can't show the name I
> submitted.
> Why?Anything wrong??
>
> Thanks!!
>                                                                  Terry
>
>
>
>
> _________________________________________________________________
> ¤µ¤é¬P®y  http://www.msn.com.hk/fortune/west/ ¹Bµ{
>



--- End Message ---
--- Begin Message ---
I stopped using pconnect. Don't see the sense in it. Why take the chance?

http://www.php.net/manual/en/function.mysql-pconnect.php

<blockquote>Warning
Using persistent connections can require a bit of tuning of your
Apache and MySQL configurations to ensure that you do not exceed
the number of connections allowed by MySQL.</blockquote>

Search also for "consistency" and read that note.

Begin using:
http://www.php.net/manual/en/function.mysql-connect.php

I had real trouble with this on a Windows server once. I stopped using pconnect. Too 
many connections. Crashed my server more than once.

# $link = mysql_pconnect($MyHost,$MyAccount,$MyPass);
$link = mysql_connect($MyHost,$MyAccount,$MyPass);
...
 mysql_close($link);

> Should we be using persistent connections, or are we better off opening and closing 
> connections on each query?


--- End Message ---
--- Begin Message ---
Anyone have the link on where I can download maguma php editor? Whatever
the latest version is.
I need if for my class.
I tried to do a search on google and they are were dead links.
 
 
Karl

--- End Message ---
--- Begin Message ---
Hi,

        The site is http://www.maguma.com 

Pierre
 


-----Message d'origine-----
De : Karl James [mailto:[EMAIL PROTECTED]
Envoye : dimanche 23 fevrier 2003 10:19
A : [EMAIL PROTECTED]
Objet : [PHP] Editors

Anyone have the link on where I can download maguma php editor? Whatever
the latest version is.
I need if for my class.
I tried to do a search on google and they are were dead links.


Karl


--- End Message ---
--- Begin Message ---
Hi!

I started out with

  $stat = stat("$gallery_dir/$pix_base") ;
  $mode = decoct($stat[mode]) ;
  print "mode = '$mode'<br>\n" ;

and moved to

  $stat = stat("$gallery_dir/$pix_base") ;
  print "decoct(stat[mode]) is '" . decoct($stat[mode]) . "'<br>\n";    ###

but I would like to get rid of $stat as well.  How can I feed the proper
subscript output of the stat call to decoct?  I've found that

  print "decoct(stat(file)[mode] is '" . decoct($stat("$gallery_dir/$pix_base")[mode]) 
. "'<br>\n" ;    ###

gives me a parse error, while

  print "decoct(stat(file)[mode] is '" . 
decoct(${stat("$gallery_dir/$pix_base")}[mode]) . "'<br>\n" ;  ###

just returns 0.  Do I *have* to use a temp array here?


TIA & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Hi! I have a website whose pages are written in PHP.. using some classes I
have made that extensively use method overloading.. Before, my webhosting
company was using PHP 4.0.6 but just this january, they have upgraded to PHP
4.3.0... that is when I started to receive errors. My website is currently
down because all of my scripts are reporting error:

Cannot Redeclare .. blablah blah..  It seems to me that the support for
method overloading was removed. Even my FastTemplate class is issuing the
same error.....


What will I do to minimize the time in re-doing all of my scripts. And also,
why did the PHP guys removed the support for method overloading..?



--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] (Electroteque) wrote in
news:[EMAIL PROTECTED]: 

> yet another regex question how could i hange the value within the
> quotes with preg_replace
> 
> php_value upload_max_filesize "5M"
> 
> 

$str = preg_replace("#php_value upload_max_filesize\s?['\"](.+?)[\"']#i", 
"php_value upload_max_filesize\"\\1\"", $str);

Should work.

--- End Message ---
--- Begin Message ---
I have the following PHP code to generate output to the flash
//=======================================================================
$query = "SELECT currencyCode,currencyName,country,buyPrice,sellPrice
                      FROM $CURRENCIES_TABLE order by currencyCode;";

     $db_linker = db_connection();
        db_selection($db_linker);
     $result = mysql_query($query);
      $num=mysql_num_rows($result);
                  echo "&array_num=".$num;
      for($i=0; $i<mysql_num_rows($result); $i++){
       echo
"&list_label".$i."=".mysql_result($result,$i,"currencyCode").",".mysql_resul
t($result,$i,"currencyName");
     }


     db_close($db_linker);


//==========================================================================
==


also the following code in actionscript use to receive&send data.
but when I run the *.swf it cann't get the output from PHP,
so anyone can help????

//============================================================
loadVariables("link.php", this, "POST"); // get the data from php file
/*
//==================================================
iList = new Array();
myItem = new Object();
iList[0] = myItem;

for (i=0; i<array_num; i++) {
myItem = new Object();
test = this["list_label"+i]
myItem.label = test
myItem.data = i;
iList[i+1] = myItem;
}

list_currency.setDataProvider(iList);

//========================================================================




thx.

--
Sincerely your;

pei_world ( .::IT::. )






--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] (Erik FranzéN) wrote in
news:[EMAIL PROTECTED]: 

> Say the you are going to create a simple forum and you want to have a
> number of classes:
> 
> Class Sql - handles the DB interface
> Class User - handles users
> Class Messages - handles messages
> 
> When you are writing the code, you first creates a new sql object in
> order to read or write data from or to the database.
> 
> Secondly you create a user object in order to handle users, for an
> example, to authenticate the user which is going to write a new
> message in your forum.
> 
> The user object have a method which reads user information from the
> database.
>  Since you alread have created a sql object, this method should use
>  the sql 
> object in order to fecth data from the database.
> 
> I nice way to do this, would be to send the sql object as an reference
> to the user object constructor and store the object reference to the
> sql object in the user object.
> 
> This is not working very well in PHP yet because PHP cannot treat
> objects as references. When you send the sql object to the user object
> constructor method, it will be a copy, not a reference!
> 
> How do I get around this? There must be a way to handle this and
> create nice OOO PHP-code? I don't like using global variables as
> object handles. 
> 

You need to use the & chracter when passing & assigning.

$obj =& new Object;

function func(&$obj)
{

}

To return an object:

function &func()
{
    return $obj;
}

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] (Davy Obdam) wrote in news:[EMAIL PROTECTED]:

> Hi people,.
> 
> I have to build several classes for a project i am doing, but i am quite 
> new to OOP programming. I need to make a database abstraction layer 
> class and a user login class.. Does anyone know some good tutorials 
> about these things and OOP in general. Thanks in advance..
> 

http://www.phppatterns.com/ is a good place to learn about OO PHP design.


--- End Message ---
--- Begin Message ---
At 20:28 22.02.2003, Daniel R. Hansen said:
--------------------[snip]--------------------
>Is it possible to define a constant that is an array of other predefined
>constants?  If so, what would the syntax be?  I'm trying something like the
>following (all items prefixed with an uppercase "G" are constants) without
>success:
--------------------[snip]-------------------- 

No, it is not possible.

 From the online manual (http://www.php.net/manual/en/language.constants.php):

Syntax
You can define a constant by using the define()-function. 
Once a constant is defined, it can never be changed or undefined.



-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message --- Hi!

In PHP, is there a way to allow the user to download a file (e.g.: sample.txt) to their computer? And, then, automatically return to the PHP-generated Web page.

How can the file be stored in C:\sample.txt, for example?

Thanks!

Tony





--- End Message ---

Reply via email to