[PHP] calling PHP self with a text link

2005-09-02 Thread Ross
Hi,

I want call the current page and set a variable (or call a function)

 a href=index.php?variable=bananas -this works but means I have to change 
it for every page name

I have tried

a href=? $PHP_SELF(); ?this is the link/a

Only works within a form tag.

Any ideas - no javascript solutions that is what I am trying to avoid.


R.

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



Re: [PHP] calling PHP self with a text link

2005-09-02 Thread Jasper Bryant-Greene

Ross wrote:

I want call the current page and set a variable (or call a function)

 a href=index.php?variable=bananas -this works but means I have to change 
it for every page name


I have tried

a href=? $PHP_SELF(); ?this is the link/a


What's wrong with

a href=?php print($_SERVER['PHP_SELF']); ??name=vallink/a

By the way, you can't trust PHP_SELF, so you might want to escape or 
validate that variable. See [1], mentioned recently by Chris Shiflett on 
this list.


[1] http://blog.phpdoc.info/archives/13-XSS-Woes.html
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

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



[PHP] Re: calling PHP self with a text link

2005-09-02 Thread Ross
a href=? echo $PHP_SELF,'?','action=something' ?do somehthing/a

this seems to work but can someone explain the syntax to me what does a '?' 
and a ',' do in PHP?

 I thought you joined strings with a full stop '.' (a period if you are from 
the US).


R.

