[PHP] Re: Header() - POST

2008-09-21 Thread Lupus Michaelis

Michelle Konzack a écrit :


Why using JS?

echo "";

would do the trick...


  No, because it'll not send back the datas in the hide form. And if 
you suggest to pass datas in a HTTP GET, I'll answer XSS in the scope :)


--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



Re: [PHP] Re: geolocation

2008-09-21 Thread Per Jessen
Michelle Konzack wrote:

> Am 2008-09-02 15:05:05, schrieb clive:
>> Hi,
>> 
>> Have any developed a site that determines a users location based on
>> IP address, Im not looking for accurate locations, just what country
>> they are coming from.
>> 
>> I know I could possible get a list of IP blocks allocated to
>> countries or make use of some web server to get the information, I
>> just want to know how others are doing this?
> 
> ...  This does not work for my (136) Servers and Dial-Up, DSL,
> Wifi-APs since I have 64 blocks of 256 IPs which I use  between  Iran,
> Turkey, Germany, france, Morocco, Algeria and other countries...
> Same for Compuserve or ALOL.


So we have a few exceptions to prove the rule. Good. 


/Per Jessen, Zürich


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



[PHP] Re: Browser could not get mp3 files from http site

2008-09-21 Thread Lupus Michaelis

Michelle Konzack a écrit :


It is a Netscape/Mozilla Extension:


  Are you kidding ? This is normalized thing : 



--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



Re: [PHP] Re: Thank you...

2008-09-21 Thread Jochem Maas

Dan Joseph schreef:

Look... Spam the list, but PLEASE do NOT open up this thread again  we
all let it rest 3 weeks ago.


wtf, Michelle just stated that her 4 daughters we're killed in Casablanca
less than a year ago and all you can say is:

"PLEASE do NOT open up this thread again"

HUZZA for empaphy.

@Michelle: did I read your post correctly? what an awful tale, I wouldn't wish 
that
on anyone ... my condolences for your loss.

rgds,
Jochem

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



Re: [PHP] Error message

2008-09-21 Thread Ashley Sheridan
On Sat, 2008-09-20 at 23:48 -0500, Shawn McKenzie wrote:
> Terry J Daichendt wrote:
> > The  error message told it all. Jochem was correct albiet not in the 
> > style I prefer. I had the code in an HTML page after the header. I've 
> > been a programmer for 15 years but I'm brand new to PHP. Anyone can make 
> > a rookie mistake. Thanks everyone for the help. Everyone was partially 
> > correct in assessing the problem.
> > 
> > Terry
> > 
> > 
> > 
> > "Eric Gorr" <[EMAIL PROTECTED]> wrote in message 
> > news:[EMAIL PROTECTED]
> >> On Sep 18, 2008, at 5:52 PM, Terry J Daichendt wrote:
> >>
> >>> I'm pasting this code from the example at php.net and getting these 
> >>> errors. Can anyone determine what I'm doing wrong?
> >>>
> >>>  >>> // page1.php
> >>>
> >>> session_start();
> >>>
> >>> echo 'Welcome to page #1';
> >>>
> >>> $_SESSION['favcolor'] = 'green';
> >>> $_SESSION['animal']   = 'cat';
> >>> $_SESSION['time'] = time();
> >>>
> >>> // Works if session cookie was accepted
> >>> echo 'page 2';
> >>>
> >>> // Or maybe pass along the session id, if needed
> >>> echo 'page 2';
> >>> ?>
> >>
> >> Well, this is weird. When I copied your text and tried it myself, the 
> >> error I got was:
> >>
> >> Parse error: syntax error, unexpected T_STRING in /Users/ericgorr/ 
> >> Sites/page1.php on line 9
> >>
> >> Now, of course, there is nothing visibly wrong with line 9 
> >> ($_SESSION['animal'] = 'cat';). But, when I had my text editor show 
> >> invisible characters, there were some on that line and line 10.
> >>
> >> Do you have a text editor that can show invisible characters?
> >>
> >> On the Mac, the one I really like (and is free) is TextWrangler 
> >> (http://www.barebones.com/products/textwrangler/ ) and has this 
> >> capability. This may be part of your problem. Once I  got rid of the 
> >> invisible characters, the example worked without any  problems.
> >>
> >> Also, are you certain there are no spaces or anything (even invisible 
> >> characters) before  >>
> >> Whenever I've gotten a similar error in the past, that was nearly  
> >> always the problem. You are welcome to compress the text file and 
> >> send  it to me directly so I can see exactly what it contains.
> >>
> > 
> Since you're a PHP rookie, to sum it up:  there can not be any output 
> before you start a session.
> 
> When PHP interprets a file (include or otherwise) it considers anything 
> before  whatever).  So if you have whitespace before the  interpreter outputs it, thus the output before the session_start() error.
> 
> -Shawn
> 
It's an easy mistake to make, not just reserved for rookies ;) I had a
similar problem streaming video to the browser, and found that for some
reason all the video files were larger than the original and wouldn't
play. Turned out (after some very strong words aimed in the general
direction of my laptop) that I'd included a header file which was
outputting some HTML!


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: render html

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 08:17 +0200, Lupus Michaelis wrote:
> Michelle Konzack a écrit :
> >> $body = "helloierhellohello";
> > ^
> > Should be 
> 
>Definitely no :
> 
> 
> 
> 
>Or maybe for buggy browsers ?
> 
> -- 
> Mickaël Wolff aka Lupus Michaelis
> http://lupusmic.org
> 
The space is completely optional, but I don't think it has anything to
do with the form that the tag is using. By default, browser will just
hide any tags they don't understand. I think that what is happening is
that the < and > have been escaped out. Try viewing the source to the
output page. If you see 
then your CMS is escaping the chevrons and interpreting them as literal text rather than code. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: Header() - POST

2008-09-21 Thread Maciek Sokolewicz

Lupus Michaelis wrote:

Michelle Konzack a écrit :


Why using JS?

echo "";

would do the trick...


  No, because it'll not send back the datas in the hide form. And if you 
suggest to pass datas in a HTTP GET, I'll answer XSS in the scope :)


Your xss answer is moot. XSS attacks can (almost) just as easily be 
performed via POST as they can via GET.


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



[PHP] Public in Classes

2008-09-21 Thread Ben Stones
Hi,

Just started with object oriented programming and glad I have come across
it, just need a few things clearing up.

When I make a variable or method public, does this mean that it can be used
outside of classes, for instance in other classes or as well as
instantiating classes? So if I made it private, it wouldn't be able to be
instantiated or extended in other classes, am I right?

I have never added public when I am creating methods so I presume its
already set as default if you don't add it?

Hope you can understand my question.

Cheers.


Re: [PHP] Public in Classes

2008-09-21 Thread Ólafur Waage
Here you go.

http://talks.php.net/show/php5_ca/4

Ólafur Waage
[EMAIL PROTECTED]

2008/9/21 Ben Stones <[EMAIL PROTECTED]>:
> Hi,
>
> Just started with object oriented programming and glad I have come across
> it, just need a few things clearing up.
>
> When I make a variable or method public, does this mean that it can be used
> outside of classes, for instance in other classes or as well as
> instantiating classes? So if I made it private, it wouldn't be able to be
> instantiated or extended in other classes, am I right?
>
> I have never added public when I am creating methods so I presume its
> already set as default if you don't add it?
>
> Hope you can understand my question.
>
> Cheers.
>

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



Re: [PHP] Public in Classes

2008-09-21 Thread Jochem Maas

Ben Stones schreef:

Hi,

Just started with object oriented programming and glad I have come across
it, just need a few things clearing up.

When I make a variable or method public, does this mean that it can be used
outside of classes, for instance in other classes or as well as
instantiating classes? So if I made it private, it wouldn't be able to be
instantiated or extended in other classes, am I right?

I have never added public when I am creating methods so I presume its
already set as default if you don't add it?

Hope you can understand my question.


yes, and the answer nearly always lies in trying it out, run this
(and if/when you hit a fatal error, comment the offending line and run it 
again):

a, "\n";
echo $this->b, "\n";
echo $this->c, "\n";
echo $this->d, "\n";
}   
}

class TestTwo
{
function tryme()
{
echo $this->a, "\n";
echo $this->b, "\n";
echo $this->c, "\n";
echo $this->d, "\n";
}
}

$t1 = new Test;
$t2 = new TestTwo;

