php-general Digest 27 Aug 2002 17:21:48 -0000 Issue 1550

Topics (messages 114217 through 114269):

Re: pattern matching urls
        114217 by: Justin French

Re: Date conversion problems
        114218 by: David Robley
        114245 by: Liam.Gibbs.dfait-maeci.gc.ca

Re: Output Compression & output buffering..
        114219 by: Gerard Samuel

Tricky question - referrer from ousite, or from intern?
        114220 by: Andy
        114224 by: hugh danaher
        114227 by: Andy
        114229 by: Justin French
        114230 by: Andy
        114231 by: Andy
        114235 by: Bogdan Stancescu
        114237 by: Justin French
        114239 by: Matt Schroebel

Re: php created pages's create time
        114221 by: lin
        114222 by: lin
        114226 by: Rasmus Lerdorf

Re: XML/XSL
        114223 by: Alia Mikati

PHP - Chat?
        114225 by: Andy
        114233 by: Bogdan Stancescu
        114251 by: Adam Williams
        114253 by: Adam Voigt

exec problem
        114228 by: Mark
        114232 by: Anders K. Madsen
        114238 by: Andrew Brampton

imagecreatefrompng...fails
        114234 by: David Herring

array_push
        114236 by: Michal Dvoracek

Re: sessions?
        114240 by: CHAILLAN Nicolas

PHP & xml: urgent!
        114241 by: Alia Mikati

php and xml
        114242 by: Alia Mikati

Re: User Authentication Script
        114243 by: Anthony Ritter
        114256 by: . Edwin

use VB DLL  (COM object) with php
        114244 by: Franky

getting directory info
        114246 by: Alexander Ross
        114249 by: Jason Wong

problem with using include files
        114247 by: Ivan Carey
        114248 by: Stas Maximov

move_uploaded_file problem
        114250 by: David Rothe
        114257 by: . Edwin

Compiling PHP with Sablot support
        114252 by: Dan Hardiker
        114254 by: Stas Maximov
        114255 by: Dan Hardiker

Re: search in serialized string
        114258 by: DL Neil

flaking out on foreach
        114259 by: ROBERT MCPEAK
        114260 by: CC Zona
        114261 by: Matt Schroebel
        114262 by: Adam Voigt
        114263 by: Gerard Samuel

Re: An if statment that someone else designed and I can't parse ;(
        114264 by: Mike

sending email to a mailing list
        114265 by: Raphael Hamzagic

PHPSESSID appended to URL on initial page load
        114266 by: Monte Ohrt
        114267 by: Gerard Samuel

Re: HTML-based mail with PHP
        114268 by: Liam.Gibbs.dfait-maeci.gc.ca

Re: MySQL PASSWORD() Question
        114269 by: Tony Harrison

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 ---
I spotted a class or function on phpclasses.org a few days back that does
this.

Justin French


on 28/08/02 4:40 AM, tux ([EMAIL PROTECTED]) wrote:

> 
> 
> 
> hey all,
> 
> Just wanting some advice on something im doing, basically im storing
> news into mysql and what i want to do is, when the news is displayed, if
> a url is in there ie(http://www.blahblah.com OR
> mailto:[EMAIL PROTECTED]) it will automatically be displayed as a link,
> im considering using preg_match for this but i was wondering if there is
> any other function already designed for automatically detecting urls?
> 
> cheers,
> 
> Jo
> 

--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]
maeci.gc.ca>, [EMAIL PROTECTED] says...
> Having a little trouble with converting dates.
> 
> I have, in my database, a bunch of dates stored like this: YYYY-M. Month is
> obviously the number of the month (5), not the name (May).
> 
> I want to convert the format to MMM, YYYY (ex: May, 2002), so I used the
> mktime function. Basically I extract the date with a regular MySQL query,
> then explode the date, and my components look great. However, when I put the
> components into my mktime function, sometimes it'll work and sometimes it
> won't. It won't work if the date is too far off in the future (2085, etc.),
> but I'm not exactly sure what the cutoff is. If it's recent, say 2005, it
> works fine.
> 
> My code is this (after grabbing the query results):
> $enddate = explode("-", $datereuslt[0]);
> $fullenddate = mktime(0, 0, 0, $enddate[1], 0, $enddate[0]);
> $finaldate = date("M, Y", $fullenddate);
> 
> Any ideas? Alternatively, if anyone has an easier way of doing this, I'm all
> ears.
> 

Hmm, as mktime returns a unix timestamp it'll be constrained by that; 
currently the unix timestamp covers a range from 1 Jan 1970 to (mumble) 
January 2038.

However, if your date is stored using one of the mysql date or time 
formats, why not try using mysql's DATE_FORMAT to pretty it up as you 
select from the db? IIRC some of the date column types have a range of 
around 10,000 years, which should meet your needs.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
> mktime generally only works thru 2037.  Why not create an array of the
> months, and index in:
> $months = array('Jan','Feb',....);
> $enddate = explode("-", $datereuslt[0]);
> $finaldate =  $months[$enddate-1] . "-$enddate[1]";

That's what I thought I might have to do. It's an alternative, but a clunky
one. Thanks Matt.

<<mktime() will not work beyond mid-August of 2038 on 32-bit machines.>>

And there's the confirmation from Richard. It actually goes back to 1969.

Thanks also to David and anyone else I missed. I'm going to try the MySQL
date format that Richard and Matt suggested. But, if all else fails, I'll go
with the array that they suggested, as well.

Thanks again, guys.
--- End Message ---
--- Begin Message ---
Basically the included file containing the error handler is like so ->
-------------
<?php
error_reporting( E_ALL );
set_error_handler('errorhandler');
ob_start();

function display_error()
{
    ob_end_clean();
    //  display error page here
}

function errorhandler()
{
     // cycle through errors here and execute display_error() when needed.
}
?>
--------------
In another file, I start compression like ->
if ($compress == '1')
{
    ob_start('gz_handler');
}
-------------

Then at the end of the script I have ob_end_flush();

I believe the sequence of events are correct.
I just so happened to pass by zend.com, and in the newsletter #100
from the 26th, there is a blurb about ob_gzhandler being broken.  Im 
running php 4.2.2, so it may apply to me, as Im getting
the blank page that its describing.

Thanks for your help.


Eric Pignot wrote:

>Hi Gerard,
>
>I never had any problem using output buffering...
>Do you correctly dump the buffer when an error occurs ? I suppose you have
>built your own error() function, a bit like this one :
>
>exit_on_error($msg){
>    ob_end_clean();
>    echo $msg;
>    exit();
>}
>
>can you tell us a bit more concerning the way you handle the exit of your
>program ?
>
>regards
>
>Eric
>
>
>
>"Gerard Samuel" <[EMAIL PROTECTED]> a écrit dans le message de news:
>[EMAIL PROTECTED]
>  
>
>>In an included file, I have an error handler that is using the 'output
>>buffering' trick to
>>dump a page in progress to display the error page.
>>I also happened to have a switch to turn on output compression.
>>When output compression is on, if an error is comitted while the page is
>>displaying, I get an empty page,
>>instead of the expected error page or the page hangs, depending on the
>>browser.
>>
>>Has anyone gotten both forms of output control to work together without
>>ill side effects??
>>
>>Thanks
>>
>>--
>>Gerard Samuel
>>http://www.trini0.org:81/
>>http://dev.trini0.org:81/
>>
>>
>>    
>>
>
>
>
>  
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



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

