php-general Digest 17 May 2005 20:57:41 -0000 Issue 3460

Topics (messages 215372 through 215410):

PHP and COM+ prob
        215372 by: bob pilly
        215395 by: Jochem Maas

Re: JavaScript+Html+PH
        215373 by: fabien champel
        215377 by: Richard Sitompul

Re: PHP Phone Number Validation
        215374 by: Kim Madsen
        215388 by: John Nichel
        215397 by: Paul Fierro

Blank page in browser
        215375 by: Nayeem
        215383 by: Leila Lappin
        215407 by: Richard Lynch

Sending a string with $_POST/$_GET
        215376 by: Ross
        215390 by: Burhan Khalid
        215396 by: disguised.jedi.gmail.com

Re: Syntax Coloring
        215378 by: Burhan Khalid

counting ocuring words in a string
        215379 by: Merlin
        215382 by: Petar Nedyalkov
        215393 by: Brian V Bonini
        215403 by: Jason Wong

PHP 5.0 and mysql
        215380 by: Eustace
        215381 by: Jay Blanchard
        215389 by: Burhan Khalid

Re: I have some upload questions.
        215384 by: Lee Chen

Re: Cache
        215385 by: Rory Browne

Re: why are session only working with cookies?
        215386 by: Brian V Bonini
        215392 by: Jason Barnett
        215400 by: Brian V Bonini
        215402 by: Jason Wong
        215408 by: Richard Lynch

Re: Re-initiating an autostarted session
        215387 by: Ville Mattila

array, trouble updating
        215391 by: mayo

PHP Applications?
        215394 by: Brian Dunning
        215405 by: Brent Baisley
        215406 by: Richard Lynch

php addslashes etc
        215398 by: Pieter Breed

Upload Files
        215399 by: Stuart Nielson

Re: regex question
        215401 by: Carl Furst
        215404 by: Al

Re: php file list with forced download
        215409 by: Richard Lynch

PHP Complex Data Structures
        215410 by: zzapper

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 all!

I am trying to start word using com and php and having
problems. I am running php 5.04 and apache 2.054 on
windows. I have used a simple example from the php
site but cant get it working.