$t1->tryme();

echo $t1->a, "\n";
echo $t1->b, "\n";
echo $t1->c, "\n";
echo $t1->d, "\n";

$t2->tryme();

echo $t2->a, "\n";
echo $t2->b, "\n";
echo $t2->c, "\n";
echo $t2->d, "\n";

?>


Cheers.




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



[PHP] Re: Browser could not get mp3 files from http site

2008-09-21 Thread tedd

At 5:29 AM +0200 9/20/08, Michelle Konzack blubbered forth:

Am 2008-09-12 18:14:23, schrieb hce:

 > 


Whoa dude -- not only is putting width and height in a tag not good 
practice, it's not necessary.


Think again.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: geolocation

2008-09-21 Thread Michael Kubler

This is a slightly OT but along the same lines.
I've found that the main way that ISP's and large content hosts control 
who can access their site and from where is by using BGP routing (Border 
Gateway Protocol), and other advanced things that are beyond the control 
of the majority of webserver admins.


It allows them to change the routing that information, which is for 
example, how your ISPs servers know where to forward your data packet to 
next.
However with some funky router, you can get 'magic' IP addresses, like 
Akami and most ISP's DNS server have.
E.g, You will request to access data on a certain Akami IP address, 
instead and taking >200ms to hit some server on the other side of the 
world, and come back, it could go to a server sitting in your nearest 
capital city in <50ms, which is great for video content, and AJAX calls. 
The thing is, someone in another country could request the same data 
from the same IP, and the request will automatically be sent to a 
completely different server, most likely that of one in their capital 
city (or at least the closest place that has an Akami server containing 
the required info).


Above is just another example of how you can't purely rely on IP 
addresses, although it is the easiest thing from a webservers PoV, and 
usually right >90% of the time (as far as I am aware, although haven't 
tested, nor have any good ways of testing besides Traceroute).


Michael Kubler
*G*rey *P*hoenix *P*roductions 



Michelle Konzack wrote:

Am 2008-09-02 09:08:50, schrieb Schiz0:
  

I use the GeoIP libraries. They work perfectly. YOu just need to
install the pecl-GeoIP package, then make sure you keep the binary
database up-to-date (from www.maxmind.com).

http://php.net/geoip



How does ths work with Compuserver or ALOL or even my IP's?

We are using dynamicaly allocated IPs arround teh world...

AOL in Germany is using IPs from the USA (ARIN) I use IPs  from  Germany
(RIPE) but they are dynamicaly allocated  in  Iran,  Turkey,  Gemany  or
other Countries where I have POPs


[PHP] Re: Browser could not get mp3 files from http site

2008-09-21 Thread tedd

At 5:35 AM +0200 9/20/08, Michelle Konzack wrote:

Am 2008-09-14 13:54:01, schrieb hce:

 I've tried the object tag as Ash suggested, the object tag crashed
 firefox):

 (1) If I open following audio.html directly from "Open File"
 file:///home/webserver/audio.html, the embed tag works just fine, the
 audio can play. The /home/webserver is the directory where all
 applications audio.php and audio.mp3 are stored.

 (2) If I open from http://www.myweb.com/audio.php, the audio.mp3 does
 not download to firefox. Nothing is played.


 > 

 

 > 

It should be:







No, the autostart attribute is fine, but should be set to true.