I have a tricky problem which I honestly think is not possible to solve.
However maybe I am wrong.

As you all know it is possible on php.net to pass a function name just
behind the adress (e.G. php.net/function-name) this will redirct to the
propper page. I did the same thing with member sites (e.G
server.com/member-name) Now I am starting a referrer programm. Every member
who follows a link like from anywhere on the net and registeres will be
tracked and the referrer gets a point. Now I did forget that I do have
several of this links on my site itself :-) Which means that they have been
aquired on my site by accident :-)

My question is how can I make sure that they do come from outside and are
not surfing my site already. I do set a coockie as soon as someone enteres
this adress, but it would be fantastic if I could do a if statement on
something to make sure he does not come from my own site. I would like to
keep all the links like that, just to find a way to track the origin of the
user.

Thank you so much for any idea on this tricky task,

Andy






--- End Message ---
--- Begin Message ---
IFF they just left one of your other sites, then you should be able to pass
a variable in the other site's header such as:

php.net/function-name?variable=from_somewhere_I_own

if the variable isn't set, then they came from a site you don't own.

or you could send them to a unique function-name where you can then record a
hit on that function-name.
<?php
function unique_name()
    {
    $hit="came from my other site";
    pseudo code -- store $hit;
    function run_me(you really want to run)
    }
?>
----- Original Message -----
From: "Andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 10:58 PM
Subject: [PHP] Tricky question - referrer from ousite, or from intern?


> Hi there,
>
> I have a tricky problem which I honestly think is not possible to solve.
> However maybe I am wrong.
>
> As you all know it is possible on php.net to pass a function name just
> behind the adress (e.G. php.net/function-name) this will redirct to the
> propper page. I did the same thing with member sites (e.G
> server.com/member-name) Now I am starting a referrer programm. Every
member
> who follows a link like from anywhere on the net and registeres will be
> tracked and the referrer gets a point. Now I did forget that I do have
> several of this links on my site itself :-) Which means that they have
been
> aquired on my site by accident :-)
>
> My question is how can I make sure that they do come from outside and are
> not surfing my site already. I do set a coockie as soon as someone enteres
> this adress, but it would be fantastic if I could do a if statement on
> something to make sure he does not come from my own site. I would like to
> keep all the links like that, just to find a way to track the origin of
the
> user.
>
> Thank you so much for any idea on this tricky task,
>
> Andy
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Thanx for your answer. This is exactly the problem. I do not want to pass
something like this.

The user gets a URL like: server.com/user-name
He passses it around and someone follows this link to my site. In case this
person registeres I am tracking this. But the same links are inside my own
site. The URL should stay the same since it is a nice one with the username
and without any ?=... stuff.

I could reduce my question to the following:

How can I find out (in PHP) that someone is comming from a different site.
Some variable like $_HTTP[referrer] might track this. I hope there is
something like this :-)

So I could do something like this:


if ($_HTTP[referrer] != myserver.com){
    //set a cookie
}

You get the idea?

Andy



"Hugh Danaher" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
000c01c24d97$4c9f3d60$0100007f@localhost">news:000c01c24d97$4c9f3d60$0100007f@localhost...
> IFF they just left one of your other sites, then you should be able to
pass
> a variable in the other site's header such as:
>
> php.net/function-name?variable=from_somewhere_I_own
>
> if the variable isn't set, then they came from a site you don't own.
>
> or you could send them to a unique function-name where you can then record
a
> hit on that function-name.
> <?php
> function unique_name()
>     {
>     $hit="came from my other site";
>     pseudo code -- store $hit;
>     function run_me(you really want to run)
>     }
> ?>
> ----- Original Message -----
> From: "Andy" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 26, 2002 10:58 PM
> Subject: [PHP] Tricky question - referrer from ousite, or from intern?
>
>
> > Hi there,
> >
> > I have a tricky problem which I honestly think is not possible to solve.
> > However maybe I am wrong.
> >
> > As you all know it is possible on php.net to pass a function name just
> > behind the adress (e.G. php.net/function-name) this will redirct to the
> > propper page. I did the same thing with member sites (e.G
> > server.com/member-name) Now I am starting a referrer programm. Every
> member
> > who follows a link like from anywhere on the net and registeres will be
> > tracked and the referrer gets a point. Now I did forget that I do have
> > several of this links on my site itself :-) Which means that they have
> been
> > aquired on my site by accident :-)
> >
> > My question is how can I make sure that they do come from outside and
are
> > not surfing my site already. I do set a coockie as soon as someone
enteres
> > this adress, but it would be fantastic if I could do a if statement on
> > something to make sure he does not come from my own site. I would like
to
> > keep all the links like that, just to find a way to track the origin of
> the
> > user.
> >
> > Thank you so much for any idea on this tricky task,
> >
> > Andy
> >
> >
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>


--- End Message ---
--- Begin Message ---
$_SERVER['HTTP_REFERRER'] (or is it $_ENV['HTTP_REFERRER']?) is your only
option.  Unfortunately it's not guaranteed to be set by the browser, so your
current method of accepting and tracking referrers is flawed, sorry.

A page.php?aid=xxxxx entry point, combined with sessions or cookies to keep
track of the affiliate ID is a proven method of making things work.


Justin French



on 27/08/02 6:25 PM, Andy ([EMAIL PROTECTED]) wrote:

> How can I find out (in PHP) that someone is comming from a different site.
> Some variable like $_HTTP[referrer] might track this. I hope there is
> something like this :-)
> 
> So I could do something like this:
> 
> 
> if ($_HTTP[referrer] != myserver.com){
> //set a cookie
> }
> 
> You get the idea?

--- End Message ---
--- Begin Message ---
All righty! I found the solution:

It might be for help to some other folkes. Here is the code which solves the
problem:


                #make sure he is not referred by our  one website
                if (!ereg($HTTP_HOST, $_SERVER[HTTP_REFERER])){
                        #set referer cookie
                        setcookie('referrer', $user_id, 0);
                }
                #redirect


Cheers,

Andy