Ross [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi,

 I want call the current page and set a variable (or call a function)

  a href=index.php?variable=bananas -this works but means I have to 
 change it for every page name

 I have tried

 a href=? $PHP_SELF(); ?this is the link/a

 Only works within a form tag.

 Any ideas - no javascript solutions that is what I am trying to avoid.


 R. 

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



Re: [PHP] Re: calling PHP self with a text link

2005-09-02 Thread Jasper Bryant-Greene

Ross wrote:

a href=? echo $PHP_SELF,'?','action=something' ?do somehthing/a

this seems to work but can someone explain the syntax to me what does a '?' 
and a ',' do in PHP?


 I thought you joined strings with a full stop '.' (a period if you are from 
the US).


You are passing multiple parameters to the 'echo' language construct. 
The '?' is just a string, and is interpreted just like any other string 
in PHP. That will print out the value of $PHP_SELF followed by 
?action=something


By the way, you really shouldn't have register_globals turned on. And 
you also really shouldn't top-post.


--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

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



[PHP] 400 error

2005-09-02 Thread Seth Rainsdon
when I try to access anything.php it tells me HTTP 400 bad request I have no 
clue how to fix this
Seth

[PHP] intval() vs. (int)

2005-09-02 Thread Thomas

Hi,

On checking form fields that they are of type int, what is best to use:
intval() or type casting (int)?
In terms of speed, would (int) not be better, because we save a function
call (especially on very large sql statements)?

Thanks.

Thomasx`


SPIRAL EYE STUDIOS 
P.O. Box 37907, Faerie Glen, 0043

Tel: +27 12 362 3486
Fax: +27 12 362 3493 
Mobile: +27 82 442 9228
Email: [EMAIL PROTECTED]
Web: www.spiraleye.co.za 

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



Re: [PHP] Re: calling PHP self with a text link

2005-09-02 Thread Mark Rees
 Ross wrote:
  a href=? echo $PHP_SELF,'?','action=something' ?do somehthing/a
 
  this seems to work but can someone explain the syntax to me what does a
'?'
  and a ',' do in PHP?
 
   I thought you joined strings with a full stop '.' (a period if you are
from
  the US).


There was a long thread on this only yesterday, under the heading String
format problem. The online archives will carry it shortly, if they don't
already, and it is well worth a read, especially the post by Satyam


 You are passing multiple parameters to the 'echo' language construct.
 The '?' is just a string, and is interpreted just like any other string
 in PHP. That will print out the value of $PHP_SELF followed by
 ?action=something

 By the way, you really shouldn't have register_globals turned on. And
 you also really shouldn't top-post.

 --
 Jasper Bryant-Greene
 Freelance web developer
 http://jasper.bryant-greene.name/

 If you find my advice useful, please consider donating to a poor
 student! You can choose whatever amount you think my advice was
 worth to you. http://tinyurl.com/7oa5s

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



[PHP] Re: 400 error

2005-09-02 Thread Mark Rees
Seth Rainsdon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
when I try to access anything.php it tells me HTTP 400 bad request I have no
clue how to fix this
Seth

Nor do we, yet.

Which OS?
Which web server?
What have you tried so far?
Has it just broken, or did it never work?

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



Re: [PHP] Re: calling PHP self with a text link

2005-09-02 Thread Jasper Bryant-Greene

Mark Rees wrote:

Ross wrote:

I thought you joined strings with a full stop '.' (a period if you are


from


the US).




There was a long thread on this only yesterday, under the heading String
format problem. The online archives will carry it shortly, if they don't
already, and it is well worth a read, especially the post by Satyam


That thread was very interesting, and while Satyam's advice was very 
true and thought-provoking, you must remember (as one reply mentioned) 
that you are talking about optimisations that save you about 0.1ms or so...


--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

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



[PHP] Php and postfix error [EMAIL PROTECTED]: Sender address rejected: Domain not found

2005-09-02 Thread choksi
Hi All,
 I have php running over Apache on a debian box. I am tryin to use the php 
mail function. When i run this command from console (php email.php) it will 
run and the mail is delivered as it will get the from username from the 
postfix config file but when i run the command from browser it runs through 
apache it uses the apache user nobody and give me error. 
 Can some help with how can i change the from username.
  Sep 2 12:00:11 localhost postfix/smtp[17821]: 3B83A52CF6: to=
[EMAIL PROTECTED], said: 450 [EMAIL PROTECTED]: Sender 
address rejected: Domain not found (in reply to RCPT TO command))
-- 
Rgds
Choksi


[PHP] comparing references

2005-09-02 Thread Stanislav Kuhn
Hi guys,

quick question

I need to find out if two different variables are pointing to same place...
example:
$var1 = my_array;
$var2 = my_array;

I need to do:
if ($var1 === $var2)

but I don't want to compare it by data, array is gonna be quite big and 
condition used in loop quite often.

I need something like
if ($var1 === $var2)
but this doesn't work...

any idea how to compare references? or how to get memory place of variable as 
string to be able compare if they are pointing to same place in memory?

Thanks a lot.
Stan.

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



Re: [PHP] Re: Tracking a mobile phone

2005-09-02 Thread Angelo Zanetti
Marcus Bointon wrote:

 On 18 Jul 2005, at 20:56, Sebastian wrote:

 The phone would have to have GPS capabilities..


 Not true. The network knows what cell the phone is in(and cells are 
 pretty small in cities), and it knows where the cell is. This is the 
 mechanism that's used for location dependent services (especially 
 directions and local maps) that are currently being pushed in the UK.

 Whether you can get access to that information is another matter, 
 especially internationally.

 Marcus



yeah Marcus is correct. the carriers will have that info but probably
wont allow you to see it. But in theory it should work.

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



Re: [PHP] Re: Tracking a mobile phone

2005-09-02 Thread Jasper Bryant-Greene

Angelo Zanetti wrote:

Marcus Bointon wrote:


On 18 Jul 2005, at 20:56, Sebastian wrote:


The phone would have to have GPS capabilities..


Not true. The network knows what cell the phone is in(and cells are 
pretty small in cities), and it knows where the cell is. This is the 
mechanism that's used for location dependent services (especially 
directions and local maps) that are currently being pushed in the UK.


Whether you can get access to that information is another matter, 
especially internationally.




yeah Marcus is correct. the carriers will have that info but probably
wont allow you to see it. But in theory it should work.



I'm not sure why this two-month-old topic has been dredged up, but I 
believe that if you can install a custom Java (or similar) app on the 
mobile then you can (at least in NZ) easily find out the name of the 
cell that the phone is in (for example Cathedral Square here in 
Christchurch, New Zealand) but I'm not so sure about location. And some 
cell names are pretty vague (Christchurch East).


Anyway, this is a bit OT now...

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

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



[PHP] Problem with new extension

2005-09-02 Thread George Pitcher
Hi,

I think that I may have messed up my php (v5.0.1).

Earlier today, I downloaded the most recent extensions and replaced my
php_pdf.dll (aug 2004)with the most recent (Mar 2005) - set the permissions
to be the same as the other extensions - then restarted the machine.

I'm now getting an error:

PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_pdf.dll' - The
specified procedure could not be found.

I'm on WinXP Pro SP2 and used the pdf extension quite a bit - but it didn't
cover things such as 'PDF_create_textflow'.

Can anyone suggest a workround, or will I need to reinstall php using the
most recent version?

MTIA

George

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



[PHP] exec() may not be safe

2005-09-02 Thread Ilja Polivanovas

Hi guys,

When running
?php echo `dir c:`; ?

On Windows 98SE, apache 1.3, PHP4, client get such thing in apache's  
error.log .


[Fri Sep 02 09:33:21 2005] [warn] exec() may not be safe
[Fri Sep 02 09:34:26 2005] [warn] exec() may not be safe
[Fri Sep 02 09:35:31 2005] [warn] exec() may not be safe

Any ideas why? Maybe safe_mode or something?

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

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



[PHP] How to force a variable to be a custom object?

2005-09-02 Thread Alex Gemmell

Hi all,

Just a quickie today: I was wondering if I can declare a Class variable 
as a certain type of object.  I'm using PHP 4 by the way.


For example, if my class looks like this:

class myClass {

var $object;

function someFunction() {
// code, code, code 
}
}

Is there anyway I can limit the variable $object to be of a particular 
Class of object that I have made.  Something like:


class myClass {

var $object *type=myOtherClass*;

function someFunction() {
// code, code, code 
}
}

Yes, yes, I know *type=myOtherClass* isn't PHP code, but do you see 
what I'm getting at?  How would I achieve this?  Is it even possible?


And would I then also have to include/require the path to the 
myOtherClass definition script in the myClass definition?

e.g.

class myClass {
*require_once('path/to/myOtherClass.php');*

var $object *type=myOtherClass*;

function someFunction() {
// code, code, code 
}
}

Any ideas folks?

All the best,

Alex

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



[PHP] Re: How to force a variable to be a custom object?

2005-09-02 Thread Norbert Wenzel

Alex Gemmell wrote:
Just a quickie today: I was wondering if I can declare a Class variable 
as a certain type of object.  I'm using PHP 4 by the way.


I don't know if this works in PHP4, but I would suggest to clear this in 
your constructur. But I don't know if this is always called in PHP4.


class myClass {

var $object;

myClass() {

$this-object = new OtherObject();

}

}

This isn't really forced, since you could change $object from outside 
the class. If there is a way you should declare $object private. That's 
not stylish, but I guess it works.


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



[PHP] Re: How to force a variable to be a custom object?

2005-09-02 Thread Alex Gemmell

Norbert Wenzel wrote:
I don't know if this works in PHP4, but I would suggest to clear this in 
your constructur. But I don't know if this is always called in PHP4.


class myClass {

var $object;

myClass() {

$this-object = new OtherObject();


}
}

This isn't really forced, since you could change $object from outside 
the class. If there is a way you should declare $object private. That's 
not stylish, but I guess it works.


I think PHP5 deals with private/public variables and all that gaff. 
PHP4 doesn't quite offer OO that well, but good enough if you strictly 
use your Class message interfaces!


Thanks for the help Norbert.  You're right - that would pretty much do 
the trick.


Alex

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



[PHP] Re: Php and postfix error [EMAIL PROTECTED]: Sender address rejected: Domain not found

2005-09-02 Thread JamesBenson

http://php.net/mail



choksi wrote:

Hi All,
 I have php running over Apache on a debian box. I am tryin to use the php 
mail function. When i run this command from console (php email.php) it will 
run and the mail is delivered as it will get the from username from the 
postfix config file but when i run the command from browser it runs through 
apache it uses the apache user nobody and give me error. 
 Can some help with how can i change the from username.

  Sep 2 12:00:11 localhost postfix/smtp[17821]: 3B83A52CF6: to=
[EMAIL PROTECTED], said: 450 [EMAIL PROTECTED]: Sender 
address rejected: Domain not found (in reply to RCPT TO command))


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



Re: [PHP] 400 error

2005-09-02 Thread John Nichel

Seth Rainsdon wrote:

when I try to access anything.php it tells me HTTP 400 bad request I have no 
clue how to fix this
Seth


And yet, unlike us, you have access to the code.

Please turn off your request for return receipts when posting to a 
mailing list.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Re: Php and postfix error [EMAIL PROTECTED]: Sender address rejected: Domain not found

2005-09-02 Thread choksi
Thanks
 This is sorted now.
 Rgds
Dhaval

 On 02/09/05, JamesBenson [EMAIL PROTECTED] wrote: 
 
 http://php.net/mail
 
 
 
 choksi wrote:
  Hi All,
  I have php running over Apache on a debian box. I am tryin to use the 
 php
  mail function. When i run this command from console (php email.php) it 
 will
  run and the mail is delivered as it will get the from username from the
  postfix config file but when i run the command from browser it runs 
 through
  apache it uses the apache user nobody and give me error.
  Can some help with how can i change the from username.
  Sep 2 12:00:11 localhost postfix/smtp[17821]: 3B83A52CF6: to=
  [EMAIL PROTECTED], said: 450 [EMAIL PROTECTED]: 
 Sender
  address rejected: Domain not found (in reply to RCPT TO command))
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Rgds
Choksi


Re: [PHP] intval() vs. (int)

2005-09-02 Thread Philip Hallstrom

On checking form fields that they are of type int, what is best to use:
intval() or type casting (int)?
In terms of speed, would (int) not be better, because we save a function
call (especially on very large sql statements)?


Time it.

On an 800mhz box doing absolutely nothing else (it's just sitting there, 
honest :) a script which reads 100,000 16byte strings from a testfile 
(composed of a bunch of tar balls put together just to get something 
random) and then doing this:


- loop through array doing $x = $array[$i] just to read it all in once.
- loop through array doing $x = intval($array[$i])
- loop through array doing $x = (int) $array[$i]

yields this (in seconds).

nothing = 0.3619658946991
intval  = 0.60399794578552
(int)   = 0.48065304756165

So, for 100,000 random 16 byte strings you're saving 0.12 seconds or 
0.012 per iteration...


So, it probably doesn't really matter :)

-philip

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



Re: [PHP] Making Text [not the background] transparent

2005-09-02 Thread Joe Wollard

Graham:

Unless you need a specific font you could just do this by using pure  
CSS. If you do, the image layer would be behind the text layer. The  
text layer can be set to any color and (in most every modern browser)  
any alpha level.
div style=filter: alpha(opacity=90); opacity:0.9; background- 
color:transparent; color:#000;This is some translucent text/div


good luck!
-Joe


On Aug 31, 2005, at 1:09 PM, Graham Anderson wrote:


How do I make the text transparent over the background ?

In my web app, I want to to put a layer BEHIND the image to control  
the color of the php-created text

So, the layer color in the web app shows thru the text php creates
Would like to use  alpha transparency so the color looks clean :)

how would I amend the below script to do this ?

many thanks
g

header(Content-type:.$mime); //$mime = image/png
$im = imagecreatetruecolor(200, 16);  //use to draw a text box

imageAlphaBlending($im, true);
imageSaveAlpha($im, true);
$left= 5; //add a little pad to the left edge
$color = imagecolorallocate($im, 255, 255, 255);
$fontSize = 11;

// choose a font
$fontPath = /home/siren/fonts/;
$defaultFont = tahomabd.ttf;
$fontName = arial.ttf;
$font = $fontPath.$fontName ;
if (! file_exists($font)) {
   $font = $fontPath.$defaultFont ;
}

$text= background color shows through the text // Add the text
imagettftext($im, $fontSize, 0, 10, 13, $color, $font, $text);
imagepng($im);
readfile($im);
imagedestroy($im);

--
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] Session expires randomly

2005-09-02 Thread Mauricio Pellegrini
Hi, I have this problem , When I start a Session everything seems to be
ok but sometimes with no reason the session vanishes.

I'm using PHP 4.3.4 as a Apache module. 
Apache version is 1.3 under Suse Linux 8.2

All settings are default , I mean session_cache_expire is 180 min.
I understand that this setting should make sessions last for at least 3
hours but in my case it seems not to be true since the real duration
varies from 20 minutes to an hour

I use session_start()
and then on any routine I verify the existence of certain session
variables.

Is the server expiring the session automatically for some reason?

Thanks
Mauricio

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



Re: [PHP] conditional statement inside while loop?

2005-09-02 Thread z a p a n
Murray, Miles, Cristea  Jim: Thanks a lot, I got it figured out.  Peace, -z

 Hello everyone,
 
 I'm using a while loop to display a list of people contained in my
 database.
 I'd like to assign different font colors to each depending on which city
 they're from, but I can't seem to get an if/elseif/else statement to work
 inside the while loop.  Is there another way to do this?
 
 Hi Zach,
 
 There should be no reason why you can't use if/elseif/else within your while
 loop. The fact that you're experiencing problems strongly suggests that you
 have a combination of conditionals in your if/elseif/else that is
 effectively ignoring the data being returned from your recordset.
 
 It may be something as simple as using = in your if statement instead of
 == (ie, so the conditional is always true, because you're using the
 assignment = operator instead of the evaluative == operator), or a
 combination of conditions, each of which are accurate but which when placed
 together cause problems.
 
 To get an idea where your problem is occurring, try going from simple to
 complex. Start with something like the following pseudo-code:
 
 while ($row = get_data_from_your_recordset){
 if (strlen($row['a_recordset_field'])  0){
 echo Data found:  . $row['a_recordset_field'] . br /;
 } else {
 echo Data not foundbr /;
 }
 }
 
 The assumption being made above is that you will be using a field from your
 recordset that contains data that is ordinarily longer than 0 bytes.
 
 Doing the above will demonstrate that at the very least you are returning a
 valid recordset and that conditional statements work within while loops. If
 even this fails, then check the SQL that is being used to populate the
 recordset, and make sure that you are using the same field names in your PHP
 code as is being returned from the table by the recordset.
 
 Once the above is working, add back in your actual conditional(s), one by
 one. You're looking for the point where 'working' code becomes 'broken'
 code. Most of the time when you debug in this way it becomes obvious why the
 code isn't behaving the way you expect it to. If there's still any confusion
 at that point, at least you will be in a better position to supply actual
 code to the list, so we can work out the real problem.
 
 Much warmth,
 
 Murray
 ---
 Lost in thought...
 http://www.planetthoughtful.org


-- 

fourthcity 2005 ; slow yr roll. --- http://www.fourthcity.net/


 quick links:
 http://www.fourthcity.net/   [fct]
 http://www.zapan.net/[  zapan]
 http://www.laptopbattle.org/ [ battle]
 http://www.postermidget.com/ [ midget]


  +
   +
 +
 + +
 +
 +


 much love! from the fourthcity studios  

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



[PHP] deleting files on Windows...permissions issue

2005-09-02 Thread James
I have a php script that can delete files in a folder but it can not 
delete the folder itself.


I've tried to play around with permissions on the Windows box and 
couldn't set it to something that would allow the PHP script to 
delete the folder.  I think I even tried to set the permissions for 
the folder's parent folder.


This PHP script is called from a browser.

What user does the PHP script run as when served up by Apache on 
Windows?   (once I have this answer, I can set the owner of the 
folder to this user and give that a shot)

--
-James

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



Re: [PHP] session cookies

2005-09-02 Thread Chris Shiflett

Rasmus Lerdorf wrote:

That's a bit misleading. The HTTP response headers are sent a soon
as you output something from your script (calling header() or
setcookie() doesn't count as output, so you can set all the headers
and cookies you want).


They're sent to Apache, but that doesn't mean anything is necessarily 
sent to the client, right? I guess I should have pointed out that this 
depends on a few things, such as whether the response is sent with:


Transfer-Encoding: chunked

or

Content-Length: ...

Common sense tells me that Apache can't provide a reliable 
Content-Length header until my script completes. :-)



 And the browsers tend to redirect right away once they get this
header.


I would find that very surprising. Maybe I'll experiment. If I 
understand you correctly, you're suggesting that a browser will request 
the new URL before receiving the previous response in its entirety. Even 
assuming a chunked transfer encoding, that seems weird.


Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



Re: [PHP] Ping : Chris Boget

2005-09-02 Thread John Nichel

John Nichel wrote:

How are you weathering the storm?  I hope all is well there.



Just heard that Chris is safe.  Don't know where he is as of yet, but he 
did leave before the storm.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Session expires randomly

2005-09-02 Thread Philip Hallstrom

On Fri, 2 Sep 2005, Mauricio Pellegrini wrote:


Hi, I have this problem , When I start a Session everything seems to be
ok but sometimes with no reason the session vanishes.

I'm using PHP 4.3.4 as a Apache module.
Apache version is 1.3 under Suse Linux 8.2

All settings are default , I mean session_cache_expire is 180 min.
I understand that this setting should make sessions last for at least 3
hours but in my case it seems not to be true since the real duration
varies from 20 minutes to an hour

I use session_start()
and then on any routine I verify the existence of certain session
variables.

Is the server expiring the session automatically for some reason?


Just a thought... normal file based sessions are stored in /tmp.  Maybe 
your server has some process that is cleaning out files in /tmp that 
haven't been accessed in X amount of time..


Crazy thought, but maybe that's it...

Try some tests... start a session, load a page, and have the page reload 
itself every minute (being sure to access/modify the session).  Put 
some code in there so as soon as the session goes away it spits out the 
date/time and stops so you can see how long it lasted. Let that run for 
over an hour.  See what happens.


Try another one, but only reload the page every 20-30 minutes or 
something...


good luck!

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



Re: [PHP] session cookies

2005-09-02 Thread Philip Hallstrom



Rasmus Lerdorf wrote:

That's a bit misleading. The HTTP response headers are sent a soon
as you output something from your script (calling header() or
setcookie() doesn't count as output, so you can set all the headers
and cookies you want).


They're sent to Apache, but that doesn't mean anything is necessarily sent to 
the client, right? I guess I should have pointed out that this depends on a 
few things, such as whether the response is sent with:


Transfer-Encoding: chunked

or

Content-Length: ...

Common sense tells me that Apache can't provide a reliable Content-Length 
header until my script completes. :-)


That's true... it can't... and doesn't... at least not all the time...

---
% telnet localhost 8004
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /phpinfo.php HTTP/1.0

HTTP/1.1 200 OK
Date: Fri, 02 Sep 2005 17:12:10 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4
X-Powered-By: PHP/4.3.4
Connection: close
Content-Type: text/html

(phpinfo output follows)
---

-philip

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



Re: [PHP] Session expires randomly

2005-09-02 Thread Kirk . Johnson
 On Fri, 2 Sep 2005, Mauricio Pellegrini wrote:
 
  Hi, I have this problem , When I start a Session everything seems to 
be
  ok but sometimes with no reason the session vanishes.
 
  All settings are default , I mean session_cache_expire is 180 min.
  I understand that this setting should make sessions last for at least 
3
  hours but in my case it seems not to be true since the real duration
  varies from 20 minutes to an hour

I think the parameter you need to look at in php.ini is 
session.gc_maxlifetime. It sets the session lifetime, not 
session_cache_expire. The default lifetime is probably 1440 seconds, 
roughly 20 minutes, so the behavior you are seeing is completely normal - 
it's all working as it should.

Kirk

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



Re: [PHP] session cookies

2005-09-02 Thread Rasmus Lerdorf
Chris Shiflett wrote:
 Rasmus Lerdorf wrote:
 
 That's a bit misleading. The HTTP response headers are sent a soon
 as you output something from your script (calling header() or
 setcookie() doesn't count as output, so you can set all the headers
 and cookies you want).
 
 
 They're sent to Apache, but that doesn't mean anything is necessarily
 sent to the client, right? I guess I should have pointed out that this
 depends on a few things, such as whether the response is sent with:
 
 Transfer-Encoding: chunked
 
 or
 
 Content-Length: ...
 
 Common sense tells me that Apache can't provide a reliable
 Content-Length header until my script completes. :-)

Which is why dynamic requests typically do not have a content-length
header.  Unless you explicitly turn on output buffering, the headers are
sent as soon as you send your first real output.  The end of the request
has nothing to do with it.

  And the browsers tend to redirect right away once they get this
 header.
 
 I would find that very surprising. Maybe I'll experiment. If I
 understand you correctly, you're suggesting that a browser will request
 the new URL before receiving the previous response in its entirety. Even
 assuming a chunked transfer encoding, that seems weird.

Consider yourself surprised then, that is how things work.

-Rasmus

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



Re: [PHP] deleting files on Windows...permissions issue

2005-09-02 Thread Gustav Wiberg

Hi there!

Are you using rmdir?

http://se2.php.net/manual/en/function.rmdir.php

/G
@varupiraten.se

- Original Message - 
From: James [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Friday, September 02, 2005 6:45 PM
Subject: [PHP] deleting files on Windows...permissions issue


I have a php script that can delete files in a folder but it can not 
delete the folder itself.


I've tried to play around with permissions on the Windows box and 
couldn't set it to something that would allow the PHP script to 
delete the folder.  I think I even tried to set the permissions for 
the folder's parent folder.


This PHP script is called from a browser.

What user does the PHP script run as when served up by Apache on 
Windows?   (once I have this answer, I can set the owner of the 
folder to this user and give that a shot)

--
-James

--
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] session cookies

2005-09-02 Thread Chris Shiflett

Chris Shiflett wrote:

 And the browsers tend to redirect right away once they get this
 header.

I would find that very surprising. Maybe I'll experiment.


I tested this with Firefox 1.0.4, Firefox 1.0.6, and Safari 1.3. None of 
them request the new URL before receiving the previous response in its 
entirety. Maybe Internet Explorer does. :-)


Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



Re: [PHP] session cookies

2005-09-02 Thread Rasmus Lerdorf
Chris Shiflett wrote:
 Chris Shiflett wrote:
 
  And the browsers tend to redirect right away once they get this
  header.

 I would find that very surprising. Maybe I'll experiment.
 
 
 I tested this with Firefox 1.0.4, Firefox 1.0.6, and Safari 1.3. None of
 them request the new URL before receiving the previous response in its
 entirety. Maybe Internet Explorer does. :-)

Then you have configured your server to always turn on output buffering
or your test script is bad.

Try this:

?php
header(Location: http://www.php.net;);
$fp = fopen(/tmp/log.txt,w);
for($i=0; $i100; $i++) {
$str = Count $i\n;
echo $str;
fputs($fp, $str);
}
?

What do you think you will see both on your screen and in /tmp/log.txt?

-Rasmus

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



[PHP] Content - strip...

2005-09-02 Thread Gustav Wiberg

Hi there!

Anyone that has an easy solution to this?

I have a string filled with content. A lot of content is before Jumping Jack 
flash


I want the $content - string to start at Jumping Jack flash

Is there any smart way of doing this?

/G
@varupiraten.se

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



Re: [PHP] session cookies

2005-09-02 Thread Chris Shiflett

Rasmus Lerdorf wrote:

Then you have configured your server to always turn on output
buffering or your test script is bad.


I don't think it's either, but I'll let you decide. I tried a new test 
with your code and some slight modifications:


?php

header('Location: http://www.php.net/');
$fp = fopen('/tmp/log.txt', 'w');
for ($i = 0; $i  30; $i++)
{
$str = Count $i\n;
echo $str;
fputs($fp, $str);
sleep(1);
flush();
}

?

Basically, I'm only looping 30 times, but I'm sleeping for a second and 
flushing the buffer each time. The result is a response that looks 
something like this:


HTTP/1.1 302 Found
Date: Fri, 02 Sep 2005 18:12:02 GMT
Server: Apache/1.3.33 (Debian GNU/Linux)
Location: http://www.php.net/
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

8
Count 0

8
Count 1

8
Count 2

...

9
Count 27

9
Count 28

9
Count 29

0

This result is not buffered on the server by PHP or Apache - each of 
these chunks are received about one second apart, and the headers are 
received barely more than one second after the request is sent (only 
because I didn't flush before the first sleep):


[2005-09-02 14:12:07] [+0.004467 seconds] HTTP Server: socket_read() ...
[2005-09-02 14:12:08] [+1.131124 seconds]  Headers Received
[2005-09-02 14:12:08] [+0.002197 seconds]  Transfer-Encoding [chunked]
[2005-09-02 14:12:08] [+0.004580 seconds]  chunk_length [8]
[2005-09-02 14:12:09] [+1.013278 seconds]  chunk_length [8]
[2005-09-02 14:12:10] [+0.972697 seconds]  chunk_length [8]

Of the three browsers I tested, none sent a request for 
http://www.php.net/ until they had received the very last byte of the 
response - the 0 indicating no more content. This happens a little more 
than 30 seconds after the request is sent and a little more than 29 
seconds after the HTTP response line and headers (including Location) 
are received.


Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



Re: [PHP] session cookies

2005-09-02 Thread Rasmus Lerdorf
Chris Shiflett wrote:
 Rasmus Lerdorf wrote:
 
 Then you have configured your server to always turn on output
 buffering or your test script is bad.
 
 
 I don't think it's either, but I'll let you decide. I tried a new test
 with your code and some slight modifications:

Why modify my test?  What did you see in log.txt from my version and on
your screen?  There are buffering issues on both ends here, but my
original test describes shows exactly how browsers will redirect long
before the end of a request.  Your test rewrite simply makes sure there
is less output.

-Rasmus

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



Re: [PHP] Content - strip...

2005-09-02 Thread Philip Hallstrom

Hi there!

Anyone that has an easy solution to this?

I have a string filled with content. A lot of content is before Jumping Jack 
flash


I want the $content - string to start at Jumping Jack flash

Is there any smart way of doing this?


Use strstr() to find the first occurence of Jumping Jack flash.
Then use substr() to extract from that point to the end of the string into 
a new string.


http://us2.php.net/strstr
http://us2.php.net/substr

-philip

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



Re: [PHP] intval() vs. (int)

2005-09-02 Thread Rory Browne
(int) seems to be faster, but not by an awful lot. Personally however
if its a case of typing five characters (int) and saving a little exec
time, or typing 8 and losing a little, then I'd perfer to go with the
five an save the exec time.

I think I remember hearing about some other consequence with using the
intval function call, but can't remember what it was.

On 9/2/05, Philip Hallstrom [EMAIL PROTECTED] wrote:
  On checking form fields that they are of type int, what is best to use:
  intval() or type casting (int)?
  In terms of speed, would (int) not be better, because we save a function
  call (especially on very large sql statements)?
 
 Time it.
 
 On an 800mhz box doing absolutely nothing else (it's just sitting there,
 honest :) a script which reads 100,000 16byte strings from a testfile
 (composed of a bunch of tar balls put together just to get something
 random) and then doing this:
 
 - loop through array doing $x = $array[$i] just to read it all in once.
 - loop through array doing $x = intval($array[$i])
 - loop through array doing $x = (int) $array[$i]
 
 yields this (in seconds).
 
 nothing = 0.3619658946991
 intval  = 0.60399794578552
 (int)   = 0.48065304756165
 
 So, for 100,000 random 16 byte strings you're saving 0.12 seconds or
 0.012 per iteration...
 
 So, it probably doesn't really matter :)
 
 -philip
 
 --
 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] session cookies

2005-09-02 Thread Chris Shiflett

Rasmus Lerdorf wrote:

Why modify my test?


Because it has less delay. Thus, it's more difficult to tell if the 
browser is requesting the new URL before or after receiving the entire 
response. My script is essentially the same thing, but the script takes 
30 seconds to execute. It makes the distinction very clear.


The addition of flush() forces the chunked response. You can remove that 
if your server uses chunked transfer encoding without it.



What did you see in log.txt from my version and on your screen?


You would see the output Count0\nCount1\n... in the log and the PHP 
web site in the browser. I'm not sure how that's relevant. No browser is 
going to render content from a 302 response, but that doesn't prove that 
it won't wait for it.


For the browsers I've tested (including Internet Explorer now), the new 
request (for http://www.php.net/) is not sent until after the previous 
response is received in its entirety.



There are buffering issues on both ends here, but my original test
describes shows exactly how browsers will redirect long before the
end of a request.


Your script, without modifications, exhibits the same behavior. It's a 
bit more difficult to visualize, but I can verify it with timestamps. 
The request for http://www.php.net/ is not sent until after the previous 
response has been received in its entirety.


I'd be curious to know which browser you're using that behaves 
differently. I'm not saying it's not possible, but it seems weird.


Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



Re: [PHP] intval() vs. (int)

2005-09-02 Thread Robert Cummings
On Fri, 2005-09-02 at 14:47, Rory Browne wrote:
 (int) seems to be faster, but not by an awful lot. Personally however
 if its a case of typing five characters (int) and saving a little exec
 time, or typing 8 and losing a little, then I'd perfer to go with the
 five an save the exec time.

(int) is a casting operator and so doesn't incur function initialization
overhead. Similarly using === null instead of is_null() has the same
consequences. While the savings might seem paltry, knowing the
difference between operator and functions and when you have both
available for the same task can add up to real savings in a large
application or in a heavily loaded system. I bet Rasmus makes a good
distinction between the two when doing work for Yahoo :) Maybe not
though, I've been wrong before ;)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] session cookies

2005-09-02 Thread Rasmus Lerdorf
Chris Shiflett wrote:
 Rasmus Lerdorf wrote:
 
 Why modify my test?
 
 
 Because it has less delay. Thus, it's more difficult to tell if the
 browser is requesting the new URL before or after receiving the entire
 response. My script is essentially the same thing, but the script takes
 30 seconds to execute. It makes the distinction very clear.
 
 The addition of flush() forces the chunked response. You can remove that
 if your server uses chunked transfer encoding without it.
 
 What did you see in log.txt from my version and on your screen?
 
 
 You would see the output Count0\nCount1\n... in the log and the PHP
 web site in the browser. I'm not sure how that's relevant. No browser is
 going to render content from a 302 response, but that doesn't prove that
 it won't wait for it.

Yes it does.  The last number in log.txt tells you exactly when the
browser stopped listening to the response and closed the socket because
PHP will abort the script at that point.  If what you are saying is
true, how do you explain the fact that you don't see a count all the way
up to 999,999 in my test in the log.txt file?

 I'd be curious to know which browser you're using that behaves
 differently. I'm not saying it's not possible, but it seems weird.

I'm just using Firefox.

-Rasmus

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



Re: [PHP] session cookies

2005-09-02 Thread Rasmus Lerdorf
Rasmus Lerdorf wrote:
 Chris Shiflett wrote:
 
Rasmus Lerdorf wrote:


Why modify my test?


Because it has less delay. Thus, it's more difficult to tell if the
browser is requesting the new URL before or after receiving the entire
response. My script is essentially the same thing, but the script takes
30 seconds to execute. It makes the distinction very clear.

The addition of flush() forces the chunked response. You can remove that
if your server uses chunked transfer encoding without it.


What did you see in log.txt from my version and on your screen?


You would see the output Count0\nCount1\n... in the log and the PHP
web site in the browser. I'm not sure how that's relevant. No browser is
going to render content from a 302 response, but that doesn't prove that
it won't wait for it.
 
 
 Yes it does.  The last number in log.txt tells you exactly when the
 browser stopped listening to the response and closed the socket because
 PHP will abort the script at that point.  If what you are saying is
 true, how do you explain the fact that you don't see a count all the way
 up to 999,999 in my test in the log.txt file?

Also, just add a single line to your own test script and make it look
like this:

header('Location: http://www.php.net/');
$fp = fopen('/tmp/log.txt', 'w');
for ($i = 0; $i  30; $i++)
{
$str = Count $i\n;
echo str_repeat($str,1000);
fputs($fp, $str);
sleep(1);
flush();
}

Then time how long it takes for the redirect to happen.  Is it still
taking 30 seconds?  If not, why not?

-Rasmus

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



[PHP] need information on sending email using php

2005-09-02 Thread Paul Goepfert
Hi all,

I am new to php.  I am going to be setting up a page that has a form
on it.  When the user clicks on submit an email should be sent with
the contents of the form.  My question is How do I do that?

the webserver that I will be placing this page on has php ver 4.4.0  on it.

Any help would be appreciated

Paul

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



Re: [PHP] need information on sending email using php

2005-09-02 Thread Philip Hallstrom

I am new to php.  I am going to be setting up a page that has a form
on it.  When the user clicks on submit an email should be sent with
the contents of the form.  My question is How do I do that?

the webserver that I will be placing this page on has php ver 4.4.0  on it.

Any help would be appreciated


www.php.net/mail

-philip

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



Re: [PHP] need information on sending email using php

2005-09-02 Thread Stephen Johnson
http://www.php.net/mail


On 9/2/05 12:40 PM, Paul Goepfert [EMAIL PROTECTED] wrote:

 Hi all,
 
 I am new to php.  I am going to be setting up a page that has a form
 on it.  When the user clicks on submit an email should be sent with
 the contents of the form.  My question is How do I do that?
 
 the webserver that I will be placing this page on has php ver 4.4.0  on it.
 
 Any help would be appreciated
 
 Paul

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



[PHP] PHP4.4.0 not recognizing pdflib installtion

2005-09-02 Thread Young

Hi,
I'm trying to install PHP 4.4.0 with pdf support in CentOS 4.1
Should I compile PHP with --with-pdflib first and install pdflib using pear 
command (pear install pdflib)?
or compile PHP with no --with-pdflib and then install pdflib using pear 
command (pear install pdflib)?

I already installed Apache2.54 and PDFlib-Lite-6.0.2

Any help is appreciated!

Thanks,

Young

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



[PHP] socket_read() trouble with PHP_BINARY_READ

2005-09-02 Thread M. Sokolewicz

hello,

I'm writing a socket approach to send email directly via an SMTP server 
(since some hosts block sendmail trough php due to abuse). Now, I have 
the code, attached below:
I have cut it down slightly so it would still be readable though. I'm 
very sure that none of the stuff I removed actually matters in the 
problem though (mostly error chechking, logging, debug stuff, etc).


Ok, back to the problem. If I reread my log, I see the following output:
S: 220 server -- Server ESMTP (iPlanet Messaging Server 5.2)
C: HELO ip
S:
C: MAIL FROM: [EMAIL PROTECTED]
S: 250 server OK, server2 [ip].
C: RCPT TO: [EMAIL PROTECTED]
S:
C: RSET

Now, obviously, the server sends something back (I checked, manually, 
using telnet). So, I figured that the socket_read(socket, size, 
PHP_NORMAL_READ) was causing the problem. So I switched over to 
PHP_BINARY_READ to make sure I didn't miss anything (because it broke 
off eg. midways). So... after I changed that, I suddenly started getting 
these errors:
Warning: socket_read() unable to read from socket [11]: Resource 
temporarily unavailable in /home/me/scripts/mail.php on line 27


This goes for each attempt to read (even the first). I'm stumped... and 
really don't know how to proceed now...


Does anyone have any clues?
very appreciated,

- Tul

P.S. see attached, code:
?php
class socket_SMTP {
var $socket = null;

function connect($host, $port, $user, $pass) {
$this-socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($this-socket  0) {
			exit(socket_create() failed: reason:  . 
socket_strerror($this-socket) . \n);

}

$res = socket_connect($this-socket, gethostbyname($host), 
$port);
if(false === $res) {
echo 'No connection';
return false;
}
socket_set_nonblock($this-socket);
$this-get();
$this-send('HELO '.'my-servers-ip-addy-goes-here');
$this-get();// ignore res
}

function send($cmd) {
socket_write($this-connection, $cmd.\r\n, 
strlen($cmd.\r\n));
}

function get() {
$ret = socket_read($this-connection, 1024, PHP_BINARY_READ);
return $ret;
}

function sendMessage($from, $to, $message, $headers) {
$headers = $this-safeData($headers);
$message = $this-safeData($message);

$this-send('MAIL FROM: '.$from.'');
$this-send('RCPT TO: '.$to.'');
$this-send('DATA');
$this-send($headers);
$this-send(''); // CRLF to distinguish between headers and 
message
$this-send($message);
$this-send('.');

// sent message
return true;
}

function disconnect() {
$this-send('QUIT');
socket_close($this-socket);
}
}
$mail = new socket_SMTP();
$mail-connect('mail.server.com', '25', 'username', 'password');
$mail-sendMessage('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', 'Test message', 
'Subject: whatever-test-mail'.\r\n);

$mail-disconnect();
?

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



[PHP] problem with the session and global variable

2005-09-02 Thread Tomás Rodriguez Orta
Hello people.

I have an problem very very complicate for me.
I have some template in my web sitie, and a car buy, I want to show to the user 
what count of the books have in your car buy,
but when I enter a new page in the other tampletae the variable take 1, why?
In ache page I write the following line 
session_start()

and the template I write 
if (isset($_SESSION['listprod'])) { $c=$_SESSION['i'];
  echo $c. .books in your car buy;

some bidy can help me?

best regards TOMAS




-
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu  y no se encontro ninguna coincidencia.

[PHP] FreeBSD php{4,5} w/ LDAP + SSL/TLS ldap_start_tls()

2005-09-02 Thread Brian A. Seklecki


All:

Firstly, sorry if this is the wrong list.  There are thousands of forums 
and PHP5 related MLs, but nothing FBSD specific.


Second, I wouldn't post if this wasn't happening on two completely 
different FBSD boxes.


For whatever reason, the php4 and php5 from FreeBSD ports refuses to 
properly configure SSL/TLS support for the LDAP module.


This breaks the TLS/SSL functionality in net/phpldapadmin and 
sysutils/ldap-account-manager (CC'ing maintainers)


I've got two current i386/RELENG_5_3 boxes.  Both with Apache 
apache-2.0.54_2 and openldap-client-2.2.27.


The ldap client binaries are linked to SSL fine and can talk both ldaps:// 
and Start_TLS over ldap://.  That's out of the question.


One with php4-4.4.0, one with php5-5.0.3_2 (see below).  Both have the 
LDAP and SSL php extension modules installed:


$ egrep -i ldap|ssl /usr/local/etc/php/extensions.ini
extension=openssl.so
extension=ldap.so

The php4 box's ldap module is linked to OpenSSL:

# ldd /usr/local/lib/php/20020429/ldap.so
/usr/local/lib/php/20020429/ldap.so:
libldap-2.2.so.7 = /usr/local/lib/libldap-2.2.so.7 (0x28174000)
liblber-2.2.so.7 = /usr/local/lib/liblber-2.2.so.7 (0x281a7000)
libcrypto.so.3 = /lib/libcrypto.so.3 (0x281b4000)
libssl.so.3 = /usr/lib/libssl.so.3 (0x282c8000)

The php5 box is as well:

$ ldd /usr/local/lib/php/20041030/ldap.so
/usr/local/lib/php/20041030/ldap.so:
libldap-2.2.so.7 = /usr/local/lib/libldap-2.2.so.7 (0x28173000)
liblber-2.2.so.7 = /usr/local/lib/liblber-2.2.so.7 (0x281a6000)
libcrypto.so.3 = /lib/libcrypto.so.3 (0x281b3000)
libssl.so.3 = /usr/lib/libssl.so.3 (0x282c7000)


The problem is that ldap_start_tls() is an unregistered/invalid function.


When i run the functions.php at 
http://www.sitepoint.com/article/php-command-line-2


ldap_start_tls() isn't listed on either machine (see below).  The only 
reference to the problem I've been able to find is a PR:


http://www.freebsd.org/cgi/query-pr.cgi?pr=72275

.but this only relates to PHP4.  I don't know why *GRRR*, but this PR 
was closed without a fix ever being commited or any remarks!  Anyway, I 
tried the proposed solution on the PHP4 machine.  I removed the OpenSSL 
shared extension, export WITH_OPENSSL=true, recompiled php4 CLI/MOD with 
SSL static.  Removed the SSL module from extensions.ini.  Same problem.


The only possible localized problem I can see is my my predecessor placed:

PHP_EXT_INC=openssl

in php.conf.  I've tried rebuilding with and without that to no avail.

Anyway, I'm going to start looking into this tonight.  Any thoughts would 
be appreciated.  I'll open a PR when I track down the problem.


TIA,

~BAS

# pkg_info |grep -i php
libmcrypt-2.5.7_1   Multi-cipher cryptographic library (used in PHP)
pear-XML_RPC-1.4.0  PHP implementation of the XML-RPC protocol
php4-4.4.0  PHP Scripting Language (Apache Module and CLI)
php4-ctype-4.4.0The ctype shared extension for php
php4-dba-4.4.0  The dba shared extension for php
php4-extensions-1.0 A meta-port to install PHP extensions
php4-gettext-4.4.0  The gettext shared extension for php
php4-ldap-4.4.0 The ldap shared extension for php
php4-mcrypt-4.4.0   The mcrypt shared extension for php
php4-mysql-4.4.0The mysql shared extension for php
php4-openssl-4.4.0  The openssl shared extension for php
php4-overload-4.4.0 The overload shared extension for php
php4-pcre-4.4.0 The pcre shared extension for php
php4-pear-4.4.0 PEAR framework for PHP
php4-pgsql-4.4.0The pgsql shared extension for php
php4-posix-4.4.0The posix shared extension for php
php4-session-4.4.0  The session shared extension for php
php4-tokenizer-4.4.0 The tokenizer shared extension for php
php4-xml-4.4.0  The xml shared extension for php
php4-zlib-4.4.0 The zlib shared extension for php
phpldapadmin-0.9.7.a6,1 A set of PHP-scripts to administer LDAP servers


$ pkg_info |grep -i php5
php5-5.0.4_1PHP Scripting Language (Apache Module and CLI)
php5-bz2-5.0.3_2The bz2 shared extension for php
php5-calendar-5.0.3_2 The calendar shared extension for php
php5-ctype-5.0.3_2  The ctype shared extension for php
php5-curl-5.0.4_2   The curl shared extension for php
php5-dom-5.0.3_2The dom shared extension for php
php5-exif-5.0.3_2   The exif shared extension for php
php5-extensions-1.0 A meta-port to install PHP extensions
php5-ftp-5.0.3_2The ftp shared extension for php
php5-gd-5.0.3_2 The gd shared extension for php
php5-gettext-5.0.3_2 The gettext shared extension for php
php5-iconv-5.0.3_2  The iconv shared extension for php
php5-imap-5.0.3_2   The imap shared extension for php
php5-ldap-5.0.4_2   The ldap shared extension for php
php5-mcrypt-5.0.3_2 The mcrypt shared extension for php
php5-mhash-5.0.3_2  The mhash shared extension for php
php5-mysql-5.0.3_2  The mysql shared extension for php
php5-odbc-5.0.4_2   The odbc shared extension for php
php5-openssl-5.0.3_2 The 

Re: [PHP] problem with the session and global variable

2005-09-02 Thread Gustav Wiberg

Hi there!

I don't quite understand what you're trying to do here. Please send more 
code, then I might be able to help you... :-)


/G
@varupiraten.se

- Original Message - 
From: Tomás Rodriguez Orta [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Saturday, September 03, 2005 4:46 AM
Subject: [PHP] problem with the session and global variable


Hello people.

I have an problem very very complicate for me.
I have some template in my web sitie, and a car buy, I want to show to the 
user what count of the books have in your car buy,

but when I enter a new page in the other tampletae the variable take 1, why?
In ache page I write the following line
session_start()

and the template I write
if (isset($_SESSION['listprod'])) { $c=$_SESSION['i'];
 echo $c. .books in your car buy;

some bidy can help me?

best regards TOMAS




-
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu  y no se encontro ninguna 
coincidencia.






No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/88 - Release Date: 2005-09-01

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



Re: [PHP] FreeBSD php{4,5} w/ LDAP + SSL/TLS ldap_start_tls()

2005-09-02 Thread Rasmus Lerdorf
Brian A. Seklecki wrote:
 Firstly, sorry if this is the wrong list.  There are thousands of forums
 and PHP5 related MLs, but nothing FBSD specific.
 
 Second, I wouldn't post if this wasn't happening on two completely
 different FBSD boxes.
 
 For whatever reason, the php4 and php5 from FreeBSD ports refuses to
 properly configure SSL/TLS support for the LDAP module.

Can't you just build from the PHP tarball instead?  Seems like a messed
up port to me.  I use FreeBSD all day, every day and haven't seen this
problem.  But I also don't use the ports.

-Rasmus

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



[PHP] SoundEx in swedish?

2005-09-02 Thread Gustav Wiberg

Hi there!

Soundex works with diffrent kind of pronounciation... but does it work with 
Swedish language?

Anyone have experience of this???

/G
@varupiraten.se

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