The above will work for Netscape -- but for other browser (i.e., 
IE's, Opera, el all) use:






Also you can add the attribute of "hidden=true" to both.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: Header() - POST

2008-09-21 Thread Lupus Michaelis

Maciek Sokolewicz a écrit :

Your xss answer is moot. XSS attacks can (almost) just as easily be 
performed via POST as they can via GET.


  No, because you can't click on a link that make a post. Maybe on 
unsecured browser that allows Xhr (and a POST so) on every sites on the 
Internet.


--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



Re: [PHP] Re: geolocation

2008-09-21 Thread tedd

At 9:56 AM +0200 9/21/08, Per Jessen wrote:

Michelle Konzack wrote:


 Am 2008-09-02 15:05:05, schrieb clive:

 Hi,

 Have any developed a site that determines a users location based on
 IP address, Im not looking for accurate locations, just what country
 they are coming from.

 I know I could possible get a list of IP blocks allocated to
 countries or make use of some web server to get the information, I
 just want to know how others are doing this?


 ...  This does not work for my (136) Servers and Dial-Up, DSL,
 Wifi-APs since I have 64 blocks of 256 IPs which I use  between  Iran,
 Turkey, Germany, france, Morocco, Algeria and other countries...
 Same for Compuserve or ALOL.



So we have a few exceptions to prove the rule. Good.

/Per Jessen, Zürich


I used to have a demo of that, but my server 
crashed and with it went the database.


It was one of those stupid things of having 
everything backed up but the database.


Too bad, I had it running for a couple of years 
gathering "correct" or "not correct" input from 
visitors.


Just another of my lame attempts to do something of worth.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: Header() - POST

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 14:29 +0200, Lupus Michaelis wrote:
> Maciek Sokolewicz a écrit :
> 
> > Your xss answer is moot. XSS attacks can (almost) just as easily be 
> > performed via POST as they can via GET.
> 
>No, because you can't click on a link that make a post. Maybe on 
> unsecured browser that allows Xhr (and a POST so) on every sites on the 
> Internet.
> 
> -- 
> Mickaël Wolff aka Lupus Michaelis
> http://lupusmic.org
> 
No, but it is very simple to spoof a POST request. It's not unknown for
people to tamper with the outgoing POST request sent from the browser as
well.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Public in Classes

2008-09-21 Thread Ben Stones
Hi,

I have this piece of code that I have created:

class userQueries {
public function numberUsers() {
$get_users=mysql_query("SELECT * FROM `users` WHERE `online` <
NOW()") or exit("../includes/error.php");
}
}

class usersOnline extends userQueries {
public function usersOnline() {
echo mysql_num_rows($this->numberUsers);
}
}

How do I request specific methods in other classes? The error that comes up
is:

mysql_num_rows(): supplied argument is not a valid MySQL result resource

which is somewhat expected as $this only refers to the variables and there
are no variables called numberUsers.

Cheers!

2008/9/21 Jochem Maas <[EMAIL PROTECTED]>

> Ben Stones schreef:
>
>  Hi,
>>
>> Just started with object oriented programming and glad I have come across
>> it, just need a few things clearing up.
>>
>> When I make a variable or method public, does this mean that it can be
>> used
>> outside of classes, for instance in other classes or as well as
>> instantiating classes? So if I made it private, it wouldn't be able to be
>> instantiated or extended in other classes, am I right?
>>
>> I have never added public when I am creating methods so I presume its
>> already set as default if you don't add it?
>>
>> Hope you can understand my question.
>>
>
> yes, and the answer nearly always lies in trying it out, run this
> (and if/when you hit a fatal error, comment the offending line and run it
> again):
>
> 
> class Test
> {
>public  $a = "A";
>protected   $b = "B";
>private $c = "C";
>
>function tryme()
>{
>echo $this->a, "\n";
>echo $this->b, "\n";
>echo $this->c, "\n";
>echo $this->d, "\n";
>}
> }
>
> class TestTwo
> {
>function tryme()
>{
>echo $this->a, "\n";
>echo $this->b, "\n";
>echo $this->c, "\n";
>echo $this->d, "\n";
>}
> }
>
> $t1 = new Test;
> $t2 = new TestTwo;
>
> $t1->tryme();
>
> echo $t1->a, "\n";
> echo $t1->b, "\n";
> echo $t1->c, "\n";
> echo $t1->d, "\n";
>
> $t2->tryme();
>
> echo $t2->a, "\n";
> echo $t2->b, "\n";
> echo $t2->c, "\n";
> echo $t2->d, "\n";
>
> ?>
>
>  Cheers.
>>
>>
>


Re: [PHP] Public in Classes

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 12:24 +0100, Ben Stones wrote:
> Hi,
> 
> Just started with object oriented programming and glad I have come across
> it, just need a few things clearing up.
> 
> When I make a variable or method public, does this mean that it can be used
> outside of classes, for instance in other classes or as well as
> instantiating classes? So if I made it private, it wouldn't be able to be
> instantiated or extended in other classes, am I right?
> 
> I have never added public when I am creating methods so I presume its
> already set as default if you don't add it?
> 
> Hope you can understand my question.
> 
> Cheers.
As far as I understand it, public methods of a class let you use it on
instances of that class, but private methods can only be called from
within the class itself, if that makes any sense?


Ash
www.ashleysheridan.co.uk


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



[PHP] was [PHP] Re: render html

2008-09-21 Thread tedd

At 8:17 AM +0200 9/21/08, Lupus Michaelis wrote:

Michelle Konzack a écrit :

$body = "helloierhellohello";

^
Should be 


  Definitely no :




  Or maybe for buggy browsers ?



 >>>  Definitely no ???  <<<

I've always found this confusing.

If one uses a  tag, you'll get a single line 
break and everything validates per W3C -- as long 
as you're not using a xml doctype.


If you use  or  tags, then both will 
generate a line break, but both will also 
generate W3C shorttag validation warnings.


If you use  , then you'll get a single 
line break, but that will also generate a W3C 
validation error, which is worse than a warning.


However, if you read this:



One would think that using  or  
tags are fine, but they're not -- and  isn't 
even mentioned.


So considering all the different ways one can do 
this, the one that's the least problematic is 
.


Of course, one could use:


   


and side-step the entire issue.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: Browser could not get mp3 files from http site

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 08:29 -0400, tedd wrote:
> At 5:35 AM +0200 9/20/08, Michelle Konzack wrote:
> >Am 2008-09-14 13:54:01, schrieb hce:
> >>  I've tried the object tag as Ash suggested, the object tag crashed
> >>  firefox):
> >>
> >>  (1) If I open following audio.html directly from "Open File"
> >>  file:///home/webserver/audio.html, the embed tag works just fine, the
> >>  audio can play. The /home/webserver is the directory where all
> >>  applications audio.php and audio.mp3 are stored.
> >>
> >>  (2) If I open from http://www.myweb.com/audio.php, the audio.mp3 does
> >>  not download to firefox. Nothing is played.
> >>
> >  > 
> >>  
> >  > 
> >
> >It should be:
> >
> >
> >
> >
> >
> 
> No, the autostart attribute is fine, but should be set to true.
> 
> 
> 
> 
> 
> The above will work for Netscape -- but for other browser (i.e., 
> IE's, Opera, el all) use:
> 
> 
> 
> 
> 
> Also you can add the attribute of "hidden=true" to both.
> 
> Cheers,
> 
> tedd
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
The bgsound tag is not in HTML 4 or XHTML 1 specifications, and I
wouldn't recommend its use, ever. Like I've said before on this thread,
the way to do this is with an embed tag inside an object tag, pretty
much the same way you'd do it for a Flash movie.









http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"; 
type="application/x-mplayer2"/>


I've kept the width and height in here, as the player displays the
controls for the clip, but you can just omit the parts you don't want.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] was [PHP] Re: render html

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 09:16 -0400, tedd wrote:
> At 8:17 AM +0200 9/21/08, Lupus Michaelis wrote:
> >Michelle Konzack a écrit :
> >>>$body = "helloierhellohello";
> >> ^
> >> Should be 
> >
> >   Definitely no :
> >
> >
> >
> >
> >   Or maybe for buggy browsers ?
> 
> 
>   >>>  Definitely no ???  <<<
> 
> I've always found this confusing.
> 
> If one uses a  tag, you'll get a single line 
> break and everything validates per W3C -- as long 
> as you're not using a xml doctype.
> 
> If you use  or  tags, then both will 
> generate a line break, but both will also 
> generate W3C shorttag validation warnings.
> 
> If you use  , then you'll get a single 
> line break, but that will also generate a W3C 
> validation error, which is worse than a warning.
> 
> However, if you read this:
> 
> 
> 
> One would think that using  or  
> tags are fine, but they're not -- and  isn't 
> even mentioned.
> 
> So considering all the different ways one can do 
> this, the one that's the least problematic is 
> .
> 
> Of course, one could use:
> 
> 
> 
> 
> 
> and side-step the entire issue.
> 
> Cheers,
> 
> tedd
> 
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
You will only get the errors you describe if you've messed up the
document type declaration. I always use this one for my sites:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

and it never gives shorttag warnings or errors.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Error message

2008-09-21 Thread tedd

At 10:26 AM +0100 9/21/08, Ashley Sheridan wrote:


It's an easy mistake to make, not just reserved for rookies ;) I had a
similar problem


Me too, I think we've all been bitten by that.

The point is simply don't send anything to the browser before "if you're going to be using session_start();


You can do this:
start of document
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Calling methods from others classes

2008-09-21 Thread Ben Stones
Hi,

I have this piece of code that I have created:

class userQueries {
public function numberUsers() {
$get_users=mysql_query("SELECT * FROM `users` WHERE `online` <
NOW()") or exit("../includes/error.php");
}
}

class usersOnline extends userQueries {
public function usersOnline() {
echo mysql_num_rows($this->numberUsers);
}
}

How do I request specific methods in other classes? The error that comes up
is:

mysql_num_rows(): supplied argument is not a valid MySQL result resource

which is somewhat expected as $this only refers to the variables and there
are no variables called numberUsers.

Cheers!


Re: [PHP] was [PHP] Re: render html

2008-09-21 Thread tedd

At 2:27 PM +0100 9/21/08, Ashley Sheridan wrote:


You will only get the errors you describe if you've messed up the
document type declaration.


Ash, I know you don't mean to be insulting, but I didn't "mess up" my 
DOCTYPE -- give me some credit for knowing a little about this.




 I always use this one for my sites:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

and it never gives shorttag warnings or errors.



Yes, IF you choose to use your DOCTYPE -- but they are other 
perfectly valid DOCTYPES for people to use -- see here:


http://alistapart.com/stories/doctype

My demo is here:

http://www.webbytedd.com//shorttag/

There is nothing wrong with what I reported.

Now, if you disagree, then prove me wrong.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: Browser could not get mp3 files from http site

2008-09-21 Thread tedd

At 2:24 PM +0100 9/21/08, Ashley Sheridan wrote:


The bgsound tag is not in HTML 4 or XHTML 1 specifications, and I
wouldn't recommend its use, ever.



I didn't say it was, nor did I recommend it -- I only pointed out the 
embed tag was for Netscape and bgsound tag was used for other 
browsers.



Like I've said before on this thread,
the way to do this is with an embed tag inside an object tag, pretty
much the same way you'd do it for a Flash movie.


With that I agree as I have done here:

http://webbytedd.com/aa/assorted-captcha/

The audio CAPTCHA delivers the mp3 file that's assembled in the background.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: Calling methods from others classes

2008-09-21 Thread Colin Guthrie

Ben Stones wrote:

Hi,

I have this piece of code that I have created:

class userQueries {
public function numberUsers() {
$get_users=mysql_query("SELECT * FROM `users` WHERE `online` <
NOW()") or exit("../includes/error.php");
}
}

class usersOnline extends userQueries {
public function usersOnline() {
echo mysql_num_rows($this->numberUsers);
}
}

How do I request specific methods in other classes? The error that comes up
is:

mysql_num_rows(): supplied argument is not a valid MySQL result resource

which is somewhat expected as $this only refers to the variables and there
are no variables called numberUsers.


You forgot to "return $get_users;" from your numberUsers() function

Also in your code you will never free the result nicely which is bad.

In order to count the users, you should possibly also use SELECT 
COUNT(*) FROM... and then use the single value that is returned as this 
will be more efficient (does not require all the data to be fetched and 
sent).


Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] was [PHP] Re: render html

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 09:55 -0400, tedd wrote:
> At 2:27 PM +0100 9/21/08, Ashley Sheridan wrote:
> >
> >You will only get the errors you describe if you've messed up the
> >document type declaration.
> 
> Ash, I know you don't mean to be insulting, but I didn't "mess up" my 
> DOCTYPE -- give me some credit for knowing a little about this.
> 
> 
> >  I always use this one for my sites:
> > >"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> >
> >and it never gives shorttag warnings or errors.
> 
> 
> Yes, IF you choose to use your DOCTYPE -- but they are other 
> perfectly valid DOCTYPES for people to use -- see here:
> 
> http://alistapart.com/stories/doctype
> 
> My demo is here:
> 
> http://www.webbytedd.com//shorttag/
> 
> There is nothing wrong with what I reported.
> 
> Now, if you disagree, then prove me wrong.
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
I'm sorry, I didn't mean to be insulting! I do agree that you will get
those errors if you choose the wrong doctype, and by wrong I mean one
that is mismatched with the types of tag you try to use. I'm guessing
that the doctype declaration was not the issue in this problem though.
The original poster mentioned that is was output from a CMS. 9 times out
of 10, problems like this can be attributed to the CMS they are output
from.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: Browser could not get mp3 files from http site

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 10:02 -0400, tedd wrote:
> At 2:24 PM +0100 9/21/08, Ashley Sheridan wrote:
> >
> >The bgsound tag is not in HTML 4 or XHTML 1 specifications, and I
> >wouldn't recommend its use, ever.
> 
> 
> I didn't say it was, nor did I recommend it -- I only pointed out the 
> embed tag was for Netscape and bgsound tag was used for other 
> browsers.
> 
> >Like I've said before on this thread,
> >the way to do this is with an embed tag inside an object tag, pretty
> >much the same way you'd do it for a Flash movie.
> 
> With that I agree as I have done here:
> 
> http://webbytedd.com/aa/assorted-captcha/
> 
> The audio CAPTCHA delivers the mp3 file that's assembled in the background.
> 
> Cheers,
> 
> tedd
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
But your audio is delivered through Flash, which adds another layer
where things can go wrong. Playing a background sound shouldn't require
a specific plugin to work, it should be possible to make it play with
the generic audio plugin that the browser has access to. Based on hits
to my own site, about 30% are made by browsers that do not have the
Flash plugin or have it disabled. Now, this may be thrown out a little
by people visiting with Chrome, as I've yet to test my tracker there,
but it's still quite a high figure. I think you would be hard pressed to
find any browser without a plugin to play an mp3 file.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] was [PHP] Re: render html

2008-09-21 Thread tedd

At 4:06 PM +0100 9/21/08, Ashley Sheridan wrote:


I'm sorry, I didn't mean to be insulting! I do agree that you will get
those errors if you choose the wrong doctype, and by wrong I mean one
that is mismatched with the types of tag you try to use.


Maybe I need to learn something here.

Are you saying then that if I want to use a  tag, then I can't use:

http://www.w3.org/TR/html4/loose.dtd";>

So, instead I must use the  tag?

If so, interesting.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: Browser could not get mp3 files from http site

2008-09-21 Thread tedd

At 4:11 PM +0100 9/21/08, Ashley Sheridan wrote:

On Sun, 2008-09-21 at 10:02 -0400, tedd wrote:

 At 2:24 PM +0100 9/21/08, Ashley Sheridan wrote:
 >
 >The bgsound tag is not in HTML 4 or XHTML 1 specifications, and I
 >wouldn't recommend its use, ever.


 I didn't say it was, nor did I recommend it -- I only pointed out the
 embed tag was for Netscape and bgsound tag was used for other
 browsers.

 >Like I've said before on this thread,
 >the way to do this is with an embed tag inside an object tag, pretty
 >much the same way you'd do it for a Flash movie.

 With that I agree as I have done here:

 http://webbytedd.com/aa/assorted-captcha/

 The audio CAPTCHA delivers the mp3 file that's assembled in the background.

 Cheers,

 tedd
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com


But your audio is delivered through Flash, which adds another layer
where things can go wrong. Playing a background sound shouldn't require
a specific plugin to work, it should be possible to make it play with
the generic audio plugin that the browser has access to. Based on hits
to my own site, about 30% are made by browsers that do not have the
Flash plugin or have it disabled. Now, this may be thrown out a little
by people visiting with Chrome, as I've yet to test my tracker there,
but it's still quite a high figure. I think you would be hard pressed to
find any browser without a plugin to play an mp3 file.


Okay.

On one hand, I say that using  and  can deliver mp3 
files, as shown here:


http://sperling.com/examples/captcha/

-- and it does work.

On the other hand, I say that I can deliver mp3 sound files via Flash 
as shown here:


http://webbytedd.com/aa/assorted-captcha/

-- and it does work.

But, you find fault with both.

So, what and where's your example?

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] [Fwd: Problem of enable ( show ) Personal MailBox Quota Usage]

2008-09-21 Thread edwardspl
Dear All,

Would you mind to help more ?

Thanks !

Edward.
 Original Message 
Subject:Problem of enable ( show ) Personal MailBox Quota Usage
Date:   Sat, 06 Sep 2008 21:39:50 +0800
From:   [EMAIL PROTECTED]
To: IMP <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED] <[EMAIL PROTECTED]>