"Andy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi there,
>
> I have a tricky problem which I honestly think is not possible to solve.
> However maybe I am wrong.
>
> As you all know it is possible on php.net to pass a function name just
> behind the adress (e.G. php.net/function-name) this will redirct to the
> propper page. I did the same thing with member sites (e.G
> server.com/member-name) Now I am starting a referrer programm. Every
member
> who follows a link like from anywhere on the net and registeres will be
> tracked and the referrer gets a point. Now I did forget that I do have
> several of this links on my site itself :-) Which means that they have
been
> aquired on my site by accident :-)
>
> My question is how can I make sure that they do come from outside and are
> not surfing my site already. I do set a coockie as soon as someone enteres
> this adress, but it would be fantastic if I could do a if statement on
> something to make sure he does not come from my own site. I would like to
> keep all the links like that, just to find a way to track the origin of
the
> user.
>
> Thank you so much for any idea on this tricky task,
>
> Andy
>
>
>
>
>
>


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

I just saw that you have been faster than me :-)

However.. you think it might be not sure that this workes for every browser?
PUh... thats bad. Do u have examples for that? It workes with IE on PC.

Cheers Andy



"Andy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> All righty! I found the solution:
>
> It might be for help to some other folkes. Here is the code which solves
the
> problem:
>
>
>                 #make sure he is not referred by our  one website
>                 if (!ereg($HTTP_HOST, $_SERVER[HTTP_REFERER])){
>                         #set referer cookie
>                         setcookie('referrer', $user_id, 0);
>                 }
>                 #redirect
>
>
> Cheers,
>
> Andy
>
>
>
> "Andy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi there,
> >
> > I have a tricky problem which I honestly think is not possible to solve.
> > However maybe I am wrong.
> >
> > As you all know it is possible on php.net to pass a function name just
> > behind the adress (e.G. php.net/function-name) this will redirct to the
> > propper page. I did the same thing with member sites (e.G
> > server.com/member-name) Now I am starting a referrer programm. Every
> member
> > who follows a link like from anywhere on the net and registeres will be
> > tracked and the referrer gets a point. Now I did forget that I do have
> > several of this links on my site itself :-) Which means that they have
> been
> > aquired on my site by accident :-)
> >
> > My question is how can I make sure that they do come from outside and
are
> > not surfing my site already. I do set a coockie as soon as someone
enteres
> > this adress, but it would be fantastic if I could do a if statement on
> > something to make sure he does not come from my own site. I would like
to
> > keep all the links like that, just to find a way to track the origin of
> the
> > user.
> >
> > Thank you so much for any idea on this tricky task,
> >
> > Andy
> >
> >
> >
> >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
Justin is right, there's no guarantee the referrer will be set. What you 
can do however is have a common pre-registration page you link to from 
everywhere on the site - and set some variable there to acknowledge they 
came from the site - and give "members" the direct address to the 
registration page.

What I wonder is how could a non-referred user be confused with a 
referred one - doesn't the referred one have some kind of variable in 
the URL which identifies the referer (i.e. isn't each referer being 
given a customized URL to pass to his/her referees?!).

Bogdan

Andy wrote:
> Hello Justin,
> 
> I just saw that you have been faster than me :-)
> 
> However.. you think it might be not sure that this workes for every browser?
> PUh... thats bad. Do u have examples for that? It workes with IE on PC.
> 
> Cheers Andy
> 
> 
> 
> "Andy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 
>>All righty! I found the solution:
>>
>>It might be for help to some other folkes. Here is the code which solves
> 
> the
> 
>>problem:
>>
>>
>>                #make sure he is not referred by our  one website
>>                if (!ereg($HTTP_HOST, $_SERVER[HTTP_REFERER])){
>>                        #set referer cookie
>>                        setcookie('referrer', $user_id, 0);
>>                }
>>                #redirect
>>
>>
>>Cheers,
>>
>>Andy
>>
>>
>>
>>"Andy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
>>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>
>>>Hi there,
>>>
>>>I have a tricky problem which I honestly think is not possible to solve.
>>>However maybe I am wrong.
>>>
>>>As you all know it is possible on php.net to pass a function name just
>>>behind the adress (e.G. php.net/function-name) this will redirct to the
>>>propper page. I did the same thing with member sites (e.G
>>>server.com/member-name) Now I am starting a referrer programm. Every
>>
>>member
>>
>>>who follows a link like from anywhere on the net and registeres will be
>>>tracked and the referrer gets a point. Now I did forget that I do have
>>>several of this links on my site itself :-) Which means that they have
>>
>>been
>>
>>>aquired on my site by accident :-)
>>>
>>>My question is how can I make sure that they do come from outside and
>>
> are
> 
>>>not surfing my site already. I do set a coockie as soon as someone
>>
> enteres
> 
>>>this adress, but it would be fantastic if I could do a if statement on
>>>something to make sure he does not come from my own site. I would like
>>
> to
> 
>>>keep all the links like that, just to find a way to track the origin of
>>
>>the
>>
>>>user.
>>>
>>>Thank you so much for any idea on this tricky task,
>>>
>>>Andy
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
> 
> 

--- End Message ---
--- Begin Message ---
on 27/08/02 7:00 PM, Andy ([EMAIL PROTECTED]) wrote:

> However.. you think it might be not sure that this workes for every browser?
> PUh... thats bad. Do u have examples for that? It workes with IE on PC.

I don't actually know of any that don't set the referrer, and probably 99%
of your vistors WILL set it, but there WILL be some that don't.  Even if you
tested every IE and Netscape version known to exist on both Mac and PC,
there's still hundreds of other lesser known browsers, text-to-speach
browsers for the blind, PDAs and hand-helds, web-tv, internet-fridges, etc
etc.  There is no way you can possibly test all of these, and since they
aren't REQUIRED to set the referrer, it's foolish to rely on it.


Justin French

--- End Message ---
--- Begin Message ---
> > However.. you think it might be not sure that this workes 
> for every browser?
> > PUh... thats bad. Do u have examples for that? It workes 
> with IE on PC.

Well, the HTTP 1.1 spec says it shouldn't be set when it's typed into the address 
line.  That happens often enough that it can't be relied on.

Try it:
<HTML>
<BODY>
<?php
echo "Referrer: {$_SERVER['HTTP_REFERER']}<br>";  //note misspeled HTTP_REFERER
?>
<p>
<a href="<?php echo $_SERVER['PHP_SELF'] ?>">Link to this page</a>
</p>
</body>
</html>
--- End Message ---
--- Begin Message ---
Dear Sir,

we use php4.1.1+apache put html pages to IE from mysql DB, We find the
created pages's create time is not availability, this let me a lot of
discommodity, our webpage cann't index in yahoo etc. search engine.

please help me, let me know how to avoid it.


Mr.lin



--- End Message ---
--- Begin Message ---
Dear Sir,

we use php4.1.1+apache put html pages to IE from mysql DB, We find the
created pages's create time is not availability, this let me a lot of
discommodity, our webpage cann't index in yahoo etc. search engine.

please help me, let me know how to avoid it.


Mr.lin


--- End Message ---
--- Begin Message ---
So use the Header() function to send an appropriate Last-Modified
timestamp.  PHP can't possibly do that automatically as it does not know
the last modication time of the actual dynamic data that you send.

