OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 28 Oct 2004 02:08:40 -0000 Issue 3078

php-general-digest-helplists.php.net
Date: Wed Oct 27 2004 - 21:08:40 CDT


php-general Digest 28 Oct 2004 02:08:40 -0000 Issue 3078

Topics (messages 200438 through 200510):

Re: PHP5 on IBM PowerPC; good combination?
        200438 by: Brent Clements

Re: Validation and session variables
        200439 by: Stuart Felenstein
        200441 by: Philip Thompson
        200443 by: Jason Wong
        200445 by: Stuart Felenstein
        200446 by: Chris Shiflett
        200447 by: Chris Shiflett
        200449 by: Chris Shiflett
        200454 by: Jason Wong
        200455 by: Greg Donald
        200458 by: Stuart Felenstein
        200459 by: Stuart Felenstein
        200465 by: Graham Cossey

Re: Problem with Regular expression
        200440 by: Tom Rogers

bless function
        200442 by: Francisco M. Marzoa Alonso

Re: Trying to Integrate PHP 4.3.4 w/ JDK 1.5.0
        200444 by: Andrew Hauger

urlencode and google search query
        200448 by: Joel CARNAT
        200480 by: Marek Kilimajer
        200487 by: Joel CARNAT
        200489 by: Marek Kilimajer

PHP + Javascript, immediate database update
        200450 by: Steve McGill
        200452 by: Matt M.

Re: DOM XML/XSL questions
        200451 by: Christian Stocker
        200457 by: Dusty Bin

bless function: a better aproach
        200453 by: Francisco M. Marzoa Alonso

PHP Command Line Scripts 'Aborting' at end ...
        200456 by: Marc G. Fournier
        200462 by: Greg Donald
        200464 by: Greg Donald
        200510 by: Marc G. Fournier

output htmkl file as text
        200460 by: Jerry Swanson
        200461 by: John Nichel
        200463 by: Greg Donald

PHP4 PHP4ISAPI Extensions
        200466 by: George Hester

PHP & XML
        200467 by: Dan Joseph
        200475 by: Dan Joseph
        200488 by: Bill McCuistion

Re: session_start generates a new session_id
        200468 by: Lizet Peña de Sola
        200470 by: Lizet Peña de Sola
        200478 by: Lizet Peña de Sola

Millisecond in PHP
        200469 by: Victor C.
        200471 by: John Nichel
        200472 by: Jim Grill
        200473 by: Marek Kilimajer
        200474 by: Victor C.

Re: SOLVED - Validation and session variables
        200476 by: Stuart Felenstein

Timezone
        200477 by: Victor C.

https://...
        200479 by: Afan Pasalic
        200481 by: Robby Russell
        200482 by: Greg Donald
        200483 by: Vail, Warren
        200502 by: Bill McCuistion

Re: simplexml question.
        200484 by: Bill McCuistion

User Screen Resolution
        200485 by: Web Guy
        200490 by: Larry E. Ullman
        200491 by: Matthew Sims
        200492 by: Robby Russell
        200493 by: Vail, Warren
        200494 by: Vail, Warren
        200495 by: Brad Bonkoski
        200497 by: Vail, Warren

Q re: php-5.0.2 ./configure --with-soap --with-openssl --with-tidy (copy)
        200486 by: Bill McCuistion
        200508 by: Curt Zirzow

Default value if parameter is not passed in
        200496 by: Quanah Gibson-Mount
        200498 by: Vail, Warren
        200499 by: Quanah Gibson-Mount
        200500 by: Vail, Warren
        200501 by: Robby Russell
        200509 by: Curt Zirzow

PHP Compiler?
        200503 by: Bill McCuistion
        200504 by: Robby Russell
        200505 by: Vail, Warren
        200506 by: Jason Barnett

Re: __PHP_Incomplete_Class Errors...
        200507 by: Stephen Craton

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


This has nothing to do with packaging systems or your choice of
distribution. His question was if it compiled on a linux-based ppc
architecture.

I answered his question. You told him to use a specific distribution with a
specific packaging system. That was not his question.

-Brent

----- Original Message -----
From: "Pierre Ancelot" <eternityosfree.fr>
To: <php-generallists.php.net>
Sent: Wednesday, October 27, 2004 8:40 AM
Subject: Re: [PHP] PHP5 on IBM PowerPC; good combination?

>
> Yes and welcome troubles with rpm when you use suse or redhat... that's
why i
> preconise debian, not have troubles this wise, when you need a lib
>
>
> On Wednesday 27 October 2004 15:15, Brent Clements wrote:
> > Just so we are all clear. It doesn't matter which linux distribution you
> > use as long as the distribution supports the ppc architecture which most
> > do. As long as you have the gnu compiler suite and all associated tools
and
> > libraries, php will compile fine.
> >
> > It will also compile using the ibm compilers but it takes a bit of
> > wrangling to get it to compile.
> >
> > -Brent
> > ----- Original Message -----
> > From: "Pierre Ancelot" <eternityosfree.fr>
> > To: <php-generallists.php.net>
> > Sent: Wednesday, October 27, 2004 8:09 AM
> > Subject: Re: [PHP] PHP5 on IBM PowerPC; good combination?
> >
> > > yes, use debian: http://www.debian.org and study the apt system you'll
> > > get
> >
> > no
> >
> > > problem. (php 5 is not in "sarge" which is what you should use but
> >
> > compiling
> >
> > > php5 on it gives no problem.) and debian supports very well ppc...
> > >
> > > On Wednesday 27 October 2004 15:25, Aaron Gould wrote:
> > > > My company is considering the purchase of a fairly nice IBM PowerPC
> > > > system, running SuSe Linux (presumably version 9.2 by the time we
get
> > > > it). This will be replacing our aging Compaq as our main server for
our
> > > > mission-critical apps.
> > > >
> > > > Does anyone here have experience compiling PHP 5.x on a Linux-based
> > > > PowerPC architecture? My primary concern is that it actually
compiles
> > > > without trouble; all we have here now are x86 systems, so we can't
test
> > > > this combination!
> > > >
> > > > --
> > > > Aaron Gould
> > > > Parts Canada - Web Developer
> > >
> > > --
> > > 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
>

attached mail follows:


--- Chris Shiflett <shiflettphp.net> wrote:
> So, the first thing to try is using a proper
> Location header:
>
> header('Location: http://example.org/success.php');
>
> Hope that helps.
>
> Chris
>
Thank Chris , but met with same behaviour.
2 Questions:
1- Should I drop the $url line ? I tried both ways ,
no change though.
2- Do I still need to call the SID ?

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
 $url = "nextpage.php";
Header ('Location:
http://www.mysite.com/nextpage.php);

}
?>

Stuart

attached mail follows:


Stuart,

On Oct 27, 2004, at 6:57 AM, Stuart Felenstein wrote:

> Not to be redundant but here is the code again:(I
> xxx'ed out some fields in the restrict access line so
> they are not public)
>
> <?php

Put session_start() here!

> //Connection statement
> require_once('Connections/MYSQLWH.php');
>
> //Aditional Functions
> require_once('includes/functions.inc.php');
>
> //load the tNG classes
> require_once('tNG/KT_tNG.inc.php');
>
> //Start the Session - begin Block
> session_start();

You should move your session_start() to the VERY top. =D

Just see if that makes any difference. You might also make sure there
is a session_id:

if (session_id())
        // do stuff
else
        // throw computer out the window

Have fun!
~Philip

attached mail follows:


On Wednesday 27 October 2004 11:31, Stuart Felenstein wrote:

Please do not top post.

> Yes I do have session_start on every page at the top.

As I have pointed out in a previous thread and Mike has pointed out in this
thread you MUST use

  session_write_close()

before you do a redirect.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Please come home with me ... I have Tylenol!!
*/

attached mail follows:


Okay, first, sorry, but what is top post? Writing
before the reply or after ?

