[PHP] Re: PHP Extensions as Shared Objects?

2008-06-02 Thread Colin Guthrie

mike wrote:

On 5/29/08, Weston C [EMAIL PROTECTED] wrote:


Fortunately, I'll have full control of the hosting environment in the
context this matters. :)

dl is  definitely interesting, but I'm worried that runtime invocation
might mean performance hits. Is there a way to do load/startup time
inclusion?


you could put it in your php ini file

extension = foo.so

then I believe the impact will be on the first instance for that php
engine. so in fastcgi mode, you'd only have the hit once every
PHP_FCGI_MAX_REQUESTS when the child restarts...



Have a look at a standard Mandriva or Fedora/CentOS PHP install. You'll 
see that the various parts of the PHP engine are all very modular with 
several PECL modules pre-built for your convenience.


The php.ini file is split into files in /etc/php.d/*.ini so that the 
packages can put their own little config systems into the php.ini file 
without dicking around with automated editing.


When using PHP as a module the impact is pretty low, only once per 
restart. As Mike wrote the low impact is also apparent in FCGI mode too 
(but it's a bit more obvious where the extra load it creates is manifested).


Personally, the convenience of modularity sells this approach for me. I 
do generally roll my own RPMs to keep things up to day and patched, but 
again I just use that format/deployment method as it's convenient.


Col


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



[PHP] Re: APC + PHP Problem (apc_fcntl_lock failed: Bad file descriptor)

2008-06-02 Thread Colin Guthrie

Scott McNaught [Synergy 8] wrote:

Hello,

I am running a production server with APC and php. We recently had a crash
where APC bombed out. When it does this, the server serves empty, white
pages.

Here is what the error_log says.



I have not yet found a resolution for this.  There are no calls made to
apc_store() on the server. It is solely script caching.  



I am running PHP 5.2.5, and APC 3.0.15. This is the PHP info for APC.


I've recently deployed a similar setup, again only for script caching. 
It's working great for me with PHP 5.2.6 and APC 3.0.19. I'd suggest 
upgrading and seeing if that fixes it (esp the APC bit for obvious 
reasons - should also be pretty painless to upgrade only that part)


I only have a fairly low cache enabled and it does fill up and expunge 
data after a time out, so if I was affected by this I'd have expected to 
have seen it rear it's ugly head by now.


Col


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



[PHP] Avoid object twice

2008-06-02 Thread Yui Hiroaki
Please take a look at code.

a.php

$obj=new my(Hello);
$obj-buff();


Class my{

private $word;
function __construct($getword){
   $this-word=$getword;
}
public function buff(){
 echo $this-word.br /;
}
--


-b.php---

function __autoload($class_name) {
include_once $class_name . '.php';
}


$objref=new my(Good);
$objref-buff();




I get an Echo;

Good
Hello
Hello

I do not need to get Hello twice.

When I b.php , $obj=new my(Hello) is loaded.


Do you have any adia to avoid load $obj in a.php twice?

Regards,
Yui

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



RE: [PHP] Avoid object twice

2008-06-02 Thread Scott McNaught [Synergy 8]
Try removing from a.php the lines:

$obj=new my(Hello);
$obj-buff();

I think this will achieve what you want.

-Original Message-
From: Yui Hiroaki [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 02, 2008 11:01 PM
To: php-general@lists.php.net
Subject: [PHP] Avoid object twice

Please take a look at code.

a.php

$obj=new my(Hello);
$obj-buff();


Class my{

private $word;
function __construct($getword){
   $this-word=$getword;
}
public function buff(){
 echo $this-word.br /;
}
--


-b.php---

function __autoload($class_name) {
include_once $class_name . '.php';
}


$objref=new my(Good);
$objref-buff();




I get an Echo;

Good
Hello
Hello

I do not need to get Hello twice.

When I b.php , $obj=new my(Hello) is loaded.


Do you have any adia to avoid load $obj in a.php twice?

Regards,
Yui

-- 
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] saving outside website content via php...

2008-06-02 Thread Boyd, Todd M.
 -Original Message-
 From: blackwater dev [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 01, 2008 9:26 PM
 To: Shawn McKenzie
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] saving outside website content via php...
 
 Yes, but file_get_contents will get me the code which I could then 
 echo back out to the browser but that wouldn't give me any external 
 images, css files or js.

Use the RegEx examples for tag-grabbing that appeared in this mailing
list last week. Parse whatever text is returned from cURL and find any
*.css links, *.js links, *.jpg/gif/png/etc images, and then use cURL
once again to download them and save them.

I'm sorry if you were hoping for some magic function that will do all
of that for you, but there is none. There may very well be some
pre-packaged solutions to your problem, but I don't know of any
off-hand.

Seriously, though: think like a programmer! You can get the text, and
the links to the elements you want to save are in the text. Parse it!
Parse it for all you're worth!


Todd Boyd
Web Programmer

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



Re: [PHP] saving outside website content via php...

2008-06-02 Thread Shawn McKenzie

Boyd, Todd M. wrote:

-Original Message-
From: blackwater dev [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 01, 2008 9:26 PM
To: Shawn McKenzie
Cc: php-general@lists.php.net
Subject: Re: [PHP] saving outside website content via php...

Yes, but file_get_contents will get me the code which I could then 
echo back out to the browser but that wouldn't give me any external 
images, css files or js.


Use the RegEx examples for tag-grabbing that appeared in this mailing
list last week. Parse whatever text is returned from cURL and find any
*.css links, *.js links, *.jpg/gif/png/etc images, and then use cURL
once again to download them and save them.

I'm sorry if you were hoping for some magic function that will do all
of that for you, but there is none. There may very well be some
pre-packaged solutions to your problem, but I don't know of any
off-hand.

Seriously, though: think like a programmer! You can get the text, and
the links to the elements you want to save are in the text. Parse it!
Parse it for all you're worth!


Todd Boyd
Web Programmer


That is one way if you're using all PHP.  If you have access to wget 
(most linux), then you can do it in one shell command.


'wget --convert-links -r http://www.example.com/' will get all files 
recursively, save them and convert the links to point to the local files.


Also look at the --mirror option.  Lot's of options/possibilities with 
wget.  There are bound to be some PHP classes that wrap wget somewhere.


-Shawn

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



[PHP] strlower problem

2008-06-02 Thread Ed Curtis
I'm converting upper case characters in a string to lower case and am 
coming up with an empty string.


As I've done a million times before with other non-numerical strings.

$thisStr = CL22;

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?

Thanks,

Ed



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



Re: [PHP] Avoid object twice

2008-06-02 Thread Jim Lucas

Yui Hiroaki wrote:

Please take a look at code.

a.php

$obj=new my(Hello);
$obj-buff();


Class my{

private $word;
function __construct($getword){
   $this-word=$getword;
}
public function buff(){
 echo $this-word.br /;
}
--


-b.php---

function __autoload($class_name) {
include_once $class_name . '.php';
}


$objref=new my(Good);
$objref-buff();




I get an Echo;

Good
Hello
Hello

I do not need to get Hello twice.

When I b.php , $obj=new my(Hello) is loaded.


Do you have any adia to avoid load $obj in a.php twice?

Regards,
Yui



Just to make sure, you are calling your a.php script my.php in real life right?

If not, this might be part of your problem.  When I run the above script, and 
change the a.php to my.php, it loads just fine and it only displays one instance 
of hello.  I am thinking that you calling the class more then once and you don't 
realize it.



--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] strlower problem

2008-06-02 Thread Jim Lucas

Richard Heyes wrote:

Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and am 
coming up with an empty string.


As I've done a million times before with other non-numerical strings.

$thisStr = CL22;

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?


Because you're echoing out the original (uppercase) string. Try:

echo $strLow;


//in my best yoda voice//

to quickly you answer before you think...

//back in the Milky Way...//

he should still see something.

the op should see the original string 'CL22'.  Last time I looked strtolower() 
did not modify the input as a reference.


So   echo $thisStr; should result in the op seeing CL22

Unless there are other things happening that only the force knows about...

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] strlower problem

2008-06-02 Thread Richard Heyes

Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and am 
coming up with an empty string.


As I've done a million times before with other non-numerical strings.

$thisStr = CL22;

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?


Because you're echoing out the original (uppercase) string. Try:

echo $strLow;

--
  Richard Heyes

 In Cambridge? Employ me
http://www.phpguru.org/cv

++
| Access SSH with a Windows mapped drive |
|http://www.phpguru.org/sftpdrive|
++

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



Re: [PHP] strlower problem

2008-06-02 Thread Ed Curtis

Richard Heyes wrote:

Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and am 
coming up with an empty string.


As I've done a million times before with other non-numerical strings.

$thisStr = CL22;

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?


Because you're echoing out the original (uppercase) string. Try:

echo $strLow;



My mistake. I meant to type echo $strLow; not echo $thisStr; in my post.

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



Re: [PHP] strlower problem

2008-06-02 Thread Michael Kubler

Does :

/echo strtolower(CL22);/

work?
You could also try :

/var_dump($strLow);

/

Ed Curtis wrote:

Richard Heyes wrote:

Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and 
am coming up with an empty string.


As I've done a million times before with other non-numerical strings.

$thisStr = CL22;

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?

My mistake. I meant to type echo $strLow; not echo $thisStr; in my post.




Re: [PHP] strlower problem

2008-06-02 Thread Ed Curtis

Michael Kubler wrote:

Does :

/echo strtolower(CL22);/

work?
You could also try :

/var_dump($strLow);

/

Ed Curtis wrote:

Richard Heyes wrote:

Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and 
am coming up with an empty string.


As I've done a million times before with other non-numerical strings.

$thisStr = CL22;

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?
My mistake. I meant to type echo $strLow; not echo $thisStr; in my 
post.




I found the problem myself. The actual code follows the same principal 
but the value of $thisStr is a $_GET value from a link. The name of that 
value in the link was 'style'. Oops, you should never use a HTML 
reserved attribute as a varible identifier in a link. I just wasn't 
thinking at the time I wrote it. (a href=order2.php?style=CL22)


Sorry I took up your time,

Ed 


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



Re: [PHP] strlower problem

2008-06-02 Thread Ted Wood


On 2-Jun-08, at 10:25 AM, Ed Curtis wrote:


I found the problem myself. The actual code follows the same  
principal but the value of $thisStr is a $_GET value from a link.  
The name of that value in the link was 'style'. Oops, you should  
never use a HTML reserved attribute as a varible identifier in a  
link. I just wasn't thinking at the time I wrote it. (a  
href=order2.php?style=CL22)


Input validation is always a very important aspect when using values  
submitted by the client.
Assuming that $_GET['style'] existed without testing for it was the  
first thing that should've been looked at.


In order to make maximum use of this mailing list, it's really helpful  
for us to see the _actual_ code you're using, rather than fake code.  
Your fake code had no problems, so we weren't able to provide you with  
a solution, but it sounds like your real code had the error that  
caused the problem.


Even in your latest post, you put this:
(a href=order2.php?style=CL22)

What's with all of those double-quotes? More fake code, or is that  
actually what you have in your code?



~Ted

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



[PHP] imageColorAllocate problem

2008-06-02 Thread Jo Ann Comito

Hi phpers,

I'm having a strange problem. My goal is to be able to generate  
navigation buttons on the fly. I had this working -- I could pass  
variable text, size and font information to the php page that  
generates the image and all worked as expected--png files were  
created, stored and displayed on the page.


The only issue was that during the testing phase, I had hard coded  
the color of the button and the text.



$im = imagecreate (168, $height);   
$buttoncolor1 = imageColorAllocate ($im, 51, 51, 51);
$navtextcolor1 = ImageColorAllocate ($im, 153, 153, 153);

$x = 160-$width;
ImageTTFText ($im, $textsize, 0, $x, 20, $navtextcolor1, $font,  
$name);

$handle = fopen ($filename, w);
ImagePNG($im, $filename);

imagePNG($im);

imagedestroy($im);


This gave me a light gray button with dark gray text.

The next step was to be able to pass the button and text colors to  
the php page, as well.



$im = imagecreate (168, $height);   
$buttoncolor1 = imageColorAllocate ($im, $redb, $greenb, $blueb);
$navtextcolor1 = ImageColorAllocate ($im, $redt, $greent, $bluet);

$x = 160-$width;
ImageTTFText ($im, $textsize, 0, $x, 20, $navtextcolor1, $font,  
$name);

$handle = fopen ($filename, w);
ImagePNG($im, $filename);

imagePNG($im);

imagedestroy($im);
}


The only thing that changed was to use variables in the  
imageColorAllocate function instead of entering actual numbers (I  
also added code to GET the color  variables).


I no longer got any buttons -- just a series of question marks.

In case the problem was with the passing of the color numbers, I  
added the following lines just before the imagecreate function as a  
test:



$redt = 51;
$greent = 51;
$bluet = 51;

$redb = 153;
$greenb = 153;
$blueb = 153;


That did not help.

The kicker is that the png images are being generated -- i find them  
in the folder where they are saved. But they do not appear on the  
page. When the color numbers are hardcoded they do appear.


Thanks for any help you can give with this.

Jo Ann
Jo Ann Comito
by Design
Complete Design  Production Services
For Print and Web
www.greatbydesign.com/




[PHP] question about session variables

2008-06-02 Thread Sudhakar
i have a registration page called register.php if the data entered is
validated correctly i call a file called thankyou.php or else validate.php



presently a user after seeing the url website.com/thankyou.php if they enter
the url directly in the browser as website.com/thankyou.php they can access
the file, if a user accesses the file this way i would like to redirect to a
page saying Direct acess to this file is not allowed



previously i used sessions in register.php and also in thakyou.php and
validate.php and it worked fine for some reason now it is not working the
way it is supposed to i might have made some changes which i do not know



previously my code in register.php was,  the first few lines of register.php
file

=

?php

ob_start();

session_start();

if(!session_is_registered(directaccess))

{

session_register(directaccess);

}

// rest of the html and php code

ob_end_flush();

?

=

code in thankyou.php, the first few lines of register.php file

=

?php

session_start();

if(!session_is_registered(directaccess))

{

header(Location: http://website.com/directaccess.html;);

exit;

}

// rest of the html and php code

ob_end_flush();

?

=

NOTE = in thankyou.php i display a thank you message by retrieving the first
name from register page and displaying in thankyou.php using session
variables in the following way



in register.php, the first few lines of register.php file

=

if(!session_is_registered(firstname))

{

session_register(firstname );

}

$_SESSION[firstname] = $ firstname;

=



in thankyou.php, the first few lines of register.php file

=

if(session_is_registered(firstname ))

{

echo $_SESSION[firstname];

session_unregister(firstname );

}

=

please advice how i should rewrite the php code in both the
files(register.php and thankyou.php) so that if a user enters the url
directly in the browser i can redirect to directaccess.html file



thanks.


[PHP] Links (A HREF) loosing my session

2008-06-02 Thread Razer Montaño
   Hello All, my first time here at list.

   Well, I am with a very weird question, never happened with me,
always worked fine.

   First of all, I am using WAMP (php 5.2.6, apache 2.2.8, mysql
5.0.51b), Firefox (All
cookies allowed), Windows XP SP 3 (I think ;-)... Ah, the
session.save_path property is pointing
to a valid path and the session files are been created there. The
session.cookie_domain I leave
in blank, as I saw in other forum.

   That code below is not working properly. First time it creates the
session and show me
First activation etc etc. If I press CTRL-R (Firefox, but I tested
in IE too), it gets the same
session, showing me the next number.

   If I press First Link (Again 1), it creates a NEW SESSION, when It
would get the old one. And now,
every CTRL-R is getting me a new session. Only If I go at address bar
and hit ENTER, I can get
the very first session created.

   The second link (Again 2) is a test. I saw that, if I set:

session.use_only_cookies=0
session.use_trans_sid=1

   this link works fine. But, I don't want to pass Session ID every
link. I tried to set the properties above
in other ways, but I get the same behavior: session lost in every link click.

   Could someone execute this script, to see if it has some wrong?

   Could you please help me...

 Thank you in advance.

 Razer.

?php
session_start();
if (!isset($_SESSION['test'])) {
  echo First activation: setting session variable;
  $_SESSION['test'] = 1;
} else {
  echo SESSIONS ARE WORKING! activation: , (++$_SESSION['test']);
?
bra href=http://localhost:8081/testesession.php;Again 1/a
br
bra href=http://localhost:8081/testesession.php??php echo
session_name().'='.session_id();?Again 2/a
?php
}
echo br . session_id() . brbr;
?

--

Razer Anthom Nizer Rojas Montaño

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



Re: [PHP] question about session variables

2008-06-02 Thread Ted Wood


How are you calling thankyou.php?

1. are you -redirecting- the user to that file?
 --or--
2. are you -including- that file into register.php upon a successful  
submission?


The method you're using determines how you best secure thankyou.php  
from direct access.


If you're redirecting, then using a session variable is what you want.
If you're including, then a simple constant or variable defined in  
register.php can be checked and validated in thankyou.php.


NOTE:  use of session_register() is deprecated. After calling  
session_start(), just assign variables directly to $_SESSION:


$_SESSION['firstname'] = 'Fred;


~Ted




On 2-Jun-08, at 11:12 AM, Sudhakar wrote:


i have a registration page called register.php if the data entered is
validated correctly i call a file called thankyou.php or else  
validate.php




presently a user after seeing the url website.com/thankyou.php if  
they enter
the url directly in the browser as website.com/thankyou.php they can  
access
the file, if a user accesses the file this way i would like to  
redirect to a

page saying Direct acess to this file is not allowed



previously i used sessions in register.php and also in thakyou.php and
validate.php and it worked fine for some reason now it is not  
working the
way it is supposed to i might have made some changes which i do not  
know




previously my code in register.php was,  the first few lines of  
register.php

file

=

?php

ob_start();

session_start();

if(!session_is_registered(directaccess))

{

session_register(directaccess);

}

// rest of the html and php code

ob_end_flush();

?

=

code in thankyou.php, the first few lines of register.php file

=

?php

session_start();

if(!session_is_registered(directaccess))

{

header(Location: http://website.com/directaccess.html;);

exit;

}

// rest of the html and php code

ob_end_flush();

?

=

NOTE = in thankyou.php i display a thank you message by retrieving  
the first

name from register page and displaying in thankyou.php using session
variables in the following way



in register.php, the first few lines of register.php file

=

if(!session_is_registered(firstname))

{

session_register(firstname );

}

$_SESSION[firstname] = $ firstname;

=



in thankyou.php, the first few lines of register.php file

=

if(session_is_registered(firstname ))

{

echo $_SESSION[firstname];

session_unregister(firstname );

}

=

please advice how i should rewrite the php code in both the
files(register.php and thankyou.php) so that if a user enters the url
directly in the browser i can redirect to directaccess.html file



thanks.



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



Re: [PHP] Links (A HREF) loosing my session

2008-06-02 Thread Ted Wood


1. If you're using cookies, there's no need to pass the session name  
via the URL.

2. Is the cookie being created?

~Ted



On 2-Jun-08, at 11:32 AM, Razer Montaño wrote:


 Hello All, my first time here at list.

 Well, I am with a very weird question, never happened with me,
always worked fine.

 First of all, I am using WAMP (php 5.2.6, apache 2.2.8, mysql
5.0.51b), Firefox (All
cookies allowed), Windows XP SP 3 (I think ;-)... Ah, the
session.save_path property is pointing
to a valid path and the session files are been created there. The
session.cookie_domain I leave
in blank, as I saw in other forum.

 That code below is not working properly. First time it creates the
session and show me
First activation etc etc. If I press CTRL-R (Firefox, but I tested
in IE too), it gets the same
session, showing me the next number.

 If I press First Link (Again 1), it creates a NEW SESSION, when It
would get the old one. And now,
every CTRL-R is getting me a new session. Only If I go at address bar
and hit ENTER, I can get
the very first session created.

 The second link (Again 2) is a test. I saw that, if I set:

session.use_only_cookies=0
session.use_trans_sid=1

 this link works fine. But, I don't want to pass Session ID every
link. I tried to set the properties above
in other ways, but I get the same behavior: session lost in every  
link click.


 Could someone execute this script, to see if it has some wrong?

 Could you please help me...

   Thank you in advance.

   Razer.

?php
session_start();
if (!isset($_SESSION['test'])) {
echo First activation: setting session variable;
$_SESSION['test'] = 1;
} else {
echo SESSIONS ARE WORKING! activation: , (++$_SESSION['test']);
?
bra href=http://localhost:8081/testesession.php;Again 1/a
br
bra href=http://localhost:8081/testesession.php??php echo
session_name().'='.session_id();?Again 2/a
?php
}
echo br . session_id() . brbr;
?

--

Razer Anthom Nizer Rojas Montaño

--
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] Links (A HREF) loosing my session

2008-06-02 Thread Razer Montaño
   Yes, the cookie is being created. I show it in Firefox (Tools |
Options | Privacy | Show Coockies).

   So the Session File, is being created at session.save_path, as
configured in PHP.INI.

:(

Thank you for your response.


2008/6/2 Ted Wood [EMAIL PROTECTED]:

 1. If you're using cookies, there's no need to pass the session name via the
 URL.
 2. Is the cookie being created?

 ~Ted



 On 2-Jun-08, at 11:32 AM, Razer Montaño wrote:

  Hello All, my first time here at list.

  Well, I am with a very weird question, never happened with me,
 always worked fine.

  First of all, I am using WAMP (php 5.2.6, apache 2.2.8, mysql
 5.0.51b), Firefox (All
 cookies allowed), Windows XP SP 3 (I think ;-)... Ah, the
 session.save_path property is pointing
 to a valid path and the session files are been created there. The
 session.cookie_domain I leave
 in blank, as I saw in other forum.

  That code below is not working properly. First time it creates the
 session and show me
 First activation etc etc. If I press CTRL-R (Firefox, but I tested
 in IE too), it gets the same
 session, showing me the next number.

  If I press First Link (Again 1), it creates a NEW SESSION, when It
 would get the old one. And now,
 every CTRL-R is getting me a new session. Only If I go at address bar
 and hit ENTER, I can get
 the very first session created.

  The second link (Again 2) is a test. I saw that, if I set:

 session.use_only_cookies=0
 session.use_trans_sid=1

  this link works fine. But, I don't want to pass Session ID every
 link. I tried to set the properties above
 in other ways, but I get the same behavior: session lost in every link
 click.

  Could someone execute this script, to see if it has some wrong?

  Could you please help me...

   Thank you in advance.

   Razer.

 ?php
 session_start();
 if (!isset($_SESSION['test'])) {
 echo First activation: setting session variable;
 $_SESSION['test'] = 1;
 } else {
 echo SESSIONS ARE WORKING! activation: , (++$_SESSION['test']);
 ?
 bra href=http://localhost:8081/testesession.php;Again 1/a
 br
 bra href=http://localhost:8081/testesession.php??php echo
 session_name().'='.session_id();?Again 2/a
 ?php
 }
 echo br . session_id() . brbr;
 ?

 --
 
 Razer Anthom Nizer Rojas Montaño

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





-- 

Razer Anthom Nizer Rojas Montaño

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



[PHP] Bug in SimpleXML?

2008-06-02 Thread Kyle Browning
I was working on a project for XML Parsing. I came across instances where my
elements were completely missing.

After further Digging into the issue, I found out, that when placing tags
inside of an element with text, SimpleXML (and dom Document) ignore the
added tags, and the text within.

Heres an example.

---ok.xml-
?xml version=1.0 encoding=UTF-8 standalone=yes?
Document
Article
Title pagenum=84 docname=Career Path mar 08Is Your
Face on Facebook? /Title
SubtitleEmploy simple strategies to market your ?profile?
using online social networking./Subtitle
BodyTemp Testing Example of SimpleXML Bug.bIs it a bug
though?/b/Body
FolioTrying to just show Examples/Folio
/Article
/Document
---ok.xml-

---ok.php-
?php

$file = file_get_contents('ok.xml');
$xml = new SimpleXMLElement($file);

print_r($xml);
print $xml-Article-Body-b . \n;
---ok.php-


---output-
SimpleXMLElement Object
(
[Article] = SimpleXMLElement Object
(
[Title] = Is Your Face on Facebook?
[Subtitle] = Employ simple strategies to market your ?profile?
using online social networking.
[Body] = Temp Testing Example of SimpleXML Bug.
[Folio] = Trying to just show Examples
)

)
Is it a bug though?
---output-




Furthermore if I place b tags at the beginning of of the Body tags
ie.

BodybTesting/bTemp Testing Example of SimpleXML Bug.bIs it a bug
though?/b/Body

The text between the /b and b is ignored and is output as follows..

---output---
SimpleXMLElement Object
(
[Article] = SimpleXMLElement Object
(
[Title] = Is Your Face on Facebook?
[Subtitle] = Employ simple strategies to market your ?profile?
using online social networking.
[Body] = SimpleXMLElement Object
(
[b] = Array
(
[0] = Testing
[1] = Is it a bug though?
)

)

[Folio] = Trying to just show Examples
)

)
Testing
---output---

The above output is using ok.php.

Is this working as intended?


[PHP] Storing £ (pound sterling) sign and displaying in HTML email

2008-06-02 Thread Graham Cossey
Could someone please point me in the right direction here please?

I have a form textarea field (submitted using POST) that accepts free
text that will include the likes of '£' (pound sterling symbol) that
is written to a MySql database and later retrieved to output into an
HTML email.

I have been experimenting with htmlentities, htmlspecialchars and
addslashes but still have the problem whereby I get ACirc;
preceeding the pound;

Could someone kindly suggest what I'm doing wrong and what function(s)
I should be looking into?

Thanks

-- 
Graham

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



Re: [PHP] Bug in SimpleXML?

2008-06-02 Thread Nathan Nobbe
On Mon, Jun 2, 2008 at 3:12 PM, Kyle Browning [EMAIL PROTECTED] wrote:

 I was working on a project for XML Parsing. I came across instances where
 my
 elements were completely missing.

 After further Digging into the issue, I found out, that when placing tags
 inside of an element with text, SimpleXML (and dom Document) ignore the
 added tags, and the text within.


thats a known limitation. i have written a workaround in some code for a
personal project, but it cant be great for performance.  anyway, another
option is to use DOM.


 ---output-
 SimpleXMLElement Object
 (
[Article] = SimpleXMLElement Object
(
[Title] = Is Your Face on Facebook?
[Subtitle] = Employ simple strategies to market your ?profile?
 using online social networking.
[Body] = Temp Testing Example of SimpleXML Bug.
[Folio] = Trying to just show Examples
)

 )


are you using print_r() or var_dump() to generate this output?  fyi, those
are explicitly not supported by simplexml.

-nathan


Re: [PHP] Bug in SimpleXML?

2008-06-02 Thread Nathan Nobbe
On Mon, Jun 2, 2008 at 4:32 PM, Kyle Browning [EMAIL PROTECTED] wrote:

 I used both print_r and var_dump.
 Whats supported for ultimate nesting prints of values and keys?, or in
 objects words, properties and values.


cc'ng the list again..

well var_dump() and print_r() just arent supported for simplexml, per the
manual,

http://php.oregonstate.edu/manual/en/function.simplexml-element-attributes.php

*Note*: SimpleXML has made a rule of adding iterative properties to most
methods. They cannot be viewed using
var_dump()http://php.oregonstate.edu/manual/en/function.var-dump.phpor
anything else which can examine objects.

basically, youre best bet w/ simplexml is asXML() ;)

-nathan


Re: [PHP] Storing £ (pound sterling) sign and displaying in HTML email

2008-06-02 Thread Richard Heyes

Graham Cossey wrote:

Could someone please point me in the right direction here please?

I have a form textarea field (submitted using POST) that accepts free
text that will include the likes of '£' (pound sterling symbol) that
is written to a MySql database and later retrieved to output into an
HTML email.

I have been experimenting with htmlentities, htmlspecialchars and
addslashes but still have the problem whereby I get ACirc;
preceeding the pound;

Could someone kindly suggest what I'm doing wrong and what function(s)
I should be looking into?


You could just store the amount numerically (and optionally the currency 
if need be) and just put the pound; in your HTML file.


--
  Richard Heyes

 In Cambridge? Employ me
http://www.phpguru.org/cv

++
| Access SSH with a Windows mapped drive |
|http://www.phpguru.org/sftpdrive|
++

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



Re: [PHP] Storing £ (pound sterling) sign and displaying in HTML email

2008-06-02 Thread James Dempster
This is most likely a character encoding issue. Check that the html encoding
is set to the same type as what your storing it as in mysql.

/James

On Mon, Jun 2, 2008 at 10:26 PM, Graham Cossey [EMAIL PROTECTED]
wrote:

 Could someone please point me in the right direction here please?

 I have a form textarea field (submitted using POST) that accepts free
 text that will include the likes of '£' (pound sterling symbol) that
 is written to a MySql database and later retrieved to output into an
 HTML email.

 I have been experimenting with htmlentities, htmlspecialchars and
 addslashes but still have the problem whereby I get ACirc;
 preceeding the pound;

 Could someone kindly suggest what I'm doing wrong and what function(s)
 I should be looking into?

 Thanks

 --
 Graham

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




Re: [PHP] Avoid object twice

2008-06-02 Thread Yui Hiroaki
if I delete
$obj=new my(Hello);
$obj-buff();

I can not show Hello.

I would like to see hello one time only.

Regards,
Yui
2008/6/2 Scott McNaught [Synergy 8] [EMAIL PROTECTED]:
 Try removing from a.php the lines:

 $obj=new my(Hello);
 $obj-buff();

 I think this will achieve what you want.

 -Original Message-
 From: Yui Hiroaki [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 02, 2008 11:01 PM
 To: php-general@lists.php.net
 Subject: [PHP] Avoid object twice

 Please take a look at code.

 a.php

 $obj=new my(Hello);
 $obj-buff();


 Class my{

 private $word;
 function __construct($getword){
   $this-word=$getword;
 }
 public function buff(){
 echo $this-word.br /;
 }
 --


 -b.php---

 function __autoload($class_name) {
include_once $class_name . '.php';
 }


 $objref=new my(Good);
 $objref-buff();
 



 I get an Echo;

 Good
 Hello
 Hello

 I do not need to get Hello twice.

 When I b.php , $obj=new my(Hello) is loaded.


 Do you have any adia to avoid load $obj in a.php twice?

 Regards,
 Yui

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


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



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



[PHP] question, about mysql query

2008-06-02 Thread LKSunny
two table, tablea and tableb
tablea
uid, col1, col2, col3
1,xx, xx, xx
2,xx, xx, xx
3,xx, xx, xx
tableb
id, uid, col1, firstdata
1, 1, xx, 1
2, 2, xx, 0
3, 2, xx, 0
4, 1, xx, 0

i want query tablea, and join tableb, uid is associate, ok LEFT JOIN 
`tableb` b ON a.uid = b.uid, and than i want tableb firstdata=1 or tableb 
no associate uid b.firstdata=1 OR b.uid IS NULL, by the time all ok, but i 
want add one case, if tableb firstdata all is 0, result one row, like b.uid 
IS NULL, i don't know how to

i want result is all tablea data no double, tableb one case firstdata is 1 
(one uid in tableb just one row possible is firstdata=1), or no row in 
tableb, or all firstdata = 0

Thank You Very Much !!

This query can't
SELECT a.*, b.* FROM `tablea` a LEFT JOIN `tableb` b ON a.uid = b.uid WHERE 
(b.firstdata=1 OR b.firstdata=0 OR b.uid IS NULL) 



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