Dear All,

Mine is FC6 System and enable build-in quota function ( Linux command ) :

I have ever visit the document as the following :
http://wiki.horde.org/QuotaHack?referrer=HowTo#

And then, modify the following config files :

For /horde/imp/config/servers.php :

$servers['cyrus'] = array(
   'name' => 'Mail Server',
   'server' => 'xxx.xxx.xxx.xxx',
   'hordeauth' => false,
   'protocol' => 'imap/notls',
   'port' => 143,
   'maildomain' => 'xxx.xxx.xx',
   'smtphost' => 'xxx.xxx.xxx.xxx',
   'smtpport' => 25,
   'realm' => '',
   'preferred' => '',
   'quota' => array(
   'driver' => 'command',
   'params' => array(
   'quota_path' => '/usr/bin/quota',
'grep_path'  => '/bin/grep'
   )
 ),
);

For /horde/imp/lib/Quota/command.php :

class IMP_Quota_command extends IMP_Quota {

   /**
* Constructor
*
* @param array $params  Hash containing connection parameters.
*/
   function IMP_Quota_command($params = array())
   {
   $this->_params = array(
   'quota_path' => 'quota',
   'grep_path'  => 'grep',
   'partition'  => null
   );

   $this->_params = array_merge($this->_params, $params);
   }

For Quota setting :

[EMAIL PROTECTED] home]$ ls -l -h aquota*
-rw-r--r-- 1 root root 10K Sep  5 23:50 aquota.group
-rw-r--r-- 1 root root 10K Sep  5 23:50 aquota.user
[EMAIL PROTECTED] home]$

BUT the result is problem :
http://www.ita.org.mo/~edward/webmail/quota_problem.jpg

Thanks for your help !

Edward.




Re: [PHP] was [PHP] Re: render html

2008-09-21 Thread b

tedd wrote:

At 8:17 AM +0200 9/21/08, Lupus Michaelis wrote:

Michelle Konzack a écrit :

$body = "helloierhellohello";

^
Should be 


  Definitely no :




  Or maybe for buggy browsers ?



 >>>  Definitely no ???  <<<

I've always found this confusing.



I think this page explains the roots of the confusion very well:

Empty elements in SGML, HTML, XML, and XHTML
http://www.cs.tut.fi/~jkorpela/html/empty.html


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



[PHP] OOP - Calling methods from classes that are inheriting?

2008-09-21 Thread Ben Stones
Hi,

How do I call methods from classes that are inherited? I want to add a
mysql_num_rows() function to a second class that is an addon to a MySQL
query in the first class. The first class will be used in several different
classes for different parts of the site so I don't want to directly add the
num_rows to the first class method as the query won't just be used for this
function.

Hope I have made myself as clear as possible!

Cheers!


Re: [PHP] Passing variables between pages

2008-09-21 Thread Nathan Rixham

tedd wrote:

At 8:31 PM +0100 9/20/08, Nathan Rixham wrote:

Am I missing something here..?


Yes. You are missing the point.

This is exactly the same; you don't need $_SESSION's in this case 
because all you're doing is POST'ing the data every time..


And that's what you are missing -- it's not continued POSTing!

Follow closely,

http://www.webbytedd.com/bb/php-run-php/

While I'm using a Submit Post button to go from this script to the next 
script I am NOT sending any data via the POST. To prove it, use FF and 
see what's passed.


All data is passed/available to the next script because the next script 
is an include.


For example, this parent script has the variable:

$test = "This is a test";

And the next script (either a.php, or b.php, or c.php -- your choice) 
simply echo's $test.


Please note, the contents of the variable $test was NOT passed via a 
POST, but rather retained because the parent script included the next 
script.


Do you see the difference?

Here's another example presenting the same technique in a different way:

http://www.webbytedd.com/bb/tedd/index.php

All the variables remain intact AND there is nothing in the REQUEST, 
SESSION nor COOKIE arrays.


I have a hard time trying to get people to understand this simple 
concept. It's so simple that people often overlook how powerful it is.