Second, I'm not entirely sure where the
session_write_close() belongs, because here below,
isn't this a redirect? back to page2 if there are
validation errors:

  if ($WAFV_Errors != "") {
    PostResult($WAFV_Redirect,$WAFV_Errors,"page2");

or is it solely in:

session_write_close()
if ($_SERVER["REQUEST_METHOD"] == "POST") {
 $url = "TestMulti3.php";
Header ('Location: http://www.mysite.com/page3.php);

Thank you ,
Stuart

--- Jason Wong <php-generalgremlins.biz> wrote:

> On Wednesday 27 October 2004 11:31, Stuart
> Felenstein wrote:
>
> Please do not top post.
>
> > Yes I do have session_start on every page at the
> top.
>
> As I have pointed out in a previous thread and Mike
> has pointed out in this
> thread you MUST use
>
> session_write_close()
>
> before you do a redirect.
>
> --
> Jason Wong -> Gremlins Associates ->
> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet
> Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> Please come home with me ... I have Tylenol!!
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


--- Jason Wong <php-generalgremlins.biz> wrote:
> As I have pointed out in a previous thread and Mike has pointed
> out in this thread you MUST use
>
> session_write_close()
>
> before you do a redirect.

Are you certain? If this is true, it is a bug in PHP, and we should fix
it.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004 http://httphandbook.org/

attached mail follows:


--- Stuart Felenstein <stuart4myahoo.com> wrote:
> Thank Chris , but met with same behaviour.

Well, it was certainly a problem, so at least it's one less thing to worry
about. :-)

> 2 Questions:
> 1- Should I drop the $url line ? I tried both ways ,
> no change though.

It doesn't matter. Your method was fine, but $url needs to be an absolute
one (http://example.org/path/to/script.php).

> 2- Do I still need to call the SID ?

This was a separate suggestion given by someone else, the idea being that
perhaps the browser is not sending the cookie. This is a good suggestion,
because most of these lost session problems are a result of the browser
not identifying itself (by sending the session identifier by some means).
The causes of this problem range, but this is the first thing to check.

On each page, it might be good to add some debugging information near the
top (where session_start() is):

<?php
session_start();
echo '<pre>' . htmlentities(print_r($_COOKIE, true)) . '</pre>';
echo '<pre>' . htmlentities(print_r($_GET, true)) . '</pre>';
echo session_id();
...

What you may notice is a lack of a session identifier in the $_COOKIE
superglobal or $_GET superglobal and/or the session identifier (from the
session_id() call) changing for every page.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004 http://httphandbook.org/

attached mail follows:


--- Stuart Felenstein <stuart4myahoo.com> wrote:
> Okay, first, sorry, but what is top post? Writing
> before the reply or after?

Top posting is writing your reply above what you are replying to. It's
really not worth discussing the advantages of bottom posting, but I will
say that trimming your posts makes people not mind so much. :-)

For example, you were really only replying to two things Jason said.

This:

> Please do not top post.

and this:

> As I have pointed out in a previous thread and Mike
> has pointed out in this thread you MUST use
>
> session_write_close()
>
> before you do a redirect.

Everything else in the email just gets in the way and makes it harder to
follow. That's all.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004 http://httphandbook.org/

attached mail follows:


On Wednesday 27 October 2004 14:36, Chris Shiflett wrote:
> --- Jason Wong <php-generalgremlins.biz> wrote:
> > As I have pointed out in a previous thread and Mike has pointed
> > out in this thread you MUST use
> >
> > session_write_close()
> >
> > before you do a redirect.
>
> Are you certain? If this is true, it is a bug in PHP, and we should fix
> it.

OK I just did a quick test using PHP 4.3.8 and you do NOT have to close
session before redirect. But IIRC this was an issue with older versions of
PHP so this probably got fixed somewhere along the line.

--
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
------------------------------------------
/*
Udall's Fourth Law:
 Any change or reform you make is going to have consequences you
 don't like.
*/

attached mail follows:


On Wed, 27 Oct 2004 07:51:48 -0700 (PDT), Chris Shiflett
<shiflettphp.net> wrote:
> It's
> really not worth discussing the advantages of bottom posting, but I will
> say that trimming your posts makes people not mind so much. :-)

I love discussing the advantages of documented standards, and 'known
best practices' of doing things Chris.. whatever do you mean 'not
worth discussing' ? :)

Bottom posting gives context.. first you read the question, then you
read the answer. It's very helpful to those of us who read top to
bottom and left to right.

But yeah, trimming posts goes a long way towards consideration.
Nothing's worse than scrolling two or three pages to read a one line
response.

And most of all.. if you participate in a list serv like php-general,
please use a 'threaded' mail client. The list serv messages contain a
unique message id and thread capable mail clients will thread them for
you based on that message id. This somewhat prevents multiple
(correct) answers to the same questions over and over throughout the
day. And don't forget to turn threading 'on' in your mail client.
Like in Pine for example, you _have_ to turn it on before it begins to
work.

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

attached mail follows:


--- Chris Shiflett <shiflettphp.net> wrote:

> On each page, it might be good to add some debugging
> information near the
> top (where session_start() is):
>
> <?php
> session_start();
> echo '<pre>' . htmlentities(print_r($_COOKIE, true))
> . '</pre>';
> echo '<pre>' . htmlentities(print_r($_GET, true)) .
> '</pre>';
> echo session_id();
> ...
>
I added this in , on top, right under session_start()
as shown and get this error:

Warning: Cannot modify header information - headers
already sent by (output started at
/home/lurkkcom/public_html/page1.php:6) in
/home/lurkkcom/public_html/page1.php on line 54

So it's clashing with the redirect:

Header ('Location:
http://www.mysite.com/page2.php?'.SID);

Stuart

attached mail follows:


--- Chris Shiflett <shiflettphp.net> wrote:
> This is most likely due to your malformed Location
> header. It requires an
> absolute URL, and some browsers (notably several
> versions of IE, but there
> may be others) do not send the proper Cookie header
> when requesting the
> new URL if you use a relative one.
>
> So, the first thing to try is using a proper
> Location header:
>
> header('Location: http://example.org/success.php');
>

I'm ready for the fork in the eye now ! ;)

Moved session_start() to way on top.

Placed the following in the redirect area:

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
Header ('Location:
http://www.mysite.com/page2.php?'.SID);
}
?>
Following Jason's last post, based on my server using
4.3.8 I did not include the session_write_close()

This is defintely a tough one!

Stuart

attached mail follows:


> --- Chris Shiflett <shiflettphp.net> wrote:
>
> > On each page, it might be good to add some debugging
> > information near the
> > top (where session_start() is):
> >
> > <?php
> > session_start();
> > echo '<pre>' . htmlentities(print_r($_COOKIE, true))
> > . '</pre>';
> > echo '<pre>' . htmlentities(print_r($_GET, true)) .
> > '</pre>';
> > echo session_id();
> > ...
> >
> I added this in , on top, right under session_start()
> as shown and get this error:
>
> Warning: Cannot modify header information - headers
> already sent by (output started at
> /home/lurkkcom/public_html/page1.php:6) in
> /home/lurkkcom/public_html/page1.php on line 54
>
> So it's clashing with the redirect:
>
> Header ('Location:
> http://www.mysite.com/page2.php?'.SID);
>

If your script outputs anything and then tries to redirect it WILL throw
that error. I believe if you want to do echos AND redirects you'll have to
use output buffering (see the manual: http://uk.php.net/outcontrol) and only
output the buffer if you do not redirect.

HTH
Graham

attached mail follows:


Hi,

Wednesday, October 27, 2004, 9:04:14 PM, you wrote:
k> Hi all.
k> I have a problem: i want subs any characters from a string but i don't
k> have fix the problem.
k> The string that i want to manipulate is the value from a text field of a
k> search engine.
k> The characters that i want to try substitute is &&, &, +, -, |, ||, or,
k> and, not in not case-sensitive mode with "".
k> I have create a pattern like this:

k> $str = "Sybase and PHP not ASP or JSP && Oracle not Andy | Perl ||
k> Python + Ruby";
k> $pattern =
k> "/(\band\b)|(\bnot\b)|(\bor\b)|(\b&&\b)|(\b&\b)|(\b\.\b)|(\b\+\b)|(\b\|\|\b)|(\b\|\b)/i";
k> echo $str = preg_replace($pattern, "", $str, -1);

k> But characters like + && don't subs with "".
k> Thanks to all and sorry my bad language

this may get you started

preg_replace('!\s(and|not|or|&&|\||\|\||)\s|(\+|-\s*)!i',' ',$string);

you have to replace with ' ' or the words will run into each other and you may
also get the + or - with no trailing space.

--
regards,
Tom

attached mail follows:


Ok, I think I've got it now. The code is autoexplicative, the only
restriction is that the object must be converted to an array using the
function obj2array instead of a direct cast. There's another ways to do
this without the needless of that obj2array function, but I think this
is not really a limitation.

Here it is:

<?

function obj2array ( &$Instance ) {
    $clone = (array) $Instance;
    $rtn = $clone;

    while ( list ($key, $value) = each ($clone) ) {
        $aux = explode ("\0", $key);
        $newkey = $aux[count($aux)-1];

        if ( $newkey != $key ) {
            $rtn[$newkey] = &$rtn[$key];
            $rtn['___FAKE_KEYS_'][] = $newkey;
        }
    }

    return $rtn;
}

function bless ( &$Instance, $Class ) {
    if ( ! (is_array ($Instance) ) ) {
        return NULL;
    }

    // First drop faked keys if available
    foreach ( $Instance['___FAKE_KEYS_'] as $fake_key ) {
        unset ($Instance[$fake_key]);
    }
    unset ( $Instance['___FAKE_KEYS_'] );

    // Get serialization data from array
    $serdata = serialize ( $Instance );

    /* For an array serialized data seems to meant:
         array_tag:array_count:{array_elems}

        array_tag is always 'a'
        array_count is the number of elements in the array
        array_elems are the elemens in the array

      For an object seems to meant:

          
object_tag:object_class_name_len:"object_class_name":object_count:{object_members}

        object_tag is always 'O'
        object_class_name_len is the length in chars of
object_class_name string
        object_class_name is a string with the name of the class
        object_count is the number of object members
        object_members is the object_members itself (exactly equal to
array_elems)
    */

    list ($array_params, $array_elems) = explode ('{', $serdata, 2);
    list ($array_tag, $array_count) = explode (':', $array_params, 3 );
    $serdata = "O:".strlen
($Class).":\"$Class\":$array_count:{".$array_elems;

    $Instance = unserialize ( $serdata );
    return $Instance;
}

class TestClass {
    private $One=1;
    protected $Two=2;
    public $Three=3;

    public function sum() {
        return $this->One+$this->Two+$this->Three;
    }
}

$Obj = new TestClass ();
//$Clone = (array) $Obj;

$Clone = obj2array ( $Obj );

echo "As the original object:<br>";
print_r ($Obj);

echo "<br><br>As an array:<br>";
print_r ($Clone);

$Clone["One"]=7;
$Clone["Two"]=7;
$Clone["Three"]=7;

bless ( $Clone, TestClass );

echo "<br><br>After blessing as a TestClass instance:<br>";
print_r ($Clone);

echo "<br><br>Calling sum method: ";
echo $Clone->sum();

echo "<br>The array was blessed! miracle!!! ;-)<br>";

?>

Hope someone appart from me find it useful. :-)

attached mail follows:


Still having trouble with this. I have tried to
compile the standard java extension in "ext/java", and
I have tried to compile "php-java-bridge" v1.0.5.

The 'phpize' script fails for the standard java
extension with the following messages:

> Can't locate object method "path" via package
"Request" at
/usr/local/share/autoconf/Autom4te/C4che.pm line 69,
<GEN1> line 94.
> aclocal: autom4te failed with exit status: 1

The 'phpize' and 'configure' scripts complete
successfully for php-java-bridge, and then 'make'
fails with the following messages:

>
/opt/php/php-4.3.9/php-java-bridge_1.0.5/server/natcJavaBridge.c:202:
too many arguments to function `sigwait'
> make: *** [server/natcJavaBridge.lo] Error 1

I back-revved from PHP 4.3.10-dev to PHP 4.3.9, and I
upgraded the supporting tools as follows:

m4: 1.4.2
autoconf: 2.59
automake: 1.9
libtool: 1.5

As a reminder, I am running Solaris 9 for Sparc.

Any help would be appreciated.

--- Andrew Hauger <a_haugeryahoo.com> wrote:

> Thanks Raditha. Unfortunately, I am still having
> problems. I am new to building extensions, and now
> my
> problem is an error during the java extension build
> process.
>
> I got the message :
>
> configure.in:65: error: possibly undefined macro:
> AC_PROG_LIBTOOL
>
> when I ran phpize in the ext/java directory. I'm not
> sure at this point how I managed to build the
> extension the first time, because now I can't build
> it.
>
> I researched this message, and I found bug report
> #16552. I followed the instructions in the bug
> report
> that said the fix was to download the latest
> snapshot,
> but no luck. I am still getting the error.
>
> Here's my configuration:
>
> OS: Solaris 9 on Sparc
> PHP: 4.3.10-dev (as of this morning, was 4.3.4)
> automake: 1.62
> autoconf: 2.53
>
> Again, I would appreciate any useful suggestions.
>
> --- raditha dissanayake <jabberraditha.com> wrote:
>
> > Andrew Hauger wrote:
> >
> > >Everything compiled okay, and I think everything
> is
> > >installed in the right places. When I try to run
> a
> > >test program, I get the error:
> > >
> > >[error] PHP Fatal error:
> > >java.lang.UnsatisfiedLinkError: no php_java in
> > >java.library.path in
> > >/usr/local/apache/htdocs/java_test2.php on line 5
> > >
> > >The file php_java.jar is in that directory!
> > >
> > >
> > And what is that directory? :-)
> >
> > here is what worked for me
> > http://www.raditha.com/php/java.php i
> > originally wrote it for version 1.4.2 but use thed
> > same settings with 1.5.0
> >
> >
> > >
> > >
> >
> >
> > --
> > Raditha Dissanayake.
> >
>
------------------------------------------------------------------------
> > http://www.radinks.com/sftp/ |
> > http://www.raditha.com/megaupload
> > Lean and mean Secure FTP applet with | Mega Upload
> -
> > PHP file uploader
> > Graphical User Inteface. Just 128 KB | with
> progress
> > bar.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> >
>
>

attached mail follows:


Hi,

I have a submit form from where I can search things to several sites
(google, freshmeat, ...). I use PHP4/urlencode to generate the correct
query. But it seems google does not use the right encoding :(

example - query="programme télé":
********************
$engine = $_POST["engine"];
$query = urlencode($_POST["query"]);
switch($engine) {
case "google":
        echo "<html><meta http-equiv=\"refresh\" content=\"0;url=http://www.google.fr/search?q=$query\"></html>";
        break;
case "freshmeat":
        echo "<html><meta http-equiv=\"refresh\" content=\"0;url=http://freshmeat.net/search/?q=$query\"></html>";
        break;
}
********************

when I use my code, the final URL is:
        http://www.google.fr/search?q=programme+t%E9l%E9
when I search "programme télé" straight from google's page, the URL is:
        http://www.google.fr/search?num=20&hl=fr&q=programme+t%C3%A9l%C3%A9&btnG=Rechercher&meta=
i also tried (by hand):
        http://www.google.fr/search?q=programme+t%C3%A9l%C3%A9
which is working.
how comes urlencode generates "%E9" and google generates "%C3%A9" ?
is google using some specific encoding ? any tweak to encode "the google way" ?

TIA,
        Jo

PS: I'm running OpenBSD/sparc64 with Apache 1 and PHP 4 (if it matters)

--
,-- This mail runs ---------.
`------------ NetBSD/i386 --'

attached mail follows:


Joel CARNAT wrote:
> Hi,
>
> I have a submit form from where I can search things to several sites
> (google, freshmeat, ...). I use PHP4/urlencode to generate the correct
> query. But it seems google does not use the right encoding :(
>
> example - query="programme télé":
> ********************
> $engine = $_POST["engine"];
> $query = urlencode($_POST["query"]);
> switch($engine) {
> case "google":
> echo "<html><meta http-equiv=\"refresh\" content=\"0;url=http://www.google.fr/search?q=$query\"></html>";
> break;
> case "freshmeat":
> echo "<html><meta http-equiv=\"refresh\" content=\"0;url=http://freshmeat.net/search/?q=$query\"></html>";
> break;
> }
> ********************
>
> when I use my code, the final URL is:
> http://www.google.fr/search?q=programme+t%E9l%E9
> when I search "programme télé" straight from google's page, the URL is:
> http://www.google.fr/search?num=20&hl=fr&q=programme+t%C3%A9l%C3%A9&btnG=Rechercher&meta=
> i also tried (by hand):
> http://www.google.fr/search?q=programme+t%C3%A9l%C3%A9
> which is working.
> how comes urlencode generates "%E9" and google generates "%C3%A9" ?
> is google using some specific encoding ? any tweak to encode "the google way" ?

you can specify your encoding to google using "ie" parameter. and output
encoding with "oe". google usualy uses UTF-8, that's why some single
characters are encoded in two bytes.

attached mail follows:


On Wed, Oct 27 2004 - 23:41, Marek Kilimajer wrote:
> >how comes urlencode generates "%E9" and google generates "%C3%A9" ?
> >is google using some specific encoding ? any tweak to encode "the google
> >way" ?
>
> you can specify your encoding to google using "ie" parameter. and output

 hum... I don't get what you mean :(
 there is no parameter to the urlencode php function, isn't it ?

> encoding with "oe". google usualy uses UTF-8, that's why some single
> characters are encoded in two bytes.
 
 I tried :
echo "<html><meta http-equiv=\"refresh\" content=\"0;url=http://www.google.fr/search?q=".utf8_encode($query)."\"></html>";
 which acts the same, aka "%E9"

 and
$query = utf8_encode($_POST["query"]);
 which is worse than ever :)
 it produces : %20t%C3%83%C6%92%C3%82%C2%A9 %-)

 can you clarify what you mean when you say "use the ie param" and "encoding with oe".

 sorry if those questions seems sily, but I'm not a heavy php coder ;)

TIA,
        Jo
--

,-- This mail runs ---------.
`-------- OpenBSD/sparc64 --'

attached mail follows:


Joel CARNAT wrote:
> On Wed, Oct 27 2004 - 23:41, Marek Kilimajer wrote:
>
>>>how comes urlencode generates "%E9" and google generates "%C3%A9" ?
>>>is google using some specific encoding ? any tweak to encode "the google
>>>way" ?
>>
>>you can specify your encoding to google using "ie" parameter. and output
>
>
> hum... I don't get what you mean :(
> there is no parameter to the urlencode php function, isn't it ?
>
>
>>encoding with "oe". google usualy uses UTF-8, that's why some single
>>characters are encoded in two bytes.
>
>
> I tried :
> echo "<html><meta http-equiv=\"refresh\" content=\"0;url=http://www.google.fr/search?q=".utf8_encode($query)."\"></html>";
> which acts the same, aka "%E9"
>
> and
> $query = utf8_encode($_POST["query"]);
> which is worse than ever :)
> it produces : %20t%C3%83%C6%92%C3%82%C2%A9 %-)
>
> can you clarify what you mean when you say "use the ie param" and "encoding with oe".
>
> sorry if those questions seems sily, but I'm not a heavy php coder ;)

I meant get parameters to google:

http://www.google.com/search?q=help&ie=utf-8&oe=utf-8

you need to change ie parameter ----^^ to whatever encoding you are using.

attached mail follows:


Hi everyone,

I have a webform which my users are expecting to act like a Windows program,
they only need to check the box and it is automatically written to the
database.

So I'd like to use a combination of javascript, like this, but it isn't
quite elegent enough:

- Tick the box.
- Javascript opens up a popup window, SQL query is made, popup window closes
again

Or a second method:

- Register an onexit() function, and auto-submit the form.

The only problem there is to remember to redirect them to their intended
destination, after having submitted the form. (i.e. they pressed back,
forward, or entered in another URL).

Can anybody point me in the right direction....?

Many thanks,
Steve

attached mail follows:


> I have a webform which my users are expecting to act like a Windows program,
> they only need to check the box and it is automatically written to the
> database.

you could try this
http://developer.apple.com/internet/webcontent/iframe.html

or this

http://jibbering.com/2002/4/httprequest.html

attached mail follows:


On Wed, 27 Oct 2004 13:52:13 +0100, Dusty Bin <lixoargus.pt> wrote:
> I have a requirement to create an XML file which looks approximately like:
>
> <?xml version="1.0" ?>
> <?xml-stylesheet type='text/xsl' href='article.xsl' ?>
> <article>
> <item>Item Text</item>
> ...
> </article>
>
> The file needs to be formatted.
>
> I built a dom using the Dom extension, creating a document, adding
> nodes, and I got a nicely formatted XML file from $dom->saveXML();
>
> The only problem I had, was that I could see no way to add the
> stylesheet definition to the XML. I'm not sure that a DOM should know
> anything about stylesheets, but an XML file probably should.
>
> I managed to bypass the problem, by loading the dom from a file, with
> the style sheet and the root element included, and then proceeding to
> build the dom by adding the extra nodes. This also worked fine, but now
> the output from $dom->saveXML() is no longer formatted.
> Here is some sample code:
>
> <?php
> $txt =<<<EOT
> <?xml version="1.0"?>
> <?xml-stylesheet type='text/xsl' href='../../../article.xsl' ?>
> <Article
> xmlns='http://www.example.com/xml'
> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> xsi:schemaLocation='http://www.example.com/test/xml article.xsd'>
> </Article>
> EOT;
>
> $dom = new DOMDocument();
> $dom->preserveWhiteSpace = FALSE;
> $dom->resolveExternals = TRUE;
> $dom->loadXML($txt);
>
> $item = $dom->createElement("Item");
> $itemText = $dom->createTextNode("Item Text");
> $item->appendChild($itemText);
> $dom->documentElement->appendChild($item);
>
> $dom->formatOutput = TRUE;
>
> echo $dom->saveXML();
> ?>
>
> My questions are:
> 1) How should I add a stylesheet to this type of document? (I do not
> need to process the stylesheet in php, it is for the guidance of the end
> user of the document, who may use it or modify it),
> and,

Use $dom->createProcessingInstruction($target, $data) ;
and then append this to the document.
that could maybe work
see
http://ch.php.net/manual/en/function.dom-domdocument-createprocessinginstruction.php
for more details.

> 2) Is this a (dare I say bug in an experimental extension) that if I
> load the dom, and perform operations on the dom, I lose formatting(A dom
> that is just loaded, or just created by dom operations, is correctly
> formatted, a dom with mixed processes is not).

The extension is not experimental anymore ;)
And the formatting is not lost. you didn't provide any ;) The DOM
Extension doesn't make any assumptions about the formatting of your
XML document (or correctly said, it doesn't insert whitespace
"automagically" ) but you can try to set the property formatOutput
just before saveXML:

$doc->formatOutput = true;

Never tested, but should work

chregu

> TIA for any advice... Dusty
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

attached mail follows:


Christian Stocker wrote:
<snip>
</snip>

> Use $dom->createProcessingInstruction($target, $data) ;
> and then append this to the document.
> that could maybe work
> see
> http://ch.php.net/manual/en/function.dom-domdocument-createprocessinginstruction.php
> for more details.
Thank you Christian, the following code worked fine.
(From within the DOM object)
$this->preserveWhiteSpace = false;
$this->resolveExternals = true;
$styleSheet = $this->createProcessingInstruction("xml-stylesheet",
"type='text/xsl' href='../../../course.xsl'");
$this->appendChild($styleSheet);
$this->createRoot();
$this->formatOutput = TRUE;
<snip>
</snip>
> And the formatting is not lost. you didn't provide any ;) The DOM
> Extension doesn't make any assumptions about the formatting of your
> XML document (or correctly said, it doesn't insert whitespace
> "automagically" ) but you can try to set the property formatOutput
> just before saveXML:
>
> $doc->formatOutput = true;
>
> Never tested, but should work

I already had formatOutput = true; in the sample code. Of course when I
am loading the DOM from a string, I am providing the formatting, which
DOM is honouring but when I am creating the DOM completely from php, you
are right, I am providing no formatting. In this case, the formatOutput
works as I would have expected, (default??)formatted output when true,
and not formatted when false. It would seem that if you provide some
formatting, DOM expects you to provide it all. When I have finished
this current assignment, I'll try to follow the calls through from PHP
to libxml2, and see if I can find something more.

Once again, thanks for your help... Dusty

attached mail follows:


Giving it a round, this seems to be a better aproach than the previous
one. It has the advantage of provide direct access to the original array
obtained from casting without boring about ___FAKE_KEYS_.

<?

function obj2array ( &$Instance ) {
    $clone = (array) $Instance;
    $rtn = array ();
    $rtn['___SOURCE_KEYS_'] = $clone;

    while ( list ($key, $value) = each ($clone) ) {
        $aux = explode ("\0", $key);
        $newkey = $aux[count($aux)-1];
        $rtn[$newkey] = &$rtn['___SOURCE_KEYS_'][$key];
    }

    return $rtn;
}

function bless ( &$Instance, $Class ) {
    if ( ! (is_array ($Instance) ) ) {
        return NULL;
    }

    // First get source keys if available
    if ( isset ($Instance['___SOURCE_KEYS_'])) {
        $Instance = $Instance['___SOURCE_KEYS_'];
    }

    // Get serialization data from array
    $serdata = serialize ( $Instance );

    /* For an array serialized data seems to meant:
         array_tag:array_count:{array_elems}

        array_tag is always 'a'
        array_count is the number of elements in the array
        array_elems are the elemens in the array

      For an object seems to meant:

          
object_tag:object_class_name_len:"object_class_name":object_count:{object_members}

        object_tag is always 'O'
        object_class_name_len is the length in chars of
object_class_name string
        object_class_name is a string with the name of the class
        object_count is the number of object members
        object_members is the object_members itself (exactly equal to
array_elems)
    */

    list ($array_params, $array_elems) = explode ('{', $serdata, 2);
    list ($array_tag, $array_count) = explode (':', $array_params, 3 );
    $serdata = "O:".strlen
($Class).":\"$Class\":$array_count:{".$array_elems;

    $Instance = unserialize ( $serdata );
    return $Instance;
}

class TestClass {
    private $One=1;
    protected $Two=2;
    public $Three=3;

    public function sum() {
        return $this->One+$this->Two+$this->Three;
    }
}

$Obj = new TestClass ();
//$Clone = (array) $Obj;

$Clone = obj2array ( $Obj );

echo "As the original object:<br>";
print_r ($Obj);

echo "<br><br>As an array:<br>";
print_r ($Clone);

$Clone["One"]=7;
$Clone["Two"]=7;
$Clone["Three"]=7;

bless ( $Clone, TestClass );

echo "<br><br>After blessing as a TestClass instance:<br>";
print_r ($Clone);

echo "<br><br>Calling sum method: ";
echo $Clone->sum();

echo "<br>The array was blessed! miracle!!! ;-)<br>";

?>

attached mail follows:


Note that the following is based on php installed via the FreeBSD ports
system ...

I have a really simple PHP script that, when you run it, generates an
Abort at the end of it:

ams# /tmp/test.php
testAbort (core dumped)

ams# cat /tmp/test.php
#!/usr/local/bin/php
<?php
echo "test";
?>

Even if I change the script slightly, so that last line isn't being run
via php, it does the same:

ams# cat /tmp/test.php
#!/usr/local/bin/php
<?php
echo "test";
?>

test

ams# /tmp/test.php
test
test
Abort (core dumped)

I'm getting a core file, but if I try:

gdb /usr/local/bin/php php.core ... its definitely not looking good:

s# gdb /usr/local/bin/php php.core
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 2627 in elfstab_build_psymtabs
Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 933 in fill_symbuf

Core was generated by `php'.
Program terminated with signal 6, Abort trap.
Reading symbols from /usr/lib/libcrypt.so.2...done.
Reading symbols from /usr/lib/libm.so.2...done.
Reading symbols from /usr/lib/libc.so.4...done.
Reading symbols from /usr/local/lib/php/20020429/interbase.so...done.
Reading symbols from /usr/local/firebird/lib/libfbembed.so.1...Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dwarf2read.c line 3049 in dwarf2_read_section
Error while reading shared library symbols:
Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.
Reading symbols from /usr/lib/libncurses.so.5...done.
Error while reading shared library symbols:
ì: No such file or directory.
Error while reading shared library symbols:
ynamic: No such file or directory.
Segmentation fault (core dumped)

mod_php4 appears to work fine, just the command line version seems to be
off ... and its running, producing expected output, its just that last
'Abort' that tends to screw things up a bit ...

Not sure how to debug ... help?

Thanks ...

----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappyhub.org Yahoo!: yscrappy ICQ: 7615664

attached mail follows:


On Wed, 27 Oct 2004 13:44:54 -0300 (ADT), Marc G. Fournier
<scrappyhub.org> wrote:
>
> Not sure how to debug ... help?

You said you installed in via ports, so did you happen to check the
'debug' option when you installed it?

[ ] DEBUG Enable debug

Just a question.. as that might help explain more what's going on.

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

attached mail follows:


On Wed, 27 Oct 2004 13:44:54 -0300 (ADT), Marc G. Fournier
<scrappyhub.org> wrote:
>
> I have a really simple PHP script that, when you run it, generates an
> Abort at the end of it:
>
> ams# /tmp/test.php
> testAbort (core dumped)

I just installed php4-cgi on a FreeBSD 4.10 system I have. The same
test.php script runs fine for me.

> cat test.php
#!/usr/local/bin/php
<?php
        echo "test";
?>

> ./test.php
Content-type: text/html
X-Powered-By: PHP/4.3.9

test

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

attached mail follows:


I just did a reinstall from ports, and it works now as well ... maybe a
stale library for one of hte modules :(

thanks ...

On Wed, 27 Oct 2004, Greg Donald wrote:

> On Wed, 27 Oct 2004 13:44:54 -0300 (ADT), Marc G. Fournier
> <scrappyhub.org> wrote:
>>
>> I have a really simple PHP script that, when you run it, generates an
>> Abort at the end of it:
>>
>> ams# /tmp/test.php
>> testAbort (core dumped)
>
> I just installed php4-cgi on a FreeBSD 4.10 system I have. The same
> test.php script runs fine for me.
>
>> cat test.php
> #!/usr/local/bin/php
> <?php
> echo "test";
> ?>
>
>> ./test.php
> Content-type: text/html
> X-Powered-By: PHP/4.3.9
>
> test
>
>
> --
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappyhub.org Yahoo!: yscrappy ICQ: 7615664

attached mail follows:


I want to output html file on the screen like text not like html file.
I want a program to read html file and output source code to the screen.

Any ideas how to fake browser, so browser will print html tags on the screen?

attached mail follows:


Jerry Swanson wrote:
> I want to output html file on the screen like text not like html file.
> I want a program to read html file and output source code to the screen.
>
> Any ideas how to fake browser, so browser will print html tags on the screen?
>

ASCII

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


On Wed, 27 Oct 2004 13:41:20 -0400, Jerry Swanson <pmysqlgmail.com> wrote:
> I want to output html file on the screen like text not like html file.
> I want a program to read html file and output source code to the screen.
>
> Any ideas how to fake browser, so browser will print html tags on the screen?

You need to send the Content-Type header for text instead of html.

php.net/header

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

attached mail follows:


In Windows 2000 Server SP3 I tried to set up the php4isapi.dll redirector. I can get it to work as long as there are no extensions loaded. But if there are from my php.ini then I get ./extensions\php_gd2.dll not found for example. But if I run <?php phpinfo();?> all the extensions I am using are found and enabled. Can anyone explain what is going on and suggest a fix? Thanks.

--
George Hester
__________________________________

attached mail follows:


Hi All,

Just looking to be pointed in the right direction... I've googled and
all that, but don't know what exactly I should be looking for.

I am writing an XML application with PHP.

Side one - send XML To side two and wait for a response:

Side two - sit and wait for side one to send XML, then process and
send a response.

I guess I don't know what functions with PHP I should be focusing on.
Everything I read tells me to point the code to file.xml, but there is
no file. I'll be receiving the XML string from another place on the
internet.

Help?

-Dan Joseph

attached mail follows:


> how is the xml being sent to you from the other place on the internet? is
> it being posted in a form, etc.?

It won't be thru a form. I guess it'll be a direct send, he'll format
something like...

<request>
   <name>Jack</name>
   <account>239048098324</account>
</request>

... in a string and send it over.

What methods are best suited for something like that? Would it be
best Side One to open a socket up to Side Two and send it thru that
way? I'm open to suggestions...

-Dan Joseph

attached mail follows:


Dan Joseph wrote:

>> how is the xml being sent to you from the other place on the internet? is
>> it being posted in a form, etc.?
>
> It won't be thru a form. I guess it'll be a direct send, he'll format
> something like...
>
> <request>
> <name>Jack</name>
> <account>239048098324</account>
> </request>
>
> ... in a string and send it over.
>
> What methods are best suited for something like that? Would it be
> best Side One to open a socket up to Side Two and send it thru that
> way? I'm open to suggestions...
>
> -Dan Joseph

Look at the SOAP functions. There's a SOAP client & SOAP server. The
applications use SOAP calls to transfer their XML messages over the
Intenet, typically http/https, but could also use smtp for transport.

attached mail follows:


I'll try that, thanks a lot.

-----Original Message-----
From: Reinhart Viane [mailto:rvdomos.be]
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; php-generallists.php.net
Subject: RE: [PHP] session_start generates a new session_id

Instead of:
        <? $_SESSION['validlogin']=""; $_SESSION['username']="";
$_SESSION['password']=""; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print("username=".$_SESSION ['username']);
        print("password=".$_SESSION['password']);

        if(session_id()){
        session_destroy();}
        ?>

Try this:

//unregister the sessions
$_SESSION['validlogin']=""; $_SESSION['username']="";
$_SESSION['password']=""; //destroy the sessions array $_SESSION = array();
//destroy the session
session_destroy();

Greetings
Reinhart Viane

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

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

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

attached mail follows:


It still doesn't work :(... When I try to destroy the session without asking
if there's a session_id, it gives me a warning, I fixed it with the
if(session_id()) but still, when the user logs in again with a different
profile, in the same browser window, the profile that is loaded is the
previous one...
Here I copy the logout.php code:
<?
$_SESSION['validlogin']="";
$_SESSION['username']="";
$_SESSION['password']=""; //destroy the sessions array
$_SESSION = array();
//destroy the session
if(session_id()){
session_destroy();
}
?>

And the code that runs when the user logs in:
<?
$username=trim($_POST['user']);
$password=trim($_POST['pwd']);

if(session_id()){echo('Error, please contact tech support'); exit();}
if(validateuser()){
                          session_start();
                                                    
                          $_SESSION['validlogin']=true;
                          $_SESSION['username']=$username;
                          $_SESSION['password']=$password;
}
...
?>
Any ideas why the session variables get set to their first value after
starting the session for the second time? Should I create a different
session id each time?
Tia, Lizet

-----Original Message-----
From: Reinhart Viane [mailto:rvdomos.be]
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; php-generallists.php.net
Subject: RE: [PHP] session_start generates a new session_id

Instead of:
        <? $_SESSION['validlogin']=""; $_SESSION['username']="";
$_SESSION['password']=""; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print("username=".$_SESSION ['username']);
        print("password=".$_SESSION['password']);

        if(session_id()){
        session_destroy();}
        ?>

Try this:

//unregister the sessions
$_SESSION['validlogin']=""; $_SESSION['username']="";
$_SESSION['password']=""; //destroy the sessions array $_SESSION = array();
//destroy the session
session_destroy();

Greetings
Reinhart Viane

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

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

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

attached mail follows:


session_id($username);
session_start();
Solved the problem...
Thank you all for the replies...

-----Original Message-----
From: Lizet Peña de Sola [mailto:lizetkrosslink.com]
Sent: Wednesday, October 27, 2004 3:55 PM
To: rvdomos.be; php-generallists.php.net
Subject: RE: [PHP] session_start generates a new session_id

It still doesn't work :(... When I try to destroy the session without asking
if there's a session_id, it gives me a warning, I fixed it with the
if(session_id()) but still, when the user logs in again with a different
profile, in the same browser window, the profile that is loaded is the
previous one... Here I copy the logout.php code: <?
$_SESSION['validlogin']="";
$_SESSION['username']="";
$_SESSION['password']=""; //destroy the sessions array
$_SESSION = array();
//destroy the session
if(session_id()){
session_destroy();
}
?>

And the code that runs when the user logs in:
<?
$username=trim($_POST['user']);
$password=trim($_POST['pwd']);

if(session_id()){echo('Error, please contact tech support'); exit();}
if(validateuser()){
                          session_start();
                                                    
                          $_SESSION['validlogin']=true;
                          $_SESSION['username']=$username;
                          $_SESSION['password']=$password;
}
...
?>
Any ideas why the session variables get set to their first value after
starting the session for the second time? Should I create a different
session id each time? Tia, Lizet

-----Original Message-----
From: Reinhart Viane [mailto:rvdomos.be]
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; php-generallists.php.net
Subject: RE: [PHP] session_start generates a new session_id

Instead of:
        <? $_SESSION['validlogin']=""; $_SESSION['username']="";
$_SESSION['password']=""; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print("username=".$_SESSION ['username']);
        print("password=".$_SESSION['password']);

        if(session_id()){
        session_destroy();}
        ?>

Try this:

//unregister the sessions
$_SESSION['validlogin']=""; $_SESSION['username']="";
$_SESSION['password']=""; //destroy the sessions array $_SESSION = array();
//destroy the session
session_destroy();

Greetings
Reinhart Viane

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

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

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

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

attached mail follows:


Hi,

I'm trying to get PHP to display the millisecond of current time. I can't
find that option in "Date()".. Any hints?

Thanks a lot

attached mail follows:


Victor C. wrote:
> Hi,
>
> I'm trying to get PHP to display the millisecond of current time. I can't
> find that option in "Date()".. Any hints?
>
> Thanks a lot
>

http://us4.php.net/manual/en/function.microtime.php

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


> Hi,
>
> I'm trying to get PHP to display the millisecond of current time. I can't
> find that option in "Date()".. Any hints?
>
> Thanks a lot
>

Take a look at

http://us2.php.net/manual/en/function.microtime.php

Jim Grill
ZCE

attached mail follows:


Victor C. wrote:
> Hi,
>
> I'm trying to get PHP to display the millisecond of current time. I can't
> find that option in "Date()".. Any hints?
>
> Thanks a lot
>

microtime()

attached mail follows:


Thank you all for answering! Really appreciate it.
"John Nichel" <johnkegworks.com> wrote in message
news:4180003B.50104kegworks.com...
> Victor C. wrote:
> > Hi,
> >
> > I'm trying to get PHP to display the millisecond of current time. I
can't
> > find that option in "Date()".. Any hints?
> >
> > Thanks a lot
> >
>
> http://us4.php.net/manual/en/function.microtime.php
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> johnkegworks.com

attached mail follows:


I guess this was the one thing I overlooked.
Since the page had to return to itself if validation
errors, it was already set in the validation script to
do so. So, as I had shown in my original post the
form action was blank ..well ""

Simple solution to keeping my session vars, set action
to page itself. i.e. Page1 , form action = "page1.php"

then the redirect like you all help me with. Sweet
and working ! I might be back when i get to page 5 :)

Thanks to all!
Stuart

attached mail follows:


Is there a way to get PHP to display the full name of time zone?
date(t) only displays in the format of 'EDT', 'PDT', etc.. But I need the
full name of the timezone, ie. "Pacific daylight saving time".
I know I can hard code all of these using switch statemetns. I'm just
wondering if there is a function that's already build in.

Thanks

attached mail follows:


hi,
how can I check using php that I use SSL?
tried with
REQUEST_URI
HTTP_HOST
PATH_INFO
but any of these does show http://

Thanks!

-afan

attached mail follows:


On Wed, 2004-10-27 at 16:35 -0500, Afan Pasalic wrote:
> hi,
> how can I check using php that I use SSL?
> tried with
> REQUEST_URI
> HTTP_HOST
> PATH_INFO
> but any of these does show http://
>
> Thanks!
>
> -afan
>

Have you looked at $_SERVER['SERVER_PORT'] and
$_SERVER['SERVER_PROTOCOL']
?

-Robby

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBBgBpy0QaQZBaqXgwRAgWZAJ9QM1igDVTtcp7scrWFJ9c9Dqwu1gCeKDgS
wOhI26eCEHSQ7fHrwyCBtpE=
=Lg93
-----END PGP SIGNATURE-----

attached mail follows:


On Wed, 27 Oct 2004 16:35:14 -0500, Afan Pasalic <afanafan.net> wrote:
> hi,
> how can I check using php that I use SSL?
> tried with
> REQUEST_URI
> HTTP_HOST
> PATH_INFO
> but any of these does show http://

phpinfo() describes my SSL stuff pretty well if that's what you mean.

And I also found:
http://marc.theaimsgroup.com/?l=php-general&m=109767486431095&w=2

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

attached mail follows:


Depends on the server and the release, but my apache shows

If($_SERVER["HTTPS"] == "on") // if true is secure

Lots of other information like cypher key size, etc.

Look in the $_SERVER array.

Keep in mind that lots of servers are setup to use the same htdocs base
directory for both secure and insecure pages, what happens if someone comes
to your unsecured page using https? Another example is, if you have coded
full urls for images, the browser will usually complain if the page is
accessed via https and the image via http.

Warren Vail

-----Original Message-----
From: Greg Donald [mailto:destineygmail.com]
Sent: Wednesday, October 27, 2004 3:01 PM
To: php-general
Subject: Re: [PHP] https://...

On Wed, 27 Oct 2004 16:35:14 -0500, Afan Pasalic <afanafan.net> wrote:
> hi,
> how can I check using php that I use SSL?
> tried with
> REQUEST_URI
> HTTP_HOST
> PATH_INFO
> but any of these does show http://

phpinfo() describes my SSL stuff pretty well if that's what you mean.

And I also found:
http://marc.theaimsgroup.com/?l=php-general&m=109767486431095&w=2

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

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

attached mail follows:


Afan Pasalic wrote:

> hi,
> how can I check using php that I use SSL?
> tried with
> REQUEST_URI
> HTTP_HOST
> PATH_INFO
> but any of these does show http://
>
> Thanks!
>
> -afan

from the command line...
php -m
should list openssl if ./configure --with-openssl option specified.

attached mail follows:


postmasterkende.com wrote:

>
> Hello,
>
> I looking to get the data out of this test.xml file but dont
> know how to get the data out because of the "bo:" namespaces.
> If I remove all "bo:" from the xml then it works fine...
> Is anyone can tell me how to do it?
>
>
> <?php
> $file = "test.xml";
> $xml = simplexml_load_file($file) or die ("Unable to load XML file!");
> echo "Name: " . $xml->UserAuthRequest->UserLoginName . "\n";
> ?>
>
>
> test.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <bo:TXLife xsi:schemaLocation="http://ACORD.org/Standards/Life/2
> TXLife2.9.90.XSD" xmlns:bo="http://ACORD.org/Standards/Life/2"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <bo:UserAuthRequest>
> <bo:UserLoginName>Test login</bo:UserLoginName>
>
>
>
> Thanks,
>
> Andras Kende

I couldn't get SimpleXML (nor the SimpleXMLIterator) to work with NS-enabled
xml. Had to use DOM functions. Sorry if this is bad news. Would be
interested if I missed a setting that enabled NS-support for SimpleXML.

attached mail follows:


I am new to PHP and couldn't find any Globals for the User's Screen
Resolution. (don't laugh at me please)

I used to use a Javascript function to pass the resolution using
screen.width and screen.height.

What I am actually trying to do is make a page resize depending on screen
resolution, in case that helps anyone.

 

Thanks for your help.

 

Ben

 

attached mail follows:


> I am new to PHP and couldn't find any Globals for the User's Screen
> Resolution. (don't laugh at me please)
>
> I used to use a Javascript function to pass the resolution using
> screen.width and screen.height.
>
> What I am actually trying to do is make a page resize depending on
> screen
> resolution, in case that helps anyone.

Using PHP you can neither find the screen resolution nor resize the
browser window. Both must be accomplished using JavaScript.

Larry

attached mail follows:


> I am new to PHP and couldn't find any Globals for the User's Screen
> Resolution. (don't laugh at me please)
>
> I used to use a Javascript function to pass the resolution using
> screen.width and screen.height.
>
> What I am actually trying to do is make a page resize depending on screen
> resolution, in case that helps anyone.
>
>

The reason why this worked for javascript is because it is a client side
instruction set. PHP is a server side instruction set. PHP has no idea
what resolution the user's screen is nor can it resize the browser. In
fact, PHP can't do anything with the browser.

I should just copy and save the above and paste it into everyone one of
these types of questions. ;)

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

attached mail follows:


On Wed, 2004-10-27 at 15:25 -0700, Web Guy wrote:
> I am new to PHP and couldn't find any Globals for the User's Screen
> Resolution. (don't laugh at me please)
>
> I used to use a Javascript function to pass the resolution using
> screen.width and screen.height.
>
> What I am actually trying to do is make a page resize depending on screen
> resolution, in case that helps anyone.
>

go back and find your javascript function. PHP is server side not client
side.

-Robby

--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robbyplanetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
* --- Now supporting PHP5 and PHP4 ---
****************************************/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBBgCjK0QaQZBaqXgwRAjGfAKCeu3D+PfeMYd6FPwANE9wWDMQKQgCdGABg
qMqg6A8D2CHoTyvSitpHoA8=
=+ppB
-----END PGP SIGNATURE-----

attached mail follows:


This is because there is no way for PHP to run in the browser. Wouldn't it
be nice to have a plug-in that allowed PHP to run there, perhaps as a
JavaScript replacement? Guess it would have to be a throttled back version
of PHP to adhere to sandbox security concerns. Sigh,,,,

Warren Vail

-----Original Message-----
From: Larry E. Ullman [mailto:LarryUllmanDMCInsights.Com]
Sent: Wednesday, October 27, 2004 3:40 PM
To: Web Guy
Cc: PHP
Subject: Re: [PHP] User Screen Resolution

> I am new to PHP and couldn't find any Globals for the User's Screen
> Resolution. (don't laugh at me please)
>
> I used to use a Javascript function to pass the resolution using
> screen.width and screen.height.
>
> What I am actually trying to do is make a page resize depending on
> screen
> resolution, in case that helps anyone.

Using PHP you can neither find the screen resolution nor resize the
browser window. Both must be accomplished using JavaScript.

Larry

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

attached mail follows:


One aspect of this list that I really enjoy is finding out that everyone but
me is on vacation or out of the office.

8-b

Warren Vail

-----Original Message-----
From: phile43plc.com [mailto:phile43plc.com]
Sent: Wednesday, October 27, 2004 4:22 PM
To: Vail, Warren
Subject: Re: RE: [PHP] User Screen Resolution

Phil Ewington will be out of the office until 1st November.

If your enquiry is urgent please email Ian Lowe (ian.lowe43plc.com).

attached mail follows:


There has been talk in the past about making a phpscript that would run on
the client, but then there are all the problems with browser integration,
and universal support. I say this is a good niche for javascript, so make
use of it if you need it.... just like you don't use a hammer to tighten a
screw...

----- Original Message -----
From: "Vail, Warren" <Warren.Vailschwab.com>
To: "'Larry E. Ullman'" <LarryUllmanDMCInsights.Com>; "Web Guy"
<webguysyndyne.com>
Cc: "PHP" <php-generallists.php.net>
Sent: Wednesday, October 27, 2004 7:05 PM
Subject: RE: [PHP] User Screen Resolution

> This is because there is no way for PHP to run in the browser. Wouldn't
> it
> be nice to have a plug-in that allowed PHP to run there, perhaps as a
> JavaScript replacement? Guess it would have to be a throttled back
> version
> of PHP to adhere to sandbox security concerns. Sigh,,,,
>
> Warren Vail
>
>
> -----Original Message-----
> From: Larry E. Ullman [mailto:LarryUllmanDMCInsights.Com]
> Sent: Wednesday, October 27, 2004 3:40 PM
> To: Web Guy
> Cc: PHP
> Subject: Re: [PHP] User Screen Resolution
>
>
>> I am new to PHP and couldn't find any Globals for the User's Screen
>> Resolution. (don't laugh at me please)
>>
>> I used to use a Javascript function to pass the resolution using
>> screen.width and screen.height.
>>
>> What I am actually trying to do is make a page resize depending on
>> screen
>> resolution, in case that helps anyone.
>
> Using PHP you can neither find the screen resolution nor resize the
> browser window. Both must be accomplished using JavaScript.
>
> Larry
>
> --
> 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
>

attached mail follows:


Good point, I suspect much of the desirability of having PHP on the client,
is it seems almost cruel and unusual punishment to have to learn how to use
a screwdriver, after having spent valuable time learning all about a hammer.
I wonder if I would have been so enthusiastic about learning and using PHP
if I had known in the beginning that I'd need to learn JavaScript as well.

Warren Vail

-----Original Message-----
From: Brad Bonkoski [mailto:bbonkosktampabay.rr.com]
Sent: Wednesday, October 27, 2004 4:33 PM
To: Vail, Warren; 'Larry E. Ullman'; Web Guy
Cc: PHP
Subject: Re: [PHP] User Screen Resolution

There has been talk in the past about making a phpscript that would run on
the client, but then there are all the problems with browser integration,
and universal support. I say this is a good niche for javascript, so make
use of it if you need it.... just like you don't use a hammer to tighten a
screw...

----- Original Message -----
From: "Vail, Warren" <Warren.Vailschwab.com>
To: "'Larry E. Ullman'" <LarryUllmanDMCInsights.Com>; "Web Guy"
<webguysyndyne.com>
Cc: "PHP" <php-generallists.php.net>
Sent: Wednesday, October 27, 2004 7:05 PM
Subject: RE: [PHP] User Screen Resolution

> This is because there is no way for PHP to run in the browser.
> Wouldn't
> it
> be nice to have a plug-in that allowed PHP to run there, perhaps as a
> JavaScript replacement? Guess it would have to be a throttled back
> version
> of PHP to adhere to sandbox security concerns. Sigh,,,,
>
> Warren Vail
>
>
> -----Original Message-----
> From: Larry E. Ullman [mailto:LarryUllmanDMCInsights.Com]
> Sent: Wednesday, October 27, 2004 3:40 PM
> To: Web Guy
> Cc: PHP
> Subject: Re: [PHP] User Screen Resolution
>
>
>> I am new to PHP and couldn't find any Globals for the User's Screen
>> Resolution. (don't laugh at me please)
>>
>> I used to use a Javascript function to pass the resolution using
>> screen.width and screen.height.
>>
>> What I am actually trying to do is make a page resize depending on
>> screen resolution, in case that helps anyone.
>
> Using PHP you can neither find the screen resolution nor resize the
> browser window. Both must be accomplished using JavaScript.
>
> Larry
>
> --
> 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
>

attached mail follows:


Q re: php-5.0.2 ./configure --with-soap --with-openssl --with-tidy

Hello all. Hoping for some direction with the above step.

Have PHP-5.0.2 and can configure the soap and openssl options, but when I
add the tidy option, the operation stops with the following message.

 --> checking for TIDY support... yes
 --> configure: error: Cannot find libtidy

I have of course gotten the latest tidy source (1.1) from sourceforge, but
don't understand what to do with it. The rpm doen't seel to load the
libtidy as I was hoping it would. Further to my confusion, the PHP docs
speak to using tidy 2.0 with PHP5, but can not locate any other refs to
tidy 2.x)

My system is Fedora Core 2 (and is pretty standard and otherwise
up-to-date).

I of course would like to get the TidyLib functions enabled within the PHP5
core. The command-line version works just fine, but I don't remember from
whence it came.

Any help would be most appreciated.

attached mail follows:


* Thus wrote Bill McCuistion:
> Q re: php-5.0.2 ./configure --with-soap --with-openssl --with-tidy
>
> Hello all. Hoping for some direction with the above step.
>
> Have PHP-5.0.2 and can configure the soap and openssl options, but when I
> add the tidy option, the operation stops with the following message.
>
> --> checking for TIDY support... yes
> --> configure: error: Cannot find libtidy
>
> I have of course gotten the latest tidy source (1.1) from sourceforge, but
> don't understand what to do with it. The rpm doen't seel to load the
> libtidy as I was hoping it would. Further to my confusion, the PHP docs
> speak to using tidy 2.0 with PHP5, but can not locate any other refs to
> tidy 2.x)

I've never have used the rpm for tidy, but in general it should in
theory install libtidy in either /usr/lib or /usr/local/lib so
you'll need to configure php like:
  ./configure --with-tidy=/usr
  or
  ./configure --with-tidy=/usr/local

If that doesn't work, then the rpm may not have installed the
libtidy.

As for the tidy 2.x reference, that is referencing php's interface
to tidy:

  tidy 1.0: for php4.x
  tidy 2.0: for php5.x

Both tidy's use the same libtidy, it is just that 2.0 includes the
new OO interface that PHP5 provides.

Curt
--
Quoth the Raven, "Nevermore."

attached mail follows:


Right now, I'm tweaking a function that has a bunch of optional parameters.
I would like to be able to set a default value for the very last one if it
is not passed in. This essentially looks like:

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ssl", &link, &arg1,
&arg1_len, &arg2, &arg2_len, &long, &long_len) == FAILURE { RETURN_FALSE; }

if (!long || long==NULL) {
     long=DEFAULT_VALUE;
}

However, what I found when printing out the value of "long" is that it has
been set to 1?! I imagine this was by the zend_parse_parameters function.
Is there a way to disable it from setting values to optional parameters?

--Quanah

--
Quanah Gibson-Mount
Principal Software Developer
ITSS/Shared Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

attached mail follows:


I notice that none of your variables use the PHP convention of $ preceding
the variable name, I also do not see you defining a value for DEFAULT_VALUE,
which by the upper case convention seems to be referring to a global
constant. Is it not true (no pun intended) that if a variable (or constant)
has not been defined, that assigning the contents of that variable (or value
of the constant) will return a false (i.e. a 1)?

Not sure I remember it all correctly but it seems to ring an ancient bell
for me.

HTH,

Warren Vail

-----Original Message-----
From: Quanah Gibson-Mount [mailto:quanahstanford.edu]
Sent: Wednesday, October 27, 2004 4:35 PM
To: php-generallists.php.net
Subject: [PHP] Default value if parameter is not passed in

Right now, I'm tweaking a function that has a bunch of optional parameters.
I would like to be able to set a default value for the very last one if it
is not passed in. This essentially looks like:

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ssl", &link, &arg1,
&arg1_len, &arg2, &arg2_len, &long, &long_len) == FAILURE { RETURN_FALSE; }

if (!long || long==NULL) {
     long=DEFAULT_VALUE;
}

However, what I found when printing out the value of "long" is that it has
been set to 1?! I imagine this was by the zend_parse_parameters function.
Is there a way to disable it from setting values to optional parameters?

--Quanah

--
Quanah Gibson-Mount
Principal Software Developer
ITSS/Shared Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

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

attached mail follows:


--On Wednesday, October 27, 2004 4:53 PM -0700 "Vail, Warren"
<Warren.Vailschwab.com> wrote:

> I notice that none of your variables use the PHP convention of $ preceding
> the variable name, I also do not see you defining a value for
> DEFAULT_VALUE, which by the upper case convention seems to be referring
> to a global constant. Is it not true (no pun intended) that if a
> variable (or constant) has not been defined, that assigning the contents
> of that variable (or value of the constant) will return a false (i.e. a
> 1)?

This is inside the C source code for PHP. C does not prefix variables with
a $.

The DEFAULT_VALUE was simply shorthand for what I'm setting it to, and is
not representative of an actual value, and that bit doesn't particularly
matter, since it was never getting executed (although it was for a global
constant from a header file).

--Quanah

--
Quanah Gibson-Mount
Principal Software Developer
ITSS/Shared Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

attached mail follows:


OK, so it was "C" code on a PHP list, isn't there a PHP developers list that
would work better?

Warren Vail

-----Original Message-----
From: Quanah Gibson-Mount [mailto:quanah