[PHP] PECL-Haru and UTF-8

2013-05-05 Thread Puiu Hrenciuc

Hello,

Does anyone have experience with using Haru extension for creating
PDF files containing UTF-8 encoded characters? I saw that UTF-8 encoding
was added to libHaru 2.3.0RC1 ( see http://libharu.org/ ), but I did
not find support for this in latest PECL-Haru (1.0.4). Am I missing
something?

Thank you,
Puiu

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



[PHP] Re: How to take output from an include, and embed it into a variable?

2009-09-23 Thread Puiu Hrenciuc

Hi,

The simplest way (actually the single way I know :) ) would be to
capture the output using output buffering functions, something like this:

// start output buffering
ob_start();

// include the file that generates the HTML (or whatever content)
include ;

// get output buffer content
$output=ob_get_contents();

// clean output buffer and stop buffering
ob_end_clean();

// the content generated in the included file is now in $output variable
// use it as you consider fit
.


Regards,
Puiu


Rob Gould wrote:
I have an invoice table that is drawn on a number of pages, so I have 
all the logic in an include-file like this:


include invoicetable_bottom.php;


However, now I'm needing to take the output from that include file and 
pass it as an email.  To do that, I need to somehow take the output from 
this include file and get it into a variable somehow.  Is there a simple 
way to do this?


Something like:  $emailtcontent = include invoicetable_bottom.php?


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



Re: [PHP] highlighting searchterms as bold text

2007-09-20 Thread Puiu Hrenciuc

Hi,

Here's what you need:

RegEx:

/((\w+)?#SearchTermHere#(\w+)?)/i

Of course, replace your #SearchTermHere# with what you need,
i.e. /((\w+)?ethyl(\w+)?)/i

Code sample:

$_textToHighlight='ethyl Lorem Ethyl ipsum MeThYl dolor Ethylene sit';
$_search='/((\w+)?ethyl(\w+)?)/i';
$_replace='b\\1/b';
$_highlightedText=preg_replace($_search,$_replace,$_textToHighlight);

This should output:

bethyl/b Lorem bEthyl/b ipsum bMeThYl/b dolor 
bEthylene/b sit


Hope it helps,
PuYa

C.R.Vegelin wrote:


- Original Message - From: Deniz Dizman (BST UGB) 
[EMAIL PROTECTED]
To: C.R.Vegelin [EMAIL PROTECTED]; [EMAIL PROTECTED] 
php-general@lists.php.net

Sent: Thursday, September 20, 2007 11:29 AM
Subject: RE: [PHP] highlighting searchterms as bold text


thats odd because the regex passes when I test it with this online tool:
http://samuelfullman.com/team/php/tools/regular_expression_tester_p2.php

--
dd


-Original Message-
From: C.R.Vegelin [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 20, 2007 1:59 PM
To: Deniz Dizman (BST UGB); [EMAIL PROTECTED]
Subject: Re: [PHP] highlighting searchterms as bold text


- Original Message -
From: Deniz Dizman (BST UGB) [EMAIL PROTECTED]
To: C.R.Vegelin [EMAIL PROTECTED]; [EMAIL PROTECTED]
php-general@lists.php.net
Sent: Thursday, September 20, 2007 10:38 AM
Subject: RE: [PHP] highlighting searchterms as bold text


try /^ethyl/i
what you want is ignore case and pattern begins with

--
dd

 -Original Message-
 From: C.R.Vegelin [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 20, 2007 1:31 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] highlighting searchterms as bold text

 Hi everyone,

 I want to highlight (bold) searchterms in text.
 For example, for all words starting with ethyl:
 a) replace ethyl by bethyl/b
 b) replace Ethyl by bEthyl/b
 c) replace ethylene by bethylene/b
 d) but not methyl by bmethyl/b

 Now I use:
 $patterns[0] = /ethyl/;
 $replacements[0] = bethyl/b;
 $text = preg_replace($patterns, $replacements, $text);

 This works for a) and c), but not for b) and d).
 Any idea how to do this ?

 TIA, Cor


Thanks Deniz,

I tried pattern /^ethyl/i but this does not highlight anything.
I also tried pattern /ethyl/i and this highlights all, but
also methyl ...
Any suggestion ?

Cor


Hi Deniz,

I tried the referred regex tool  as well,
and I get Bad Result for /^ethyl/i
and Good Result for /ethyl/i

Cor


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



Re: [PHP] highlighting searchterms as bold text

2007-09-20 Thread Puiu Hrenciuc

Sorry, I didn't read d) right (NOT Methyl),
here is teh new regex :