-Rasmus

On Tue, 27 Aug 2002, lin wrote:

> Dear Sir,
>
> we use php4.1.1+apache put html pages to IE from mysql DB, We find the
> created pages's create time is not availability, this let me a lot of
> discommodity, our webpage cann't index in yahoo etc. search engine.
>
> please help me, let me know how to avoid it.
>
>
> Mr.lin
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hi everybody,
I'm using Sablotron to transform XML with XSL and this is the PHP file:

<?PHP

$strXhtml = "<?xml version=\"1.0\"?>\n";
$strXhtml = $strXhtml . "<html><body>\n";
$strXhtml = $strXhtml . "<p><b><font color=\"#800080
\">Balance:</font></b></p>\n";
$strXhtml = $strXhtml . "<p align=\"left\"><input type=\"text\" 
name=\"balanceText\" size=\"20\" value=\"200$\"/></p>\n";
$strXhtml = $strXhtml ."</body></html>";
//echo(trim($strXhtml));

include("XSLTransformer.php"); 
$xml=$strXhtml; 
$xsl="testing.xsl"; 

$transform = new XSLTransformer(); 
if($transform->setXsl($xsl)) { 
           if($transform->setXmlString($xml)) { 
              $transform->transform(); 
              if ($transform->getError() == 0) { 
                 echo $transform->getOutput(); 
              } else { 
                 echo "<p>Error transforming ",$xml,".</p>\n"; 
              } 
           } else { 
              echo "<p>",$xml,": ",$transform->getError(),"</p>\n"; 
           } 

$transform->destroy(); 
} ?> 


I'm getting the following warning although I'm sure that if I applied XSL 
to the XML file without php, it's working. Plz can u help me and tell me 
what could be the problem?
Warning: xslt_process(): supplied argument is not a valid XSLT Processor 
resource in /home/alia/public_html/XHTML/XSLTransformer.php on line 69

Thx a lot


--- End Message ---
--- Begin Message ---
HI there,

I am wondering if a Chat coded in PHP would be sufficiant for a medium sized
site. Maybe someone has a working example online. It would be no problem to
get a ircdeamon working, just the client is in question.

Thank you for your suggestions,

Andy







--- End Message ---
--- Begin Message ---
Check freshmeat - there are a couple of more than reasonable such 
projects (unfortunately I don't remember the names, but I checked some 
out and they seemed ok).

Bogdan

Andy wrote:
> HI there,
> 
> I am wondering if a Chat coded in PHP would be sufficiant for a medium sized
> site. Maybe someone has a working example online. It would be no problem to
> get a ircdeamon working, just the client is in question.
> 
> Thank you for your suggestions,
> 
> Andy
> 
> 
> 
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
look around for phpmychat

Maybe its on freshmeat.net?

                        Adam

On Tue, 27 Aug 2002, Andy wrote:

> HI there,
>
> I am wondering if a Chat coded in PHP would be sufficiant for a medium sized
> site. Maybe someone has a working example online. It would be no problem to
> get a ircdeamon working, just the client is in question.
>
> Thank you for your suggestions,
>
> Andy
>
>
>
>
>
>
>
>
>

--- End Message ---
--- Begin Message ---
PHPOpenChat: http://phpopenchat.sourceforge.net/

Very good.

Adam Voigt
[EMAIL PROTECTED]

> On Tue, 27 Aug 2002, Andy wrote:
> 
> > HI there,
> >
> > I am wondering if a Chat coded in PHP would be sufficiant for a medium sized
> > site. Maybe someone has a working example online. It would be no problem to
> > get a ircdeamon working, just the client is in question.
> >
> > Thank you for your suggestions,
> >
> > Andy
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
i'm basicly trying to execute an executeable with this following script.

$command = "../theApp/theapp";
exec ( $command ,  $ValueIn,  $ValueOut);
echo $ValueOut;

I'm getting a value of 0 returned, but from a command line the executable
works fine and does what it is suposed to do is there any other way i can do
this or ami i doing it work ??

Cheers


--- End Message ---
--- Begin Message ---
> I'm getting a value of 0 returned, but from a command line the executable
> works fine and does what it is suposed to do is there any other way i can do
> this or ami i doing it work ??

Well, as far as I know, command-line returnes 0 on success and other on 
failure.
So if your exec ( $command, $ValueIn, $ValueOut) returns 0 in $ValueOut 
it should be done correctly...

Best regards
                Madsen

--- End Message ---
--- Begin Message ---
If you are trying to receive the output of the command line you can use the
backtick notation
$list = `ls`;

Hope that helps
Andrew

"Mark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i'm basicly trying to execute an executeable with this following script.
>
> $command = "../theApp/theapp";
> exec ( $command ,  $ValueIn,  $ValueOut);
> echo $ValueOut;
>
> I'm getting a value of 0 returned, but from a command line the executable
> works fine and does what it is suposed to do is there any other way i can
do
> this or ami i doing it work ??
>
> Cheers
>

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


Trying to install apache 1.3.26 plus PHP 4.2.2 installed and cannot get 
the libpng stuff to work with GD....


in the apache error log I get:-

[Tue Aug 27 09:31:10 2002] [notice] child pid 6825 exit signal 
Segmentation fault (11)
[Tue Aug 27 09:31:10 2002] [notice] child pid 6824 exit signal 
Segmentation fault (11)


-- and these are being generated when access imagecreatefrompng --


My configure line for PHP is:-

./configure --enable-debug \
            --with-gd=/usr/local/gd-1.8.4 \
            --with-mysql=/usr/local/mysql \
            --with-png-dir=/usr/lib \
            --with-zlib-dir=/usr/lib \
            --with-jpeg-dir=/usr/lib \
            --with-apxs=/usr/local/apache/bin/apxs \
            --with-config-file-path=/usr/local/apache/config


When I run http -X I cann not get a trackback...e.g:-

linux:/usr/local/apache/bin # pwd
/usr/local/apache/bin
linux:/usr/local/apache/bin # ./httpd -X
Segmentation fault
linux:/usr/local/apache/bin # ls
.  ..  ab  apachectl  apxs  checkgid  dbmmanage  htdigest  htpasswd  
httpd  logresolve  rotatelogs
linux:/usr/local/apache/bin #

Any ideas ?

Thanks in advance, dave



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

why this array_push($x ? $a : $b, 'value'); produce error(Fatal error:
Only variables can be passed by reference)

<?php

$x = 1;
#$x = 0;

$a = array();
$b = array();

array_push($x ? $a : $b, 'value');

i must rewrote this in

if ($x)
   array_push($a, 'value');
else
   array_push($b, 'value');




Regards,
Michal Dvoracek                          [EMAIL PROTECTED]

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

