Re: [PHP] Extending Element class in a dom tree?

2005-04-30 Thread =?ISO-8859-1?Q?Erik_Franz=E9n?=
Christian Stocker wrote:
Does not work, will never work, just forget about it ;)

Ok, that was not the really right answer ;) Of course it does work.
You can even do stuff on that element, if you use the variable, resp.
reference ($oMyElement) for doing this.
What doesn't work (and I  referred to that) is getting this object
back from the DomDocument, so for example:
$oDom->documentElement will give you the DomElement back and not your
new MyElement.
Hope it's a little bit clearer now
chregu
chregu
You mean that dom methods for retrieving Elements will only return 
objects with the object methods defined in the DomElement class?

Is there any way to extend Elements in the tree with own methods? Or is 
the dom structurue only used to handle defined methods?

The method DomDocument::CreateElement() only returns instances of 
DomElement so maybee the Dom structure is not meant to be extended 
regarding elements?

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


Re: [PHP] Splitting Vars from MySQL in PHP

2005-04-30 Thread Rasmus Lerdorf
Richard Lynch wrote:
On Fri, April 29, 2005 4:36 pm, Philip Olson said:
I remember in Perl I used to extract vars from a single fetchrow by
adding
each var name to the beginning (like this). Only this ain'ta workin
:)...
Anyone know the right syntax to do this?
($var1, $var2, $var3)= mysql_fetch_array($result, MYSQL_ASSOC)

list($var1, $var2, $var3) = mysql_fetch_array($result, MYSQL_ASSOC);
http://us4.php.net/manual/en/function.list.php
But remember that list() only works with numerical
arrays so use MYSQL_NUM (or array_values()) in the
above. For associative, extract() can be useful.

I dunno what the documentation is trying to say when it says "list only
works with numerical indices" but it's patently false:
php -a
'apple', 'b'=>'banana', 'c'=>'coconut');
  while (list($k, $v) = each($foo)){
echo "$k: $v\n";
  }
?>
Content-type: text/html
X-Powered-By: PHP/4.3.11
a: apple
b: banana
c: coconut
It has worked just fine with alpha indices since PHP 3.0rc2, at a minimum,
cuz I've been doing it that long.
I dunno who was smoking what that day they typed the documentation :-)
I'm pretty sure it's not an "undocumented feature" that it works.
Richard, this is what the docs are talking about:
  list($a,$b,$c,$d) = array('a','b','c','d');
  echo $a,$b,$c,$d;
vs.
  list($a,$b,$c,$d) = array('a'=>'a','b'=>'b','c'=>'c','d'=>'d');
  echo $a,$b,$c,$d;
In your case you are calling each() which itself returns a numerically 
indexed array.

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


Re: [PHP] Splitting Vars from MySQL in PHP

2005-04-30 Thread Richard Lynch
On Fri, April 29, 2005 4:36 pm, Philip Olson said:
>> > I remember in Perl I used to extract vars from a single fetchrow by
>> adding
>> > each var name to the beginning (like this). Only this ain'ta workin
>> :)...
>> > Anyone know the right syntax to do this?
>> >
>> > ($var1, $var2, $var3)= mysql_fetch_array($result, MYSQL_ASSOC)
>>
>>
>> list($var1, $var2, $var3) = mysql_fetch_array($result, MYSQL_ASSOC);
>> http://us4.php.net/manual/en/function.list.php
>
> But remember that list() only works with numerical
> arrays so use MYSQL_NUM (or array_values()) in the
> above. For associative, extract() can be useful.

I dunno what the documentation is trying to say when it says "list only
works with numerical indices" but it's patently false:

php -a
'apple', 'b'=>'banana', 'c'=>'coconut');
  while (list($k, $v) = each($foo)){
echo "$k: $v\n";
  }
?>
Content-type: text/html
X-Powered-By: PHP/4.3.11

a: apple
b: banana
c: coconut

It has worked just fine with alpha indices since PHP 3.0rc2, at a minimum,
cuz I've been doing it that long.