/(\b#SearchTermHere#(\w+)?)/i

The code sample is the same, replace regex, of course .

Output should be :

bethyl/b Lorem bEthyl/b ipsum MeThYl dolor bEthylene/b sit

Cheers


Puiu Hrenciuc wrote:

Hi,

Here's what you need:

RegEx:

/((\w+)?#SearchTermHere#(\w+)?)/i

Of course, replace your #SearchTermHere# with what you need,
i.e. /((\w+)?ethyl(\w+)?)/i

Code sample:

$_textToHighlight='ethyl Lorem Ethyl ipsum MeThYl dolor Ethylene sit';
$_search='/((\w+)?ethyl(\w+)?)/i';
$_replace='b\\1/b';
$_highlightedText=preg_replace($_search,$_replace,$_textToHighlight);

This should output:

bethyl/b Lorem bEthyl/b ipsum bMeThYl/b dolor 
bEthylene/b sit


Hope it helps,
PuYa

C.R.Vegelin wrote:


- Original Message - From: Deniz Dizman (BST UGB) 
[EMAIL PROTECTED]
To: C.R.Vegelin [EMAIL PROTECTED]; [EMAIL PROTECTED] 
php-general@lists.php.net

Sent: Thursday, September 20, 2007 11:29 AM
Subject: RE: [PHP] highlighting searchterms as bold text


thats odd because the regex passes when I test it with this online tool:
http://samuelfullman.com/team/php/tools/regular_expression_tester_p2.php

--
dd


-Original Message-
From: C.R.Vegelin [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 20, 2007 1:59 PM
To: Deniz Dizman (BST UGB); [EMAIL PROTECTED]
Subject: Re: [PHP] highlighting searchterms as bold text


- Original Message -
From: Deniz Dizman (BST UGB) [EMAIL PROTECTED]
To: C.R.Vegelin [EMAIL PROTECTED]; [EMAIL PROTECTED]
php-general@lists.php.net
Sent: Thursday, September 20, 2007 10:38 AM
Subject: RE: [PHP] highlighting searchterms as bold text


try /^ethyl/i
what you want is ignore case and pattern begins with

--
dd

 -Original Message-
 From: C.R.Vegelin [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 20, 2007 1:31 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] highlighting searchterms as bold text

 Hi everyone,

 I want to highlight (bold) searchterms in text.
 For example, for all words starting with ethyl:
 a) replace ethyl by bethyl/b
 b) replace Ethyl by bEthyl/b
 c) replace ethylene by bethylene/b
 d) but not methyl by bmethyl/b

 Now I use:
 $patterns[0] = /ethyl/;
 $replacements[0] = bethyl/b;
 $text = preg_replace($patterns, $replacements, $text);

 This works for a) and c), but not for b) and d).
 Any idea how to do this ?

 TIA, Cor


Thanks Deniz,

I tried pattern /^ethyl/i but this does not highlight anything.
I also tried pattern /ethyl/i and this highlights all, but
also methyl ...
Any suggestion ?

Cor


Hi Deniz,

I tried the referred regex tool  as well,
and I get Bad Result for /^ethyl/i
and Good Result for /ethyl/i

Cor


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



Re: [PHP] highlighting searchterms as bold text

2007-09-20 Thread Puiu Hrenciuc

C.R.Vegelin wrote:

- Original Message - From: Puiu Hrenciuc [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, September 20, 2007 12:56 PM
Subject: Re: [PHP] highlighting searchterms as bold text



Sorry, I didn't read d) right (NOT Methyl),
here is teh new regex :

/(\b#SearchTermHere#(\w+)?)/i

The code sample is the same, replace regex, of course .

Output should be :

bethyl/b Lorem bEthyl/b ipsum MeThYl dolor bEthylene/b sit

Cheers


Puiu Hrenciuc wrote:

Hi,

Here's what you need:

RegEx:

/((\w+)?#SearchTermHere#(\w+)?)/i

Of course, replace your #SearchTermHere# with what you need,
i.e. /((\w+)?ethyl(\w+)?)/i

Code sample:

$_textToHighlight='ethyl Lorem Ethyl ipsum MeThYl dolor Ethylene sit';
$_search='/((\w+)?ethyl(\w+)?)/i';
$_replace='b\\1/b';
$_highlightedText=preg_replace($_search,$_replace,$_textToHighlight);

This should output:

bethyl/b Lorem bEthyl/b ipsum bMeThYl/b dolor 
bEthylene/b sit


Hope it helps,
PuYa

C.R.Vegelin wrote:


- Original Message - From: Deniz Dizman (BST UGB) 
[EMAIL PROTECTED]
To: C.R.Vegelin [EMAIL PROTECTED]; [EMAIL PROTECTED] 
php-general@lists.php.net

Sent: Thursday, September 20, 2007 11:29 AM
Subject: RE: [PHP] highlighting searchterms as bold text


thats odd because the regex passes when I test it with this online 
tool:
http://samuelfullman.com/team/php/tools/regular_expression_tester_p2.php 



--
dd


-Original Message-
From: C.R.Vegelin [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 20, 2007 1:59 PM
To: Deniz Dizman (BST UGB); [EMAIL PROTECTED]
Subject: Re: [PHP] highlighting searchterms as bold text


- Original Message -
From: Deniz Dizman (BST UGB) [EMAIL PROTECTED]
To: C.R.Vegelin [EMAIL PROTECTED]; [EMAIL PROTECTED]
php-general@lists.php.net
Sent: Thursday, September 20, 2007 10:38 AM
Subject: RE: [PHP] highlighting searchterms as bold text


try /^ethyl/i
what you want is ignore case and pattern begins with

--
dd

 -Original Message-
 From: C.R.Vegelin [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 20, 2007 1:31 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] highlighting searchterms as bold text

 Hi everyone,

 I want to highlight (bold) searchterms in text.
 For example, for all words starting with ethyl:
 a) replace ethyl by bethyl/b
 b) replace Ethyl by bEthyl/b
 c) replace ethylene by bethylene/b
 d) but not methyl by bmethyl/b

 Now I use:
 $patterns[0] = /ethyl/;
 $replacements[0] = bethyl/b;
 $text = preg_replace($patterns, $replacements, $text);

 This works for a) and c), but not for b) and d).
 Any idea how to do this ?

 TIA, Cor