"Mark Faine" <[EMAIL PROTECTED]> a écrit dans le message de news:
8ioeq3$kg2$[EMAIL PROTECTED]
> Linux Mandrake 7.1 Apache/PHP4
>
> I'm trying to implement this mysql session scheme as describe here:
> http://phpbuilder.com/columns/ying20000602.php3
>
> A.) my sessions are not being saved into the database, they are still
being
> saved in the /tmp directory
They are supposed to stay into /tmp
>
> B.) my session (the ones that are saved in the /tmp directory)  will not
> persist past the first page?
session persist on every page if you ask them to, you need to
session_start(); in every page.
>
> The support forum on phpbuilder.com is useless.
Thats why we are here.
>
>
> Thanks
> Mark
Happy to help the nasa.
>
>
>


--- End Message ---
--- Begin Message ---
Hello,
I have an HTML file. I want to transform it to XML then filter it and 
transform it to another XML file. I used Sablotron with PHP to apply XSL 
to XML to filter the XML file. But I'm facing problems when I want to 
transform HTML to XML. I used TIDY but it seems it transforms to XHTML in 
a format not appropriate to Sablotron parser. I'm getting this msg:
Warning: Sablotron error on line 26: cannot open 
file '/home/alia/public_html/XHTML/testing.xhtml' 
in /home/alia/public_html/XHTML/XSLTransformer.php on line 91

Can u plz help me.
Thx a lot.


--- End Message ---
--- Begin Message ---
Hello
What's the best to convert HTML to XML that I can use in PHP????
Thx a lot


--- End Message ---
--- Begin Message ---
Thank you for the reply Farianto.

Exactly where in the

httpd.conf file

should I insert that line?

If you could copy and paste the line *above* and *below* in the httpd.conf
file that already exists so I know the location I would appreciate it.

Thanks again.
TR

for example:

# blahblah1

Load Module PHP4_Module c:/Apache/php/sapi/php4apache.dll  // insert this
line

# blahblah2
......................................................


----- Original Message -----
From: Farianto Kurniawan <[EMAIL PROTECTED]>
To: Anthony Ritter <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 10:36 PM
Subject: Re: [PHP] PHP: User Authentication Script