I dunno who was smoking what that day they typed the documentation :-)

I'm pretty sure it's not an "undocumented feature" that it works.

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



RE: [PHP] Problem query (0T)

2005-04-30 Thread Ryan A
Hi Pablo,
Thanks for replying.

The problem is the images are not coming properly
go here :http://www.jappz.com/prob.gif and you will see the results i am
getting when
i should be getting the images according to the red arrows there.

Thanks,
Ryan



On 5/1/2005 1:56:23 AM, Pablo Gosse ([EMAIL PROTECTED]) wrote:
> 
>
> I have these two tables:
>
>
>
> jappz_guestbook(owner_cno,  sent_datetime,  is_secret,  accepted)
>
> jappz_member_profile(cno, pic_name)
>
>
>
> jappz_guestbook's owner_cno and jappz_member_profile's cno are the same
>
>
>
> what i need to do is select * from jappz_guestbook where owner_cno=x and
>
> also select pic_name from jappz_member_profile where cno=jappz_guestbook.
> cno
>
>
>
> I have been fooling around with something like this:
>
>
>
> SELECT * FROM jappz_guestbook
>
> INNER JOIN jappz_member_profile ON jappz_guestbook.owner_cno =
>
> jappz_member_profile.cno
>
> WHERE jappz_guestbook.owner_cno = jappz_member_profile.cno;
>
>
>
> but its not working, how do i get the pic name from the other table
>
> (jappz_member_profile)?
>
> 
>
>
>
> This should do it for you:
>
>
>
> select g.owner_cno, g.sent_datetime, g.is_secret, g.accepted, p.pic_name
>
> from jappz_guestbook g, jappz_member_profile p
>
> where g.owner_cno = x
>
> and g.owner_cno = p.cno
>
>
>
> HTH,
>
>
>
> Pablo



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 4/29/2005

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



Re: [PHP] Extending Element class in a dom tree?

2005-04-30 Thread Christian Stocker
Hi again

On 4/30/05, Christian Stocker <[EMAIL PROTECTED]> wrote:
> On 4/30/05, Erik Franzén <[EMAIL PROTECTED]> wrote:
> > The DOM implementation i PHP5 allows classes to be extended. Extending
> > the Document class is no problem, but how can I extend the Element class
> > and use it in a DOM tree?
> >
> > DOMDocument::createElement returns a DOMElement object which you cannot
> > extend.
> >
> > Could this be a solution?
> >
> > class MyElement extends DomElement {
> >  function __construct($a_stTagName) {
> >  //has to be called!
> >  parent::__construct($a_stTagName);
> >  }
> >
> >  function myFunction() {
> > // do something
> >  }
> > }
> >
> > $oDom = new DomDocument();
> > $oMyElement = new MyElement('mytag');
> >
> > $oMyElement = $oDom->importNode($oMyElement, true);
> > $oMyElement = $oDom->appendChild($oMyElement);
> 
> Does not work, will never work, just forget about it ;)

Ok, that was not the really right answer ;) Of course it does work.
You can even do stuff on that element, if you use the variable, resp.
reference ($oMyElement) for doing this.

What doesn't work (and I  referred to that) is getting this object
back from the DomDocument, so for example:
$oDom->documentElement will give you the DomElement back and not your
new MyElement.

Hope it's a little bit clearer now
chregu
> 
> chregu
> >
> > Regards
> > /Erik
> >
> > --
> > 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  |  [EMAIL PROTECTED]  |  gnupg-keyid 0x5CE1DECB
> 


-- 
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  |  [EMAIL PROTECTED]  |  gnupg-keyid 0x5CE1DECB

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



[PHP] Problem query (0T)

2005-04-30 Thread Ryan A
Hey,
I know this belongs more on the mysql list, but I'm not a member there and I
dont often have problems queries plus dont have time to join then ask just
this one q and then unsub...so if possible please help :-)

I have these two tables:

jappz_guestbook(owner_cno,  sent_datetime,  is_secret,  accepted)
jappz_member_profile(cno, pic_name)