Thanks Deniz,

I tried pattern /^ethyl/i but this does not highlight anything.
I also tried pattern /ethyl/i and this highlights all, but
also methyl ...
Any suggestion ?

Cor


Hi Deniz,

I tried the referred regex tool  as well,
and I get Bad Result for /^ethyl/i
and Good Result for /ethyl/i

Cor


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



Thanks Puiu,

I tested your regex with the code below.
However, it didn't work.
Maybe I'm missing something ...
To test it, change the $pattern setting.

?php
 $term = ethyl;
 $text = Ethylene, ethyl and methyl are different things.;
 $pattern = /(\b# . $term . #(\w+)?)/i;
 $replacement = b . $term . /b;
 // or: $replacement = b\\1/b;
 echo before:  . $text, br /;
 $text = preg_replace($pattern, $replacement, $text);
 echo after:  . $text, br /;

 echo wanted:br /bEthyl/bene, bethyl/b and methyl are 
different things., br /;
 echo or:br /bethyl/bene, bethyl/b and methyl are different 
things., br /;

?

Regards, Cor


you forgot to also remove '#' and enclose in single quotes,
otherwise the '\' character has another meaning :)
Also, the replacement should be exactly as I gave it, with \\1,
it means 'put here the string that matched first brackets pair '


So these two lines should look like:


$pattern = '/(\b' . $term . '(\w+)?)/i';
$replacement = 'b\\1/b';

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



[PHP] Re: scaling images

2007-09-20 Thread Puiu Hrenciuc

Hulf wrote:

Sorry my message was cut off.

Yes I want to scale to 300 x 200px before I upload the image to my folder. 
Here is my code so far.


thanks,

H.


$imageinfo = getimagesize($_FILES['userfile']['tmp_name']);

echo $x=$imageinfo[0];
echo $y=$imageinfo[1];


$newwidth = 300;
$newheight = 200;

// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($_FILES['userfile']['tmp_name']);

// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, 
$height);


// Output
$myimage = imagejpeg($thumb);

$target_path = ../property_images/$property_id/.basename( 
$_FILES['userfile']['name']);


$img_url= $property_id./.basename( $_FILES['userfile']['name']);

if(move_uploaded_file($myimage, $target_path)) {
  /*  echo The file .  basename( $_FILES['userfile']['name']).
 has been uploaded;*/
} else{
echo There was an error uploading the file, please try again!;
} 


After resizing the image you will have the newly created JPEG
data (binary) in the $myimage variable, not a file(name).

So you actually have to do something like:

file_put_contents($target_path,$myimage);

This will put the content in the $myimage variable ( the resized JPEG
data) into the target path. Note that you should also check if the
uploaded file is a supported image, so do something like :

if($source = @imagecreatefromjpeg($_FILES['userfile']['tmp_name']))
{
// file is a supported image type, resize it and save it
}
else
{
// unsupported image file or not an image file at all,
// display some error here
}


Note:
file_put_contents is a PHP5 only function, use fopen,fwrite,fclose
for PHP4.

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



[PHP] Undefined class constant

2007-09-19 Thread Puiu Hrenciuc

Hi everyone,

I'm having a hard time dealing with an error that appeared overnight
in one of my PHP script:

Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in 
/#/classes/framework/HTML/HTMLForm.php on line 120


HTMLForm.php snippet:

.
// Creates the HTMLFormFields
foreach ($this-Record-Columns as $_column)
{
// Add only visible columns
if ($_column-IsVisible)
{
// Default field type
$_type=HTMLFormField::ELEMENT_TYPE_TEXT ;

// Adjust default type based on Column type
switch ($_column-Type)
{
	case Column::TYPE_AUTONUMBER: 
   			  $_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;

  break;

case Column::TYPE_BOOLEAN :
  $_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX ;
  break;
default:
  break;
117:   }
118:
119:// Add the column to the list of fields
120:$this-Fields[$_column-Name]=new 
121:HTMLFormField($this-Name,$_column,$_type);
122:
123:}

}