For example, with a little forethought, I think there isn't a script 
I've written that I could not have used this technique and dispensed 
with SESSION's all together. That's pretty powerful, don't you think?


Do you understand what I'm doing now?


no ill-intention meant.


That's Okay -- I realize you meant no ill-intent.

Neither do I -- I realize that occasionally simple concepts are hard for 
you smarter guys to get because you have to dumb down a lot to consider 
what we're talking about. But I think it's an interesting concept to 
consider.


Cheers,

tedd




at it's simplest is this correct..?

index.php


anotherscript.php


I'm struggling to follow here I thinks! lol

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



[PHP] Re: OOP - Calling methods from classes that are inheriting?

2008-09-21 Thread Lupus Michaelis

Ben Stones a écrit :

Hope I have made myself as clear as possible!


  I did'nt understand what you mean, but I guess you're seeking for the 
parent keyword. Read again the PHP manual about OOP.


--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



Re: [PHP] Public in Classes

2008-09-21 Thread Jochem Maas

Ben Stones schreef:

Hi,

I have this piece of code that I have created:

class userQueries {
public function numberUsers() {
$get_users=mysql_query("SELECT * FROM `users` WHERE `online` <
NOW()") or exit("../includes/error.php");
}
}

class usersOnline extends userQueries {
public function usersOnline() {
echo mysql_num_rows($this->numberUsers);
}
}

How do I request specific methods in other classes? The error that comes up
is:

mysql_num_rows(): supplied argument is not a valid MySQL result resource

which is somewhat expected as $this only refers to the variables and there
are no variables called numberUsers.

Cheers!


1. don't double post, a bit of patience is in order.
2. this has nothing to do with public/private methods.
3. use braces to call a method ... methods are not variables.
4. you can't pass an include file to exit and expect it to run that file
(it will just echo out the string you gave it)
5. the 'foo() or exit()' error handling strategy is rather crap (imho)
... you could do it gracefully instead of just killing the script.
6. I doubt whether "`online` < NOW()" will give you the result your looking for

class userQueries {
public function numberUsers($where = "1") {
$r = mysql_query("SELECT * FROM `users` WHERE $where") or 
$this->killMe();
$n = mysql_num_rows($r);
mysql_free_result($r);

return $n;
}

protected function killMe()
{
include "../includes/error.php";
exit(1);
}
}

class usersOnline extends userQueries {
public function usersOnline() {
return $this->numberUsers("`online` < NOW()");
}
}



2008/9/21 Jochem Maas <[EMAIL PROTECTED]>


Ben Stones schreef:

 Hi,

Just started with object oriented programming and glad I have come across
it, just need a few things clearing up.

When I make a variable or method public, does this mean that it can be
used
outside of classes, for instance in other classes or as well as
instantiating classes? So if I made it private, it wouldn't be able to be
instantiated or extended in other classes, am I right?

I have never added public when I am creating methods so I presume its
already set as default if you don't add it?

Hope you can understand my question.


yes, and the answer nearly always lies in trying it out, run this
(and if/when you hit a fatal error, comment the offending line and run it
again):

a, "\n";
   echo $this->b, "\n";
   echo $this->c, "\n";
   echo $this->d, "\n";
   }
}

class TestTwo
{
   function tryme()
   {
   echo $this->a, "\n";
   echo $this->b, "\n";
   echo $this->c, "\n";
   echo $this->d, "\n";
   }
}

$t1 = new Test;
$t2 = new TestTwo;

$t1->tryme();

echo $t1->a, "\n";
echo $t1->b, "\n";
echo $t1->c, "\n";
echo $t1->d, "\n";

$t2->tryme();

echo $t2->a, "\n";
echo $t2->b, "\n";
echo $t2->c, "\n";
echo $t2->d, "\n";

?>

 Cheers.







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



[PHP] Re: Problem with sorting

2008-09-21 Thread Nathan Rixham

Michelle Konzack wrote:


*   Do not Cc: me, because I READ THIS LIST, if I write here   *
*Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*


Hello,

I have a Database of µChips and I want to sort it "case insensitive" and
in "numerical order" in the same time.

Since the name of the µChips are mostly  [:alpha:][:num:]*  I am running
into problems since the first one can have 0-5 characters.

So, what I need is to get the substring (leading  [:alpha:])  unify  and
sort it and not use a loop over it, and get all chips from the category.
Now from each category cut the  [:alpha:],  the sort numerical and after
this re-add the cuted [:alpha:].

H, first I am searching a solution the get the  "Categories",  which
mean, the leading [:alpha:] AND, if numerical "categories" exist,  there
first number.

The listing should be something like

3
8
AW
AT
DS
ICL
LM
MAX
W

Does somone has a solution for it? (I do not like to reinvent the wheel)


Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant




if it's from a database could you "order by substring(columnname, 2,1)" 
or similar..?


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



Re: [PHP] Re: OOP - Calling methods from classes that are inheriting?

2008-09-21 Thread Ben Stones
Hi, maybe if I post below what I'm trying to do it may make more sense:

class myClass {
public function func() {
$hello = "Yay!!";
}
}

class otherClass extends myClass {
public function otherFunc() {
echo parent::func();
}
}

$class=new otherClass();
echo $class->otherFunc();

Nothing outputs. Sorry I am slightly new to OOP so there may be a simple fix
for this?

2008/9/21 Lupus Michaelis <[EMAIL PROTECTED]<[EMAIL PROTECTED]>
>

> Ben Stones a écrit :
>
>> Hope I have made myself as clear as possible!
>>
>
>  I did'nt understand what you mean, but I guess you're seeking for the
> parent keyword. Read again the PHP manual about OOP.
>
> --
> Mickaël Wolff aka Lupus Michaelis
> http://lupusmic.org
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: Browser could not get mp3 files from http site

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 11:26 -0400, tedd wrote:
> At 4:11 PM +0100 9/21/08, Ashley Sheridan wrote:
> >On Sun, 2008-09-21 at 10:02 -0400, tedd wrote:
> >>  At 2:24 PM +0100 9/21/08, Ashley Sheridan wrote:
> >>  >
> >>  >The bgsound tag is not in HTML 4 or XHTML 1 specifications, and I
> >>  >wouldn't recommend its use, ever.
> >>
> >>
> >>  I didn't say it was, nor did I recommend it -- I only pointed out the
> >>  embed tag was for Netscape and bgsound tag was used for other
> >>  browsers.
> >>
> >>  >Like I've said before on this thread,
> >>  >the way to do this is with an embed tag inside an object tag, pretty
> >>  >much the same way you'd do it for a Flash movie.
> >>
> >>  With that I agree as I have done here:
> >>
> >>  http://webbytedd.com/aa/assorted-captcha/
> >>
> >>  The audio CAPTCHA delivers the mp3 file that's assembled in the 
> >> background.
> >>
> >>  Cheers,
> >>
> >>  tedd
> >>  --
> >>  ---
> >>  http://sperling.com  http://ancientstones.com  http://earthstones.com
> >>
> >But your audio is delivered through Flash, which adds another layer
> >where things can go wrong. Playing a background sound shouldn't require
> >a specific plugin to work, it should be possible to make it play with
> >the generic audio plugin that the browser has access to. Based on hits
> >to my own site, about 30% are made by browsers that do not have the
> >Flash plugin or have it disabled. Now, this may be thrown out a little
> >by people visiting with Chrome, as I've yet to test my tracker there,
> >but it's still quite a high figure. I think you would be hard pressed to
> >find any browser without a plugin to play an mp3 file.
> 
> Okay.
> 
> On one hand, I say that using  and  can deliver mp3 
> files, as shown here:
> 
> http://sperling.com/examples/captcha/
> 
> -- and it does work.
> 
> On the other hand, I say that I can deliver mp3 sound files via Flash 
> as shown here:
> 
> http://webbytedd.com/aa/assorted-captcha/
> 
> -- and it does work.
> 
> But, you find fault with both.
> 
> So, what and where's your example?
> 
> Cheers,
> 
> tedd
> 
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
This is now going to be a double post, but here it is:








http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"; 
type="application/x-mplayer2"/>


This does make use of the embed tag, but in a way that will not be used
by browsers that can understand the object tag. It won't validate with
the W3C validators, but it will work.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: OOP - Calling methods from classes that are inheriting?

2008-09-21 Thread Maciek Sokolewicz

class myClass {
public function func() {
return "Yay!!";
}
}