jappz_guestbook's owner_cno and jappz_member_profile's cno are the same

what i need to do is select * from jappz_guestbook where owner_cno=x and
also select pic_name from jappz_member_profile where cno=jappz_guestbook.cno

I have been fooling around with something like this:


SELECT * FROM jappz_guestbook
INNER JOIN jappz_member_profile ON jappz_guestbook.owner_cno =
jappz_member_profile.cno
 WHERE jappz_guestbook.owner_cno = jappz_member_profile.cno;

but its not working, how do i get the pic name from the other table
(jappz_member_profile)?

Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 4/29/2005

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



Re: [PHP] Extending Element class in a dom tree?

2005-04-30 Thread Christian Stocker
On 4/30/05, Erik Franzén <[EMAIL PROTECTED]> wrote:
> The DOM implementation i PHP5 allows classes to be extended. Extending
> the Document class is no problem, but how can I extend the Element class
> and use it in a DOM tree?
> 
> DOMDocument::createElement returns a DOMElement object which you cannot
> extend.
> 
> Could this be a solution?
> 
> class MyElement extends DomElement {
>  function __construct($a_stTagName) {
>  //has to be called!
>  parent::__construct($a_stTagName);
>  }
> 
>  function myFunction() {
> // do something
>  }
> }
> 
> $oDom = new DomDocument();
> $oMyElement = new MyElement('mytag');
> 
> $oMyElement = $oDom->importNode($oMyElement, true);
> $oMyElement = $oDom->appendChild($oMyElement);

Does not work, will never work, just forget about it ;)

chregu
> 
> Regards
> /Erik
> 
> --
> 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  |  [EMAIL PROTECTED]  |  gnupg-keyid 0x5CE1DECB

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



Re: [PHP] making php go faster

2005-04-30 Thread Rasmus Lerdorf
Sebastian wrote:
i've been doing some reading on optimizing php for fastest performance.
are there any benifts to configure php with:
--enable-inline-optimization
That's the default now, so no, you don't need that.
also running eAccelerator.
these are my current options:
--with-apache=../apache_1.3.33 \
That's a bit of a hassle for you, I bet.  You have to recompile Apache 
to upgrade PHP.  You can get the same performance by using --with-apxs 
to get a shared library and --without-pic to make sure you get a non-pic 
library.  For older PHP versions, --without-pic won't work and you need 
to hack your configure scripts a bit.  Just change all instances of 
-prefer-pic to -prefer-non-pic.  Or use this patch:

  http://www.lerdorf.com/php/non-pic.txt
You can tell if it is working by looking at the compile line as it is 
compiling.  If you see -prefer-non-pic instead of -prefer-pic on each 
line it is working.

--with-mysql=/usr/local/mysql \
--with-xml \
--with-gd \
--with-jpeg-dir=/usr/lib \
--with-png-dir=/usr/lib \
--with-xpm \
--enable-magic-quotes \
--with-pear \
--enable-gd-native-ttf \
--with-zlib
just looking for tips.. that is all.
Beyond the compile-time switches, look at your configuration.  Check 
your variables_order and turn off $_ENV population.  That is, remove the 
'E' from variables_order and look for any $_ENV instances in your code 
and change them to getenv() calls.

Also, remove '.' from your include_path and always use:
 include './foo.inc';
That will save you a system call on every include.  At the same time, 
for the real include_path includes, make sure that most of your includes 
hit the first include path.  If PHP has to scan multiple dirs on every 
include it will be slower than it needs to be.

But most of your gains will come from profiling your actual code using 
either apd or xdebug and optimizing the parts that show up as being the 
bottlenecks.

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


[PHP] making php go faster

2005-04-30 Thread Sebastian
i've been doing some reading on optimizing php for fastest performance.

are there any benifts to configure php with:
--enable-inline-optimization

also running eAccelerator.

these are my current options:
--with-apache=../apache_1.3.33 \
--with-mysql=/usr/local/mysql \
--with-xml \
--with-gd \
--with-jpeg-dir=/usr/lib \
--with-png-dir=/usr/lib \
--with-xpm \
--enable-magic-quotes \
--with-pear \
--enable-gd-native-ttf \
--with-zlib