As you can see there is no refference to any TYPE_HIDDEN constant
at line 120, nor in the HTMLFormField's constructor.

I searched the net, but I just can't find the reason of this.
Can someone please help me ?

Thanks,
Puiu

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



Re: [PHP] Undefined class constant

2007-09-19 Thread Puiu Hrenciuc

Here are the content for all used variables:

$_this-Name: (string) FilterForm
$_column:
StringColumn Object
(
[Table] = Roles
[Name] = RoleName
[Function] = like
[Type] = 4
[Min] =
[Max] =
[RegEx] =
[AllowedValues] = Array
(
)

[IsValid] =
[IsVisible] = 1
[Sorted] = 0
[Primary] =
[Foreign] =
[Negated] =
[GroupBy] =
[Aggregate] =
[_value:protected] =
)

$_type: (int) 1

T . Lensselink wrote:

On Wed, 19 Sep 2007 15:56:22 +0300, Puiu Hrenciuc [EMAIL PROTECTED] wrote:

Hi everyone,

I'm having a hard time dealing with an error that appeared overnight
in one of my PHP script:

Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in
/#/classes/framework/HTML/HTMLForm.php on line 120

HTMLForm.php snippet:

.
// Creates the HTMLFormFields
foreach ($this-Record-Columns as $_column)
{
// Add only visible columns
if ($_column-IsVisible)
{
// Default field type
$_type=HTMLFormField::ELEMENT_TYPE_TEXT ;

 // Adjust default type based on Column type
 switch ($_column-Type)
 {
case Column::TYPE_AUTONUMBER:
  
$_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;
   break;

case Column::TYPE_BOOLEAN :
   $_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX ;
   break;
 default:
   break;
117:   }
118:
119:// Add the column to the list of fields
120:$this-Fields[$_column-Name]=new
121:HTMLFormField($this-Name,$_column,$_type);
122:
123:}

}

As you can see there is no refference to any TYPE_HIDDEN constant
at line 120, nor in the HTMLFormField's constructor.

I searched the net, but I just can't find the reason of this.
Can someone please help me ?

Thanks,
Puiu


When the error happens. What are the contents of 120: $_column-Name ?


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



Re: [PHP] Undefined class constant

2007-09-19 Thread Puiu Hrenciuc

Here is the HTMLFormField constructor, it is pretty simple :

   /**
* Creates a new HTMLFormField object
*
* @param string $_formName Name of the form this field belongs to
* @param Column $_column Record object this column derives from
* @param int $_type Type of field, this determines the type of 
HTML element that will be rendered

* @param string $_class Class name for the HTML element
* @param array $_values Array of display values for combos, 
lists, radios
* @param string $_label Label to be displayed next to a radio, 
check box
* @param string $_nullMessage Message that will be displayed 
when a required field was not filled
* @param string $_invalidMessage Message that will be displayed 
when the data entered is invalid
* @param string $_tooShortMessage Message displayed when the 
field value is bellow minimum value or length
* @param string $_tooLongMessage Message displayed when the 
field value is above maximum value or length

*/
   public function 
__construct($_formName,$_column=null,$_type=0,$_class='' 
,$_fieldValues=null,$_label=,$_nullMessage='',$_invalidMessage='',$_tooShortMessage='',$_tooLongMessage='')

   {
   // Copy column's properties and save passed parameters 
into local properties

   if ($_column instanceof Column )
   {
   $this-Name=$_column-Name;
   $this-RegEx=$_column-RegEx;
   $this-Min=$_column-Min;
   $this-Max=$_column-Max;
   $this-Type=$_column-Type;
   $this-Value=$_column-Value;
   }

   $this-FormName=$_formName;
   $this-NullMessage=$_nullMessage;
   $this-InvalidDataMessage=$_invalidMessage;
   $this-TooLongMessage=$_tooShortMessage;
   $this-TooLongMessage=$_tooLongMessage;
   $this-Class=$_class;
   $this-FieldValues=$_fieldValues;
   $this-FieldType=$_type;

   }

Trust me, it doesn't have any logical explanation :)

Puiu

T.Lensselink wrote:

On Wed, 19 Sep 2007 17:13:02 +0300, Puiu Hrenciuc [EMAIL PROTECTED] wrote:
  

Here are the content for all used variables:

$_this-Name: (string) FilterForm
$_column:
StringColumn Object
(
 [Table] = Roles
 [Name] = RoleName
 [Function] = like
 [Type] = 4
 [Min] =
 [Max] =
 [RegEx] =
 [AllowedValues] = Array
 (
 )

 [IsValid] =
 [IsVisible] = 1
 [Sorted] = 0
 [Primary] =
 [Foreign] =
 [Negated] =
 [GroupBy] =
 [Aggregate] =
 [_value:protected] =
)

$_type: (int) 1

T . Lensselink wrote:


On Wed, 19 Sep 2007 15:56:22 +0300, Puiu Hrenciuc [EMAIL PROTECTED]
  

wrote:


Hi everyone,

I'm having a hard time dealing with an error that appeared overnight
in one of my PHP script:

Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in
/#/classes/framework/HTML/HTMLForm.php on line 120

HTMLForm.php snippet:

.
// Creates the HTMLFormFields
foreach ($this-Record-Columns as $_column)
{
// Add only visible columns
if ($_column-IsVisible)
{
// Default field type
$_type=HTMLFormField::ELEMENT_TYPE_TEXT ;

 // Adjust default type based on Column type
 switch ($_column-Type)
 {
case Column::TYPE_AUTONUMBER:
  
$_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;
   break;

case Column::TYPE_BOOLEAN :
   $_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX


;


   break;
 default:
   break;
117:   }
118:
119:// Add the column to the list of fields
120:$this-Fields[$_column-Name]=new
121:HTMLFormField($this-Name,$_column,$_type);
122:
123:}

}

As you can see there is no refference to any TYPE_HIDDEN constant
at line 120, nor in the HTMLFormField's constructor.

I searched the net, but I just can't find the reason of this.
Can someone please help me ?

Thanks,
Puiu


When the error happens. What are the contents of 120: $_column-Name ?
  


What happens inside the constructor when you create a new instance of
HTMLFormField?
Maybe the $_type is validated there. Or i'm missing something in this
snippet.


  




[PHP] Sessions, sessions and... sessions

2004-03-02 Thread Puiu Hrenciuc
Hello,

I am a little desperate right now since I have tried to solve this problem
for 3-4 days now.
I have developed a site that uses sessions for user authentication and data
storage between page access.
The development server is Apache1.3.24/MySQL4.1.0/PHP4.3.3/Win XP Pro
The release server is Apache1.3.27/MySQ3.2.25/PHP4.3.1/Linux 2.4.25

The site is working just fine on the development server, but when uploading
on release
server it keeps losing session data and the users are logged out of their
account in a
randomly manner. I can't reproduce the behaviour since it is all randomly,
for eg.
the session may expire immediately but it can also last 30-40 min. It does
not expire
on same page every time. I have tried to see if it is a browser related
issue so I have loaded
the page into IE6, NN7, OPERA7 but the problem persisted. Next step I
thought that it
could be a process on the release server that deletes files on /tmp so I
have changed the
session_save_path to another dir, same problem. Now I have made some
functions
and keep the sessions in a MySQL database. It works fine on the development
server,
but... , BUT... , it has the same behaviour on the release server. Using
MySQL storage
I have discovered the PHP changes SIDs randomly ( at least so it seems ) so
the session's
data is not lost ( the MySQL record is there, and the data field is ok, all
variables are there
kindly waiting to be read by PHP :) ), but new sessions are created for same
connection
so I think this is PHP or Cookies related.
If you would like to see the phpinfo() snapshots:
Development server : http://www.pur.ro/devphpinfo.htm
Release server : http://www.pur.ro/relphpinfo.htm

Can someone please help me, coz' my hair is turning white and I'm too young
to die :)

Thanks,
Puiu Hrenciuc.

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



Re: [PHP] Sessions, sessions and... sessions

2004-03-02 Thread Puiu Hrenciuc
1. No. If that would be the problem i think that sessions would expire
 after the same period of time and not randomly , right ?
2. The site consists in a single page (index.php) that includes
 the subpages as needed. The session_start() is at the begining of the
file.
 If this would be the problem the sessions would expire on the same
page, right ?
3. No, it is not cross domains. It is on a virtual server thought .


Richard Davey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello Puiu,

 Tuesday, March 2, 2004, 11:13:07 AM, you wrote:

 PH The site is working just fine on the development server, but when
 PH uploading on release server it keeps losing session data and the
 PH users are logged out of their account in a

 Some things to try/think about:

 1. Are your sessions/cookies set to expire after a certain time? If
 so, is the server in a different time zone to your development server?

 2. Are you 100% sure you call session_start() on every page that needs
 it before doing any work with the session variables?

 3. Does your site cross domains? Sessions will not propagate (unless
 you make them).

 --
 Best regards,
  Richard Davey
  http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] Sessions, sessions and... sessions

2004-03-02 Thread Puiu Hrenciuc
the session_start() is in a file that is require_once in every page,
so it can't get called more than one time. If this would be the problem,
I would also have problems on the development server, don't you think ?