|<?php
// starting word
$word = new COM("word.application") or die("Unable to
instantiate Word");
echo "Loaded Word, version {$word->Version}\n";

//bring it to front
$word->Visible = 1;

//open an empty document
$word->Documents->Add();

//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");

//closing word
$word->Quit();

//free the object
$word = null;
?>

i have called this page testcom.php but when i try and
view it with a clients browser i get this error:

[client xxx.xxx.xxx.xxx] PHP Fatal error:  Uncaught
exception 'com_exception' with message 'Failed to
create COM object `Word.application': Invalid
syntax\r\n' in C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\testcom.php:3\nStack
trace:\n#0 C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\testcom.php(3):
com->com('Word.applicatio...')\n#1 {main}\n  thrown in
C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\testcom.php on line 3

|
Has anyone seen this error before or know what it
means? Or if possible does anyone know of any good
docs on using com with php?

Thanks in advance for any help!!

Cheers

Bob 


        
        
                
___________________________________________________________ 
Yahoo! Messenger - want a free and easy way to contact your friends online? 
http://uk.messenger.yahoo.com

--- End Message ---
--- Begin Message --- bob pilly wrote:
Hi all!

I am trying to start word using com and php and having
problems. I am running php 5.04 and apache 2.054 on
windows. I have used a simple example from the php
site but cant get it working.

|<?php
// starting word
$word = new COM("word.application") or die("Unable to
instantiate Word");
echo "Loaded Word, version {$word->Version}\n";

//bring it to front
$word->Visible = 1;

//open an empty document
$word->Documents->Add();

//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");

//closing word
$word->Quit();

//free the object
$word = null;
?>

i have called this page testcom.php but when i try and
view it with a clients browser i get this error:

[client xxx.xxx.xxx.xxx] PHP Fatal error:  Uncaught
exception 'com_exception' with message 'Failed to
create COM object `Word.application': Invalid
syntax\r\n' in C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\testcom.php:3\nStack
trace:\n#0 C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\testcom.php(3):
com->com('Word.applicatio...')\n#1 {main}\n  thrown in
C:\\Program Files\\Apache
Group\\Apache2\\htdocs\\testcom.php on line 3

|
Has anyone seen this error before or know what it
means? Or if possible does anyone know of any good
docs on using com with php?

this is not a COM specific error, you're trying to create a new COM object and that fails - rather than return something that evaluates to false the constructor for the COM object ( or something it is trying to call) is throwing a Exception...

('throwing' of) exceptions (and logically also the 'catching'
of them) are new concepts in PHP5.

try like it this and see whether something more useful error msg
is output:

<?php

// this is PHP5 only!
try {
        // starting word
        $word = new COM("word.application");
        echo "Loaded Word, version {$word->Version}\n";

        //bring it to front
        $word->Visible = 1;

        //open an empty document
        $word->Documents->Add();
        
        //do some weird stuff
        $word->Selection->TypeText("This is a test...");
        $word->Documents[1]->SaveAs("Useless test.doc");

        //closing word
        $word->Quit();

        //free the object
        $word = null;

}
catch (com_exception $e) {
        echo "something bad happened with COM:<br />", $e->__toString();     
}
catch (Exception $e) {
        echo "something bad happened:<br />", $e->__toString();
}

?>

lookup 'try'/'catch'/'throw', 'exception' in the manual (php5 specific
areas).


Thanks in advance for any help!!

Cheers

Bob





___________________________________________________________ Yahoo! Messenger - want a free and easy way to contact your friends online? http://uk.messenger.yahoo.com


--- End Message ---
--- Begin Message ---
no




javascript won't call a php function. you'll need to open another page
or do it in javascript

--- End Message ---
--- Begin Message ---
Of course, why not, or you can use smarty template engine.
http://smarty.php.net/


Thanks,
Richard Sitompul


-----Original Message-----
From: ÃÃÂÃÃÃ [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 17, 2005 12:26
To: [email protected]
Subject: [PHP] JavaScript+Html+PH

Hiï

Can  I  use  JavaScript+Html+PHP in  a  file?

 

 

<?

Function sort_asc() {

$sql=ââ

      .âorder by customer_id  ASCâ;

}

 

?>

<script: javascript>

Function sort(){

Sort_asc();

}

</javascript>

 

<Html>

<input  type=âbuttonâ  value=âorder â onclick=â sort()â>

<Html>

 

E-mail/MSN: [EMAIL PROTECTED]

 

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: IMEX Research [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 17, 2005 2:49 AM
> To: [email protected]
> Subject: [PHP] PHP Phone Number Validation
> 
> OK, I know this has probably gone aruond the list a few times, but how
do
> I validate a phone number that is in the format ddd-ddd-dddd ??  I
can't
> figure out how.

With regular expressions: 

http://dk.php.net/manual/en/function.ereg.php
http://dk.php.net/manual/en/function.preg-match.php

I expect You wanna match 555-666-0606? (Angelina Jolies number ;-)

This will match the number from start to end:

^[0-9]{3}-[0-9]{3}-[0-9]{5}$

^ means the start of the string
$ means the end of the string
[0-9] means any number from 0 to 9
{3} means _exactly_ 3 occurences, no more no less (can also be {2,4} if
You world allow from 2 to 4 occurences or {2,} if You want at least 2
digits)

So this line says _start_ with 3 digits followed by a - then 3 digits,
then another - and end with 4 digits

Example:

$number = "555-666-0606";

if(ereg("^[0-9]{3}-[0-9]{3}-[0-9]{4}$", $number)) {
  echo "valid phonenumber";
}
else {
  echo "invalid phonenumber";
}

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

--- End Message ---
--- Begin Message --- IMEX Research wrote:
OK, I know this has probably gone aruond the list a few times, but how do I validate a phone number that is in the format ddd-ddd-dddd ?? I can't figure out how.

preg_match ( "/^\d{3}-\d{3}-\d{4}$/", $phnumber )

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

--- End Message ---
--- Begin Message ---
On 05/16/2005 7:48 PM, IMEX Research <[EMAIL PROTECTED]> wrote:

> OK, I know this has probably gone aruond the list a few times, but how do I
> validate a phone number that is in the format ddd-ddd-dddd ??  I can't figure
> out how.

I try to not restrict the way your users enter phone numbers or other types
of structured data. I wouldn't bother validating against ddd-ddd-dddd unless
you also plan on validating (ddd) ddd-dddd, ddd.ddd.dddd, +1 ddd ddd ddd or
any number of variations. Your best bet is to make sure that the number
contains 10 (or 11) digits:

$phone = preg_replace('/[^0-9]/', '', $phone); # remove non-numbers

if (preg_match('/^1?[0-9]{10}$/', $phone)) {
    echo 'Valid';
}

To answer your original question:

if (preg_match('/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/', $phone)) {
    echo 'Valid';
}

Paul

--- End Message ---
--- Begin Message ---
Dear All,

I'm new to PHP programming and I just try to display small information from
database on web page but its shows blank page. So my code is mention below
and let me know what's wrong in it but when I execute same program on
command prompt then its shows all result correctly with HTML Tags 

<?php

  PutEnv("ORACLE_SID=TSH1");
  PutEnv("ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1");
  PutEnv("TNS_ADMIN=/var/opt/oracle");

   $db_conn = ocilogon("scott", "tiger", "");

   $cmdstr = "select ename, sal from emp";
   $parsed = ociparse($db_conn, $cmdstr);
   ociexecute($parsed);
   $nrows = ocifetchstatement($parsed, $results);
   echo "Found: $nrows results<br><br>\n";

   echo "<table border=1 cellspacing='0' width='50%'>\n";
   echo "<tr>\n";
   echo "<td><b>Name</b></td>\n";
   echo "<td><b>Salary</b></td>\n";
   echo "</tr>\n";

   for ($i = 0; $i < $nrows; $i++ ) {
         echo "<tr>\n";
         echo "<td>" . $results["ENAME"][$i] . "</td>";
         echo "<td>$ " . number_format($results["SAL"][$i], 2). "</td>";
         echo "</tr>\n";
   }

   echo "</table>\n";

   ?>

--- End Message ---
--- Begin Message ---
Blank page usually means there was an error during parsing of PHP.  The
error will be in the error.log file under apache.  Find that file and check
it, it'll show you what happened.



-----Original Message-----
From: Nayeem [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 17, 2005 4:42 AM
To: [email protected]
Subject: [PHP] Blank page in browser


Dear All,

I'm new to PHP programming and I just try to display small information from
database on web page but its shows blank page. So my code is mention below
and let me know what's wrong in it but when I execute same program on
command prompt then its shows all result correctly with HTML Tags

<?php

  PutEnv("ORACLE_SID=TSH1");
  PutEnv("ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1");
  PutEnv("TNS_ADMIN=/var/opt/oracle");

   $db_conn = ocilogon("scott", "tiger", "");

   $cmdstr = "select ename, sal from emp";
   $parsed = ociparse($db_conn, $cmdstr);
   ociexecute($parsed);
   $nrows = ocifetchstatement($parsed, $results);
   echo "Found: $nrows results<br><br>\n";

   echo "<table border=1 cellspacing='0' width='50%'>\n";
   echo "<tr>\n";
   echo "<td><b>Name</b></td>\n";
   echo "<td><b>Salary</b></td>\n";
   echo "</tr>\n";

   for ($i = 0; $i < $nrows; $i++ ) {
         echo "<tr>\n";
         echo "<td>" . $results["ENAME"][$i] . "</td>";
         echo "<td>$ " . number_format($results["SAL"][$i], 2). "</td>";
         echo "</tr>\n";
   }

   echo "</table>\n";

   ?>

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

--- End Message ---
--- Begin Message ---
On Tue, May 17, 2005 1:41 am, Nayeem said:
> I'm new to PHP programming and I just try to display small information
> from
> database on web page but its shows blank page. So my code is mention below
> and let me know what's wrong in it but when I execute same program on
> command prompt then its shows all result correctly with HTML Tags

You logged in as you.
The PHP user runs as somebody else.

That other user does not have the same permissions/rights as you, and not
the same environment variables ($PATH in shell) and not even the same
shell.

If you can 'su' to that other user and run it, you may find out why it
fails.  You should also check error logs as suggested, and use "View
Source" in your browser to see if the "blank" page is really blank, or
just buried inside an unfinished HTML tag.

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

--- End Message ---
--- Begin Message ---
I want to write a string to a variable and use $_POST or $_GET to retrieve 
it on another page.

I keep gettting an undefined index errror. Can someone show me how this is 
done?

Do I have to use session_start() ?

Have checked the documentation, can't find a really basic example.

R. 

--- End Message ---
--- Begin Message --- Ross wrote:
I want to write a string to a variable and use $_POST or $_GET to retrieve it on another page.

I keep gettting an undefined index errror. Can someone show me how this is done?

Do I have to use session_start() ?

This would be ideal.


Have checked the documentation, can't find a really basic example.

Well you didn't post any code, so I can't give you specifics, but a crude example is :

<?php
  session_start();
  $_SESSION['some-string'] = "hello I am a string";
  echo '<a href="page2.php">Read the string</a>';
?>

<?php
  session_start();
  echo 'String is : '.$_SESSION['some-string'];
?>

--- End Message ---
--- Begin Message ---
> I want to write a string to a variable and use $_POST or $_GET to retrieve
> it on another page.
> 
> I keep gettting an undefined index errror. Can someone show me how this is
> done?
/*
How are you trying to accomplish this?  Are you setting the $_GET in
the page code, or using a hidden form?  (If you are using the form,
you can skip this part.  If you aren't, or don't know what I mean,
read on!)  For example:

This code (page1.php):
<?php 
$_GET['myvalue'] = 'This is MY GET VALUE!!!!';
$_POST['myvalue'] = 'This is MY POST VALUE!!!!';
?>

With this code (page2.php):
<?php
echo $_GET['myvalue'];
echo $_POST['myvalue'];
?>
Will not return an error, but the second page won't echo anything. 
However, if you access page2.php with the URL like this:
http://localhost/page2.php?myvalue=This is MY GET VALUE!!!!

The first line will output: "This is MY GET VALUE!!!!"

To get the second line to work, you will need to use this:
(page1.php)
<form action="page2.php" method="post">
<input type="hidden" value="This is MY POST VALUE!!!!">
<input type="submit">
</form>

When the button is clicked, page2.php, which is the same as before,
will load, and the second line will cause the output of "This is MY
POST VALUE!!!!".  You can make both lines of page2.php work by
changing the action attribute of the form to "page2.php?myvalue=This
is MY GET VALUE!!!!".  That way, they will both work.
*/
> Do I have to use session_start() ?
/*
This would be better.  You can use sessions the way I think you are
trying to use $_GET and $_POST.  Just start the session on the first
page, and set an element in $_SESSION and on the next page you can
start the session again and read the value out of the array.  Like
this:

(page1.php)
<?php
session_start();
$_SESSION['test'] = 'test value';
?>

(page2.php)
<?php 
session_start();
echo $_SESSION['test'];
?>

The page, page2.php, will show "test value" if you run page1.php
first.  $_SESSION is probably the easiest of all the superglobals to
use.

Try those, and if I'm completely off-base, and not even helping, try
posting some code, which is ALWAYS a good thing to do.  A big post
asking for help never hurt anyone.  Most people almost never read the
short ones.

Happy coding!!!
*/

-- 
[EMAIL PROTECTED]

PHP rocks!
"Knowledge is Power.  Power Corrupts.  Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored. 
However, I must say that the ENTIRE contents of this message are
subject to other's criticism, corrections, and speculations.

This message is Certified Virus Free

--- End Message ---
--- Begin Message --- hima wrote:
Hi all,

I am trying to apply syntax coloring to my source code
as I type it in unix shell. I work on a mac machine. How do I achieve this.
In the php.ini file I see these following lines
commented out.

; Colors for Syntax Highlighting mode.  Anything
that's acceptable in
; <font color="??????"> would work.
;highlight.string  = #DD0000
;highlight.comment = #FF9900
;highlight.keyword = #007700
;highlight.bg      = #FFFFFF
;highlight.default = #0000BB
;highlight.html    = #000000

Should I uncomment the above lines?

These lines are to set up custom colors for the highlight_* functions and for the automatic highlighting of .phps files.

For your console needs, you would need to find an editor that supports PHP highlighting. Almost all unix based editors do. For example, vim does PHP syntax highlighting, as I'm sure Emacs has a mode that does this too (I don't use emacs).
--- End Message ---
--- Begin Message ---
Hi there,

I am trying to find a way to count the number of times (if any) words are inside a string. So I played around with ereg, preg_match_all and so on, but could not put together a working code.

Can anybody help me on that?

This is the current code:
function count_words($str, $words) {
  if(is_array($words)) {
   foreach($words as $k => $word) {
     $pattern[$k] = "/\b($word)\b/is";
   }
  }
  else {
   $pattern = "/\b($words)\b/is";
  }
  return ereg( $pattern, $str);
}
$words = 'php language';
$str = 'One language which is great is php. PHP works great!';
$num_hits = count_words($str, $word);
echo $num_hits;

I would like to get an case insensitive result. In this example: 3

I am a bit lost on this one. Thank you for any help.

Merlin
--- End Message ---
--- Begin Message ---
On Tuesday 17 May 2005 13:00, Merlin wrote:
> Hi there,
>
> I am trying to find a way to count the number of times (if any) words are
> inside a string. So I played around with ereg, preg_match_all and so on,
> but could not put together a working code.
>
> Can anybody help me on that?
>
> This is the current code:
> function count_words($str, $words) {
>    if(is_array($words)) {
>     foreach($words as $k => $word) {
>       $pattern[$k] = "/\b($word)\b/is";
>     }
>    }
>    else {
>     $pattern = "/\b($words)\b/is";
>    }
>    return ereg( $pattern, $str);
> }
> $words = 'php language';
> $str = 'One language which is great is php. PHP works great!';
> $num_hits = count_words($str, $word);
> echo $num_hits;
>
> I would like to get an case insensitive result. In this example: 3

http://www.php.net/manual/en/function.substr-count.php

Try this.

>
> I am a bit lost on this one. Thank you for any help.
>
> Merlin

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgp7yjXjYM9SC.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
On Tue, 2005-05-17 at 06:00, Merlin wrote:
> Hi there,
> 
> I am trying to find a way to count the number of times (if any) words are 
> inside 
> a string. So I played around with ereg, preg_match_all and so on, but could 
> not 
> put together a working code.

Maybe something like this?

<?php

$words = array("php", "language");
$str = 'One language which is great is php. PHP works great!';
$str = strtolower($str);

echo '<pre>';

foreach($words as $word) {
    echo 'word = ' .$word;
    echo ' (' . substr_count($str, $word). ")\n";
}

echo '</pre>';

?>

Although you'll run into a problem if your words array contains for
example 'air' which will match both 'air' and 'fair',

-- 

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


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

--- End Message ---
--- Begin Message ---
On Tuesday 17 May 2005 18:00, Merlin wrote:

> I am trying to find a way to count the number of times (if any) words
> are inside a string.

  explode()
  array_count_values()

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
This is going to a very naive question, but how do I make mysql work with
PHP 5? I run PHP on IIS on Windows 2000. Help!

--- End Message ---
--- Begin Message ---
[snip]
This is going to a very naive question, but how do I make mysql work
with
PHP 5? I run PHP on IIS on Windows 2000. Help!
[/snip]

Read the instructions http://us4.php.net/mysql

--- End Message ---
--- Begin Message --- Jay Blanchard wrote:
[snip]
This is going to a very naive question, but how do I make mysql work
with
PHP 5? I run PHP on IIS on Windows 2000. Help!
[/snip]

Read the instructions http://us4.php.net/mysql


Also See > http://www.php.net/manual/en/install.windows.extensions.php
--- End Message ---
--- Begin Message ---
"James E Hicks III" <[EMAIL PROTECTED]>
???????:[EMAIL PROTECTED]
> Lee Chen wrote:
>
> >Thanks
> >I check the phpinfo, and my safe_mode is off.
> >This is my phpinfo
> >http://homepage.ntu.edu.tw/~b91401010/phpinfo().htm
> >It is just a copy, not on the server.    (so it's html file, not a php
file)
> >
> >Thanks.
> >
> >
> Looks like you need to check this in your php.ini file. Could be your
> problem!
>
> max_input_time integer
>
>  This sets the maximum time in seconds a script is allowed to receive
> input data, like POST, GET and file uploads.
>
>
>
> James Hicks

Thanks for your anwsering.

I still have some questions   that if I put the same php file   on the OTHER
server whose settings are like this:
http://homepage.ntu.edu.tw/~b91401010/phpinfo()1.htm

With the same    max_input_time value "60"  ,   I can upload a file of 30MB
successfully and I'm very sure that  the duration of uploading files
was exceeding "5 minutes"    without seeing any message like :Fatal error:
Maximum execution time of 0 seconds exceeded in justtest.php on
line 2

I don't know what's the difference between the two servers about some
settings.
With almost the same settings, but it made different results.
I'm confused.

Please help me solve this problem.               Did I have some settings
wrong?
Thanks.

--- End Message ---
--- Begin Message ---
> Probably, but not serializing at all, and stuffing the data directly into
> shared memory would perhaps be faster, at least as I vaguely understood
> the results of a thread on serialization on this very forum from a month
> or two ago.  (Check archives for "serialize" "shared memory" and "Rasmus
> Lerdorf" who weighed in with a succinct explanation of how to avoid
> serialization if that performance hit was really a problem (unlikely as
> that was))

You're looking for this topic:

From: Josh Whiting <[EMAIL PROTECTED]>
To: [email protected]
Date: Jan 3, 2005 5:28 PM
Subject: [PHP] Persistent PHP web application?

and this response by Rasmus:

From: Rasmus Lerdorf <[EMAIL PROTECTED]>
To: Josh Whiting <[EMAIL PROTECTED]>
Cc: [email protected]
Date: Jan 4, 2005 6:40 PM
Subject: Re: [PHP] Persistent PHP web application?

The important functions were apc_fetch(), and apc_store() IIRC.
> 
> --
> 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
> 
>

--- End Message ---
--- Begin Message ---
On Mon, 2005-05-16 at 22:10, Richard Lynch wrote:
> Does <?php phpinfo();?> show the same /path/to/php.ini as the one you edit?
> 

Yup

> To be 100% certain, use 'stop' to stop Apache and then do:
> ps auxwwww | grep httpd
> 
> You should see only the "grep httpd" output, or no output at all.

Did that...


> Then start Apache, and triple check <?php phpinfo();?> shows the php.ini
> file being read from the same directory you edited php.ini
> 

Yup

Still no go... Other changes in php.ini DO take effect, just not
this.... I'm at a loss....


-- 

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


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

--- End Message ---
--- Begin Message ---
Brian V Bonini wrote:
...

Still no go... Other changes in php.ini DO take effect, just not this.... I'm at a loss....



By any chance are you changing PHP values through Apache's conf file?
--- End Message ---
--- Begin Message ---
On Tue, 2005-05-17 at 09:53, Jason Barnett wrote:
> Brian V Bonini wrote:
> ...
> > 
> > Still no go... Other changes in php.ini DO take effect, just not
> > this.... I'm at a loss....
> > 
> > 
> 
> By any chance are you changing PHP values through Apache's conf file?

I am, in ANOTHER virtual hosts container block.... but not any values
related to sessions. What are you getting at?

--- End Message ---
--- Begin Message ---
On Tuesday 17 May 2005 21:01, Brian V Bonini wrote:

> Still no go... Other changes in php.ini DO take effect, just not
> this.... I'm at a loss....

What version of PHP are you using? In older versions (have a look at the 
changelog) you had to configure with --enable-trans-sid, in newer 
versions this is the default.

Summary: you have to compile PHP with --enable-trans-sid, AND enable it in 
php.ini.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
> On Tuesday 17 May 2005 21:01, Brian V Bonini wrote:
>
>> Still no go... Other changes in php.ini DO take effect, just not
>> this.... I'm at a loss....

Does phpinfo() show trans_sid as "on" or "off"?

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

--- End Message ---
--- Begin Message --- [EMAIL PROTECTED] wrote:
Look in the user contributed notes in the session-destroy page.  There
is a function to wipe out the session and has worked nicely for me!
http://www.php.net/session_destroy

Thank you for a message. Anyway, I could not get it working (the code follows) - I do still have exactly the same session id. I'm not sure if you meant that note as you spoke about a function. Anyway, I couldn't find any function that handles the cookies (only one about wiping out a session file from the server but it doesn't do anything for the cookie at the client's side).



        $CookieInfo = session_get_cookie_params();
        if ( (empty($CookieInfo['domain'])) && (empty($CookieInfo['secure'])) ) 
{
                setcookie(session_name(), '', time()-3600, $CookieInfo['path']);
        } elseif (empty($CookieInfo['secure'])) {
                setcookie(session_name(), '', time()-3600, $CookieInfo['path'], 
$CookieInfo['domain']);
        } else {
                setcookie(session_name(), '', time()-3600, $CookieInfo['path'], 
$CookieInfo['domain'], $CookieInfo['secure']);
        }
        unset($_COOKIE[session_name()]);
        session_destroy();

        session_write_close();

        Header("Location: ...");
        exit;


Very mysterous... =/

Ville
--- End Message ---
--- Begin Message ---
I usually work with cold fusion and took on a little project to get my
feet wet in php and am spinning my wheels.  What I thought might be
difficult was easy and what I thought would be a piece of cake has
caused me much grief over the last few days.
 
I'm making a little shopping basket, writing the results to a file,
ftping the file to a distributor and sending the CC data to merchant
services company.
 
Write to file - easy
FTP file to distributor - easy
Updating the array in the shopping basket -- not so easy !!??!!
 
A shopping basket should be able to add and delete items (done)
You should be able to delete the whole basket (done)
Now I need to be able to update quantity - I've spent at least 5 or 6
hours on this and have gotten nowhere!!! This learning exercise is
getting to be a major time drag.
 
Any hints would be good. 
 
The code is below:
 
 
<?php
 
            if ($action == "empty") 
            { 
                        while ($ses_basket_items > -1) 
                        { 
                                    array_splice ($ses_basket_name,
$ses_basket_items, 1); 
                                    array_splice ($ses_basket_amount,
$ses_basket_items, 1); 
                                    array_splice ($ses_basket_price,
$ses_basket_items, 1); 
                                    array_splice ($ses_basket_id,
$ses_basket_items, 1); 
                                    $ses_basket_items--; 
                        } 
            } 
 
            if ($action2 == "deleteItem") 
            { 
                        array_splice ($ses_basket_name, $position, 1); 
                        array_splice ($ses_basket_amount, $position, 1);

                        array_splice ($ses_basket_price, $position, 1); 
                        array_splice ($ses_basket_id, $position, 1); 
                        $ses_basket_items--;
            } 
 
?>
<?php 
 
if ($_GET['basket']!=""){ 
if (session_is_registered('ses_basket_items')){ 
$basket_position_counter=0; 
$double=0; 
if ($_SESSION['ses_basket_items']>0){ 
foreach ($_SESSION['ses_basket_name'] as $basket_item){ 
if ($basket_item==$_GET['basket']){ 
$double=1; 
$subtract=1;
$basket_position=$basket_position_counter; 
 
} 
$basket_position_counter++; 
} 
} 
 
if ($double==1){ 
                        
            $oldamount=$_SESSION['ses_basket_amount'][$basket_position];

            $_SESSION['ses_basket_amount'][$basket_position]++; 
            $amount=$_SESSION['ses_basket_amount'][$basket_position]; 
            $oldprice=$_SESSION['ses_basket_price'][$basket_position]; 
            $newprice=($oldprice/$oldamount)*$amount; 
            $_SESSION['ses_basket_price'][$basket_position]=$newprice; 
 
}else{ 
            $_SESSION['ses_basket_name'][]=$_GET['basket']; 
            $_SESSION['ses_basket_amount'][]=1; 
            $_SESSION['ses_basket_price'][]=$_GET['price']; 
            $_SESSION['ses_basket_id'][]=$_GET['id']; 
            $_SESSION['ses_basket_items']++; 
} 
}else{ 
 
            $_SESSION['ses_basket_items']=1; 
            $_SESSION['ses_basket_name'][0]=$_GET['basket']; 
            $_SESSION['ses_basket_amount'][0]=1; 
            $_SESSION['ses_basket_price'][0]=$_GET['price']; 
            $_SESSION['ses_basket_id'][0]=$_GET['id']; 
            session_register("ses_basket_items"); 
            session_register("ses_basket_name"); 
            session_register("ses_basket_amount"); 
            session_register("ses_basket_price"); 
            session_register("ses_basket_id"); 
} 
} 
 
            
if ($_SESSION['ses_basket_items']>0){ 
 
for
($basket_counter=0;$basket_counter<$_SESSION['ses_basket_items'];$basket
_counter++){ 
// basket output 
$price=sprintf("%01.2f",$_SESSION['ses_basket_price'][$basket_counter]);

$amount=$_SESSION['ses_basket_amount'][$basket_counter]; 
$name=$_SESSION['ses_basket_name'][$basket_counter]; 
$aaa=$basket_counter;
 
echo "$amount $name $price";
echo "<a href=\"2.php?action2=deleteItem&position=" . $aaa .
"\">DEL</a>";
echo "<a
href=\"2.php?id=1001&price=25&basket=mouse&subtract=yes\">-sub</a>";
echo "$aaa";
 
echo "<BR>\n"; 
} 
} else { 
 
$_SESSION['ses_basket_items']=0; 
unset($_SESSION['ses_basket_name']); 
unset($_SESSION['ses_basket_amount']); 
unset($_SESSION['ses_basket_price']); 
unset($_SESSION['ses_basket_id']); 
} 
 
?>
 

--- End Message ---
--- Begin Message ---
Hi all -

My background is mostly with Lasso. One cool feature is the ability to make "LassoApps" - single file applications that are secure and can be sold & distributed without providing access to the source. Does PHP offer any such capability?

- Brian
--- End Message ---
--- Begin Message --- Zend sells a compiler to speed up your PHP code. Since it's compiled, it also does not contain the source code in readable form. You should visit the Zend website.


On May 17, 2005, at 10:27 AM, Brian Dunning wrote:

Hi all -

My background is mostly with Lasso. One cool feature is the ability to make "LassoApps" - single file applications that are secure and can be sold & distributed without providing access to the source. Does PHP offer any such capability?

- Brian

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


--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--- End Message ---
--- Begin Message ---
On Tue, May 17, 2005 7:27 am, Brian Dunning said:
> My background is mostly with Lasso. One cool feature is the ability
> to make "LassoApps" - single file applications that are secure and
> can be sold & distributed without providing access to the source.
> Does PHP offer any such capability?

No.

Third-party hacks to do things kinda sorta like what you describe can be
acquired for varying amounts of money.

Zend has one, I think, and road[mumble] and there are several others.

Google for "PHP compiler" and you should find most of them.

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

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

First of, sorry for the attachment. It is a screenshot of the output of the 
following code. It also shows the contents of the array data in question.

I have the following piece of actual code:

<code>
// $arrayData is the data in an array form
$arrayData = ArrayIzeDbResult( $db2 ) ;

// we want to capture the printed output
ob_start();
$data = addslashes( serialize( $arrayData ) );
print $testdata;
$printeddata = ob_get_contents();

// this next line does not work since the results of unserialize 
// is bool(false)
ob_end_flush();
print "\nNumber, the first\n";
print_r( unserialize( stripslashes( $printeddata ) ) );

// however, this next line DOES work
print "\nNumber, the second\n";
print_r( unserialize( stripslashes( addslashes( serialize( $arrayData ) ) ) ) );
</code>

I am trying to store the serialized array into a database (mysql) but on 
reading it out again, it cannot unserialize. This piece of code, even though 
it doesn't use the db, shows the problem perfectly.

The other funny thing is that not all arrays break when I am doing this. I 
have quite a lot of similar arrays that work find when you do this. This one 
however needs to work too ;)

Regards,
Pieter Breed


 

--- End Message ---
--- Begin Message ---
I have a few interpretive questions on uploading files.  There is the
max_input_time, and the max_execution_time.  I am uploading files and
they continue to time out after a few minutes.  Looking at the php.ini
file from phpinfo() shows max_input_time set to -1 and
max_execution_time set to 60.

Does the max_execution_time have anything to do with the timeout, or is
it all in the max_input_time?  And does the "-1" value mean run
indefinitely (until the file is uploaded)?  Is there any function that
will change that value?

Any clarifications on this would be helpful.

Stuart

--- End Message ---
--- Begin Message ---
I think there maybe a few ways to do this... One is

[EMAIL PROTECTED]@[EMAIL PROTECTED]

That basically says "find me the pattern where one non-at symbol is followed
by an at symbol followed by another non-at symbol"

So if you do 

<?php

$string = "@ one more T@@me for @ and i@ the Bl@@dy [EMAIL PROTECTED]";


$pattern = '/[EMAIL PROTECTED](@)[EMAIL PROTECTED]/';

$numMatch = preg_match_all($pattern, $string, $matches);

echo "numMatch: $numMatch\n";
print_r ($matches);

?>

numMatch: 3
Array
(
    [0] => Array
        (
            [0] =>  @ 
            [1] => i@ 
            [2] => [EMAIL PROTECTED]
        )

    [1] => Array
        (
            [0] => @
            [1] => @
            [2] => @
        )

)

Well, where that fails is when you have @'s at the beginning or end of the
string and that's easy enough to do.. So that would mean three searches...
There's probably a way to integrate them into one without loosing integrity,
but it depends on what kind of regexp libs you have, I reckon. It also
depends on what you really are trying to do with this search. Consider
str_replace, strpos and strtr as well.

Thanks,


Carl
-----Original Message-----
From: Al [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 16, 2005 3:54 PM
To: [email protected]
Subject: regex question

What pattern can I use to match ONLY single occurrences of a character in a
string.

e.g., "Some text @ and some mo@@re and [EMAIL PROTECTED], etc @@@.

I only want the two occurrences with a single occurrence of "@".

@{1} doesn't work; there are 4 matches.

Thanks....

--- End Message ---
--- Begin Message --- Murry's solution here is ideal since it only captures the single occurrence. Since I want to use it for a preg_replace(), it is perfect.

A couple of folks sent this pattern [EMAIL PROTECTED]@[EMAIL PROTECTED]; but, it doesn't work because I then have to remove the unwanted caracters on either side.

All it says is [not  @[EMAIL PROTECTED]@] but, it captures the 2 characters on 
each side.

Murry's solution (?<!@)@(?!@) is good since it only captures the "@"

Thanks everyone....





Murray @ PlanetThoughtful wrote:
What pattern can I use to match ONLY single occurrences of a character in
a string.

e.g., "Some text @ and some mo@@re and [EMAIL PROTECTED], etc @@@.

I only want the two occurrences with a single occurrence of "@".

@{1} doesn't work; there are 4 matches.

Thanks....


Please ignore my last email re: your question. I realized that the negation
of the range containing the "@" would end up capturing unwanted characters.

As an alternative, try the following:

preg_match_all('/(?<!@)@(?!@)/','Some @ text with the @t sym@@bol @@@@ ',
$thing, PREG_OFFSET_CAPTURE);

print_r($thing);

Hope that's a little more relevant to your question.

Regards,

Murray

--- End Message ---
--- Begin Message ---
On Mon, May 16, 2005 5:49 pm, Miguel Vaz said:
>       Was coding a directory listing for several dirs on a client's server 
> that
> would list the files and allow users to download them. The question is, is
> there a way to force download of all files, regardless of their types?
> i.e., if the list constains a .jpg, the browser will show it instead of
> asking the user to download. Also for .html, gifs, etc.

<?php
  header("Content-type: application/octet-stream");
  readfile("/full/path/to/your/file");
?>

Any browser that doesn't force a download for application/octet-stream is
in violation of every HTTP protocol version ever published.

Even *MICROSOFT* hasn't screwed this one up.  Yet...

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

--- End Message ---
--- Begin Message ---
Hi,
I seem to remember that you access/use PHP data in the same/similar way to Perl 
data and that you
can create complex data structures ie
arrays of arrays, arrays of records etc.

For once Google let me down so can any one point at any doc info.


-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips

--- End Message ---

Reply via email to