just looking for tips.. that is all.

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



Re: [PHP] About the mail().

2005-04-30 Thread BAO RuiXian
Hello,
Penghui Wang wrote:
Hi lists:
I am new here. And i know little about php. Sorry ask so stupid
question.
 

snipped ...
 $headers .= "Content-Transfer-Encoding: UTF-8\n";
 $headers .= "Content-Type: text/plain; charset=utf-8\n";
 

snipped ...

åçæé

 

snipped ...
But all the chinese words could change to "". The charset of this
file is UTF-8.
I wonder know how to deal with it. And i am blind with it now. Because
the lack of experience with php.
 

Maybe UTF-8 is not supported by your system. You may try GB2312 to see 
what happends.

Good luck.
Ruixian
Best regards
Wang Penghui

 

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


[PHP] Extending Element class in a dom tree?

2005-04-30 Thread =?ISO-8859-1?Q?Erik_Franz=E9n?=
The DOM implementation i PHP5 allows classes to be extended. Extending 
the Document class is no problem, but how can I extend the Element class 
and use it in a DOM tree?

DOMDocument::createElement returns a DOMElement object which you cannot 
extend.

Could this be a solution?
class MyElement extends DomElement {
function __construct($a_stTagName) {
//has to be called!
parent::__construct($a_stTagName);
}
function myFunction() {
// do something
}
}
$oDom = new DomDocument();
$oMyElement = new MyElement('mytag');
$oMyElement = $oDom->importNode($oMyElement, true);
$oMyElement = $oDom->appendChild($oMyElement);
Regards
/Erik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Templating engines

2005-04-30 Thread rush
> You also need to recognize that you are going to need presentation-layer
> logic.  You simply can't get around that and you shouldn't confuse
> presentation-level logic, which can be quite complex, with the business
> logic behind your application.  I often see people make the mistake of
> trying to separate their PHP code from their HTML which the article you
> referenced hinted at as well.

Yes, I completely agree that business logic should be separated from
presentation logic. Only problem I have is that from there people go on to
conclude that html does not need to be sseparated from presentation logic.
As far as I see It is a very good idea to keep all 3 of them separated.
Bussines logic from presentation logic by proper organization and code
design in php, and presentation logic from html by template engine.

> My main issue with general-purpose templating systems is that they
> always end up inventing a new language.  It may start off as a subset of
> some other language, but eventually it turns into a new language.  In
> Smarty, for example, you now have stuff like:

They have to define markup language, (begin/end of template, free variable
marker), but we are not talking about that.

What usually is the problem is that template systems define its own
programming language, with constrructs for loops, if's and whole other bunch
of stuff to model dynamic behavior. And I agree with you that this makes
diffrence between using such template system, and just php as template
system much, much smaller.

Where I do not agree, is that "fat template" syndrom is common to all
template engines, and that it is inveitable. For instance my TemplateTamer,
is now almost 5 years old, and it never had any sign of becomming
programming language in it self, and it never will. It has a markup language
of only 6 idioms:





{VARIABLE}
{#TRANSLATE}

and there is no single sign of presentation logic inside html template, no
ifs, no loops, no calls to the methods or functions, nada. All presentation
logic is written in php, and in nicely separated logic.php file.

rush
--
http://www.templatetamer.com/
http://www.folderscavenger.com/

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



Re: [PHP] inserting an auto incemented column in table already created

2005-04-30 Thread Marek Kilimajer
Ross Hulford wrote:
Hi,
I have a table with 15 columns or so that has been inherited from an older 
db and am trying to insert an auto increment column  (in mysql) without 
having to number it manually. This is fine when I add new colums via a form 
but the old entries have a null value

Alternatively It has been converted from Excel soif anyone knows how to do 
it that way that would help.I never use Excel so have no clue about it.

R. 

$id = 1;
do {
  mysql_query('update table_name set id = ' . $id++ . ' where id is 
null limit 1');
} while(mysql_affected_rows() > 0);

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


Re: [PHP] only allowing php_flag register_globals off

2005-04-30 Thread Jochem Maas
Karin van den Berg wrote:
Hi,
I am on a quest for a new good webhost and I am currently using a trail
account at a host that seems pretty good, but has one problem. I cannot
turn register_globals off. They don't allow php_flag/php_value in
.htaccess for security reasons but in this case it's causing insecurity
... hi Karen, I notice you're (probably) dutch, that given I might recommend
http://webhosting.nedlinux.nl - always been very good for me.
Marc (the owner) is very generous guy (for instance he runs a php, myql
& gentoo mirrors). as a php programmer I have never been left wanting
for functionality..i.e. you want registers globals off on your site,
you got it.
klein maar fijn. :-)

Thanks a million!
Karin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Regular expressions problem

2005-04-30 Thread Matthew Weier O'Phinney
* Khorosh Irani <[EMAIL PROTECTED]>:
> For example I want to math this stream:
> 123 mm  334
> What is the pattern that math with this stream?

Depends on what regexp function you use, what exactly you want to match,
and whether or not you want to know, after you match, any of the
segments. Rasmus has given you one possible pattern that works with the
ereg functions. If you wanted to use a preg function and wanted to match
3 digits, a space, two m', one or more spaces, and 3 digits, you would
use:

preg_match('/^\d{3} mm\s+\d{3}$/', $string);

But, what it all comes down to is: you need to determine what PATTERN
you need to be able to match. Once you know that, you can write the
regexp.

> On 4/29/05, Malcolm Mill <[EMAIL PROTECTED]> wrote:
> > What is it you want to do?
> > 
> > On 4/29/05, Khorosh Irani <[EMAIL PROTECTED]> wrote:
> > > Hello
> > > I have a question:
> > > What is in the role of space in the regular expressions (POSIX)?

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

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



Fwd: [PHP] Re: Can this code go faster?

2005-04-30 Thread Rory Browne
I sent this about a week ago, but I forgot to 'reply to all', and send
it to the list.
Thanks Rolf for pointing that out to me.

I'm not totally sure, but this might work. I'm too tired to understand
rolf's masks, but:

 wrote:
> [EMAIL PROTECTED] (René Fournier) wrote in
> news:[EMAIL PROTECTED]:
>
> > I need to convert a binary number of arbitrary length to a signed
> > integer.
> > This is how I'm doing it now:
> > CODE
> > 
> > function bin2int ($bin) {
> >  if (substr($bin,0,1) == 1) {
> >   $val = 0 - bindec(substr($bin,1)); // NEGATIVE
> >   } else {
> >   $val = bindec(substr($bin,1)); // POSITIVE
> >   }
> >  }
> >
> > echo bin2int("1101").'';
> > echo bin2int("10001101");
> >
> > OUTPUT
> > 
> > 13
> > -13
> >
> > As you can see, if the most-significant bit is 1, then the rest of the
> > value is negative. If the first bit is 0, then the rest is positive.
>
> If this is what you want then your numeric representation of negative
> numbers is not standard. In that case your function is as good as you can
> get.
>
> This is the standard two's complement representation:
> "1101"  is 13
> "0010"  is -13
> "10001101"  is -115
>
> You specify the most-significant bit as sign bit, and that you can have a
> arbitrary lenght string representing a binary number.
> Then "010" will be different than "10", is that correct?
>
> If you on the other hand know that the string should represent an 8 bit in
> two's complement then this could work:
>
> function bin2int ($bin) {
> $a =  bindec($bin);
>
> $val = ($a | 0x80) ? (0xff00 | $a) : $a;
>
> return $val;
> }
>
> //  or by using if instead of ? and :
> //function bin2int ($bin) {
> //$a =  bindec($bin);
> //  if ( $a | 0x80) {
> //  $val = (0xff00 | $a);
> //  } else {
> //  $val =$a;
> //  }
> //
> //return $val;
> //}
>
> If the string represent a 16 bit number use
> $val = ($ | 0x8000) ? (0x | $a) : $a;
>
> If the string represent a 32 bit number use only bindec
>
> If you still want
>  - a leading 1 to represent a negative number,
>  - and that the string can have arbitrary lenght,
>  - but you want correct two's complement representation
> then we need something different, e.g:
>
> function bin2int ($bin) {
> if (substr($bin,0,1) == 1) {
> // NEGATIVE
> $val = bindec(substr("".$bin,-32));
> } else {
>// POSITIVE
> $val = bindec($bin);
> }
> return $val;
> }
>
> --
> Rolf
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] How to know if php CAN write files on server and WHERE it can?