Electroteque [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 all i can think of here, you could be calling start_session twice in the
 same page ? also init set the session timeout to an hour or so

 -Original Message-
 From: Puiu Hrenciuc [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 02, 2004 10:13 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Sessions, sessions and... sessions


 Hello,

 I am a little desperate right now since I have tried to solve this problem
 for 3-4 days now.
 I have developed a site that uses sessions for user authentication and
data
 storage between page access.
 The development server is Apache1.3.24/MySQL4.1.0/PHP4.3.3/Win XP Pro
 The release server is Apache1.3.27/MySQ3.2.25/PHP4.3.1/Linux 2.4.25

 The site is working just fine on the development server, but when
uploading
 on release
 server it keeps losing session data and the users are logged out of their
 account in a
 randomly manner. I can't reproduce the behaviour since it is all randomly,
 for eg.
 the session may expire immediately but it can also last 30-40 min. It does
 not expire
 on same page every time. I have tried to see if it is a browser related
 issue so I have loaded
 the page into IE6, NN7, OPERA7 but the problem persisted. Next step I
 thought that it
 could be a process on the release server that deletes files on /tmp so I
 have changed the
 session_save_path to another dir, same problem. Now I have made some
 functions
 and keep the sessions in a MySQL database. It works fine on the
development
 server,
 but... , BUT... , it has the same behaviour on the release server. Using
 MySQL storage
 I have discovered the PHP changes SIDs randomly ( at least so it seems )
so
 the session's
 data is not lost ( the MySQL record is there, and the data field is ok,
all
 variables are there
 kindly waiting to be read by PHP :) ), but new sessions are created for
same
 connection
 so I think this is PHP or Cookies related.
 If you would like to see the phpinfo() snapshots:
 Development server : http://www.pur.ro/devphpinfo.htm
 Release server : http://www.pur.ro/relphpinfo.htm

 Can someone please help me, coz' my hair is turning white and I'm too
young
 to die :)

 Thanks,
 Puiu Hrenciuc.

 --
 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] Re: Session and MS-IE6

2004-03-02 Thread Puiu Hrenciuc
Have you tried other browsers ?
Before you can say it is a browser issue you have to try as
many browsers as possible and see if the problem is still there.
What server/os/php is on your machine and what on client's ?
Can you post the session management part of tour code ?
Please provide more info in order to be able to get help.