class otherClass extends myClass {
public function otherFunc() {
echo $this->func();
}
}

$class=new otherClass();
echo $class->otherFunc();

oh yes, it's that simple.
2 things to remember:
1. If you want to see output, actually make sure the function you call 
RETURNS any output in the first place. ($hello = "Yay!!"; isn't 
returning anything)
2. parent::* calls on the parent class in a static context. If your 
class extends another, it automatically inherits all functions from that 
class, unless it overwrites it itself. So you can simply use 
$this->func() in your child class.


Ben Stones wrote:

Hi, maybe if I post below what I'm trying to do it may make more sense:

class myClass {
public function func() {
$hello = "Yay!!";
}
}

class otherClass extends myClass {
public function otherFunc() {
echo parent::func();
}
}

$class=new otherClass();
echo $class->otherFunc();

Nothing outputs. Sorry I am slightly new to OOP so there may be a simple fix
for this?

2008/9/21 Lupus Michaelis <[EMAIL PROTECTED]<[EMAIL PROTECTED]>


Ben Stones a écrit :


Hope I have made myself as clear as possible!


 I did'nt understand what you mean, but I guess you're seeking for the
parent keyword. Read again the PHP manual about OOP.

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--
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] Re: OOP - Calling methods from classes that are inheriting?

2008-09-21 Thread Jochem Maas

Maciek Sokolewicz schreef:

class myClass {
public function func() {
return "Yay!!";
}
}

class otherClass extends myClass {
public function otherFunc() {
echo $this->func();
}
}

$class=new otherClass();
echo $class->otherFunc();

oh yes, it's that simple.
2 things to remember:
1. If you want to see output, actually make sure the function you call 
RETURNS any output in the first place. ($hello = "Yay!!"; isn't 
returning anything)
2. parent::* calls on the parent class in a static context. If your 
class extends another, it automatically inherits all functions from that 
class, unless it overwrites it itself. So you can simply use 
$this->func() in your child class.



not true (well you can use $this->func() in this case) ... but
parent::* assumes the context your in (i.e. static or not):

func2();




Ben Stones wrote:

Hi, maybe if I post below what I'm trying to do it may make more sense:

class myClass {
public function func() {
$hello = "Yay!!";
}
}

class otherClass extends myClass {
public function otherFunc() {
echo parent::func();
}
}

$class=new otherClass();
echo $class->otherFunc();

Nothing outputs. Sorry I am slightly new to OOP so there may be a 
simple fix

for this?


use a return statement, just like standalone functions, assuming
you want to output the "Yah!!".



2008/9/21 Lupus Michaelis 
<[EMAIL PROTECTED]<[EMAIL PROTECTED]>



Ben Stones a écrit :


Hope I have made myself as clear as possible!


 I did'nt understand what you mean, but I guess you're seeking for the
parent keyword. Read again the PHP manual about OOP.

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--
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] Re: Problem with sorting

2008-09-21 Thread Eric Butera
On Sun, Sep 21, 2008 at 1:19 PM, Nathan Rixham <[EMAIL PROTECTED]> wrote:
> Michelle Konzack wrote:
>>
>> 
>> *   Do not Cc: me, because I READ THIS LIST, if I write here   *
>> *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*
>> 

Cute, get gmail and you won't have such problems.

>>
>> Thanks, Greetings and nice Day/Evening
>>Michelle Konzack
>>Systemadministrator
>>24V Electronic Engineer
>>Tamay Dogan Network
>>Debian GNU/Linux Consultant
>>
>>
>
> if it's from a database could you "order by substring(columnname, 2,1)" or
> similar..?