> ...hello .. Mr.Anthony Ritter ..
>
> Actually I have faced the same problem with you but right now I can fix it
.
>
> What you must do is :
> 1. Turn off your Apache Web Server
> 2. Edit your httpd.conf file from folder conf under Apache folder.
> 3. Please add this sentence  --   LoadModule php4_module
> c:/Apache/php/sapi/php4apache.dll   -- in it. (the important thing   that
> php4apache.dll is in that directory , if itsn't change it to the right
> position.
> 4. Save it
> 5. Turn Your Apache Web Server on.
>
> I hope it can work know...
>
> Regards,
>
> Farianto.K
> PT.Yosibara Inti Corpora
> Phone: 62-21-5267645/46
> Indonesia



--- End Message ---
--- Begin Message ---
You can insert the line at the very end of your httpd.conf file...

I'm sure you can find more info here...

  http://www.php.net/manual/en/install.windows.php

- E

>
>Thank you for the reply Farianto.
>
>Exactly where in the
>
>httpd.conf file
>
>should I insert that line?
>
>If you could copy and paste the line *above* and *below* in the httpd.conf
>file that already exists so I know the location I would appreciate it.
>
>Thanks again.
>TR
>
>for example:
>
># blahblah1
>
>Load Module PHP4_Module c:/Apache/php/sapi/php4apache.dll  // insert this
>line
>
># blahblah2
>......................................................
>
>
>----- Original Message -----
>From: Farianto Kurniawan <[EMAIL PROTECTED]>
>To: Anthony Ritter <[EMAIL PROTECTED]>;
><[EMAIL PROTECTED]>
>Sent: Monday, August 26, 2002 10:36 PM
>Subject: Re: [PHP] PHP: User Authentication Script
>
>
> > ...hello .. Mr.Anthony Ritter ..
> >
> > Actually I have faced the same problem with you but right now I can fix 
it
>.
> >
> > What you must do is :
> > 1. Turn off your Apache Web Server
> > 2. Edit your httpd.conf file from folder conf under Apache folder.
> > 3. Please add this sentence  --   LoadModule php4_module
> > c:/Apache/php/sapi/php4apache.dll   -- in it. (the important thing   
that
> > php4apache.dll is in that directory , if itsn't change it to the right
> > position.
> > 4. Save it
> > 5. Turn Your Apache Web Server on.
> >
> > I hope it can work know...
> >
> > Regards,
> >
> > Farianto.K
> > PT.Yosibara Inti Corpora
> > Phone: 62-21-5267645/46
> > Indonesia
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php




_________________________________________________________________
$B2q0wEPO?$OL5NA!&=<http://auction.msn.co.jp/
--- End Message ---
--- Begin Message ---
I try to use a simple COM write in VB ...
======================================================
Option Explicit

Dim sc As ScriptingContext


Sub OnStartPage(AspSC As ScriptingContext)
    Set sc = AspSC

End Sub

Public Function ecrire()
    sc.Response.Write "Voici mon super texte"
End Function
=======================================================

...but it doesn't work!  Is run in ASP put when i try in php the parameter
is not good.  I supose is the ScriptingContext variable but I don't know is
value?!

Somebody can help me Please?


Franky
[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Can I use php to get a list of all the jpgs in a folder?  I want to make a
photo album type thing for a website, and I want it to be real simple (i.e.
you put photos (jpgs) in a folder called photos and upload them.  Then the
album is built dynamically using php.  Thoughts?


--- End Message ---
--- Begin Message ---
On Tuesday 27 August 2002 20:51, Alexander Ross wrote:
> Can I use php to get a list of all the jpgs in a folder? 

manual -> Directory functions

> I want to make a
> photo album type thing for a website, and I want it to be real simple (i.e.
> you put photos (jpgs) in a folder called photos and upload them.  Then the
> album is built dynamically using php.  Thoughts?

manual -> Handling file uploads

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Maintence window broken
*/

--- End Message ---
--- Begin Message ---
Hello
The problem I have when using include files is the path to different parts of the web 
site.

To Explain:

I have a header.inc file in an inc directory:

root
 |___inc
 |       |___header.inc
 |
 |___images
 |       |___topbar_01.gif
 |
 |___faq
        |___faq.php

In the header.inc file there is: 
<img name="topbar_01" src="images/topbar_01.gif" width=783 height=56>

now when I include this into the faq.php file I do not display the topbar_01.gif as 
the path to topbar_01.gif is now
/root/faq/images/topbar_01.gif

I would like to be able to use a header.inc file so that I can update the entire site 
simply.

Is there a way I can specify the correct path when using an include file in this way?
I have tried to use some of the Environment Variables.

I find that I am having this problem when I am using a structured site. I would rather 
not place all files into the same directory

Thankyou for your reply,
Ivan
--- End Message ---
--- Begin Message ---
<img name="topbar_01" src="/images/topbar_01.gif" width=783 height=56>
This should help you. This way the browser will look for images directory in
the root of your webserver.

Regards, Stas

----- Original Message -----
From: "Ivan Carey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 1:50 PM
Subject: [PHP] problem with using include files


Hello
The problem I have when using include files is the path to different parts
of the web site.

To Explain:

I have a header.inc file in an inc directory:

root
 |___inc
 |       |___header.inc
 |
 |___images
 |       |___topbar_01.gif
 |
 |___faq
        |___faq.php

In the header.inc file there is:
<img name="topbar_01" src="images/topbar_01.gif" width=783 height=56>

now when I include this into the faq.php file I do not display the
topbar_01.gif as the path to topbar_01.gif is now
/root/faq/images/topbar_01.gif

I would like to be able to use a header.inc file so that I can update the
entire site simply.

Is there a way I can specify the correct path when using an include file in
this way?
I have tried to use some of the Environment Variables.

I find that I am having this problem when I am using a structured site. I
would rather not place all files into the same directory

Thankyou for your reply,
Ivan


--- End Message ---
--- Begin Message ---
I'm trying to enable my site users to upload pictures (using the
move_uploaded_file function)

This works fine on my home development machine but 'not' on the deployment
server. This is a shared server with 'safe mode' enabled. (The php manual
seems to suggest that it should still work despite safe mode but maybe I am
misunderstanding something).

Any thoughts gratefully received.

David Rothe




--- End Message ---
--- Begin Message ---
There could be a lot of different reasons why. Check the manual again (esp. 
the user's comments). I'm sure you'll find a lot of ideas.

  http://www.php.net/manual/en/features.file-upload.php

Also, this has been discussed many times recently. I'm sure you'll find a 
lot too in the archives. :)

- E
  
>
>I'm trying to enable my site users to upload pictures (using the
>move_uploaded_file function)
>
>This works fine on my home development machine but 'not' on the deployment
>server. This is a shared server with 'safe mode' enabled. (The php manual
>seems to suggest that it should still work despite safe mode but maybe I 
am
>misunderstanding something).
>
>Any thoughts gratefully received.
>
>David Rothe
>
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php




_________________________________________________________________
$B:G?7$N%U%!%$%J%s%9>pJs$H%i%$%U%W%i%s$N%"%I%P%$%9(B MSN $B%^%M!<(B 
http://money.msn.co.jp/
--- End Message ---
--- Begin Message ---
Hi All,

I have PHP-4.3.0(dev) [php cvs version] and have the following
configure:

../configure --with-mysql=/usr/local/ --with-gd=/usr/local/
--with-openssl --with-curl --enable-ftp --with-dom --with-xml
--enable-trans-sid
--enable-sockets --enable-wddx --with-zlib --with-mcrypt=/usr/local/
--with-mhash=/usr/local/ --with-freetype --with-t1lib --with-ttf
--with-freetype-dir=/usr/local/ --with-gettext --enable-track-vars
--with-apxs --with-expat --with-enable-xslt --with-xslt-sablot
--with-sablot

Configure runs fine... Make runs beautifully... Make Install runs
perfectly... Apache restarts great, but:

Fatal error: Call to undefined function: xslt_create_processor() in
/usr/home/dhardiker/public_html/cvs/flash_api_4.03/xslTransformer.inc.php
on line 24

Ideas?

PS: Im running FreeBSD 4.6-Stable and a copy of my
phpinfo() output can be found at http://dipsy.dapond.net/phpinfo.html.


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
Hi,
There should be a new entry like "XSLT enabled" under "XML enabled" in your
PHPinfo in case of successful set-up.
I'm not very familiar with the Unix build, but just to be sure can you check
if you uncommented the xslt extension in your php.ini file (if any)?

HTH, Stas

----- Original Message -----
From: "Dan Hardiker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 2:52 PM
Subject: [PHP] Compiling PHP with Sablot support


> Hi All,
>
> I have PHP-4.3.0(dev) [php cvs version] and have the following
> configure:
>
> ../configure --with-mysql=/usr/local/ --with-gd=/usr/local/
> --with-openssl --with-curl --enable-ftp --with-dom --with-xml
> --enable-trans-sid
> --enable-sockets --enable-wddx --with-zlib --with-mcrypt=/usr/local/
> --with-mhash=/usr/local/ --with-freetype --with-t1lib --with-ttf
> --with-freetype-dir=/usr/local/ --with-gettext --enable-track-vars
> --with-apxs --with-expat --with-enable-xslt --with-xslt-sablot
> --with-sablot
>
> Configure runs fine... Make runs beautifully... Make Install runs
> perfectly... Apache restarts great, but:
>
> Fatal error: Call to undefined function: xslt_create_processor() in
> /usr/home/dhardiker/public_html/cvs/flash_api_4.03/xslTransformer.inc.php
> on line 24
>
> Ideas?
>
> PS: Im running FreeBSD 4.6-Stable and a copy of my
> phpinfo() output can be found at http://dipsy.dapond.net/phpinfo.html.
>
>
> --
> Dan Hardiker [[EMAIL PROTECTED]]
> ADAM Software & Systems Engineer
> First Creative Ltd
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
> There should be a new entry like "XSLT enabled" under "XML enabled" in
> your PHPinfo in case of successful set-up.

Thats what Im looking for, but cant find it... however the configure line
still says its in there.

> I'm not very familiar with the Unix build, but just to be sure can you
> check if you uncommented the xslt extension in your php.ini file (if
> any)?

As far as I know Ive done everything I need to, there isnt any php.ini
directive that does that. If Im missing something I can check...

If there was an error I could probably debug it - but there isnt! heh

> ----- Original Message -----
> From: "Dan Hardiker" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, August 27, 2002 2:52 PM
> Subject: [PHP] Compiling PHP with Sablot support
>
>
>> Hi All,
>>
>> I have PHP-4.3.0(dev) [php cvs version] and have the following
>> configure:
>>
>> ../configure --with-mysql=/usr/local/ --with-gd=/usr/local/
>> --with-openssl --with-curl --enable-ftp --with-dom --with-xml
>> --enable-trans-sid
>> --enable-sockets --enable-wddx --with-zlib --with-mcrypt=/usr/local/
>> --with-mhash=/usr/local/ --with-freetype --with-t1lib --with-ttf
>> --with-freetype-dir=/usr/local/ --with-gettext --enable-track-vars
>> --with-apxs --with-expat --with-enable-xslt --with-xslt-sablot
>> --with-sablot
>>
>> Configure runs fine... Make runs beautifully... Make Install runs
>> perfectly... Apache restarts great, but:
>>
>> Fatal error: Call to undefined function: xslt_create_processor() in
>> /usr/home/dhardiker/public_html/cvs/flash_api_4.03/xslTransformer.inc.php
>> on line 24
>>
>> Ideas?
>>
>> PS: Im running FreeBSD 4.6-Stable and a copy of my
>> phpinfo() output can be found at http://dipsy.dapond.net/phpinfo.html.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
Rodrigo,

Yuk! No wonder I was having trouble visualising your problem... The
serialised field cannot be meaningfully indexed (it's a waste of time if it
is). That means that any search against a criteria involving a/the
serialised field will require (the time to perform an) the examination of
every row - so make it the last clause of a SELECT - WHERE process.

Given that I would expect that you/users would want to search on such an
important field, the db designer/implementer deserves to be first up against
the wall...

NB if a user issues a fairly open search, eg all programmers (on an IT
staffing database) - and let's just say that such represents a 50% 'hit
rate' against the total number of rows/people's data stored, then if the
table is thousands of names long, such a search for English-Advanced will be
very, very 'expensive'/slow!

However, I think we can do it. Two possibilities:
1 it may be possible to use a RegEx to examine the serialised text field for
"English" and "Advanced" in the correct sequence and proximity.
2 haul all of the rows that satisfy the other WHERE criteria into PHP,
deserialise each field, and do the check there and then.

The second will be more expensive in terms of RAM and possibly time, but
offers a guaranteed result. The first is possibly faster and is more
storage-efficient but will require some thought/clever coding.

I assume you could manage the first. If you would like me to have a go at
tackling the second for/with you, then please provide:
a) a copy of the PHP code which serialises the data and stores it in the
database,
b) a copy of any relevant array/class definitions,
c) the MySQL CREATE TABLE line for the TEXT field used,
d) (if not evident from the above), a list of some of the more likely
languages and the skill levels used within the data,
e) (if possible) some sample data to play with/prove.