Pance [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I verify users to my website with sessions. It's been working fine for the
 past couple of years, but recently I started having some problems using
 sessions for example:
session_register(user_id);
if (!(user_id)){ 

 and then I read the PHP manual and it suggested this instead:
   session_start();
   if (!$_SESSION['user_id']){ 

 which worked on my machine (Win98 and MS-IE5.5). But today I tried to
login
 to my page from the client's computer using MS-IE 6 and I got the error:
 undefined index 'user-id'

 Does anybody know what's going on? Is there a bug with MS-IE6 when using
 sessions? I've read some of the other comments here about IE6 but they
apply
 to forms, not sessions.

 Pance.

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



[PHP] Re: Sessions, sessions and... sessions

2004-03-02 Thread Puiu Hrenciuc
I don't use session_register(), just the $_SESSION global variable, so this
is not it... :(


Pance [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi Puiu,
 I've been having the same problem too. My code that worked up until
recently
 just stopped working. I did change from using:
session_register(user_id);
if (!(user_id)){ 

 to using:
   session_start();
   if (!$_SESSION['user_id']){ 

 Now it works with my computer Win98 and MS-IE5.5 but not on my client's
 computer Win98 and MS-IE6.

 I think there's something seriously wrong somewhere (either PHP or MS).
I'll
 keep you posted if I find a solution.

 Pance.

 Puiu Hrenciuc [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hello,
 
  I am a little desperate right now since I have tried to solve this
problem
  for 3-4 days now.
  I have developed a site that uses sessions for user authentication and
 data
  storage between page access.
  The development server is Apache1.3.24/MySQL4.1.0/PHP4.3.3/Win XP Pro
  The release server is Apache1.3.27/MySQ3.2.25/PHP4.3.1/Linux 2.4.25
 
  The site is working just fine on the development server, but when
 uploading
  on release
  server it keeps losing session data and the users are logged out of
their
  account in a
  randomly manner. I can't reproduce the behaviour since it is all
randomly,
  for eg.
  the session may expire immediately but it can also last 30-40 min. It
does
  not expire
  on same page every time. I have tried to see if it is a browser related
  issue so I have loaded
  the page into IE6, NN7, OPERA7 but the problem persisted. Next step I
  thought that it
  could be a process on the release server that deletes files on /tmp so I
  have changed the
  session_save_path to another dir, same problem. Now I have made some
  functions
  and keep the sessions in a MySQL database. It works fine on the
 development
  server,
  but... , BUT... , it has the same behaviour on the release server. Using
  MySQL storage
  I have discovered the PHP changes SIDs randomly ( at least so it seems )
 so
  the session's
  data is not lost ( the MySQL record is there, and the data field is ok,
 all
  variables are there
  kindly waiting to be read by PHP :) ), but new sessions are created for
 same
  connection
  so I think this is PHP or Cookies related.
  If you would like to see the phpinfo() snapshots:
  Development server : http://www.pur.ro/devphpinfo.htm
  Release server : http://www.pur.ro/relphpinfo.htm
 
  Can someone please help me, coz' my hair is turning white and I'm too
 young
  to die :)
 
  Thanks,
  Puiu Hrenciuc.

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



[PHP] Re: Session and MS-IE6

2004-03-02 Thread Puiu Hrenciuc
Please provide the code where you set the $_SESSION['userid']
variable.


Pance [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Have you tried other browsers ?
 I've tried MS-IE 5.5 and Mozilla 1.4b on my Win98 computer. They both
work.
 I've tried MS-IE6 on my clients Win98 computer - it didn't work.

  What server/os/php is on your machine and what on client's ?
 My server is runing Linux 2.4.24 #3; PHP-4.3.3; Zend 1.3.0

  Can you post the session management part of tour code ?
 I'm not sure what you mean by session management. I use:
 session_start();
 at the top of every PHP page and I try to verify the user by:
 if (!$_SESSION['user_id']){
   printf(a href=\index.php\You have not logged in. Please click this
to
 do so./a);
  exit();
 }

 Pance.


 Puiu Hrenciuc [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Have you tried other browsers ?
  Before you can say it is a browser issue you have to try as
  many browsers as possible and see if the problem is still there.
  What server/os/php is on your machine and what on client's ?
  Can you post the session management part of tour code ?
  Please provide more info in order to be able to get help.
 
 
  Pance [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   I verify users to my website with sessions. It's been working fine for
 the
   past couple of years, but recently I started having some problems
using
   sessions for example:
  session_register(user_id);
  if (!(user_id)){ 
  
   and then I read the PHP manual and it suggested this instead:
 session_start();
 if (!$_SESSION['user_id']){ 
  
   which worked on my machine (Win98 and MS-IE5.5). But today I tried to
  login
   to my page from the client's computer using MS-IE 6 and I got the
error:
   undefined index 'user-id'
  
   Does anybody know what's going on? Is there a bug with MS-IE6 when
using
   sessions? I've read some of the other comments here about IE6 but they
  apply
   to forms, not sessions.
  
   Pance.

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



[PHP] Re: interbase + php

2004-03-02 Thread Puiu Hrenciuc
Why don't you use base64_encode and base64_decode functions ?
It will take about 33% more space  but will be SQL and PHP safe .


Markus Ecker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hi all!!

 i have the problem that i want to put an image into a firebird database.
the
 problem is that when i copy the code of the image into my sql syntax, the
 code contains ' and  and then php thinks that this is the end of the sql
 statement, although this is just data of the image.

 is there another method how i can put images into a database???

 what are the functions ibase_blob_create good for??

 many thanks
 greets
 markus

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



[PHP] Re: interbase + php

2004-03-02 Thread Puiu Hrenciuc
I also think addslashes() and stripslashes() could be useful..


Puiu Hrenciuc [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Why don't you use base64_encode and base64_decode functions ?
 It will take about 33% more space  but will be SQL and PHP safe .


 Markus Ecker [EMAIL PROTECTED] wrote in
message
 news:[EMAIL PROTECTED]
  hi all!!
 
  i have the problem that i want to put an image into a firebird database.
 the
  problem is that when i copy the code of the image into my sql syntax,
the
  code contains ' and  and then php thinks that this is the end of the
sql
  statement, although this is just data of the image.
 
  is there another method how i can put images into a database???
 
  what are the functions ibase_blob_create good for??
 
  many thanks
  greets
  markus

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



[PHP] Re: session_id and cookie settings

2004-03-02 Thread Puiu Hrenciuc
Firs of all I think it would be easier to conult PHP Help before posting.
Quoting from PHP Help - function session_destroy():

[EMAIL PROTECTED] (18-Jan-2002 02:26)

When users log in and out of your site they will keep the original session
you have set for them.
if you need to have this change on each login then you should use the
setcookie function to remove the session id on each logout.
for instance:
//remove the local session
session_destroy();
//remove the client session
setcookie(SES_NAME,,,/);
//redirect user with header
header(somewhere);
exit;

Also from PHP Help:
session_destroy() destroys all of the data associated with the current
session. It does not unset any of the global variables associated with the
session, or unset the session cookie.


Torsten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,
 when I destroy my session and reload my index.php. I get the same
 session_id() that was just destroyed before. I've checked it after
 session_destroy() with echo session(); The function returned no value
 anymore. But as I said, when starting a new session the old session_id is
 reappearing. Only when I set off the cookie option in my browser
 session_start() gives a new session_id.

 I get really confused with it, because I thought that the session_id is
 generated by php (a remote machine in my case) and has nothing to do with
 the browser, exept I would actively set cookies. How can code it that way,
 that non-independend from the cookie settings in the browser I always can
be
 sure to have a really new session_id?

 Thank you,
 Torsten

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



[PHP] Re: readfile error

2004-03-02 Thread Puiu Hrenciuc
Can you try :
readfile(http://ip.address.here/paperchase/blogger_rss.xml;) ?

I don't know the cause, but I think replacing the host name
with it's IP address would work...

Ashley [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I posted this on Novell's PHP forum, but I have not gotten a response.
 Hopefully, someone here can help me.

 --
 I was using the readfile function on a server that was running Apache
 1.3.2, PHP 4.2.3 (PHP for Netware) and then switched to a different
 server running Apache 2.0.48, PHP 4.2.3 (PHP for Netware)

 It was working just fine before I moved the file to the new server.  Now
 I get the following error message:

 Warning: php_network_getaddresses: gethostbyname failed in 'insert path
 here' on line 6

 Warning:
 readfile(http://jurist.law.pitt.edu/paperchase/blogger_rss.xml;) - Bad
 file number in 'insert path here' on line 6


 Does anyone have any suggestions as to what is different or could be
 causing this problem?
 I have looked through the php.ini files and cannot determine anything
 that could cause this.

 Thanks in advance,
 Ashley

 --

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



[PHP] Re: Cookie Problems (Different than the post by David Jackson)

2004-03-02 Thread Puiu Hrenciuc
I bet you have some session management functions in
  include('lib/sessionfunc.php');
something like session_start() that also sends out header informations,
but you can't send any headers AFTER you have started
the output for eg:
?
 some cookies/session/header code1
?
Some HTML output like:
html
head
?
 some cookies/session/header code2
?

code1 will work ok, but code2 will fail with headers already sent error.
Instead you should write :
?
 ALL cookies/session/header code
?
The HTML code
?
other PHP code
?

the headers are sent before any HTML code, so if you have even one
blank space sent to the output you can't modify the headers any more.





Brian J. Celenza [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Here's a snippet of the code. I'm sending the setcookie header out long
 before any of the other headers, but I'm still getting:
 Warning: Cannot modify header information - headers already sent by
(output
 started at C:\wwwroot\index.php:4) in C:\wwwroot\index.php on line 7

 -Code--

 ?
 function cookie_set($userid){
  if (isset($userid)){
   setcookie(vfsnet, $userid, time()+600);
  }
 }
 cookie_set($_GET['user']);
 ?
 html
 head
 ?

  include('lib/sessionfunc.php');
  include('lib/dbconnect.php');
  include('lib/filefunc.php');
  include('lib/urlfunc.php');
 ?
 link rel=stylesheet type=text/css href=themes/master.css
 titleWebsite0001/title
 meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
 /head

 ---Code---

 Any ideas?

 Thanks
 Brian





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



[PHP] Re: Sessions, sessions and... sessions

2004-03-02 Thread Puiu Hrenciuc
I have make a workaround for my problem using MySQL for
session storage and not using the PHP generated SIDs, but using
some SID generated with something like this :

 $tsid=$_SERVER['HTTP_USER_AGENT'].'|'.$_SERVER['REMOTE_ADDR'].'|';
 $tsid=md5(md5($tsid));
 session_id($tsid);
 session_set_save_handler
(mysession_open,mysession_close,mysession_read,mysession_write,myse
ssion_destroy,mysession_gc);
 session_start();

this works just fine, it is more insecure but it works, it also shows that
the
problem is somewhere in PHP generating another SID for the same user
before session's timeout in a randomly manner. I will try to report this in
the PHP bugs database.


Thanks all for help.
Puiu Hrenciuc.

Puiu Hrenciuc [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I am a little desperate right now since I have tried to solve this problem
 for 3-4 days now.
 I have developed a site that uses sessions for user authentication and
data
 storage between page access.
 The development server is Apache1.3.24/MySQL4.1.0/PHP4.3.3/Win XP Pro
 The release server is Apache1.3.27/MySQ3.2.25/PHP4.3.1/Linux 2.4.25

 The site is working just fine on the development server, but when
uploading
 on release
 server it keeps losing session data and the users are logged out of their
 account in a
 randomly manner. I can't reproduce the behaviour since it is all randomly,
 for eg.
 the session may expire immediately but it can also last 30-40 min. It does
 not expire
 on same page every time. I have tried to see if it is a browser related
 issue so I have loaded
 the page into IE6, NN7, OPERA7 but the problem persisted. Next step I
 thought that it
 could be a process on the release server that deletes files on /tmp so I
 have changed the
 session_save_path to another dir, same problem. Now I have made some
 functions
 and keep the sessions in a MySQL database. It works fine on the
development
 server,
 but... , BUT... , it has the same behaviour on the release server. Using
 MySQL storage
 I have discovered the PHP changes SIDs randomly ( at least so it seems )
so
 the session's
 data is not lost ( the MySQL record is there, and the data field is ok,
all
 variables are there
 kindly waiting to be read by PHP :) ), but new sessions are created for
same
 connection
 so I think this is PHP or Cookies related.
 If you would like to see the phpinfo() snapshots:
 Development server : http://www.pur.ro/devphpinfo.htm
 Release server : http://www.pur.ro/relphpinfo.htm

 Can someone please help me, coz' my hair is turning white and I'm too
young
 to die :)

 Thanks,
 Puiu Hrenciuc.

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