2005-04-30 Thread Giulio
Thanks Richard for your answer
Il giorno 29/apr/05, alle 10:07 PM, Richard Lynch ha scritto:


If you're just going to delete the files after your script is done, why
copy them somewhere else at all?
Your best bet is to try and use the /tmp dir, or, more properly, what 
PHP
thinks is a "good" place for tmp files.
I developed an application that uploads files on the server calling a 
php page, using post just as a form would be.

to avoid the max_file_size and max_post_size problems, the application 
splits large files on smasller chunks, and calls repeatedly the php 
sending one file chunk at a time, every time waiting for a response 
from the php page and then reposting to it subsequent chunk of data.

So the php script is called more times, one for every chunk, and at the 
last call It's up to the php script to re-construct the entire file 
when all the uploads are finished, and then copy it on a known location 
using ftp.

That's why I would like to move every temp file on another directory, 
since I'm not assured that php temp files will keep existing during all 
the upload process transactions ( or worst, could be php engine itself 
deleting them immediatly when php script execution ends? )

Hope was clear what I'm attempting to do...
regards,
  Giulio
For that matter, using http://php.net/tmpfile may take care of all your
worries on this one.
Cantoberon Multimedia srl
http://www.cantoberon.it
Tel. 06 39737052
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Regular expressions problem

2005-04-30 Thread Rasmus Lerdorf
Khorosh Irani wrote:
For example I want to math this stream:
123 mm  334
What is the pattern that math with this stream?
Thanks
123[[:space:]]+mm[[:space:]]+334
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Regular expressions problem

2005-04-30 Thread Khorosh Irani
For example I want to math this stream:
123 mm  334
What is the pattern that math with this stream?
Thanks

On 4/29/05, Malcolm Mill <[EMAIL PROTECTED]> wrote:
> What is it you want to do?
> 
> On 4/29/05, Khorosh Irani <[EMAIL PROTECTED]> wrote:
> > Hello
> > I have a question:
> > What is in the role of space in the regular expressions (POSIX)?
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

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



Re: [PHP] sessions problems

2005-04-30 Thread Deep
Hi,

   When someone hit the logout page say "logout.php".
You can write the code in that page itself to update
the record. Since the username of that particular user
is stored as a session as long as the user closes the
browser window.

So in the logout page you can add like this.

session_start();
include("connect.php");
$uname=$_SESSION['username'];
$sql = mysql_query("UPDATE users SET online='0'
 WHERE username='$uname'");

//alternatively u can also delete that particular user
from the database instead of updating the online
status to '0'.

I hope this might help you.

Regards
..Deeps..

--- Anasta <[EMAIL PROTECTED]> wrote:
> Anyone know how to update a record on logout, heres
> what i am using for
> login, however there iare no variables for the
> logout page.
> 
> ?
> session_start();  // Start Session
> 
> include("connect.php");
> 
> $username = $_POST['username'];
> $password = $_POST['password'];
> 
>// Register some session variables
>session_register('username');
>$_SESSION['username'] = $username;
>  //sets user online to yes
> $sql = mysql_query("UPDATE users SET online='1'
> WHERE username='$username'
> AND password='$password'");
> 
>if (($username == "admin") And ($password ==
> "admin")) {
> header("location: login_admin.php");
>} else {
> header("location: login_success.php");
>}
> 
> ?>
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

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