Could be fun, (but it won't be pretty!)

Regards,
=dn


> I mean double ouch!!! :-)
>
> well..
>
> 1 no, it's a select for the language (<select name=language[]) and another
> to skill level
>
> 1b no separator it's stored as array. The array generated by language[]
and
> skill[] are stored into another array, serialized and put into DB
>
> 2 yes. could be up to 5
>
> 2b again, none. only the array structure
>
> the field is a text.
>
>
> on 8/26/02 9:58 AM, DL Neil at [EMAIL PROTECTED] wrote:
>
> > Rodrigo,
> >
> > Inherited problems = ouch!
> >
> > Sorry I don't keep old list msgs, perhaps you mentioned this before:
does
> > the language skills field contain:
> > 1 both the language and the skill-level, eg English - Advanced
> > 1b what separator is used between the two words?
> > 2 more than one language/skill-level where applicable, eg English -
> > Advanced, German - Intro.
> > 2b what separator is used between language entries?
> >
> > What is the database field description in the table schema?
> >
> > Please advise,
> > =dn
> >
> >
> >
> >> well, I my opinion is not the way to work, but like I said the work was
> > done
> >> by other guy, and now I have the problem to solve. So i back to old
> > question
> >> :-)
> >> How can I search with some precision in a serialized string?
> >>
> >>
> >>
> >> on 8/24/02 12:13 PM, DL Neil at [EMAIL PROTECTED] wrote:
> >>
> >>> Rodrigo,
> >>>
> >>> Then the question to be asked is: is serialize()ing this data good
> >>> design/technique, or is there a better way?
> >>>
> >>> Regards,
> >>> =dn
> >>>
> >>>
> >>
> >>
> >> --
> >> 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
>
>

--- End Message ---
--- Begin Message ---
Why is this code:

<?php
                
                        $bob=array(1,2,3,5,6);
                        
                        foreach($bob as $foo);
                        {
                        echo "$foo<BR>";
                        }
                        ?>

Rendering only "6".  That's it.  Just "6".  What am I missing here?
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Robert McPeak) wrote:

> Why is this code:
> 
> <?php
>               
>                       $bob=array(1,2,3,5,6);
>                       
>                       foreach($bob as $foo);
>                       {
>                       echo "$foo<BR>";
>                       }
>                       ?>
> 
> Rendering only "6".  That's it.  Just "6".  What am I missing here?

What do you see in the HTML source view?

-- 
CC
--- End Message ---
--- Begin Message ---
> From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, August 27, 2002 11:08 AM
> Subject: [PHP] flaking out on foreach
> 
> 
> Why is this code:
> 
> <?php
>               
>                       $bob=array(1,2,3,5,6);
>                       
>                       foreach($bob as $foo);

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Because of the empty statement caused by the mistaken semi-colon here

>                       {
>                       echo "$foo<BR>";
>                       }
>                       ?>
> 
> Rendering only "6".  That's it.  Just "6".  What am I missing here?

> 
--- End Message ---
--- Begin Message ---
Don't put a semicolon after the foreach.

Adam Voigt
[EMAIL PROTECTED]

On Tue, 2002-08-27 at 11:07, ROBERT MCPEAK wrote:
> Why is this code:
> 
> <?php
>               
>                       $bob=array(1,2,3,5,6);
>                       
>                       foreach($bob as $foo);
>                       {
>                       echo "$foo<BR>";
>                       }
>                       ?>
> 
> Rendering only "6".  That's it.  Just "6".  What am I missing here?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Bad code.
Take the ';' off the end of the foreach...

ROBERT MCPEAK wrote:

>Why is this code:
>
><?php
>               
>                       $bob=array(1,2,3,5,6);
>                       
>                       foreach($bob as $foo);
>                       {
>                       echo "$foo<BR>";
>                       }
>                       ?>
>
>Rendering only "6".  That's it.  Just "6".  What am I missing here?
>
>  
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



--- End Message ---
--- Begin Message ---
I can't use this because there is some other stuff that is also in %
signs... The whole line is as thus:
$string = "a href=\"{$_SERVER['PHP_SELF']}?thing=do&id=%number%\">%some%
- %stuff% %if%%artist%?(%artist% Minutes):\"WAH!\"%if%</a>";

So doing an explode on all the % signs would not work unfortunately.
Thanks,
Mike

-----Original Message-----
From: Richard Lynch [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, August 24, 2002 7:36 PM
To: Mike
Cc: [EMAIL PROTECTED]
Subject: [PHP] Re: An if statment that someone else designed and I can't
parse ;(

>This may not be the best place to post this question, but I don't know
>where else to ask it, so here it goes. 
>I have a program that someone was helping me to build and one of the
>functions returns a string similar to this:
"%if%(%value%)?(%value%>Minutes):\"WAH!\"%if%"

Personally, I think Regex is (A) overkill and (B) over-complicated.  But
I'm
not very smart. :-)

I would do:

<?php
  $string = "%if%(%value%)?(%value%>Minutes):\"WAH!\"%if%";
  $parts = explode('%', $string);
  # That gets you pretty close:
  # array(0=>if,1=>(,2=>value,3=>)?(,4=>value,5=>>Minutes):"WAH!",6=>if)
/*
I suspect that there are more %'s in your input, and you might be
"finished"
at this point...
If not, use explode some more:
*/
  $minuteswah = $parts[5];
  $minuteswah = explode('):', $minuteswah);
?>

Basically, a couple explode calls over the headache of trying to
understand
some convoluted Regex is always a "win" in my book. :-)