I've done stuff like this before but it is way too slow to be used on
anything other than a manager screen (that isn't used much).  I'd
recommend creating another column that sets your data up correctly for
sorting based on your criteria.

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



Re: [PHP] Re: Header() - POST

2008-09-21 Thread Stut

On 20 Sep 2008, at 01:23, Michelle Konzack wrote:

Am 2008-09-05 17:11:58, schrieb Stut:

You're trying to post to the browser which won't know how to handle
it. The header() function is modifying the response headers that are
being sent back to the browser, they do not create a new request.

If you want to do a new request I suggest looking at curl. If you
actually want the browser to make the new request the only way is to
return a hidden form and auto-submit it with JS. However, as someone
else pointed out if that second request is coming back to the same
server there probably isn't any need for a second request at all.


Why using JS?

   echo "";

would do the trick...


Bloody nora Michelle. If you're going to post answers to week-old  
questions please have the decency to read the question properly. The  
OP wanted to automatically POST some data. That's not gonna happen  
with a meta tag no matter how much you want it to do it.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Problem with sorting

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 14:34 -0400, Eric Butera wrote:

> > Michelle Konzack wrote:
> >>
> >>
> 
> >> *   Do not Cc: me, because I READ THIS LIST, if I write here
> *
> >> *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe
> *
> >>
> 
> 
> Cute, get gmail and you won't have such problems.
> 

I quite like the double emails thing, it makes me feel like I'm more
popular :p


Ash
www.ashleysheridan.co.uk


Re: [PHP] Re: Problem with sorting

2008-09-21 Thread Eric Butera
On Sun, Sep 21, 2008 at 3:17 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> On Sun, 2008-09-21 at 14:34 -0400, Eric Butera wrote:
>
>> Michelle Konzack wrote:
>>>
>>> 
>>> *   Do not Cc: me, because I READ THIS LIST, if I write here   *
>>> *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*
>>> 
>
> Cute, get gmail and you won't have such problems.
>
> I quite like the double emails thing, it makes me feel like I'm more popular
> :p
>
>
> Ash
> www.ashleysheridan.co.uk

I could also always bcc replies to you so you get three.  How great
would that be? :D

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



Re: [PHP] Re: Problem with sorting

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 15:21 -0400, Eric Butera wrote:
> On Sun, Sep 21, 2008 at 3:17 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> > On Sun, 2008-09-21 at 14:34 -0400, Eric Butera wrote:
> >
> >> Michelle Konzack wrote:
> >>>
> >>> 
> >>> *   Do not Cc: me, because I READ THIS LIST, if I write here   *
> >>> *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*
> >>> 
> >
> > Cute, get gmail and you won't have such problems.
> >
> > I quite like the double emails thing, it makes me feel like I'm more popular
> > :p
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> 
> I could also always bcc replies to you so you get three.  How great
> would that be? :D
Wow, I'd be like really popular if everyone did that! Does this really
mean that I need to get out more and make friends outside of the
Interweb?!


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: Problem with sorting

2008-09-21 Thread Eric Butera
On Sun, Sep 21, 2008 at 3:26 PM, Ashley Sheridan
<[EMAIL PROTECTED]> wrote:
> On Sun, 2008-09-21 at 15:21 -0400, Eric Butera wrote:
>> On Sun, Sep 21, 2008 at 3:17 PM, Ashley Sheridan
>> <[EMAIL PROTECTED]> wrote:
>> > On Sun, 2008-09-21 at 14:34 -0400, Eric Butera wrote:
>> >
>> >> Michelle Konzack wrote:
>> >>>
>> >>> 
>> >>> *   Do not Cc: me, because I READ THIS LIST, if I write here   *
>> >>> *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*
>> >>> 
>> >
>> > Cute, get gmail and you won't have such problems.
>> >
>> > I quite like the double emails thing, it makes me feel like I'm more 
>> > popular
>> > :p
>> >
>> >
>> > Ash
>> > www.ashleysheridan.co.uk
>>
>> I could also always bcc replies to you so you get three.  How great
>> would that be? :D
> Wow, I'd be like really popular if everyone did that! Does this really
> mean that I need to get out more and make friends outside of the
> Interweb?!
>
>
> Ash
> www.ashleysheridan.co.uk
>
>

No, the fact we're having this exchange on a Sunday is an indicator.  :(  *sigh*

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



Re: [PHP] Re: Problem with sorting

2008-09-21 Thread Ashley Sheridan
On Sun, 2008-09-21 at 15:24 -0400, Eric Butera wrote:
> On Sun, Sep 21, 2008 at 3:26 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
> > On Sun, 2008-09-21 at 15:21 -0400, Eric Butera wrote:
> >> On Sun, Sep 21, 2008 at 3:17 PM, Ashley Sheridan
> >> <[EMAIL PROTECTED]> wrote:
> >> > On Sun, 2008-09-21 at 14:34 -0400, Eric Butera wrote:
> >> >
> >> >> Michelle Konzack wrote:
> >> >>>
> >> >>> 
> >> >>> *   Do not Cc: me, because I READ THIS LIST, if I write here   
> >> >>> *
> >> >>> *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe
> >> >>> *
> >> >>> 
> >> >
> >> > Cute, get gmail and you won't have such problems.
> >> >
> >> > I quite like the double emails thing, it makes me feel like I'm more 
> >> > popular
> >> > :p
> >> >
> >> >
> >> > Ash
> >> > www.ashleysheridan.co.uk
> >>
> >> I could also always bcc replies to you so you get three.  How great
> >> would that be? :D
> > Wow, I'd be like really popular if everyone did that! Does this really
> > mean that I need to get out more and make friends outside of the
> > Interweb?!
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> 
> No, the fact we're having this exchange on a Sunday is an indicator.  :(  
> *sigh*
> 
Bugger, it's official then... :'-(


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] was [PHP] Re: render html

2008-09-21 Thread Stut

On 21 Sep 2008, at 16:18, tedd wrote:

At 4:06 PM +0100 9/21/08, Ashley Sheridan wrote:


I'm sorry, I didn't mean to be insulting! I do agree that you will  
get

those errors if you choose the wrong doctype, and by wrong I mean one
that is mismatched with the types of tag you try to use.


Maybe I need to learn something here.

Are you saying then that if I want to use a  tag, then I can't  
use:


http://www.w3.org/TR/html4/loose.dtd";>

So, instead I must use the  tag?

If so, interesting.


That's what the DocType is. It tells the browser what version of  
(X)HTML you're using and therefore which tags are allowed and which  
are not. It has a major effect on some browsers, and if you use the  
right one it can help a lot when trying to make pages look the same in  
all browsers. Worth reading up on.


-Stut

--
http://stut.net/

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



Re: [PHP] Passing variables between pages

2008-09-21 Thread Stut

On 21 Sep 2008, at 18:13, Nathan Rixham wrote:

tedd wrote:

At 8:31 PM +0100 9/20/08, Nathan Rixham wrote:

Am I missing something here..?

Yes. You are missing the point.
This is exactly the same; you don't need $_SESSION's in this case  
because all you're doing is POST'ing the data every time..

And that's what you are missing -- it's not continued POSTing!
Follow closely,
http://www.webbytedd.com/bb/php-run-php/
While I'm using a Submit Post button to go from this script to the  
next script I am NOT sending any data via the POST. To prove it,  
use FF and see what's passed.
All data is passed/available to the next script because the next  
script is an include.

For example, this parent script has the variable:
$test = "This is a test";
And the next script (either a.php, or b.php, or c.php -- your  
choice) simply echo's $test.
Please note, the contents of the variable $test was NOT passed via  
a POST, but rather retained because the parent script included the  
next script.

Do you see the difference?
Here's another example presenting the same technique in a different  
way:

http://www.webbytedd.com/bb/tedd/index.php
All the variables remain intact AND there is nothing in the  
REQUEST, SESSION nor COOKIE arrays.
I have a hard time trying to get people to understand this simple  
concept. It's so simple that people often overlook how powerful it  
is.
For example, with a little forethought, I think there isn't a  
script I've written that I could not have used this technique and  
dispensed with SESSION's all together. That's pretty powerful,  
don't you think?

Do you understand what I'm doing now?

no ill-intention meant.

That's Okay -- I realize you meant no ill-intent.
Neither do I -- I realize that occasionally simple concepts are  
hard for you smarter guys to get because you have to dumb down a  
lot to consider what we're talking about. But I think it's an  
interesting concept to consider.

Cheers,
tedd



at it's simplest is this correct..?

index.php


anotherscript.php


I'm struggling to follow here I thinks! lol


I don't think you're missing the point Nathan, I think you've hit it  
on the head. This technique does not solve the problem of passing  
variables between requests. I think the only benefit here is to avoid  
having to repost data by including the next script rather than  
bouncing off the browser.


Or maybe I'm missing the point.

-Stut

--
http://stut.net/

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



Re: [PHP] Passing variables between pages

2008-09-21 Thread Robert Cummings
On Sun, 2008-09-21 at 20:39 +0100, Stut wrote:
> On 21 Sep 2008, at 18:13, Nathan Rixham wrote:
> > tedd wrote:
> >> At 8:31 PM +0100 9/20/08, Nathan Rixham wrote:
> >>> Am I missing something here..?
> >> Yes. You are missing the point.
> >>> This is exactly the same; you don't need $_SESSION's in this case  
> >>> because all you're doing is POST'ing the data every time..
> >> And that's what you are missing -- it's not continued POSTing!
> >> Follow closely,
> >> http://www.webbytedd.com/bb/php-run-php/
> >> While I'm using a Submit Post button to go from this script to the  
> >> next script I am NOT sending any data via the POST. To prove it,  
> >> use FF and see what's passed.
> >> All data is passed/available to the next script because the next  
> >> script is an include.
> >> For example, this parent script has the variable:
> >> $test = "This is a test";
> >> And the next script (either a.php, or b.php, or c.php -- your  
> >> choice) simply echo's $test.
> >> Please note, the contents of the variable $test was NOT passed via  
> >> a POST, but rather retained because the parent script included the  
> >> next script.
> >> Do you see the difference?
> >> Here's another example presenting the same technique in a different  
> >> way:
> >> http://www.webbytedd.com/bb/tedd/index.php
> >> All the variables remain intact AND there is nothing in the  
> >> REQUEST, SESSION nor COOKIE arrays.
> >> I have a hard time trying to get people to understand this simple  
> >> concept. It's so simple that people often overlook how powerful it  
> >> is.
> >> For example, with a little forethought, I think there isn't a  
> >> script I've written that I could not have used this technique and  
> >> dispensed with SESSION's all together. That's pretty powerful,  
> >> don't you think?
> >> Do you understand what I'm doing now?
> >>> no ill-intention meant.
> >> That's Okay -- I realize you meant no ill-intent.
> >> Neither do I -- I realize that occasionally simple concepts are  
> >> hard for you smarter guys to get because you have to dumb down a  
> >> lot to consider what we're talking about. But I think it's an  
> >> interesting concept to consider.
> >> Cheers,
> >> tedd
> >
> >
> > at it's simplest is this correct..?
> >
> > index.php
> >  > $variables = $_POST;
> > include 'anotherscript.php';
> > ?>
> >
> > anotherscript.php
> >  > print_r( $variables ); //include has access to $variables from parent
> > print_r( $_POST ); //include has access to post data as well
> > ?>
> >
> > I'm struggling to follow here I thinks! lol
> 
> I don't think you're missing the point Nathan, I think you've hit it  
> on the head. This technique does not solve the problem of passing  
> variables between requests. I think the only benefit here is to avoid  
> having to repost data by including the next script rather than  
> bouncing off the browser.
> 
> Or maybe I'm missing the point.

Looks like a basic front-end loader pattern. Data isn't passed, it's
available by virtue of being in the current request's context.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Passing variables between pages

2008-09-21 Thread Nathan Rixham

Robert Cummings wrote:

On Sun, 2008-09-21 at 20:39 +0100, Stut wrote:

On 21 Sep 2008, at 18:13, Nathan Rixham wrote:

tedd wrote:

At 8:31 PM +0100 9/20/08, Nathan Rixham wrote:

Am I missing something here..?

Yes. You are missing the point.
This is exactly the same; you don't need $_SESSION's in this case  
because all you're doing is POST'ing the data every time..

And that's what you are missing -- it's not continued POSTing!
Follow closely,
http://www.webbytedd.com/bb/php-run-php/
While I'm using a Submit Post button to go from this script to the  
next script I am NOT sending any data via the POST. To prove it,  
use FF and see what's passed.
All data is passed/available to the next script because the next  
script is an include.

For example, this parent script has the variable:
$test = "This is a test";
And the next script (either a.php, or b.php, or c.php -- your  
choice) simply echo's $test.
Please note, the contents of the variable $test was NOT passed via  
a POST, but rather retained because the parent script included the  
next script.

Do you see the difference?
Here's another example presenting the same technique in a different  
way:

http://www.webbytedd.com/bb/tedd/index.php
All the variables remain intact AND there is nothing in the  
REQUEST, SESSION nor COOKIE arrays.
I have a hard time trying to get people to understand this simple  
concept. It's so simple that people often overlook how powerful it  
is.
For example, with a little forethought, I think there isn't a  
script I've written that I could not have used this technique and  
dispensed with SESSION's all together. That's pretty powerful,  
don't you think?

Do you understand what I'm doing now?

no ill-intention meant.

That's Okay -- I realize you meant no ill-intent.
Neither do I -- I realize that occasionally simple concepts are  
hard for you smarter guys to get because you have to dumb down a  
lot to consider what we're talking about. But I think it's an  
interesting concept to consider.

Cheers,
tedd


at it's simplest is this correct..?

index.php


anotherscript.php


I'm struggling to follow here I thinks! lol
I don't think you're missing the point Nathan, I think you've hit it  
on the head. This technique does not solve the problem of passing  
variables between requests. I think the only benefit here is to avoid  
having to repost data by including the next script rather than  
bouncing off the browser.


Or maybe I'm missing the point.


Looks like a basic front-end loader pattern. Data isn't passed, it's
available by virtue of being in the current request's context.

Cheers,
Rob.


so may as well just have everything in one script then..

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



Re: [PHP] Associative array issues with loading values after initialization

2008-09-21 Thread Jochem Maas

funny how that perl code looks so much like php ... or is it the other way
around.

Thomas Bolioli schreef:
I should add, it is not working with this funciton, which could be the 
source of the issue.


function dropbox_from_list($list, $selected_index){
   while ($nex = next($list)) {
   $k = key($nex);
   if (strcmp($selected_index, $k) == 0) {
   $select = ' SELECTED';
   }
   else {
   $select = '';
   }
   print("".$nex[$k]."");
   }
}



okay, so all the while, next, key stuff is gonna make your eyes bleed.
we have foreach() ... it is your friend:

function dropBox($items, $selected, $name, $output = false)
{
if (!is_array($items))
return;

$opts = array();
foreach($items as $k => $v) {
$k = htmlentities($k, ENT_QUOTES); // htmlentities should really
$v = htmlentities($v, ENT_QUOTES); // be getting a charset are 4rd arg
$s = $k == $selected ? ' selected="selected"' : '';

$opts[] = ''.$v.'';
}

$html = ''.join('', $opts).'';

if ($output)
echo $html;
else
return $html;
}




Thomas Bolioli wrote:

The below function is not working.
function crm_get_country_list(){
global $dbh;
   $result = mysql_query("SELECT * FROM countries ORDER BY 
pk_country_id ASC", $dbh) or die(mysql_error());

   $country_list = array(' ' =>' ');
   while ($row = mysql_fetch_assoc($result)){
   $country_list[$row['pk_countryID']] = $row['country_name'];
   }
return $country_list;
}

I know how to write this in perl but for some reason, when I write it 
in PHP it doesn't work.

In perl it would be (roughly):

function crm_get_country_list(){
global $dbh;
   $result = mysql_query("SELECT * FROM countries ORDER BY 
pk_country_id ASC", $dbh) or die(mysql_error());

   my %country_list;
   while ($row = mysql_fetch_assoc($result)){
   $country_list[$row['pk_countryID']] = $row['country_name'];
   }
return \%country_list;
}

What am I doing wrong here?


you learnt perl first :-D


Thanks in advance,
Tom






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



Re: [PHP] SESSIONS vs. MySQL

2008-09-21 Thread Jochem Maas

Philip Thompson schreef:

Hi all.

Let me start out by saying, I have STFW and read through the list 
archives. Now that that's out of the way.


To speed up our application, we want to implement using SESSIONs in some 
locations. Beforehand, on every page, we would run approximately 30-40 
queries just to get the page setup - user information and other stuff. 
Now while we can't take away all of the setup queries, we would like to 
reduce the startup number.


Ok, so I've implemented this in several places where information 
basically does not change from page to page. Jumping to the 
point/question... when does it become more inefficient to store lots of 
information in SESSION variables than to run several more queries? Note, 
we are actually storing sessions in the database - so a read/write is 
required on each page load - it's not file sessions.


Now I know this can depend on the complexity of the queries and how much 
data is actually stored inside the sessions... but initial thoughts? To 
give you a number, the strlen of the _SESSION array is 325463 - which is 
equivalent to the number of bytes (I think).


not exactly - depends on how you measure it, also the serialized form of the
session data is longer still because it contains data type descriptions et al.

are you running on a linux box? if so try using session files again and
sticking your session data in /dev/shm/some-dir which effectively means your
sticking the files in RAM ... generally much faster than using a DB or the FS,
on the other hand this is rather volatile (if the box goes down you lose all the
data ... but then you have other problems probably, you can get round it
by regularly backing up the contents of /dev/shm/some-dir and restoring the 
backup
if/when the machine reboots ... the backup can occur out of process, so
your page performance isn't directly effected, you'd still have to think about
file locking etc) I use this trick quite often, generally without bothering
to backup the session data (I figure if the site goes down completely then
losing session data is the least of my worries ... and a user won't be
all that surprised to find his login status wiped when the site comes back
up ... although he/she might be a little miffed)



Thanks,
~Philip




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



Re: [PHP] SESSIONS vs. MySQL

2008-09-21 Thread Eric Butera
On Sun, Sep 21, 2008 at 6:48 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Philip Thompson schreef:
>>
>> Hi all.
>>
>> Let me start out by saying, I have STFW and read through the list
>> archives. Now that that's out of the way.
>>
>> To speed up our application, we want to implement using SESSIONs in some
>> locations. Beforehand, on every page, we would run approximately 30-40
>> queries just to get the page setup - user information and other stuff. Now
>> while we can't take away all of the setup queries, we would like to reduce
>> the startup number.
>>
>> Ok, so I've implemented this in several places where information basically
>> does not change from page to page. Jumping to the point/question... when
>> does it become more inefficient to store lots of information in SESSION
>> variables than to run several more queries? Note, we are actually storing
>> sessions in the database - so a read/write is required on each page load -
>> it's not file sessions.
>>
>> Now I know this can depend on the complexity of the queries and how much
>> data is actually stored inside the sessions... but initial thoughts? To give
>> you a number, the strlen of the _SESSION array is 325463 - which is
>> equivalent to the number of bytes (I think).
>
> not exactly - depends on how you measure it, also the serialized form of the
> session data is longer still because it contains data type descriptions et
> al.
>
> are you running on a linux box? if so try using session files again and
> sticking your session data in /dev/shm/some-dir which effectively means your
> sticking the files in RAM ... generally much faster than using a DB or the
> FS,
> on the other hand this is rather volatile (if the box goes down you lose all
> the
> data ... but then you have other problems probably, you can get round it
> by regularly backing up the contents of /dev/shm/some-dir and restoring the
> backup
> if/when the machine reboots ... the backup can occur out of process, so
> your page performance isn't directly effected, you'd still have to think
> about
> file locking etc) I use this trick quite often, generally without bothering
> to backup the session data (I figure if the site goes down completely then
> losing session data is the least of my worries ... and a user won't be
> all that surprised to find his login status wiped when the site comes back
> up ... although he/she might be a little miffed)
>
>>
>> Thanks,
>> ~Philip
>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Wouldn't you (probably) loose sessions in /tmp if the box crashed also?

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



Re: [PHP] How to detect the host (window or Linux)?

2008-09-21 Thread Thodoris



$win = stripos(PHP_OS, 'win') !== false ? true : false;

Anderson Franco
Web Developer

Franco Tecnologia Bras. e Com. LTDA
Phone / Fax: +55 (19) 3455 2262
Email: [EMAIL PROTECTED]
MSN/GTalk: [EMAIL PROTECTED]
Skype: francotecnologia


On Sat, Sep 20, 2008 at 7:38 PM, hce <[EMAIL PROTECTED]> wrote:

  

Hi,

How can I detect the host is window or linux in PHP code?

Thank you.

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





  


Perhaps you could also use this as an alternative:

http://gr.php.net/manual/en/function.php-uname.php


--
Thodoris



Re: [PHP] SESSIONS vs. MySQL

2008-09-21 Thread Per Jessen
Eric Butera wrote:

> 
> Wouldn't you (probably) loose sessions in /tmp if the box crashed
> also?

No, that wouldn't be the default behaviour.  /tmp is typically on the
filesystem, and it's not cleared on every reboot (unless your system
has been configured to do so). 


/Per Jessen, Zürich


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