http://php.net/explode  

-- 
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 ---
Hi everyone,

I'm with a little doubt about the best way to send a mail message to a large
mailing list using PHP. I'm not interested  in existing mailing list
managers, or source codes.
I dont know if the best way to send emails is to use a repeat loop with
mail() function, or use some other structure to send emails with timeouts
intervals...

Thanks in advance

Hamzagic


--- End Message ---
--- Begin Message ---
Hi, I have a few questions with php sessions, below is an example script:

test_sess.php
-------------

<?php

session_cache_limiter("");
session_start();

?>
<A HREF="/local/path.php">local path</A>



When I initially load the file (session cookie gets set), the HREF link 
gets the PHPSESSID appended to it. If I reload the page (cookie already 
set) the appendage goes away.

According to the PHP manual, the PHPSESSID gets appended to the URL only 
in the case the session cookie is not accepted by the browser.

I would guess that on the first page load the server has no way of 
knowing if the browser accepted the cookie. So maybe this is 
intentional? I'm trying to figure out how to avoid PHPSESSID in the URLs 
entirely unless the browser does not accept cookies. I suppose I could 
disable URL rewriting altogether and rely soley on cookies. How do I 
disable PHP session URL rewriting? I don't see a setting in php.ini for it.

PHP 4.2.2, Solaris Sparc


TIA
Monte

php.ini
-------



[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler.  In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = /export/tmp
; Whether to use cookies.
session.use_cookies = 1


; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =

; Handler used to serialize data.  php is the standard serializer of PHP.
session.serialize_handler = php

; Percentual probability that the 'garbage collection' process is started
; on every session initialization.
session.gc_probability = 1

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

; Check HTTP Referer to invalidate externally stored URLs containing ids.
session.referer_check =

; How many bytes to read from the file.
;session.entropy_length = 0
session.entropy_length = 32

; Specified here to create the session id.
;session.entropy_file =
session.entropy_file = /dev/urandom

; Set to {nocache,private,public} to determine HTTP caching aspects.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 180

; use transient sid support if enabled by compiling with --enable-trans-sid.
session.use_trans_sid = 1

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

--- End Message ---
--- Begin Message ---
Actually, over the weekend, I started using sessions in my scripts.
All I did was start it using session_start();
I only noticed this behaviour using Opera 6.02 Linux browser running 
under FBSD 4.6-Stable.
(It may have happened in mozilla 1.0 r3, but I may have not paid 
attention to it).
I load the page the first time and the PHPSESSID is appended to the url.
All links on the pages has the same appended SID.  Then a reload clears 
it away.
I thought it was something in my code since Im not too familiar on 
session usage.
Im running php 4.2.2 on FBSD 4.6.2-Release.

Thx



Monte Ohrt wrote:

> Hi, I have a few questions with php sessions, below is an example script:
>
> test_sess.php
> -------------
>
> <?php
>
> session_cache_limiter("");
> session_start();
>
> ?>
> <A HREF="/local/path.php">local path</A>
>
>
>
> When I initially load the file (session cookie gets set), the HREF 
> link gets the PHPSESSID appended to it. If I reload the page (cookie 
> already set) the appendage goes away.
>
> According to the PHP manual, the PHPSESSID gets appended to the URL 
> only in the case the session cookie is not accepted by the browser.
>
> I would guess that on the first page load the server has no way of 
> knowing if the browser accepted the cookie. So maybe this is 
> intentional? I'm trying to figure out how to avoid PHPSESSID in the 
> URLs entirely unless the browser does not accept cookies. I suppose I 
> could disable URL rewriting altogether and rely soley on cookies. How 
> do I disable PHP session URL rewriting? I don't see a setting in 
> php.ini for it.
>
> PHP 4.2.2, Solaris Sparc
>
>
> TIA
> Monte
>
> php.ini
> -------
>
>
>
> [Session]
> ; Handler used to store/retrieve data.
> session.save_handler = files
>
> ; Argument passed to save_handler.  In the case of files, this is the 
> path
> ; where data files are stored. Note: Windows users have to change this
> ; variable in order to use PHP's session functions.
> session.save_path = /export/tmp
> ; Whether to use cookies.
> session.use_cookies = 1
>
>
> ; Name of the session (used as cookie name).
> session.name = PHPSESSID
>
> ; Initialize session on request startup.
> session.auto_start = 0
>
> ; Lifetime in seconds of cookie or, if 0, until browser is restarted.
> session.cookie_lifetime = 0
>
> ; The path for which the cookie is valid.
> session.cookie_path = /
>
> ; The domain for which the cookie is valid.
> session.cookie_domain =
>
> ; Handler used to serialize data.  php is the standard serializer of PHP.
> session.serialize_handler = php
>
> ; Percentual probability that the 'garbage collection' process is started
> ; on every session initialization.
> session.gc_probability = 1
>
> ; After this number of seconds, stored data will be seen as 'garbage' and
> ; cleaned up by the garbage collection process.
> session.gc_maxlifetime = 1440
>
> ; Check HTTP Referer to invalidate externally stored URLs containing ids.
> session.referer_check =
>
> ; How many bytes to read from the file.
> ;session.entropy_length = 0
> session.entropy_length = 32
>
> ; Specified here to create the session id.
> ;session.entropy_file =
> session.entropy_file = /dev/urandom
>
> ; Set to {nocache,private,public} to determine HTTP caching aspects.
> session.cache_limiter = nocache
>
> ; Document expires after n minutes.
> session.cache_expire = 180
>
> ; use transient sid support if enabled by compiling with 
> --enable-trans-sid.
> session.use_trans_sid = 1
>
> url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
>
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



--- End Message ---
--- Begin Message ---
> I've seen this before.  I believe it had something to do with Microsoft's
> screwed up cacheing routine.  No guarantees, but delete the contents of
> your temporary internet files folder and try again.

No, that wasn't it. I'm using a newer computer now, and I just tried it.
--- End Message ---
--- Begin Message ---
cheers

"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> >If I insert a row's field's value using the PASSWORD() function, will I
need
> >to use it or another function to find that row using the same field?
>
> You'll need to do this when somebody tries to log in later:
>
> <?php
>   $username = $_POST['username']; # Or $PHP_AUTH_USER or $_GET['username']
> or ...
>   $password = $_POST['password']; # Or $PHP_AUTH_PW or $_GET or ...
>   $query = "select whatever from users where username = '$username' and
> password('$password') = password";
> ?>
>
> In other words, you can *NEVER* "go backwards" from the password()
function
> output to get the original back.  But you can call password() on some
> incoming data and see if the two outputs match.
>
> --
> Like Music?  http://l-i-e.com/artists.htm
>


--- End Message ---

Reply via email to