Re: [PHP] Re: PHP 5 limits "readfile" to 1.9 MB?

2005-08-17 Thread Catalin Trifu

I know there was ! No one said it was intentional !

Catalin


Rory Browne wrote:
Just for your information there was a topic on this a few months ago. 


It definately wasn't intentional - Rasmus didn't know about it until then.

On 8/17/05, Jordan Miller <[EMAIL PROTECTED]> wrote:


turns out it's a known bug, fixed in CVS already... haven't tried the
PHP 5.1 beta release yet.

http://bugs.php.net/bug.php?id=32970



On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote:



   Hi,

   Indeed a fclose($fp) is needed (wrote it as an example :)).
   1MB is more than enough as a buffer.  If you have a 53MB file,
what will happen then ?
   I have no idea if it's a bug or a feature. Either way I did lose
some hair over this when I switched from PHP4 to PHP5.

Catalin


Jordan Miller wrote:



Catalin,
Wow, that worked great, thanks.
I'm curious why you set a static buffer of 1024768... why not just
do  filesize($file), as shown at http://www.php.net/fread ? Is it
better  for memory usage to have a potentially smaller buffer?
Also, you may  want an fclose($fp) after the file has been
downloaded.
So is this a bug in PHP 5 or are they just purposely limiting the
abilities of the "readfile" command?
Jordan
On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote:



   Hi,

   I've had a similar problem. The download always stopped at
exactly 2.000.000 bytes.
   You have to work around that with:
   $fp = fopen($file, 'r');
   if($fp) {
   while(!feof($fp)) {
   echo fread($fp, 1024768);//see the huge buffer to read into
   }
   } else {
   //whatever error handler
   }

Catalin


Jordan Miller wrote:





Hello all,
I am new to this list and I have searched the archives to no
avail. I  am having a peculiar problem when upgrading to PHP 5:
My  downloads  are now limited to the first 1.9 MB of the file
in  question, with the  download either terminating at 1.9 MB
or  seemingly continuously stuck  in a downloading process at
1.9 MB.  The code in the PHP script has  not changed and all
parameters  that I could find that are relevant to  this problem
are given below:
the minimal code needed for download:
   // $file_to_read is the complete path of the file to
download
   header("Content-Type: application/pdf");
   header( "Content-Disposition: inline; filename=
\"$filename \"");
   $len = filesize($file_to_read);
   header("Content-Length: $len");
   @readfile($file_to_read);
php.ini file for both php version 4 and 5 contain the
following   settings that may be relevant:
allow_url_fopen = On
max_execution_time = 300 ; Maximum execution time of each
script,  in seconds
max_input_time = 300; Maximum amount of time each script
may   spend parsing request data
memory_limit = 8M  ; Maximum amount of memory a script may
consume (8MB)
post_max_size = 200M
upload_max_filesize = 200M
Some additional details:
All files less than 1.9 MB download fine
It is not a corrupted file, because all files larger than 1.9
MB  fail  after 1.9 MB
The connection is not timing out (download of 1.9 MB takes only
~15 sec)
Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4
Fails for both Safari and Firefox
Fails regardless of "inline" or "attachment"
Fails regardless of "pdf" or "ppt" content-type
This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with
the   same settings, above
What am I doing wrong??? Any other parameter in php.ini I
should  have  set? Any suggestions are much appreciated.
thanks,
Jordan





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








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






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




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



Re: [PHP] Re: PHP 5 limits "readfile" to 1.9 MB?

2005-08-17 Thread Catalin Trifu

Hi,

Indeed a fclose($fp) is needed (wrote it as an example :)).
1MB is more than enough as a buffer.  If you have a 53MB file,
what will happen then ?
I have no idea if it's a bug or a feature. Either way I did lose
some hair over this when I switched from PHP4 to PHP5.

Catalin


Jordan Miller wrote:

Catalin,

Wow, that worked great, thanks.

I'm curious why you set a static buffer of 1024768... why not just do  
filesize($file), as shown at http://www.php.net/fread ? Is it better  
for memory usage to have a potentially smaller buffer? Also, you may  
want an fclose($fp) after the file has been downloaded.


So is this a bug in PHP 5 or are they just purposely limiting the  
abilities of the "readfile" command?


Jordan



On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote:



Hi,

I've had a similar problem. The download always stopped at  
exactly 2.000.000 bytes.

You have to work around that with:
$fp = fopen($file, 'r');
if($fp) {
while(!feof($fp)) {
echo fread($fp, 1024768);//see the huge buffer to read into
}
} else {
//whatever error handler
}

Catalin


Jordan Miller wrote:



Hello all,
I am new to this list and I have searched the archives to no  avail. 
I  am having a peculiar problem when upgrading to PHP 5: My  
downloads  are now limited to the first 1.9 MB of the file in  
question, with the  download either terminating at 1.9 MB or  
seemingly continuously stuck  in a downloading process at 1.9 MB.  
The code in the PHP script has  not changed and all parameters  that 
I could find that are relevant to  this problem are given below:

the minimal code needed for download:
// $file_to_read is the complete path of the file to download
header("Content-Type: application/pdf");
header( "Content-Disposition: inline; filename=\"$filename \"");
$len = filesize($file_to_read);
header("Content-Length: $len");
@readfile($file_to_read);
php.ini file for both php version 4 and 5 contain the following   
settings that may be relevant:

allow_url_fopen = On
max_execution_time = 300 ; Maximum execution time of each  
script,  in seconds
max_input_time = 300; Maximum amount of time each script may   
spend parsing request data
memory_limit = 8M  ; Maximum amount of memory a script may   
consume (8MB)

post_max_size = 200M
upload_max_filesize = 200M
Some additional details:
All files less than 1.9 MB download fine
It is not a corrupted file, because all files larger than 1.9 MB  
fail  after 1.9 MB
The connection is not timing out (download of 1.9 MB takes only  ~15 
sec)

Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4
Fails for both Safari and Firefox
Fails regardless of "inline" or "attachment"
Fails regardless of "pdf" or "ppt" content-type
This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the   
same settings, above
What am I doing wrong??? Any other parameter in php.ini I should  
have  set? Any suggestions are much appreciated.

thanks,
Jordan




--
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: PHP 5 limits "readfile" to 1.9 MB?

2005-08-17 Thread Catalin Trifu

Hi,

I've had a similar problem. The download always stopped at exactly 
2.000.000 bytes.
You have to work around that with:
$fp = fopen($file, 'r');
if($fp) {
while(!feof($fp)) {
echo fread($fp, 1024768);//see the huge buffer to read into
}
} else {
//whatever error handler
}

Catalin


Jordan Miller wrote:

Hello all,

I am new to this list and I have searched the archives to no avail. I  
am having a peculiar problem when upgrading to PHP 5: My downloads  are 
now limited to the first 1.9 MB of the file in question, with the  
download either terminating at 1.9 MB or seemingly continuously stuck  
in a downloading process at 1.9 MB. The code in the PHP script has  not 
changed and all parameters that I could find that are relevant to  this 
problem are given below:


the minimal code needed for download:
// $file_to_read is the complete path of the file to download
header("Content-Type: application/pdf");
header( "Content-Disposition: inline; filename=\"$filename\"");
$len = filesize($file_to_read);
header("Content-Length: $len");
@readfile($file_to_read);

php.ini file for both php version 4 and 5 contain the following  
settings that may be relevant:


allow_url_fopen = On
max_execution_time = 300 ; Maximum execution time of each script,  
in seconds
max_input_time = 300; Maximum amount of time each script may  spend 
parsing request data
memory_limit = 8M  ; Maximum amount of memory a script may  consume 
(8MB)

post_max_size = 200M
upload_max_filesize = 200M


Some additional details:
All files less than 1.9 MB download fine
It is not a corrupted file, because all files larger than 1.9 MB fail  
after 1.9 MB

The connection is not timing out (download of 1.9 MB takes only ~15 sec)
Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4
Fails for both Safari and Firefox
Fails regardless of "inline" or "attachment"
Fails regardless of "pdf" or "ppt" content-type
This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the  same 
settings, above



What am I doing wrong??? Any other parameter in php.ini I should have  
set? Any suggestions are much appreciated.


thanks,
Jordan


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



[PHP] Re: PHP from CLI with SAPI

2005-07-18 Thread Catalin Trifu
Hi,

   Why are you displeased with apache ? After all, the 60% share market
of apache must mean something :)

Catalin


Fredrik Tolf wrote:
> Hi!
> 
> I've begun to be more and more displeased with Apache lately, so I've
> been thinking of writing my own HTTP server instead. I still want PHP
> support, but writing a new SAPI for PHP seems like overkill.
> 
> Therefore, is it possible to use PHP from the command line, but still
> enable some HTTP-server-only stuff, like GET and POST variables,
> cookies, session management, file uploads, and so on? I haven't been
> able to find any docs on doing that, but I'm thinking that it should be
> possible.
> 
> So, can someone either point me to some docs in this, or, lacking such,
> give me a short intro to it?
> 
> Thanks for reading!
> 
> Fredrik Tolf

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



[PHP] Re: libCURL help

2005-07-18 Thread Catalin Trifu
hi,

   Usually the .do files are servlets and the .do stuff you enter is rewritten
by the server internally to point to the actual servlet.
   With a http request you will get whatever the servlet is spitting out the 
wire.

Catalin


Jon wrote:
> is there some way to get a .do file from a server is it readable?  I think
> that may be my whole problem with my curl sequence.  I need to see what the
> routing file is doing

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



[PHP] Re: Support for Oracle 10g in php 5.0.4

2005-07-06 Thread Catalin Trifu
   I have multiple installations of Oracle 10g -> two on linux and one on 
win32.
Apache is on linux and php is compiled with oci8 and without oracle. I connect 
with php
to all oracle servers without problems; one of them is on the same machine as 
the server.

Catalin


Chuck Carson wrote:
> I'm having problems getting php 5.0.4 working with Oracle 10.1.0.3 and
> just wanted to check and make sure 10g was supported before wasting
> any more cycles on it.
> 
> Thx,
> CC

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



[PHP] Re: Support for Oracle 10g in php 5.0.4

2005-07-06 Thread Catalin Trifu
I am using php 5.0.4 with oracle 10g and i had no problems so far.

Catalin


Chuck Carson wrote:
> I'm having problems getting php 5.0.4 working with Oracle 10.1.0.3 and
> just wanted to check and make sure 10g was supported before wasting
> any more cycles on it.
> 
> Thx,
> CC

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



[PHP] Re: Building sapi_apache2

2005-07-04 Thread Catalin Trifu
I think you are looking for  Hi,
> 
> I have php 5.0.4 running fine on Fedora Core 2 under Apache 2.0.49.  To
> all intents and purposes, PHP works fine.  The only problem I have is
> with Plesk, which uses the presence of the sapi_apache2 module to turn
> PHP on or off for the various sites that it controls:
> 
> 
> php_admin_flag engine on
> php_admin_value open_basedir
> "/home/httpd/vhosts/stells.co.uk/httpdocs:/
> 
> 
> The problem is that the sapi_apache2 module isn't built into php. 
> phpinfo() shows no mention of this module, but on other systems I have
> seen it compiled in.  How do I build php 5.0.4 to have this module
> included?
> 
> I'm sorry for the cross posting, the php-install list was silent on the
> matter, and I'm pretty sure it's not a Plesk related issue.  I have
> already googled extensively for this but with no joy, as well as trawled
> the Plesk support forums and PHP list archives.  Also, as this is not my
> machine, the client requests Plesk, so I can't just turn that off.
> 
> I'm sure the problem is a very small and minor one, but I just can't see
> it!
> 
> Gaby
> 
> -- 
> Junkets for bunterish lickspittles since 1998!
> [EMAIL PROTECTED]
> http://weblog.vanhegan.net

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



[PHP] Re: Ouput HTML w/PHP

2005-06-30 Thread Catalin Trifu
Hi,

   It seems to me you are going the wrong way with "embedded" PHP;
try separating logic from view, tons of mvc frameworks out there and
templating engines.
   Try firefox with web developer extension -> Validate Local HTML.

Catalin


Rick Emery wrote:
> And now for something completely different...
> 
> I have a question that has been nagging at me. I've searched the
> archives, FAQs, and web sites, but haven't found an answer.
> 
> I have two ways that I've output HTML with PHP; one is to write the
> HTML, using the PHP tags to execute code when necessary. The other is to
> store the entire HTML output file in a string variable with
> concatenation and call the print (or echo) function at the bottom to
> output the page.
> 
> Are there advantages one way or the other?
> 
> This leads (sort of) to a second question: how can I validate my HTML?
> My applications run on an intranet (with database access), so I can't
> use the W3C Validator to point to the URL. If I try to upload the file,
> the validator doesn't parse the PHP to get the HTML output (which is why
> I wonder if I'm not better writing the HTML and sticking PHP where it's
> needed). Is there a way for me to maybe use the PHP tidy functions on
> the string containing the HTML ouput to validate it?
> 
> Thanks in advance,
> Rick

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



[PHP] Re: Stop spreading PEAR FUD; WAS Re: [PHP] Re: PHP web archeticture

2005-06-25 Thread Catalin Trifu
  Hi,


   I feel like I should answer your "anger" towards my opinion.
First of all I consider PEAR to be bloated for the following reasons;
it's a large library, it tries to cover a very general approach and
please 99% of case one may encounter. It's exception system is overused and
the overhead of it is not to be disregarded.
   Granted, PHP5 brings PEAR into a new light with it's new object model,
but till recently, php4 was in place and it's object model made big class
libraries quite a problem. Let's not forget there are few out there
using php5 in production.
   I, for one, prefer to use highly specialezed libraries, which are
designed for one purpose only and which are carefully coded to achive
that purpose with maximum efficiency and as less overhead as possible.
   I think PEAR is a very good class library and it's code is very nice
and well thought. I use the Log package of PEAR, which does not depend
on the PEAR core and I am very happy with it.
   I don't deny it's usefullness nor do i contest it in any way, I simply
prefer a different approach when building a project.
   If I were to compare PEAR with another well known library from the C++
world I would compare it with MFC and if I am to choose between smaller,
leaner and meaner PHP libraries over PEAR then I will choose them just
as I would choose ATL/WTL over MFC.
   It can be that development time may be a bit longer but the code
quality will be better in my opinion and I for one value more code
quality over a few hours of extra time.
   Btw! I do keep an eye on PEAR as I do on many other PHP libraries and
I do monthly research about what's new and noteworthy in the PHP world. For
example, when the issue of using a database layer and a templating engine
came into the big picture, I tried both PEAR::DB and ADOdb as I tried
PEAR::HTML_* and Smarty. I decided to use ADOdb and Smarty because they were
smaller and faster.
   My decision was based on personal experience and not influenced by opinions
expressed by others; of course I did take the time to see what others have
to say but the decision was mine to make. I may as well have been wrong
in making that decision but for now I am quite happy with it and I don't
consider switching to PEAR as a better alternative.


Catalin

P.S.
   Please forgive me if my opinion offended you in any way.


Matthew Weier O'Phinney wrote:
> * Catalin Trifu <[EMAIL PROTECTED]> :
> 
>>I also tend to stay away from PEAR, which is kinda bloated for my
>>taste, except the Log package.
> 
> 
> 
> I hear that a lot on this list, and I don't understand the reasoning
> behind such comments -- perhaps because nobody offers any reasoning,
> only the opinion?
> 
> I'm a PEAR user, and I've found the packages anything *but* bloated.
> Granted, I only use a subset of PEAR, but that subset has made mycoding
> easier. I use DB, Log, Mail, Mail_MIME, HTML_QuickForm, Cache_Lite, and
> Pager daily; additionally, we use custom PEAR error handlers to catch
> errors generated by these packages, log them, and display custom error
> pages. If I'd had to write the functionality I have readily available in
> these packages, I wouldn't have a job right now. They've helped me meet
> numerous deadlines.
> 
> If somebody could offer some *constructive* criticism of PEAR -- PEAR as
> it is TODAY, not "3 years ago, when I last tried it" -- these comments
> would have more weight. As it is, I feel they're just FUD based on
> ignorance.
> 
> 

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



Re: [PHP] Re: PHP web archeticture

2005-06-25 Thread Catalin Trifu
  Hi,

I personally use phrame because it's small, pretty fast, easy to setup
and was enough for my needs, although it does not seem to be maintained
anymore.
I think you should choose the one which better suits the needs of your 
project.
It's rather hard to say that framework is better than the other.
I also tend to stay away from PEAR, which is kinda bloated for my taste, 
except
the Log package.
Other than that, it all comes to project needs, personal choice and testing 
for
features, speed, stability and support (if you are interested in such things) 
although
tests are not always very concludent since they depend on many factors.


Catalin


Joe Muddah wrote:
> Thanks a bunch. I have alot of work now ahead of me to decide which
> framework to use. Any opinions on which one is the best?
> 
> On 6/24/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> 
>>   Hi,
>>
>>  You can take a look at phrame.sf.net, phpmvc.net, horder.org, 
>> binarycloud.com
>>adodb.sf.net (for fast db abstraction layer).
>>  Read around and one of those will surely satisfy your needs.
>>
>>Catalin
>>
>>
>>Joe Muddah wrote:
>>
>>>I am trying to design a website archeticture. Does anyone have any
>>>links or experience with archetictures that actually work. Any ideas
>>>of how to layout a website would be greatly appreciated.
>>>
>>>This is what I am thinking of doing
>>>
>>>1)Seperate Logic from presentation
>>> Using Templates (Smarty) for presentation
>>> Using PHP Objects for logic (no echo statements)
>>>
>>>2)Use Controllers to bring together logic and presentation
>>>  I don't really have an idea yet of how to do this. I am thinking
>>>about having something like a page variable to figure out what
>>>template to output, action variable to figure out what objects are
>>>called (save, delete, etc.). All this would be under a switch
>>>statment. Example:
>>>
>>>switch($page){
>>>case "UserListPage"
>>>  if(action==saveUser)
>>>userObject->saveUser(_$POST)
>>>
>>>  displayTemplate("UserList")
>>>
>>>
>>>case "EmailPage"
>>>  .
>>>}
>>>
>>>
>>>Thanks.
>>>
>>>j.m.
>>
>>--
>>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: MMcache question

2005-06-25 Thread Catalin Trifu
The use of mmcache (try eaccelerator btw!) is not visible
without some stress on the server. Try building a rahter complex PHP
script, which does some crazy iterations but without DB connections
and such things which are not related to PHPs abilities and
use ab (apache benchmark tool) to issue many simultaneous requests
to that page; do it a few times, with mmcache and without mmcache enabled
and will surely see the differences.
No! You don't have to rewrite your application. What mmacache does is
to keep a "bytecode" version of the script available so that PHP won't have
to reparse the script every time, which is expensive and also has a nice code 
optimizer.
On heavy loaded sites and on sites that use lots of libraries and objects
mmcache (eaccelerator) does a perfect job.


Catalin


Merlin wrote:
> Hi there,
> 
> I just steped over mmcache:
> http://turck-mmcache.sourceforge.net/index_old.html#install
> 
> After installing it, I can not see a real performance gain at all. The
> system is installed corectly and mmcache.php tells me it is active and
> running.
> 
> Now I saw that there is a mmcache API. Does that mean that I do have to
> recode my whole app to make use of mmcache?!
> 
> Thanx for any hint,
> 
> Merlin

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



[PHP] Re: PHP web archeticture

2005-06-24 Thread Catalin Trifu
Hi,

   You can take a look at phrame.sf.net, phpmvc.net, horder.org, binarycloud.com
adodb.sf.net (for fast db abstraction layer).
   Read around and one of those will surely satisfy your needs.

Catalin


Joe Muddah wrote:
> I am trying to design a website archeticture. Does anyone have any
> links or experience with archetictures that actually work. Any ideas
> of how to layout a website would be greatly appreciated.
> 
> This is what I am thinking of doing 
> 
> 1)Seperate Logic from presentation 
>  Using Templates (Smarty) for presentation 
>  Using PHP Objects for logic (no echo statements) 
> 
> 2)Use Controllers to bring together logic and presentation 
>   I don't really have an idea yet of how to do this. I am thinking
> about having something like a page variable to figure out what
> template to output, action variable to figure out what objects are
> called (save, delete, etc.). All this would be under a switch
> statment. Example:
> 
> switch($page){ 
> case "UserListPage" 
>   if(action==saveUser) 
> userObject->saveUser(_$POST) 
> 
>   displayTemplate("UserList") 
> 
> 
> case "EmailPage" 
>   . 
> } 
> 
> 
> Thanks. 
> 
> j.m.

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



[PHP] Re: Sorting with french characters

2005-06-23 Thread Catalin Trifu
 Check the manual for sort www.php.net/sort -> SORT_LOCALE_STRING
 You would have to pay attention to the current locale -> 
www.php.net/setlocale
before the actual sort.

hope this solves it,
Catalin


Mathieu Dumoulin wrote:
> I've got a little problem with the ksort and sort functions. When i fill
>  this array's keys or the array's data and i sort it, i can't seem to
> get a correct sort order concerning accented french characters.
> 
> For example:
> 
> Emiss, Erick
> Morrison, Phillip
> Tatey, Peter
> Zachary, Martin
> Élement, Marc-André
> 
> This is the kind of result i get from Ksort when i put these as keys.
> Notice the "Élement, Marc-André" at the end? Its supossed to be in the
> "E"s not at the end.
> 
> So i'm wondering how i can make this work now. I can't afford to make a
> STR_REPLACE on all possible accents, i got over a thousand records from
> the database to parse in a fast way and there are at the very least 60
> different accents to replace from the A, E, I, O and U without
> forgetting we have acute, grave, trema, circonflex accents for each
> letter. :S
> 
> My guess is there is something in the configuration of my dev server
> that must do this. Can anyone help me?

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



[PHP] Re: Showing tables (converting from MySQL to Oracle)

2005-06-23 Thread Catalin Trifu
Hi,

the USER_TABLES view shows all tables in oracle. Take a look at adodb.sf.net
for a very nice php library for database access. It takes much of the porting
burden off your shoulders and is pretty fast.

Catalin


Shane Presley wrote:
> Hello,
> 
> I've recompiled PHP to use Oracle, and been able to run a quick test
> script that looks like...
> 
>  if ($c=OCILogon("user", "pw", "server")) {
>   echo "Successfully connected to Oracle.\n";
>   OCILogoff($c);
> } else {
>   $err = OCIError();
>   echo "Oracle Connect Error " . $err[text];
> }
> ?>
> 
> 
> So now I'm going through and converting my MySQL code to Oracle.  I've
> finished the connect functions, but getting hung up on how to do
> queries.  For example the first query wants to SHOW TABLES.  Not sure
> how to do this with Oracle calls?
> 
> function get_tables($link) {
> $tableList = array();
> $query = "SHOW TABLES";
> $result = perform_query($query, $link);
> while($row = fetch_array($result)) {
> array_push($tableList, $row[0]);
> }
> 
> return $tableList;
> }
> 
> 
> function perform_query($query, $link) {
> if($link) {
> $result = mysql_query($query, $link) or die('Query
> failed: ' . mysql_error());
> }
> else {
> die('No DB link');
> }
> 
> return $result;
> }
> 
> 
> Thanks!
> Shane

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



Re: [PHP] Re: Extra (persistant) tier

2005-06-22 Thread Catalin Trifu
Yes, but putting objects into sessions is pretty inefficient
and makes no sense for database connection and such, since any resources
associated with that object are discarded at script end.

Catalin

david forums wrote:
> 
> To make persistant object with php use serialize
> 
> and include the object into session.
> 
> it's the only way with php
> 
> regards
> 
> david
> 
> 
> Le Wed, 22 Jun 2005 14:43:51 +0200, Catalin Trifu 
> <[EMAIL PROTECTED]> a écrit:
> 
>> Hi,
>>
>> Basically you can take your mind off object persistance in PHP
>> unless you code a C extension yourself which would do such a thing.
>> Besides code accelerators and caching techniques there isn't much
>> to play with; at least none that I know of.
>>
>> Catalin
>>
>>
>> Evert | Rooftop wrote:
>>
>>> Hi,
>>>
>>> I'm writing a big web application, and trying really hard to seperate
>>> business logic and presentation, which been no problem up to now.
>>> Because I abstracted the business logic so much the framework became
>>> heavier, sometimes a simple action can take up to 2 mb memory and
>>> several extra milliseconds.
>>>
>>> I know this doesn't sound much and I'm applying all kinds of technique's
>>> to reduce resource-usage and increase speed. The thing is, I feel like I
>>> need to split the business tier up in 2 tiers, one of them being my
>>> persisitant object manager. The main reason is because every script that
>>> is executed must do some initialization and database calls, and I think
>>> I could reduce this by making a persistant tier, but there doesn't seem
>>> a good way to do this using php except when I would use sockets.
>>>
>>> Shared memory doesn't really seem like an option, because I would still
>>> need to include all the classes to manage it, and when I use shared
>>> memory, the memory would still be copied into the php memory + having a
>>> central manager seems like a good idea.
>>>
>>> I know I'm pretty vague in my requirements, but I think it should be
>>> enough to explain what kind of solution I´m looking for, because this
>>> seems like a big advantage of java over php, or am I mistaken?
>>> If you have any ideas, let me know :)
>>>
>>> grt,
>>> Evert
>>> Collab
>>
>>

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



[PHP] Re: Extra (persistant) tier

2005-06-22 Thread Catalin Trifu
Hi,

Basically you can take your mind off object persistance in PHP
unless you code a C extension yourself which would do such a thing.
Besides code accelerators and caching techniques there isn't much
to play with; at least none that I know of.

Catalin


Evert | Rooftop wrote:
> Hi,
> 
> I'm writing a big web application, and trying really hard to seperate
> business logic and presentation, which been no problem up to now.
> Because I abstracted the business logic so much the framework became
> heavier, sometimes a simple action can take up to 2 mb memory and
> several extra milliseconds.
> 
> I know this doesn't sound much and I'm applying all kinds of technique's
> to reduce resource-usage and increase speed. The thing is, I feel like I
> need to split the business tier up in 2 tiers, one of them being my
> persisitant object manager. The main reason is because every script that
> is executed must do some initialization and database calls, and I think
> I could reduce this by making a persistant tier, but there doesn't seem
> a good way to do this using php except when I would use sockets.
> 
> Shared memory doesn't really seem like an option, because I would still
> need to include all the classes to manage it, and when I use shared
> memory, the memory would still be copied into the php memory + having a
> central manager seems like a good idea.
> 
> I know I'm pretty vague in my requirements, but I think it should be
> enough to explain what kind of solution I´m looking for, because this
> seems like a big advantage of java over php, or am I mistaken?
> If you have any ideas, let me know :)
> 
> grt,
> Evert
> Collab

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



Re: [PHP] MySQLI, Class not found

2005-06-21 Thread Catalin Trifu
Hi,

One thing i see is the use of num_rows on mysqli_result class,
but num_rows is member or mysqli class and not mysqli_result.
Perhaps this call to num_rows corrupts the rest.
Other than that everything seems fine.
Perhaps you should consider linux :), much better choice for web server
anyway.
Try adding error_reporting(E_ALL); at the beginning of the script.
Btw! you should disable from php.ini the magic quotes; it's a real pain.

Catalin


[EMAIL PROTECTED] wrote:
> when i try it this way:
>  
>   
> // create short variable  names
> $searchtype=$_POST['searchtype'];
> $searchtype=$_POST['searchterm'];
>  
> $searchterm=trim($searchterm);
>  
> if (!$searchtype || !$searchterm)
> {
> echo 'You have not entered  search details. Please go back and try again.';
> exit;
> }
>  
> if  (!get_magic_quotes_gpc())
> {
> $searchtype=addslashes($searchtype);
> $searchterm=addslashes($searchterm);
> }
>  
> $db = new mysqli('localhost', 'root', 'root', 'bookorama');
>  
>  
>  
> if(mysqli_connect_errno())
> {
> echo 'Error: Could not connect to  the Database. Please try again later.';
> exit;
> }
>  
> $query = "select * from books where ".$searchtype." like  
> '%".$searchterm."%'";
> $result = $db->query($query);
>  
> $num_results = $result->num_rows;
>  
> echo 'Number of books found: '.$num_results.'';
>  
> for ($i=0; $i <$num_results; $i++)
> {
> $row =  $result->fetch_assoc();
> echo ''.($i+1).'.  Title: ';
> echo  htmlspecialchars(stripslashes($row['title']));
> echo  'Author: ';
> echo  stripslashes($row['author']);
> echo 'ISBN: ';
> echo  stripslashes($row['isbn']);
> echo 'Price: ';
> echo  stripslashes($row['price']);
> echo  '';
> }
> var_export($result);
> $result->free();
> $db->close();
>  
> ?>
>  
> It doesn't even try searching the database... it gives me  the:  'You have 
> not entered search details. Please go back and try  again. Error.
>  
> when i comment out the IF statement and add the  var_export($result) (just to 
> see what it happens) it gives me this  error:
>  
> ===
> Number of books found: false
> Fatal error: Call to a  member function free() on a non-object in 
> c:\wamp\www\books\results.php  on line 56 
> ===
>  
> the HTML code is:
>  
> ===
> 
> Choose Search  Type: 
> 
> Author
> Title
> ISBN
> 
> 
> Enter Search Term:
> 
> 
> 
> 
> 
>  
> maybe i'm just tired and not seeing something - but i've looked a thousand  
> times and i have no clue why it's doing this... searches on google prove 
> nothing  either.
>  
> Server Configuration 
> Apache version : Apache/1.3.33 (Win32) (WIN XP)  PHP version : 5.0.4  
> MySQL version :  
> 5.0.7-beta-nt - extension : mysqli
>  
> Thanks again,
>  
> Clint
> 
> 

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



Re: [PHP] MySQLI, Class not found

2005-06-21 Thread Catalin Trifu
Could you make a var_export($result); before calling free() ?
Normally the extension should work fine with MySQL 4.1.12.
Does the phpinfo() say against which MySQL version it was compiled.
I use mysqli on linux and have no problems with it.
php5.1.0b1, apache 2.0.54, mysql 4.1.12, gentoo ck-sources-2.6.11 with nptl 
kernel

Catalin


[EMAIL PROTECTED] wrote:
> Well, I figured out that problem (I suppose) by upgrading to MySQL 5.0 and  
> the error doesn't come up anymore... but now I get this error:
>  
>  Fatal error: Call to a member function  free() on a non-object in 
> C:\xampp\htdocs\results.php on line 60 
>  
> Again, here's the code:
>  
> ==
>   
> // create short variable  names
> $searchtype=$_POST['searchtype'];
> $searchtype=$_POST['searchterm'];
>  
> $searchterm= trim($searchterm);
>  
> if (!$searchtype || !$searchterm)
> {
> echo 'You have not entered  search details. Please go back and try again.';
> exit;
> }
>  
> if (!get_magic_quotes_gpc())
> {
> $searchtype=  addslashes($searchtype);
> $searchterm=  addslashes($searchterm);
> }
>  
> $db = new mysqli('localhost', 'root', 'root', 'bookorama');
>  
>  
>  
> if(mysqli_connect_errno())
> {
> echo 'Error: Could not connect to  the Database. Please try again later.';
> exit;
> }
>  
> $query = "select * from books where ".$searchtype." like  
> '%".$searchterm."%'";
> $result = $db->query($query);
>  
> $num_results = $result->num_rows;
>  
> echo 'Number of books found: '.$num_results.'';
>  
> for ($i=0; $i <$num_results; $i++)
> {
> $row =  $result->fetch_assoc();
> echo ''.($i+1).'.  Title: ';
> echo  htmlspecialchars(stripslashes($row['title']));
> echo  'Author: ';
> echo  stripslashes($row['author']);
> echo 'ISBN: ';
> echo  stripslashes($row['isbn']);
> echo 'Price: ';
> echo  stripslashes($row['price']);
> echo '';
> }
>  
> //$result->free();
> $db->close();
>  
> ?>
> 
>  
> Anymore help would be more than appreciated! I've spent hours trying to fix  
> the first problem and about another hour trying to fix this one now... Google 
>  
> doesn't supply anything besides PHPNuke installation errors - which is not 
> the  case here.
>  
> Thanks,
>  
> Clint
> 

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



Re: [PHP] Re: Persistant Connections and max_connections on mysql

2005-06-21 Thread Catalin Trifu
One other mysql optimization is to increase the thread_pool.
This way mysql spends less time creating threads; which on linux without NPTL
is not exactly a cheap operation.

Catalin


Dan Rossi wrote:
> 
> On 21/06/2005, at 7:47 PM, Catalin Trifu wrote:
> 
>>
>> I presume you mean whether it's interactive_timeout or
>> wait_timeout, or ?
>> Actually they both are important. Read the mysql at dev.mysql.com
>>
>> C.
>>
>>
> 
> We should be sweet now, still use persistant connections on a high
> traffice server, but reduce the timeout for the threads before they drop
> off, hence why they stay open for so long and then run into the
> max_connection issues.

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



Re: [PHP] Re: Persistant Connections and max_connections on mysql

2005-06-21 Thread Catalin Trifu


Dan Rossi wrote:
> 
> On 21/06/2005, at 6:06 PM, Catalin Trifu wrote:
> 
>> Hi,
>>
>> This is a database issue and has to do with the following mysql
>> variables:
>>
>> interactive_timeout
>> wait_timeout
>>
>> By default these variables are set to 28800 and they represent the
>> time for which
>> the server waits on "persistent" connection.
>> If you have a busy site that number is way too big; so try to
>> decrease
>> those variables and you should be fine:
>>
>> mysql> set global interactive_timeout = 120;
>> mysql> set global wait_timeout = 120;
>>
>> This makes the timeout on connections 2 minutes after which mysql
>> disconects the user
>> and so freeing usable space for new connections.
>> You can also add them in my.cnf so that the server gets them when
>> started:
>>
>> set-variable = intercative_timeout=120
>>
> 
> Cheers its one or the other :O , I work most with intranet apps so dont
> have these kind of issues.

I presume you mean whether it's interactive_timeout or wait_timeout, or 
?
Actually they both are important. Read the mysql at dev.mysql.com

C.

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



[suspicious - maybe spam] [PHP] [suspicious - maybe spam] Re: [suspicious - maybe spam] Re: MYSQLI, Class not found?

2005-06-21 Thread Catalin Trifu
 Can you describe your environment:
 PHP version, Apache version, MySQL version, linux or win32.
 Did you run phpinfo() and see the loaded extensions ?

Catalin

[EMAIL PROTECTED] wrote:
>> Is PHP compiled with mysqli support:  http://ro.php.net/mysqli
>>Read the docs about what this extension   requires.
> 
> 
> 
> I did all of this and I'm still getting the  error:
> 
> Runtime Configuration
> The behaviour of these  functions is affected by settings in php.ini.  
> 
> Table 1. MySQLi  Configuration Options Name Default Changeable  
> Changelog   mysqli.max_links "-1" PHP_INI_SYSTEM Available since  PHP 5.0.0.  
> mysqli.default_port "3306" PHP_INI_ALL Available since PHP  5.0.0.  
> mysqli.default_socket NULL PHP_INI_ALL Available since PHP  5.0.0.  mysqli
> .default_host NULL 
> PHP_INI_ALL Available since PHP  5.0.0.  mysqli.default_user NULL PHP_INI_ALL 
> Available since PHP  5.0.0.  mysqli.default_pw NULL PHP_INI_ALL Available 
> since PHP   
> 5.0.0.
> 

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



[PHP] Re: Persistant Connections and max_connections on mysql

2005-06-21 Thread Catalin Trifu
Hi,

This is a database issue and has to do with the following mysql variables:

interactive_timeout
wait_timeout

By default these variables are set to 28800 and they represent the time for 
which
the server waits on "persistent" connection.
If you have a busy site that number is way too big; so try to decrease
those variables and you should be fine:

mysql> set global interactive_timeout = 120;
mysql> set global wait_timeout = 120;

This makes the timeout on connections 2 minutes after which mysql 
disconects the user
and so freeing usable space for new connections.
You can also add them in my.cnf so that the server gets them when started:

set-variable = intercative_timeout=120
set-variable = wait_timeout=120


Cheers,
Catalin


Dan Rossi wrote:
> Hi there, I have run into issues on a public production server where I
> keep running into max connection issues on mysql if I am using peristant
> connections. Sometimes the machine gets high traffic and I was wondering
> if there are good reasons to leave them on or off. After turning them
> off its been ok for one of the sites/projects. The mysql setting was
> originally 100 I got the bumped up to 500 but still the same issue ?
> 
> Let me know.

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



[suspicious - maybe spam] [PHP] [suspicious - maybe spam] Re: MYSQLI, Class not found?

2005-06-20 Thread Catalin Trifu
Hi,

Is PHP compiled with mysqli support: http://ro.php.net/mysqli
Read the docs about what this extension requires.

Catalin


[EMAIL PROTECTED] wrote:
>  
> Hey guys,
>  
>  I'm doing a tutorial from a book (PHP and MySQL Web Development) and  I'm 
> having a problem... when I use the script they supply I get this  error:
>  
>  
> Fatal error: Class 'mysqli' not found  in 
> C:\apachefriends\xampp\htdocs\results.php on line 29 
>  
> here is the code:
>  
>  
> ===
>   
> // create short variable  names
> $searchtype=$_POST['searchtype'];
> $searchtype=$_POST['searchterm'];
>  
> $searchterm= trim($searchterm);
>  
> if (!$searchtype || !$searchterm)
> {
> echo 'You have not  entered search details. Please go back and try  again.';
> exit;
> }
>  
> if (!get_magic_quotes_gpc())
> {
> $searchtype=  addslashes($searchtype);
> $searchterm=  addslashes($searchterm);
> }
>  
> $db = new mysqli('localhost', 'root', 'root', 'bookorama');
>  
> 
> //$db = mysql_connect('localhost', 'root', 'root');  // tried  this way, no 
> luck
> //mysql_select_db("bookorama", $db);
>  
> if(mysqli_connect_errno())
> {
> echo 'Error: Could not connect  to the Database. Please try again later.';
> exit;
> }
>  
> $query = "select * from books where ".$searchtype." like  
> '%".$searchterm."%'";
> $result = $db->query($query);
>  
> $num_results = $result->num_rows;
>  
> echo 'Number of books found:  '.$num_results.'';
>  
> for ($i=0; $i <$num_results; $i++)
> {
> $row =  $result->fetch_assoc();
> echo ''.($i+1).'.  Title: ';
> echo  htmlspecialchars(stripslashes($row['title']));
> echo  'Author: ';
> echo  stripslashes($row['author']);
> echo 'ISBN: ';
> echo  stripslashes($row['isbn']);
> echo 'Price: ';
> echo  stripslashes($row['price']);
> echo '';
> }
>  
> $result->free();
> $db->close();
>  
> ?>
>  
> 
> 
>  
> ===
>  
> I updated PHP from 5.0.3 to 5.0.4 to see if it would help, no luck.
>  
> Now I'm just completely lost.
>  
> Thanks,
>  
> Clint
> 
> 

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



Re: [PHP] weird thing;downloading from a php script stops at exactly 2.000.000 bytes

2005-06-12 Thread Catalin Trifu
Hi,

eaccelerator is compiled as an extension, so, not loading it
with extension=...bla...bla... in php.ini is like it's never been there
in the first place.
As you can see from the ./configure eaccelerator is not "built in"
Any other suggestions ?

Cheers,
Catalin


Richard Lynch wrote:
> 
> I just noticed the eaccelerator bit in this thread.
> 
> Just disabling eaccelerator isn't the same as not compiling it in in the
> first place...
> 
> Try that before reporting a bug to http://bugs.php.net
> 
> On Thu, June 9, 2005 1:59 am, Catalin Trifu said:
> 
>>  Hi,
>>
>>   I installed php5 using the configue below. I tried with apache2 as well
>>and same things.
>>
>>'./configure' '--prefix=/usr/local/php5'
>>'--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
>>'--with-config-file-path=/etc/php5' '--with-dom' '--with-gd'
>>'--enable-sockets' '--enable-exif'
>>'--with-freetype2' '--with-freetype-dir=/usr/include/freetype2'
>>'--enable-gd-native-ttf'
>>'--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp'
>>'--with-mysql=/usr'
>>'--with-xsl' '--with-libxml-dir=/usr'
>>
>>   I have a script which generates a temporary catalog file, which is
>>generated correctly having
>>4.7MB on disk.
>>   Then I push up the wire with readfile($filname):
>>
>>   header("Content-Type: text/csv");
>>   header("Content-Disposition: attachment; filename=somfilename.csv");
>>   header("Content-Length: ". filesize($file));
>>
>>   readfile($file);
>>
>>
>>   As expected the browser starts the download and reports it is expecting
>>a file of 4.7MB.
>>   However, the download stops at 2.000.000 bytes no matter what browser I
>>use (normally i use
>>Firefox on Linux), no matter if php runs on apache2 or apache1.3
>>
>>   Is there some php config option I missed ?
>>   Where could this come from ?
>>
>>
>>Thanks,
>>Catalin
>>
>>--
>>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] [? BUG ?] weird thing;downloading from a php script stops at exactly 2.000.000 bytes

2005-06-11 Thread Catalin Trifu
Hi,

There is not a big speed difference between the two.
The only thing is that it was frustrating to find out the limitations
on readfile.
I used it before with large files and it was ok; only to find out now
that on 5.0.4 it doesn't work as it used to.
As php manual states readfile should be the way to spit a file out
the wire.
btw:
$fp = fopen('somefile');
fpassthru($fp);
is also stopping at 2.000.000 bytes, which definetely drives me
to think there is a bug somewhere.


Catalin


Richard Lynch wrote:
> On Thu, June 9, 2005 4:12 pm, Catalin Trifu said:
> 
>>  Tried it and it works indeed, but it's quite annoying to make such
>>tricks
>>and is not the best solution either; fopen and fread are "expensive".
>>   I can't say if it's a bug in PHP or some config option.
> 
> 
> You may want to benchmark the difference between readfile and fopen/fread
> for a 1.9M file.
> 
> If it ain't much, don't worry about it.
> 
> One posible work-around:
> 
> `cat filename`;
> 
> This MIGHT be cheaper than fopen/fread -- Or not, since it has to build a
> shell of some kind, I think.
> 
> PS File a bug report, if you haven't already.
> 

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



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-10 Thread Catalin Trifu
Hi,

   It can't be a memory limit problem. The server ha 2GB memory,
and in PHP each script can consume up to 64MB. On php4, apache 1.3 and
same configs readfile works without fread tricks.

C.


Rory Browne wrote:
> It's probably something to do with maximum memory, or something like
> that, but taking into account that your method is stretching the
> resources, fopen/fread may be a better solution.
> 
> I'd be curious to see the benchmarked differences  - but couldn't be
> bothered at this minute doing the benchmarking atm.
> 
> On 6/10/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> 
>>   Hi,
>>
>>  Tried it and it works indeed, but it's quite annoying to make such tricks
>>and is not the best solution either; fopen and fread are "expensive".
>>   I can't say if it's a bug in PHP or some config option.
>>
>>
>>C.
>>
>>
>>Rory Browne wrote:
>>
>>>I've never came across that problem, but try this
>>>
>>>function output_file($filename){
>>>$fp = fopen($filename, "r");
>>>while(!feof($fp)){
>>>  echo fread($fp, 1024000);
>>>}
>>>}
>>>
>>>On 6/9/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>  I installed php5 using the configue below. I tried with apache2 as well 
>>>> and same things.
>>>>
>>>>'./configure' '--prefix=/usr/local/php5' 
>>>>'--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
>>>>'--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' 
>>>>'--enable-sockets' '--enable-exif'
>>>>'--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
>>>>'--enable-gd-native-ttf'
>>>>'--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
>>>>'--with-mysql=/usr'
>>>>'--with-xsl' '--with-libxml-dir=/usr'
>>>>
>>>>  I have a script which generates a temporary catalog file, which is 
>>>> generated correctly having
>>>>4.7MB on disk.
>>>>  Then I push up the wire with readfile($filname):
>>>>
>>>>  header("Content-Type: text/csv");
>>>>  header("Content-Disposition: attachment; filename=somfilename.csv");
>>>>  header("Content-Length: ". filesize($file));
>>>>
>>>>  readfile($file);
>>>>
>>>>  I also tried with fopen.
>>>>  If I try to download the file directly from apache it works, all 4.7MB 
>>>> are received.
>>>>
>>>>  As expected the browser starts the download and reports it is expecting a 
>>>> file of 4.7MB.
>>>>  However, the download stops at 2.000.000 bytes no matter what browser I 
>>>> use (normally i use
>>>>Firefox on Linux), no matter if php runs on apache2 or apache1.3
>>>>
>>>>  Is there some php config option I missed ?
>>>>  Could this be from curlwrappers ?
>>>>  Where could this come from ?
>>>>
>>>>
>>>>Thanks,
>>>>Catalin
>>>>
>>>>--
>>>>PHP General Mailing List (http://www.php.net/)
>>>>To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

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



Re: [PHP] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-09 Thread Catalin Trifu
   Hi,

  Tried it and it works indeed, but it's quite annoying to make such tricks
and is not the best solution either; fopen and fread are "expensive".
   I can't say if it's a bug in PHP or some config option.


C.


Rory Browne wrote:
> I've never came across that problem, but try this
> 
> function output_file($filename){
> $fp = fopen($filename, "r");
> while(!feof($fp)){
>   echo fread($fp, 1024000);
> }
> }
> 
> On 6/9/05, Catalin Trifu <[EMAIL PROTECTED]> wrote:
> 
>>Hi,
>>
>>   I installed php5 using the configue below. I tried with apache2 as well 
>> and same things.
>>
>>'./configure' '--prefix=/usr/local/php5' 
>>'--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
>>'--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' 
>>'--enable-sockets' '--enable-exif'
>>'--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
>>'--enable-gd-native-ttf'
>>'--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
>>'--with-mysql=/usr'
>>'--with-xsl' '--with-libxml-dir=/usr'
>>
>>   I have a script which generates a temporary catalog file, which is 
>> generated correctly having
>>4.7MB on disk.
>>   Then I push up the wire with readfile($filname):
>>
>>   header("Content-Type: text/csv");
>>   header("Content-Disposition: attachment; filename=somfilename.csv");
>>   header("Content-Length: ". filesize($file));
>>
>>   readfile($file);
>>
>>   I also tried with fopen.
>>   If I try to download the file directly from apache it works, all 4.7MB are 
>> received.
>>
>>   As expected the browser starts the download and reports it is expecting a 
>> file of 4.7MB.
>>   However, the download stops at 2.000.000 bytes no matter what browser I 
>> use (normally i use
>>Firefox on Linux), no matter if php runs on apache2 or apache1.3
>>
>>   Is there some php config option I missed ?
>>   Could this be from curlwrappers ?
>>   Where could this come from ?
>>
>>
>>Thanks,
>>Catalin
>>
>>--
>>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] [? BUG ?] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-09 Thread Catalin Trifu
Hi,

   I installed php5 using the configue below. I tried with apache2 as well and 
same things.

'./configure' '--prefix=/usr/local/php5' 
'--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
'--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' '--enable-sockets' 
'--enable-exif'
'--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
'--enable-gd-native-ttf'
'--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
'--with-mysql=/usr'
'--with-xsl' '--with-libxml-dir=/usr'

   I have a script which generates a temporary catalog file, which is generated 
correctly having
4.7MB on disk.
   Then I push up the wire with readfile($filname):

   header("Content-Type: text/csv");
   header("Content-Disposition: attachment; filename=somfilename.csv");
   header("Content-Length: ". filesize($file));

   readfile($file);

   I also tried with fopen.
   If I try to download the file directly from apache it works, all 4.7MB are 
received.

   As expected the browser starts the download and reports it is expecting a 
file of 4.7MB.
   However, the download stops at 2.000.000 bytes no matter what browser I use 
(normally i use
Firefox on Linux), no matter if php runs on apache2 or apache1.3

   Is there some php config option I missed ?
   Could this be from curlwrappers ?
   Where could this come from ?


Thanks,
Catalin

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



[PHP] Re: weird thing; downloading from a php script stops at exactly 2.000.000bytes

2005-06-09 Thread Catalin Trifu
Hi,

   Thanks for the answer; the amount of memory configured is 64MB.
   readfile does no buffering and such things; it simply spits the file
on the wire.
   Other suggestions ?

C.


rush wrote:
> "Catalin Trifu" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> 
>>Hi,
>>   As expected the browser starts the download and reports it is expecting
> 
> a file of 4.7MB.
> 
>>   However, the download stops at 2.000.000 bytes no matter what browser I
> 
> use (normally i use
> 
>>Firefox on Linux), no matter if php runs on apache2 or apache1.3
> 
> 
> try changing the amount of memory that php script can use, and see if
> download stops at different place. Default memory for script is 8Mb, and 2Mb
> is suspiciosly equal to 8Mb/word size.
> 
> rush
> --
> http://www.templatetamer.com/
> http://www.folderscavenger.com/

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



[PHP] Re: _construct() problem

2005-06-09 Thread Catalin Trifu
Hi,

   What aout __construct() ->thi shoul do the trick (read the manual)

Catalin


Stéphane Bruno wrote:
> Hello,
> 
> I designed a "player" class with the following properties and
> constructor:
> 
> class player {
>   private $properties = array('firstname' => NULL, 'lastname' => NULL);
> 
>   function _construct($first, $last) {
> $this->properties['firstname'] = $first;
> $this->properties['lastname'] = $last;
>   }
> }
> 
> Then I have other methods that allow me to set and get the properties.
> However, when I issue a:
> 
> $myplayer = new player('Laurent', 'Blanc');
> 
> it seems that the constructor is not taken into account: the properties
> are not initialized. I have to explicitly initialize them with the
> setter methods in order for the initialization to take place.
> 
> What did I do wrong?
> 
> I am running PHP 5.0.4 with Apache 2.0.54 on Fedora Core 1.
> 
> Stéphane

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



[PHP] Re: weird thing; downloading from a php script stops at exactly 2.000.000bytes

2005-06-09 Thread Catalin Trifu
I also use eaccelrator; However, even if I disable it completely, it 
still stops at 2.000.000 bytes.


Catalin


Catalin Trifu wrote:
>   Hi,
> 
>I installed php5 using the configue below. I tried with apache2 as well 
> and same things.
> 
> './configure' '--prefix=/usr/local/php5' 
> '--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
> '--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' 
> '--enable-sockets' '--enable-exif'
> '--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
> '--enable-gd-native-ttf'
> '--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
> '--with-mysql=/usr'
> '--with-xsl' '--with-libxml-dir=/usr'
> 
>I have a script which generates a temporary catalog file, which is 
> generated correctly having
> 4.7MB on disk.
>Then I push up the wire with readfile($filname):
> 
>header("Content-Type: text/csv");
>header("Content-Disposition: attachment; filename=somfilename.csv");
>header("Content-Length: ". filesize($file));
> 
>readfile($file);
> 
> 
>As expected the browser starts the download and reports it is expecting a 
> file of 4.7MB.
>However, the download stops at 2.000.000 bytes no matter what browser I 
> use (normally i use
> Firefox on Linux), no matter if php runs on apache2 or apache1.3
> 
>Is there some php config option I missed ?
>Where could this come from ?
> 
> 
> Thanks,
> Catalin

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



[PHP] weird thing; downloading from a php script stops at exactly 2.000.000 bytes

2005-06-09 Thread Catalin Trifu
Hi,

   I installed php5 using the configue below. I tried with apache2 as well and 
same things.

'./configure' '--prefix=/usr/local/php5' 
'--with-apxs=/usr/local/apache/bin/apxs' '--disable-cgi'
'--with-config-file-path=/etc/php5' '--with-dom' '--with-gd' '--enable-sockets' 
'--enable-exif'
'--with-freetype2' '--with-freetype-dir=/usr/include/freetype2' 
'--enable-gd-native-ttf'
'--with-zlib-dir=/usr' '--with-curl' '--with-curlwrappers' '--enable-ftp' 
'--with-mysql=/usr'
'--with-xsl' '--with-libxml-dir=/usr'

   I have a script which generates a temporary catalog file, which is generated 
correctly having
4.7MB on disk.
   Then I push up the wire with readfile($filname):

   header("Content-Type: text/csv");
   header("Content-Disposition: attachment; filename=somfilename.csv");
   header("Content-Length: ". filesize($file));

   readfile($file);


   As expected the browser starts the download and reports it is expecting a 
file of 4.7MB.
   However, the download stops at 2.000.000 bytes no matter what browser I use 
(normally i use
Firefox on Linux), no matter if php runs on apache2 or apache1.3

   Is there some php config option I missed ?
   Where could this come from ?


Thanks,
Catalin

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



[PHP] kannel library

2005-05-11 Thread Catalin Trifu
Hi,


   Has anyone knowledge about a kannel (www.kannel.org) php library to deal
with sms and binary content messages such as wap push and nokia smart messages ?


Catalin

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



[PHP] Re: php SMPP

2005-04-13 Thread Catalin Trifu
Hi,

   If you are into C programming try kannel (www.kannel.org); they fully 
implement
SMPP protocol into their gateway, so you could take a look at their code.

Catalin


Kyriacos Sakkas wrote:
> Hi all,
>   Just wondering if anybody has had experience using SMPP with php. I
> have used the one available class that has limited functionality for
> sending simple messages, but would like to do a little bit more
> (concatenated messages over 170 chars.).
>   Ipworks has some libraries, but I have not been able to compile the php
> side of them (keep getting compilation errors for on file), so now I am
> stuck.
>   Any pointers to existing scripts, or advice on how to create SMPP pdu's
> manually will be very appreciated.
>   
> thanks
>   Kyriacos

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



[PHP] php_serializer

2005-02-15 Thread Catalin Trifu
Hi,
Is the php5 session serializer php_binary faster than the php one ?
Or it's purpose is just to obscure the saved datas ?
thanks,
catalin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Dynamic PHP links

2005-02-13 Thread Catalin Trifu
Hi,
   Check out this http://phpsec.org/
Cheers,
Catalin

Hi,
I'm new to PHP and I'd appreciate your advice a lot.
I'm trying to use dynamic PHP links instead of plain HTML and I'm gonna use 
something like
this:
File "index.php":
story
about

But a guy told me it is not preferable to use this method because of security 
considerations.
I'm sure there is a common way of building dynamic links; am I on wrong way?
Any help would be appreciated.
Thank you in advance

Best regards,
Eduard Grigoryan
*
Armenian Freenet Catalog
http://freenet.am/~edik_g
http://armfn.net/~edik_g
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: mail function and qmail

2004-09-26 Thread Catalin Trifu
Php Mysql wrote:
mail function in php requires to use 'sendmail'. But I have only
'qmail' on the box. How I can send email in PHP?
Thanks
Hi,
   After u installed qmail, there is a qmail compatible sendmail 
created for you in /var/lib/qmail/bin (i think that's where it should be).
   As qmail docu' says y should copy or symlink this sendmail to the
/bin/sendmail or /usr/bin/sendmail on u'r system.
   Make sure u first backup u'r original sendmail.
   This should make PHP's mail stuff work as expected with qmail

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


[PHP] Re: how to post data to java servlet

2004-09-19 Thread Catalin Trifu
Hi,
$str = "DATA=abc&DATA=123&DATA=xxx"
I believe you should encode the string with http://www.php.net/rawurlencode
but make sure u don't encode the & and = signs.
  $len = strlen($str);
$p = "POST /httpsmspp/servlet/sms HTTP/1.0\r\n";
  $p.= "Host: 123.31.228.206\r\n";
  $p.= "Content-type: application/x-www-form-urlencoded\r\n";
I think you the Content-Type here is wrong, since you don't encode your
string to match the content type. Perhaps text/plain might do it.
  $p.= "Content-length: $len\n\n";
here there should be another line
$p .= "\r\n";
here the \n\n should be \r\n
  $p.= "$str\n";
here \n should be \r\n
  $p.= "\r\n";
the above line should not exist
$server = "123.31.228.206";
$connection_timeout = 10;
$fp = fsockopen ($server, 80, &$errno, &$errstr, $connection_timeout);
  fputs ($fp,$p);
$recdata = "";
while (!feof($fp))
 {
  $recdata .= fgets ($fp,128);
 }
  fclose ($fp);
What is the response from the server ?
Hope this helps,
Catalin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: gettext does not translate

2004-09-11 Thread Catalin Trifu
Hi,

I had really bad headaches with gettext some time ago
and since then I decided to no longer use it. It's unreliable on
heavy loads (mixed english + translated texts), moving the scritps to
another machine means more headache, it relies on system calls which
are not "isolated", which means scritps can step on each others toes.
My advice is stay away of gettext. Try some DB framework for
translation; it definetely performs better and more reliable.
Or, if the site is small you can rely on included files.

Cheers,
catalin

"Christian David" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello!
>
> I wrote this skript, but gettext returns only the english string.
>
> I could not find a bug at bugs.php.net, so I think I forgot something.
> I have Debian Linux, PHP Version 4.3.4 and Gettext 0.14.1 (PHP and Gettext
> as debian pakages)
>
> gettext.php in /var/www/gymbay/
>
>  // Set language to German
> setlocale(LC_ALL, 'de_DE');
>
> // Specify location of translation tables
> bindtextdomain("messages", "i18n");
>
> // Choose domain
> textdomain("messages");
>
> // Translation is (should) looking for in
> i18n/de_DE/LC_MESSAGES/messages.mo now
>
> // Print a test message
> echo gettext("Welcome to My PHP Application");
>
> // Or use the alias _() for gettext()
> echo _("Have a nice day");
>
> // Output:
> // Welcome to My PHP ApplicationHave a nice day
>
> ?>
>
> messages.po
>
> # translation of messages.po to german
> # This file is distributed under the same license as the PACKAGE package.
> # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER.
> # Christian Dávid <[EMAIL PROTECTED]>, 2004.
> #
> msgid ""
> msgstr ""
> "Project-Id-Version: messages\n"
> "Report-Msgid-Bugs-To: \n"
> "POT-Creation-Date: 2004-09-11 15:50+0200\n"
> "PO-Revision-Date: 2004-09-11 15:52+0200\n"
> "Last-Translator: Christian Dávid <[EMAIL PROTECTED]>\n"
> "Language-Team: \n"
> "MIME-Version: 1.0\n"
> "Content-Type: text/plain; charset=UTF-8\n"
> "Content-Transfer-Encoding: 8bit\n"
> "X-Generator: KBabel 1.3.1\n"
> "Plural-Forms:  nplurals=2; plural=(n != 1);\n"
>
> #: gettext.php:15
> msgid "Welcome to My PHP Application"
> msgstr "Willkommen zu meiner PHP Anwendung"
>
> #: gettext.php:18
> msgid "Have a nice day"
> msgstr "Wir wünschen Ihnen einen schönen Tag"
>
> and the "messages.mo" is in /var/www/gymbay/i18n/de_DE/LC_MESSAGES/
>
> Thank you! 

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



[PHP] Re: PHP modules

2004-09-10 Thread Catalin Trifu
http://ro.php.net/manual/en/zend.php

This might be a good start.

Cheers,
Catalin

"Benjamin Bostow" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I have heard of php modules and to the sound of it it allows me to create 
>php functions that I don't have to have include files to have access to 
>those functions. I have been searching for any information on this and have 
>not had any success. I am basically trying to write an API that others can 
>use in php that will interface with my software. I would like to make it so 
>that they don't have to worry about adding include files and having all of 
>the structures set up for that. If anyone can provide information on 
>building custom functions and calls into PHP it would be helpful.
>
> Benjamin Bostow 

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



[PHP] Re: problems setting up php5 on apache2 (WinXP Pro)

2004-09-10 Thread Catalin Trifu
Hi,

I 2 use winxp pro at home, actually linux + windowoze and i have
encountered the same problem with mysql extension.
Some extensions, such as iconv, openssl depend on external libraries.

btw! it's not a good idea to mess with windows\system32 folder. If you 
want
you can add the c:\php dir to the PATH variable and all dlls in there will 
be found at
runtime by the engine which should happen anyway, since php5ts.dll is in 
that dir
anyway.
You should try and check for famous win32 DLL HELL.
http://www.sysinternals.com/ntw2k/source/filemon.shtml
This tool can be really helpfull to see which files are accessed during 
startup and see
which dlls are loaded and where they are looked for.

As far as mysql is concerned, my installation is mysql-4.0.18. I tried 
the following:
- i saw that the libmysql.dll which was delivered with php-5.0.1 was not 
working so
i tried to use the libmysql.dll which came with my mysql server 
installation.
This did not work either, so, I recompiled the mysql extension against 
my mysql server
installation and since then everything works perfect.
I used VC 6.0 since php-5.0.1 for win32 is compiled with it.
If you need some help with compiling the extension, please ask.

Cheers,
Catalin

P.S.
It's not so bad considering linux for home use either. I have to use 
winxp but i would
go for only linux if I could

"Mathieu Dumoulin" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> (Don't write to me telling me to use linux, i dont want to, this is my 
> home
> machine not a production server, thank you, now if you really want to help
> keep on reading)
>
> I got a most recent copy of PHP 5.01 extracted into "C:\php" and 
> everything
> seems to be working fine as long as i dont ask to load extensions. Any
> extension that i try to add will fail to load and i'm clueless.
>
> At first in the PHP.ini file this was the original directive:
>
> ; Directory in which the loadable extensions (modules) reside.
> extension_dir = "./"
>
> And it would not work so i changed it to a hardcoded path
>
> ; Directory in which the loadable extensions (modules) reside.
> extension_dir = "C:\php\ext"
>
> Still no extensions wont load. Whats the weirdest, all the DLLs are at the
> correct location, apache reports: "PHP startup: Unable to load dynamic
> library 'C:\php\ext\php_mysql.dll' - The specified module could not be
> found."
>
> but it IS there, at the exact location, i even looked and compared both
> paths manually letter by letter. Another weird thing to note is that some
> extensions DO load while some don't, here is a list of the extensions that
> i'm loading and which one fails (Note ALL extensions DLL are indeed in the
> folder intended, they just dont load)
>
> extension=php_bz2.dll
> extension=php_gd2.dll
> extension=php_imap.dll
> extension=php_mysql.dll <<< fails but it's vital to me
>
> these extensions are activated, only mysql fails, but there are other i
> wanted earlier lemme see which ones: (These would be nice to have, i'll 
> tell
> you which one fails too)
>
> ;extension=php_exif.dll <<< fails
> ;extension=php_ldap.dll <<< fails (The file really isnt there so it's not 
> a
> real problem)
> ;extension=php_openssl.dll <<< fails
> ;extension=php_pdf.dll
> ;extension=php_pgsql.dll
> ;extension=php_snmp.dll
> ;extension=php_sockets.dll
> ;extension=php_tidy.dll
> ;extension=php_zip.dll
>
> All of these will load... S I'm stuck there, i need help, tell me if 
> you
> need to know anything else. i'll be glad to give you info, i want to set
> this up to further my PHP developement at home. We intensively use PHP4 at
> work but i wanted to start working on PHP5 to see how good it is.
>
> Till then
> See ya'll
> TheInsaneCoder 

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



Re: [PHP] Re: [PHP5]__get, __set and isset()

2004-08-31 Thread Catalin Trifu
Actually i think no property is created; not in the sense of
real object property.
The only "real" property of the object is $elem.
The $o->a, and $o->b are, IMHO, not object properties;
It is true that one can access $o->a and $o->b, but what is actually
returned is a member of the array $elem, and only because of the
implementation of the magic functions __set and __get.
isset() does test for an "actual" variable beeing set, which is 
definetely
not the case.
I agree however that this is confusing. I am definetely puzzled by the
usefullness of these methods since i consider this to be a real error trap;
it would be so easy to fill up an object with values without knowing
what they are and what they are supposed to do and when developing some
kinda library, things can get really messy.
On my part I would stick with the usual declaration of properties and 
not
use __set() and __get().
I think it's much cleaner to say:
class OO {
/** this is variable a and means ... */
public $a;
/** this is variable a and means ... */
public $b;
}

cheers,
Catalin


""Frédéric hardy"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Yes but not :-).
>
> With you use these magic functions, when you write $o->a = 'foo', you 
> create a property in the object. Not ? Even if it is stored in an array 
> member, __set() create a property and __get() retrieve its value.
>
> Doc says :
>
> >The $name parameter used is the name of the variable that should
> > be set or retrieved.
> >The __set() method's $value parameter specifies the value that
> > the object should set set the $name.
>
> Conclusion :
>
> class OO
> {
>private $elem = array();
>public function __get ($prop)
>{
>   if (isset($this->elem[$prop])) {
>  return $this->elem[$prop];
>}
>else
>{
>   return NULL;
>}
>
>public function __set ($prop, $val)
>{
>   $this->elem[$prop] = $val;
>}
> }
>
> $o = new OO();
> echo isset($o->a) ? "yes\n" : "no\n"; # Must return false and return false 
> effectively, cool
> $o->a = 'foo';
> echo isset($o->a) ? "yes\n" : "no\n"; # Must return false and return false 
> effectively, NOT COOL
>
> Fred.
>
>
> Catalin Trifu wrote:
>
>> Hi,
>>
>> Is this really a bug. I think not.
>> There is no variable $o->a or $a->b in the class OO
>> there is only the variable $elem and $a and $b is a member
>> of that array
>> So ...
>> The fact that PHP5 provides __set and __get magic
>> functions does not mean that the actual variables exist with
>> that particular name in the class ?
>> Perhaps it would be nice to have a __isset magic function ?
>>
>> Cheers
>> Catalin
>>
>>
>>
>>>>>
>>>class OO
>>>{
>>>private $elem = array("a" => 1);
>>>
>>>public function __get ($prop)
>>>{
>>>if (isset($this->elem[$prop])) {
>>>return $this->elem[$prop];
>>>} else {
>>>return NULL;
>>>}
>>>}
>>>
>>>public function __set ($prop, $val)
>>>{
>>>$this->elem[$prop] = $val;
>>>}
>>>}
>>>
>>>$o = new OO();
>>>
>>>echo isset($o->a) ? "yes\n" : "no\n";
>>>echo isset($o->b) ? "yes\n" : "no\n";
>>>
>>>echo is_null($o->a) ? "yes\n" : "no\n";
>>>echo is_null($o->b) ? "yes\n" : "no\n";
>>>
>>>?>
>>>
>>>I expected something like this:
>>>
>>>yes
>>>no
>>>no
>>>yes
>>>
>>>But got this:
>>>
>>>no
>>>no
>>>no
>>>yes
>>>
>>>It looks like isset() can't handle object properties correctly. I'll post 
>>>the bug on php.net.
>>>
>>>-- 
>>>Daniel Schierbeck
>>
>>
>
> -- 
> ===
> Frederic HARDYEmail: [EMAIL PROTECTED]
> HEXANET SARL  URL: http://www.hexanet.fr/
> ZAC Les CharmillesTel: +33 (0)3 26 79 30 05
> 3, allée Thierry Sabine   Direct: +33 (0)3 26 61 77 84
> BP 202 - 51686 REIMS CEDEX 2 FRANCE
> === 

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



[PHP] Re: [PHP5]__get, __set and isset()

2004-08-31 Thread Catalin Trifu
Hi,

Is this really a bug. I think not.
There is no variable $o->a or $a->b in the class OO
there is only the variable $elem and $a and $b is a member
of that array
So ...
The fact that PHP5 provides __set and __get magic
functions does not mean that the actual variables exist with
that particular name in the class ?
Perhaps it would be nice to have a __isset magic function ?

Cheers
Catalin


> 
> class OO
> {
> private $elem = array("a" => 1);
>
> public function __get ($prop)
> {
> if (isset($this->elem[$prop])) {
> return $this->elem[$prop];
> } else {
> return NULL;
> }
> }
>
> public function __set ($prop, $val)
> {
> $this->elem[$prop] = $val;
> }
> }
>
> $o = new OO();
>
> echo isset($o->a) ? "yes\n" : "no\n";
> echo isset($o->b) ? "yes\n" : "no\n";
>
> echo is_null($o->a) ? "yes\n" : "no\n";
> echo is_null($o->b) ? "yes\n" : "no\n";
>
> ?>
>
> I expected something like this:
>
> yes
> no
> no
> yes
>
> But got this:
>
> no
> no
> no
> yes
>
> It looks like isset() can't handle object properties correctly. I'll post 
> the bug on php.net.
>
> -- 
> Daniel Schierbeck 

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



[PHP] WAP Push

2004-04-21 Thread Catalin Trifu
Hi,

Has anyone worked with Simplewire SMS SDK ?
If yes, is it possible to send WAP push messages with it and
if yes how.
If anyone has any info about some PHP + WAP push combination
i would be very grateful.


Thank you,
Catalin

P.S.
I've googled for it

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



[PHP] Re: Adding a new entry using PHP

2004-04-08 Thread Catalin Trifu
Hi,

Check http://php.weblogs.com/adodb

Catalin


P.S.
Welcome to PHP :)


"Alistair Hayward" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I am an ASP user, now learning PHP.
>
> When adding a record in ASP, I do this:
>
> Recordset.AddNew
> Field1 = whatever
> RecordSet.Update
>
> How is this done in PHP?
>
> I have built a recordset using a query, and have all the information
> needed to go into the different fields, but how do I 'Edit' or 'AddNew'
> and 'Update'?
> This is what I have:
>
> 
> unset($price);
> $price = $_GET['Price'];
>
> unset($id);
> $id = $_GET['id'];
>
> unset($partnumber);
> $partnumber = $_GET['PartNumber'];
>
> unset($disc);
> $disc = $_GET['Disc'];
>
> $link = mysql_connect('localhost', 'root', 'password');
> if (!$link) {
>  echo "Couldn't make a connection!";
>  exit;
>  }
> $db = mysql_select_db("order", $link);
> if (!$db) {
>  echo "Couldn't select database!";
>  exit;
>  }
> $sql= "SELECT * FROM tborder WHERE sid='session.sessionid'";
> $result = mysql_query($sql);
>
> $total_records = mysql_num_rows($result);
>
>
> ?>

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



[PHP] Re: Exceptions and builtin functions in PHP5

2004-04-08 Thread Catalin Trifu
Hi,

I think this question is better suited to the devel list.

Catalin

"Tumurbaatar S." <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If I understand right, PHP5 has an exception
> handling mechanism but it is only for "manual" using, i.e.
> a programmer can use try/catch but only for own code.
> PHP's built-in functions and functions from extensions still
> use old "return value" method. Yes?

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



[PHP] Re: php + lynx + grep

2004-04-07 Thread Catalin Trifu
Hi,

I had same problem myself once.
Try adding the apache user to sudoers in /etc/sudoers if not
already there

Cheers,
Catalin


"Brian L. Ollom" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v
> '41-35-19N' |grep TOL | head -n 1
>
> I need to get the output of the above command for a web site I'm
> working on.  I've tried exec(), system() and neither seems to
> work.
>
> It's output should be something like this(it changes hourly):
> KTOL 031452Z 28013KT
>   10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015
>
> Help!
>
> 
> | Brian Ollom  |   |
> | NiteHawke.Com|  http://www.nitehawke.com/|
> | An Authorized Firefly Dealer |  email  [EMAIL PROTECTED]  |
> 

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



[PHP] Re: Transfering a file

2004-02-24 Thread Catalin Trifu
Hi,

You could ftp to the other server, or even http.
>From php you can open a connection to the other's ftp
ot http services and transfer the file from one server to the
other like this

Regards,
C.


"Mike Koponick" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hello everyone,

I will apologize in advance if this has been discussed previously.

I would like transfer a file that is created by PHP. Once written, I
need to transfer (or write it) to another server. The destination server
is on another network behind a firewall, whereas the front end is in a
DMZ. Both of these servers are Linux (Redhat 9.0) and I REALLY don't
want to use NFS because of security reasons. Is there another route I
should look at?

Thanks in advance,

Mike

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



Re: [PHP] Re: session expired -> how to know if the session is newor old

2004-02-24 Thread Catalin Trifu
Hi,

Thanks for the reply.
The method you suggest does not work. Have you tested it somewhere ?

Catalin


"Seba" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "in the first page of your website, or when you connect for the firs
> time to it"
>
> $_SESSION['first_session_value'] = session_id();
>
> "others pages"
> if($_SESSION['first_session_value'] != session_id()){
> echo "The session has a new value";
> }
>
>
>
> Seba
>
>
> Il mar, 2004-02-24 alle 15:16, Jakes ha scritto:
> > What do you need this for.? You session is only suppose to last for one
> > browser session
> >
> > "Catalin Trifu" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Hi,
> > >
> > > Here is the problem:
> > >
> > > The session gc runs and deletes the session data. This is good,
> > > but calling session_start in PHP obviously creates a new session.
> > >
> > > How can I know if the session was created after an old one was
> > > deleted because gc has invalidated it or it is a completely fresh
session,
> > > from let's say a fresh browser window.
> > >
> > > I googled for it and looked in the docs but I found nothing on
this
> > > matter.
> > >
> > > Thanks in advance,
> > > Catalin

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



Re: [PHP] Re: session expired -> how to know if the session is new or old

2004-02-24 Thread Catalin Trifu
Thanks for the response.
Indeed it seems this is the only way to achieve what I want.
It would be nice if the PHP guys would implement such functionality.

Catalin

"Stuart" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Catalin Trifu wrote:
> > I want to redirect my users to a session expired page and not
directly
> > to
> > a blank login page based on wheter this is just a gc colected session.
> > In case the user goes to sleep but leaves the browser open and then
in
> > the
> > morning he comes back and does something the browser will send the
> > session id he got before sleeping.
>
> The only way to accomplish this is to keep a persistant cookie updated
> with the last time they used a session. Then if someone comes to the
> site without a session, check for that cookie and present the
> appropriate page. However, this seems like a lot of effort for little
> gain to me.
>
> -- 
> Stuart

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



[PHP] Re: session expired -> how to know if the session is new or old

2004-02-24 Thread Catalin Trifu
Hi,

I want to redirect my users to a session expired page and not directly
to
a blank login page based on wheter this is just a gc colected session.
In case the user goes to sleep but leaves the browser open and then in
the
morning he comes back and does something the browser will send the
session id he got before sleeping.


Catalin,


"Jakes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What do you need this for.? You session is only suppose to last for one
> browser session
>
> "Catalin Trifu" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi,
> >
> > Here is the problem:
> >
> > The session gc runs and deletes the session data. This is good,
> > but calling session_start in PHP obviously creates a new session.
> >
> > How can I know if the session was created after an old one was
> > deleted because gc has invalidated it or it is a completely fresh
session,
> > from let's say a fresh browser window.
> >
> > I googled for it and looked in the docs but I found nothing on this
> > matter.
> >
> > Thanks in advance,
> > Catalin

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



[PHP] session expired -> how to know if the session is new or old

2004-02-24 Thread Catalin Trifu
Hi,

Here is the problem:

The session gc runs and deletes the session data. This is good,
but calling session_start in PHP obviously creates a new session.

How can I know if the session was created after an old one was
deleted because gc has invalidated it or it is a completely fresh session,
from let's say a fresh browser window.

I googled for it and looked in the docs but I found nothing on this
matter.

Thanks in advance,
Catalin

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



[PHP] Re: session timeout?

2004-02-24 Thread Catalin Trifu
Hi,

You have to make the code yourself,

After session_start you should check the session for some
variable you use to check if the user is logged in

eg:


C.


"Jake McHenry" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
How can I make my site auto log out a user like I've seen on many sites?
Right now, the users session never expires unless manually logging out or
the browser is closed. Also, should I change anything to cover any security
issues? I havn't changed much from the default, only enough to get it
running for my site.

Here is what I have in my php.ini file:

[Session]
session.save_handler = files
session.save_path = /var/www/sessions
session.use_cookies = 1
session.name = NittanyTravelSessionCookie
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"


Thanks,
Jake

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



[PHP] ImageMagick + PHP on Win32

2003-11-28 Thread Catalin Trifu
Hi,

I have downloaded and installed ImageMagick (5.5.7 Q8) in c:\imagemagick
added it to %PATH%
I have downloaded the latest php_imagick.dll extension from kromann.info
and installed it.
PHP says imagick is installed properly.
However, when i am trying to run any of the examples that come with it
I get only errors.
If anyone knows how to install imagemagick on win32, please do advise
me.
I have googled fot it, but i did not manage to fins anything usefull
(perhaps my mistake)

Thank you,
Catalin

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



[PHP] Re: 2 (simple?) php related questions

2003-11-28 Thread Catalin Trifu
Hi,

> Whats the advantage of the above and whats the idea?
> isnt it much easier (and logical) to keep track of pages if you give them
a
> logical name?

The idea behind this approach is using MVC (MVC2) architecture which
gives much more
flexibility to the programmer.
Usually index.php (or whatever name) is called the controller and it
uses some
configuration files so that it knows which script(s) are responsible fo
processing certain
actions.
This approach allows to separate between business logic and
presentation.
An MVC intro is beyond the scope of this list, so google for it
Take a look at phrame.sourceforge.net for some ideas

Cheers,
Catalin

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



[PHP] Re: .htaccess authentification problem

2003-11-28 Thread Catalin Trifu
Hi,

When using .htaccess files the request does not reach
your scripts untill Apache has done his authentication.
So, I suggest you take out the .htaccess part for authentication
and deal with it only from PHP; for instance with sessions:
1. Ask for user/pass on first page and authnticate against DB
2. If ok, put it in the $_SESSION
3. When in the user dir, check his session and if he/she is not
authenticated make authentication with PHP (your code below)


Hope this helps,
Catalin

"Michael HüBner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hallo,
>
> Hope somebody can help me.
>
> I'm working on Linux, Apache.
>
> On my start-site the user can log in via inserting Username and Password
> into normal formfields, which are compared with a DB.
>
> After this login, he can change to his own user-directory which is
.htpasswd
> and .htaccess protected. Thats the reson he has to insert his Username and
> Password again ;(
>
> My Question:
>
> Is there a way, so the user has to insert his data only once?
>
> I've also tried it by doing a authentification like this first:
>
>if (!isset($_SERVER['PHP_AUTH_USER'])) {
>Header("WWW-Authenticate: Basic realm=\"My Realm\"");
>Header("HTTP/1.0 401 Unauthorized");
>echo "Text to send if user hits Cancel button\n";
>exit;
> } else {
> echo "Hello {$_SERVER['PHP_AUTH_USER']}";
> echo "You entered {$_SERVER['PHP_AUTH_PW']} as your password.";
>   }
> ?>
>
> but it doesn't work for me, because when switching to the userdirs, the
> .htaccess authentification window pops up again (it is the same pwd and
uid
> in the DB and the .htpasswd) ;(
>
> Thank you in advance,
>
> Michael

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



[PHP] GD2 Fonts

2003-11-28 Thread Catalin Trifu
Fonts,

I am trying to use imageloadfont($PATH_TO_FONT . '/arial.ttf'); on a
windowze
machine. It fails without any error message.
Now, the font I use is the one from the windows Fonts/ dir.
I have also installed the freetype extension.
Can anyone tell me how they do it with fonts on windowze.
Please don't tell me to use Linux (i know that ;)).

Thank you,
Catalin

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



[PHP] Re: Setting up PHP5 alongside PHP4 on apache

2003-11-04 Thread Catalin Trifu
Luke Van Blerk wrote:

Hi everyone

I'd like to set up PHP5 to parse php files with a .php5 extension on Apache
1.3.28. Anybody know how to do this?
Regards
Luke
Hi,

  You can set up virtual hosts on the apache server
and load the php module on a per virual host base
Cheers,
Catalin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: AIX + PHP Extension Module Does Not Work (giving core dump at zend_parse_parameters)

2003-09-12 Thread Catalin Trifu
Hi,

This should go to the php.devel list

Cheers,
Catalin

"Ashish Borkar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi ,
> I am writing a php extension module on AIX 4.3.3  RS6000 machine.I
> have compiled php as CGI.When I test my php extension module function
> from a test php script I get a CORE dump.The gdb php core is as below
> Core was generated by `php'.
> Program terminated with signal 11, Segmentation fault.
> #0  0xd0990180 in zend_parse_parameters ()
> (gdb)  bt
> #0  0xd0990180 in zend_parse_parameters ()
> #1  0xd0990930 in zif_myfunction ()
> #2  0x1002c5a4 in execute (op_array=0x200e6c70, tsrm_ls=0x20027738)
> at /usr/local/php-4.3.2/Zend/zend_execute.c:1606
> #3  0x1000e0d4 in zend_execute_scripts (type=8, tsrm_ls=0x20027738,
> retval=0x0, file_count=3)
> at /usr/local/php-4.3.2/Zend/zend.c:869
> #4  0x10007410 in php_execute_script (primary_file=0x5,
> tsrm_ls=0x3027738)
> at /usr/local/php-4.3.2/main/main.c:1671
> #5  0x10001ec8 in main (argc=2, argv=0x2ff228c0) at
> /usr/local/php-4.3.2/sapi/cgi/cgi_main.c:1501
> #6  0x11dc in __start ()
> I have tried all combinations of ZTS=0 ZEND_DEBUG =0
>  ZTS=0 ZEND_DEBUG =1
>  ZTS=1 ZEND_DEBUG =0
>  ZTS=1 ZEND_DEBUG =1
> for compiling php as well as my extension module. All give the same
> result :-(
> Has anyone encountered this on a AIX machine.
> If not atleast has anyone successfully tested a PHP extension module on
> a AIX machine.I urgently need some Help.No matter what I tried till now
> All has failed.
> Thanks & Regards
> Ashish Borkar
>
>
>
> -
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software

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



[PHP] Re: HTTP_REFERER

2003-09-12 Thread Catalin Trifu
Hi,

It does support any HTTP information, and since
HTTP_REFERER is part of the HTTP spec. it is supported.
You can find it in the $_SERVER variable.
FYI: The referer is not a reliable information.

Cheers,
Catalin


"Louie Miranda" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Does php support this? HTTP_REFERER
> or simply cgi and ssi only?
>
> -
> Louie

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



[PHP] Re: question about mysqli

2003-09-07 Thread Catalin Trifu
http://de.php.net/mysqli

Cheers,
Catalin

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am using PHP 5 on Windows. I have downloaded the lastest from snaps.
When I
> try to use the mysqli functions, I get the error message:
>
> undefined function mysqli_connect()
>
> I assume this means that mysqli support is not compiled into the Windows
> version of PHP 5. However, there doesn't seem to be an extension dll for
> mysqli either in the extension directory. And no line for it in the
php.ini
> file.
>
> Does anyone know about mysqli for Windows? Is it going to be compiled into
> PHP 5? Or an extension included? When might this happen? Or is there an
> extension available somewhere that I can get? Or is mysqli support
available
> only if I compile the Windows version myself?
>
> Thanks,
>
> Janet

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



Re: [PHP] Re: sscanf error?

2003-09-07 Thread Catalin Trifu
Hi,

sscanf is meant to READ paramaters, which means
it "transforms" the input into the desired output, which in
your case it was an integer and an integer looses, of course
the initial zeros "if any".
What you wanted was, more or less, to transform the
parameters, job for which sprintf is better suited, at least in
this case.

Cheers,
Catalin

"Nuno Lopes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> Thanks for your answer!
>
> You say that sscanf is doing it's job, so the documentation isn't very
> clear.
> I think it says that the format is equal to sprintf. And sprintf has %010d
> in format that says that a var is a number with at least 10 digits, filled
> with 0's. So I think that sscanf should do the job!
>
>
> Nuno Lopes
>
>
>
> - Original Message - 
> From: "Catalin Trifu" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, September 07, 2003 5:51 PM
> Subject: [PHP] Re: sscanf error?
>
>
> > Hi,
> >
> > sscanf does what it says, that is
> > it reads parameters, which means it expects to find
> > a string like this "33996344" and converts it
> > into an integer; that's why you get the result you get.
> > This code does the job, but it's ugly: :).
> >
> >  > $db='33996344,33996351,"GB","GBR","UNITED KINGDOM"
> > 50331648,83886079,"US","USA","UNITED STATES"
> > 94585424,94585439,"SE","SWE","SWEDEN"';
> >
> > $lines=explode("\n", $db);
> >
> > echo "";
> > print_r($lines);
> >
> >
> > foreach ($lines as $line) {
> >  $args = explode(",", $line);
> >  $array = sprintf("%010d,%010d,%2s", $args[0], $args[1], $args[2]);
> >  $array = explode(",", $array);
> >  list ($start, $end, $country) = $array;
> >  print_r($array);
> > }
> >
> > print_r(printf("%010d", "33996344"));
> > echo "";
> >
> > ?>
> > It uses sprintf.
> >
> > Cheers,
> > Catalin
> >
> > "Nuno Lopes" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Hello,
> > >
> > > I'm trying to use sscanf, but I'm not receiving the results I
expected!
> > Can
> > > anybody help me, please?
> > >
> > >
> > > Thanking in advance,
> > > Nuno Lopes
> > >
> > >
> > > //
> > >  > > $db='"33996344","33996351","GB","GBR","UNITED KINGDOM"
> > > "50331648","83886079","US","USA","UNITED STATES"
> > > "94585424","94585439","SE","SWE","SWEDEN"';
> > >
> > > $lines=explode("\n", $db);
> > >
> > > foreach ($lines as $line) {
> > > $array=sscanf($line, "\"%010d\",\"%010d\",\"%2s");
> > > list ($start, $end, $country) = $array;
> > > print_r($array);
> > > }
> > > ?>
> > > /**/
> > > Output:
> > > Array
> > > (
> > > [0] => 33996344
> > > [1] => 33996351
> > > [2] => GB
> > > )
> > > 
> > > //
> > > Expected output:
> > > Array
> > > (
> > > [0] => 0033996344
> > > [1] => 0033996351
> > > [2] => GB
> > > )

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



[PHP] Re: sscanf error?

2003-09-07 Thread Catalin Trifu
Hi,

sscanf does what it says, that is
it reads parameters, which means it expects to find
a string like this "33996344" and converts it
into an integer; that's why you get the result you get.
This code does the job, but it's ugly: :).

";
print_r($lines);


foreach ($lines as $line) {
 $args = explode(",", $line);
 $array = sprintf("%010d,%010d,%2s", $args[0], $args[1], $args[2]);
 $array = explode(",", $array);
 list ($start, $end, $country) = $array;
 print_r($array);
}

print_r(printf("%010d", "33996344"));
echo "";

?>
It uses sprintf.

Cheers,
Catalin

"Nuno Lopes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I'm trying to use sscanf, but I'm not receiving the results I expected!
Can
> anybody help me, please?
>
>
> Thanking in advance,
> Nuno Lopes
>
>
> //
>  $db='"33996344","33996351","GB","GBR","UNITED KINGDOM"
> "50331648","83886079","US","USA","UNITED STATES"
> "94585424","94585439","SE","SWE","SWEDEN"';
>
> $lines=explode("\n", $db);
>
> foreach ($lines as $line) {
> $array=sscanf($line, "\"%010d\",\"%010d\",\"%2s");
> list ($start, $end, $country) = $array;
> print_r($array);
> }
> ?>
> /**/
> Output:
> Array
> (
> [0] => 33996344
> [1] => 33996351
> [2] => GB
> )
> 
> //
> Expected output:
> Array
> (
> [0] => 0033996344
> [1] => 0033996351
> [2] => GB
> )

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



[PHP] Re: highlighting multi term search results

2003-09-07 Thread Catalin Trifu
Hi,

>  function highlight($src_terms, $src_terms_int, $result) {
> $i = 0;
>while ($i < $src_terms_int) {
>$result = preg_replace('/('.$src_terms[$i].')/si',
> ''.$src_terms[$i].'', $result);
Here the $result is changed to 'test' on the first search.
Obviously on the second replace the term will not be found anymore!
>$i++;
>}
> return $result;
> }
>
> $search = "te est"; // user input to search for
> $src_terms = explode(" ", $search);
> $src_terms_int = count($src_terms);
>
> $result = "this is just a test"; // result from database
>
> print highlight($src_terms, $src_terms_int, $result);
> ?>

Cheers,
Catalin

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



[PHP] Re: PEAR

2003-09-05 Thread Catalin Trifu
Hi,

Let's say you have PEAR installed in
/usr/local/php/lib/php
To use PEAR related classes, you should add
/usr/local/php/lib/php to your include_path; then restart the server ;)
or you can use ini_set() on top of your scripts.

Cheers,
Catalin

"Richard Baskett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Ok I have loaded the new version of php 4.3.3, but now how in the world do I
enable PEAR? I have a couple of scripts that just call a pear php script,
but it says it doesn¹t exist.. does this mean that I need to change the
include path?  How do I include all those pear classes?

Thanks!

Rick

"Too much caution is bad for you. By avoiding things you fear, you may let
yourself in for unhappy consequences. It is usually wiser to stand up to a
scary-seeming experience and walk right into it, risking the bruises as hard
knocks. You are likely to find it is not as tough as you had thought.  Or
you may find it plenty tough, but also discover you have what it takes to
handle it." - Norman Vincent Peale

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



[PHP] Re: Creating Images

2003-09-04 Thread Catalin Trifu
Hi,

RTFM: http://de.php.net/manual/en/ref.image.php

Cheers,
Catalin

"Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have been trying to write some image creation scripts, and although I
have
> a version of PHP that includes image support, I keep getting errors
related
> to imagecreatefrompng(). Here is the latest error:
>
> Fatal error: Call to undefined function: imagecreatefrompng() in
> /web/html-docs/psych/jb4920/public_html/pic/picture.php on line 12
>
> Isn't imagecreatfrompng() a built in function? Anyone run across something
> like this or a suggestion?
>
> Thanks for the help!
> Jed R. Brubaker

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



Re: [PHP] Re: gettext i18n

2003-09-04 Thread Catalin Trifu
Thank you!


> putenv("LANG=de_DE");
> putenv("LANGUAGE=de_DE");  // better to be paranoid, works for me ;-)
this one did the trick !
> putenv("LC_ALL=de_DE");
> setlocale(LC_ALL, "de_DE", "german");
>
> (see some user comments in php manual)
i already read the all before posting here :)

Again thx,
Catalin

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



[PHP] Re: gettext i18n

2003-09-04 Thread Catalin Trifu
Hi,

Thanks for the reply, but it doesn't work
this way either.
in /www/locale I do have
de/
LC_MESSAGES/
messages.mo
de_DE/
LC_MESSAGES/
messages.mo

btw! on win32 it works :(

Catalin

"Desi" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> Try:
>
> putenv("LANG=de_DE") . '';
> putenv("LC_ALL=de_DE") . '';
> setlocale(LC_ALL, "de_DE", "german") . '';
>
> Desi
>
>
> Catalin Trifu wrote:
> > Hi,
> >
> > I want to add i18n support for my web site, but
> > it doesn't seem to work.
> > PHP 4.3.3., Apache 1.3.28, Mandrake 9.0
> > Here comes the test code. As you can see I try all sorts of things.
> >
> >  >  echo putenv("LANG=de") . '';
> >  echo putenv("LC_ALL=de") . '';
> >  echo setlocale(LC_ALL, "de", "german") . '';
> >  echo bindtextdomain("messages", "/www/locale") . '';
> >  echo textdomain("messages") . '';
> >
> >  echo gettext("User") . '';
> >
> >  echo strftime ("%A %e %B %Y", time()) . '';
> > ?>
> >
> > The funny thing is that strftime prints correctly.
> > Any ideas
> >
> > Catalin.

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



[PHP] gettext i18n

2003-09-04 Thread Catalin Trifu
Hi,

I want to add i18n support for my web site, but
it doesn't seem to work.
PHP 4.3.3., Apache 1.3.28, Mandrake 9.0
Here comes the test code. As you can see I try all sorts of things.

';
 echo putenv("LC_ALL=de") . '';
 echo setlocale(LC_ALL, "de", "german") . '';
 echo bindtextdomain("messages", "/www/locale") . '';
 echo textdomain("messages") . '';

 echo gettext("User") . '';

 echo strftime ("%A %e %B %Y", time()) . '';
?>

The funny thing is that strftime prints correctly.
Any ideas

Catalin.

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



Re: [PHP] Re: PHP SESSION timeouts

2003-09-03 Thread Catalin Trifu
Hi,

It does not.
session.gc_maxlifetime states that PHP will consider
that garbage, but it will not inform you it did so, neither does
it terminate the session.
Make an experimet if you want. set the "timeout" 5 minutes,
go for a coffee and come back in 10 minutes. You'll have a surprise

; After this number of seconds, stored data will be seen as 'garbage'
and
; cleaned up by the garbage collection process.
session.gc_maxlifetime

But since the garbage collection does not run on every request...
So, the gc_maxlife states only that the data is passible for garbage,
collection (much like java) nothing more.
As for the cookie_lifetime, doesn't work either.

Cheers,
Catalin


"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Let me corect you.
>
> Catalin Trifu wrote:
> > Hi,
> >
> > No, there is not! You have to manage yourself
> > the timeout, for instance through a timestamp,
> > which you verify on each request. PHP does not
> > destry sessions by itself.
> Yes, it does, check your session.gc_maxlifetime setting (gc stands for
> garbage colector). You cannot change or set this setting per vhost or
> directory. If you want, you can manage the session yourself (see
> session_set_save_handler()) and implement your own expiration routines.
> Anothor thing that can affect session lifetime is the lifetime of
> session cookie, default is set by session.cookie_lifetime.

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



[PHP] Re: can someone explain...

2003-09-01 Thread Catalin Trifu
Hi,

http://de.php.net/manual/en/language.references.php

Cheers,
Catalin

"Jswalter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> this difference bewteen A and B below?
>
> A)$a = &new className(true, 6);
>
> B)$a = new className(true, 6); /* missing & on the NEW */
>
> thanks
>
> walter

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



[PHP] Re: Optionally force refresh in another frame

2003-09-01 Thread Catalin Trifu
Hi,

JavaScript reload() function.
If you have  wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> I have 3 frames:
> Top, Menu (menu.php?menuid=x) and Content ( Content.php?[ table=y |
> article=z])
>
> Menu.php displays a menu, and the selected item=x
> Content.php displays either a mysql table or an article.
>
> Now I don't want to refresh the menu frame when the topic is the same for
> another article, or table.
> But on some occasions, I want to menu to select another topic, based on a
> condition evaluated by Content.php.
> How can I optionally tell the menu frame to refresh?
>
> TIA
> Ronald

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



[PHP] Re: parent classes

2003-09-01 Thread Catalin Trifu
Hi,

If I'm not mistaking here, you can not find the parent(s)
of a class  without an instance and it is quite logical.
Since PHP is not a compiled language, the parent
is available only at runtime.

Cheers,
Catalin


"Cristiano Duarte" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I want to iterate through parents of some class.
> The function get_parent_class is not enough since it retrieves only the
> first parent of an instance.
> Is there a way to retrieve the parents of a class without having an
instance
> of this class ? And if I have an instance, can I retrieve all parent
> classes?
>
> Cristiano Duarte.

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



[PHP] Re: Unique yet Eerie

2003-09-01 Thread Catalin Trifu
Hi,

I have been using PHP for some time now and I, for one,
never had such problems. I'm pretty sure the problem is elsewhere.
For instance, when creating the HTML form, you have to make
sure everything is quoted perfectly:



And then in PHP, you have to quote indexes of an associative array:
$_POST["example"].
When uploading files, remeber to use the
 wrote in message
news:[EMAIL PROTECTED]
> I'm have a strange problem. I've encoutered a few before, but nothing like
> this:
>
> New machine with php4.2.2 on RedHat with Apache2.0
>
> All my forms use POST method. But I noticed that some scripts when i
submit
> the form, i get wierd data.
>
> For example:
> say i have 
>
> then what i will get for $example is the string "valexample=val" instead
of
> just "val"!!! even the $_POST[example] variable gives the same thing...
>
> magic quotes and globals are ON.
>
> If i put it to GET, then it works fine. But i don't want to put GET!
> Especially that you can't use get for file uploads.
>
> Also, i think this is screwing up my uploads! I uploaded a text file and
saw
> that it inserted a bunch of text right in the middleof the file!!
>
> Something like:
> -7d3323a150580
> Content-Disposition: form-data; name="userfile"; filename="C:\Documents
and
> Settings\file.txt"
> Content-Type: text/plain
>
>
> So something is causing my php to insert the name of the variable and
other
> stuff into the variable itself..ANY IDEAS?

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



Re: [PHP] Re: Simple File Error

2003-09-01 Thread Catalin Trifu
Hi,

The user root is the which starts the main apache process,
the others are the actual servers spawn by the first one. So
the user under which apache runs is www.
This means that you need to grand write access to those
directory to the user www, and or the group (www i suppose)

Cheers,
Catalin

FYI:
To find out the user used by apache you can look in httpd.conf and
look for the directive User

"Seth Willits" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday, August 31, 2003, at 04:38  PM, Catalin Trifu wrote:
>
> > Does the user under wich the Apache server runs (implicitly PHP)
> > has write access to those directories ?
>
> Hmm... I don't know. Not exactly sure how Apache runs under OS X. I see
> a handful of httpd processes which are under the user 'www' and one
> other that is under 'root'.
>
>
> Seth Willits
>  
> ---
> President and Head Developer of Freak Software - http://www.freaksw.com
> Q&A Columnist for REALbasic Developer Magazine -
> http://www.rbdeveloper.com
> Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames
>
> "Rather fail with honor than succeed by fraud."
>  -- Sophocles
>  
> ---

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



[PHP] Re: Simple File Error

2003-08-31 Thread Catalin Trifu
Hi,

Does the user under wich the Apache server runs (implicitly PHP)
has write access to those directories ?

Cheers,
Catalin

"Seth Willits" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Warning:  imagejpeg(): Unable to open
> 'thumbnails/marching/years/2000/Miscellaneous/24left.jpg' for writing
> in /Library/WebServer/Documents/pictures/list.php on line 28
>
> I'm looping through a directory and creating thumbnail images and in
> doing so, I get the error above for each image. The code I'm using to
> resize and create the image is below (it's an example from php.net) and
> the parameters are as follows:
>
> $forcedwidth = 100
> $forcedheight = 100
> $sourcefile = 'marching/years/2000/Miscellaneous/24left.jpg'
> $destfile = 'thumbnails/marching/years/2000/Miscellaneous/24left.jpg'
> $imgcomp = 50
>
>
> Both directories exist as does the source file. Which makes me wonder,
> will the library create a directory if it doesn't exist?
>
>
> function resampimagejpg($forcedwidth, $forcedheight, $sourcefile,
> $destfile, $imgcomp) {
> $g_imgcomp=100-$imgcomp;
> $g_srcfile=$sourcefile;
> $g_dstfile=$destfile;
> $g_fw=$forcedwidth;
> $g_fh=$forcedheight;
> $g_is=getimagesize($g_srcfile);
>
> if (file_exists($g_srcfile)) {
> /// Set Image Size ///
> if(($g_is[0]-$g_fw)>=($g_is[1]-$g_fh)) {
> /// Width is Greater Than Or Equal to Height
> $g_iw=$g_fw;
> $g_ih=($g_fw/$g_is[0])*$g_is[1];
> } else {
> /// Height is Greater than Width
> $g_ih=$g_fh;
> $g_iw=($g_ih/$g_is[1])*$g_is[0];
> }
>
> // Create Thumbnail ///
> $img_src=imagecreatefromjpeg($g_srcfile);
> $img_dst=imagecreate($g_iw, $g_ih);
> imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $g_iw, $g_ih,
> $g_is[0], $g_is[1]);
> imagejpeg($img_dst, $g_dstfile, $g_imgcomp);
> imagedestroy($img_dst);
> } else
> return false;
> }
>
>
>
> Seth Willits
>  
> ---
> President and Head Developer of Freak Software - http://www.freaksw.com
> Q&A Columnist for REALbasic Developer Magazine -
> http://www.rbdeveloper.com
> Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames
>
> "Few are those who see with their own eyes and feel with their own
> hearts."
>  -- Albert Einstein
>  
> ---

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



[PHP] Re: post values from HTML to PHP

2003-08-31 Thread Catalin Trifu
Hi,

Did you use a  in HTML ?
Notice the POST method. You can also use $_REQUEST, which hold all
variable posted, either by POST or GET.

Cheers,
Catalin

"Ted Yu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> I found that $_POST['name'] is empty inside my PHP script whose previous
> HTML page has the following:
>   
> How can I retrieve values in input fields ?
> Thanks

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



[PHP] Re: calculating datetime

2003-08-31 Thread Catalin Trifu
Hi,

offset = 1day + 1hour + 10 secs = 24 * 60 * 60 + 60 * 60 + 10 (seconds)
time() + offset = the time you need
or
$now = explode('.', date("d.m.Y.H.i.s", time());
$now is array ( 0 => the day, 1 => the month. aso)
add to the elements of the array the values you need
then turn it back into a timestamp with mktime()

Cheers,
Catalin

"Ryan A" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> I have a datetime field in my table, i want to enter a datetime 1 day,1
hour
> and 10 mins into the future from today/the present, how do i calculate
that?
>
> This is for the expiring links/members part of a script i am trying to
> create.
>
>
> I have looked around the archive and google but maybe i didnt find the
> correct thread.
> Google turned up these revelient results but are not too much help:
>
http://forums.devshed.com/showthread.php?threadid=4238&kw=get+current+date+and+time+of+server
>
> useing the date function
> http://www.phpbuilder.com/mail/php-general/2002062/1026.php (rasmus)
>
> now()
> http://www.phpbuilder.com/mail/php-general/2002062/1033.php (john)
>
> This was very helpful but it brings up the other question of is the local
> php time on the server the same as the one on mysql? Logically it should
be
> but..
>
http://www.google.com/url?sa=U&start=3&q=http://www.phpbuilder.com/manual/ref.datetime.php&e=7391
>
>
>
> Thanks in advance,
> -Ryan
>
>
> We will slaughter you all! - The Iraqi (Dis)information ministers site
> http://MrSahaf.com

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



Re: [PHP] Re: calculating datetime

2003-08-31 Thread Catalin Trifu
Hi,

You have to take into consideration the behaviour of the
datetime data type in MySQL. Look at the documentation
http://www.mysql.com/doc/en/DATETIME.html
I think the field type you need should be TIMESTAMP(14)
since you can use some MySQL functions to easily check for
expired data.
also see the php manual for mktime :
http://de.php.net/manual/en/function.mktime.php
As you will notice you didn't exactly used it like you should have,
hence the error


Hope this helps,
Catalin

"Ryan A" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> Thanks for replying.
>
> Am a bit confused even after your example as to how to enter this into the
> datetime field in mysql so that i can compare it to the present datetime
>
> heres the code i made based on what you said:
>  $day=2;
> $hour=2;
> $seconds=05;
>
> $theDay=24*60*60;
> $theHour=60*60;
> //$theSec=$seconds;
>
> $FinalDay=$day*$theDay;
> $FinalHour=$hour*theHour;
>
> $offset=$FinalDay + $FinalHour + $seconds;
> $FinalTime=time() + $offset;
>
> print time();   echo "";
> print $FinalTime;  echo "";
> $Result=mktime($FinalTime);
> echo $Result;//gives a warning or error
> ?>
>
> Its giving me a number based on the above that is correctly higher than
> time() but how do i enter that into mysql for a comparision?
>
> eg:
> my table structure in mysql is so:
> present_day datetime
> expire_day  datetime
> filename   varchar(50)
>
> (my logic)
> if ($present_day - $expire_day <= 0)
> {echo "link expired";}
> //else
> //give file
>
> Kindly reply,
> -Ryan
>
>
> > Hi,
> >
> > offset = 1day + 1hour + 10 secs = 24 * 60 * 60 + 60 * 60 + 10
> (seconds)
> > time() + offset = the time you need
> > or
> > $now = explode('.', date("d.m.Y.H.i.s", time());
> > $now is array ( 0 => the day, 1 => the month. aso)
> > add to the elements of the array the values you need
> > then turn it back into a timestamp with mktime()
> >
> > Cheers,
> > Catalin
> >
> > "Ryan A" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Hi,
> > > I have a datetime field in my table, i want to enter a datetime 1
day,1
> > hour
> > > and 10 mins into the future from today/the present, how do i calculate
> > that?
> > >
> > > This is for the expiring links/members part of a script i am trying to
> > > create.
> > >
> > >
> > > I have looked around the archive and google but maybe i didnt find the
> > > correct thread.
> > > Google turned up these revelient results but are not too much help:
> > >
> >
>
http://forums.devshed.com/showthread.php?threadid=4238&kw=get+current+date+and+time+of+server
> > >
> > > useing the date function
> > > http://www.phpbuilder.com/mail/php-general/2002062/1026.php (rasmus)
> > >
> > > now()
> > > http://www.phpbuilder.com/mail/php-general/2002062/1033.php (john)
> > >
> > > This was very helpful but it brings up the other question of is the
> local
> > > php time on the server the same as the one on mysql? Logically it
should
> > be
> > > but..
> > >
> >
>
http://www.google.com/url?sa=U&start=3&q=http://www.phpbuilder.com/manual/ref.datetime.php&e=7391
> > >
> > >
> > >
> > > Thanks in advance,
> > > -Ryan
> > >
> > >
> > > We will slaughter you all! - The Iraqi (Dis)information ministers site
> > > http://MrSahaf.com
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >

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



Re: [PHP] Re: Error Log

2003-08-31 Thread Catalin Trifu
make a script with just phpinfo() in it
and see the output to from where the php should get the php.ini
download a php.ini-dist from www.php.net and go for it

Cheers,
Catalin

"Seth Willits" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday, August 31, 2003, at 09:38  AM, Catalin Trifu wrote:
>
> > Look at the php.ini file.
> > There you can define how and where to store the errors,
> > also the level of errors youn want to show
>
> This may come as a really big shock, but, I have no php.ini file. I
> just searched my entire hard drive and it's not there. I'm running on
> OS X and am using the built-in Apache web server. Crazy...
>
>
> Seth Willits
>  
> ---
> President and Head Developer of Freak Software - http://www.freaksw.com
> Q&A Columnist for REALbasic Developer Magazine -
> http://www.rbdeveloper.com
> Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames
>
> "Often, by taking a chance, you either lose it or gain from it. If you
> have
>   nothing to lose, why hesitate? Not pursuing the things you want in
>   life only lets the opportunity to obtain them pass you by."
>  -- Seth Willits
>  
> ---

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



[PHP] Re: Error Log

2003-08-31 Thread Catalin Trifu
Hi,

Look at the php.ini file.
There you can define how and where to store the errors,
also the level of errors youn want to show

Cheers,
Catalin

"Seth Willits" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This may be obvious, but I even looked in a few books and didn't see
> it, but where are PHP errors logged? No errors ever appear on the page
> yet the online documentation refers to error messages and such, so I'm
> assuming there must be some log somewhere.
>
> Thanks,
>
> Seth Willits
>  
> ---
> President and Head Developer of Freak Software - http://www.freaksw.com
> Q&A Columnist for REALbasic Developer Magazine -
> http://www.rbdeveloper.com
> Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames
>
> "Few are those who see with their own eyes and feel with their own
> hearts."
>  -- Albert Einstein
>  
> ---

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



[PHP] Re: Help with copy()/uploading a file

2003-08-31 Thread Catalin Trifu
Hi,

Take a look here:
http://de2.php.net/manual/en/features.safe-mode.php#ini.open-basedir
Basically toy have opne_basedir in effect which means you can only
access
subdirs of the base dir, which in your case is, (I suppose)
/home/.paco/campuscb/campuscorkboard.com/
So take a look in php.ini (if you can access it)

Cheers,
Catalin


"James Johnson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi,

I need some help with the copy() function in order to allow a user to upload
an image. The image will need to be in a folder that I can access it's URL
for display in a page.

The hosting company, www.dreamhost.com, isn't too helpful with my requests
for help.

I have the following code:

$webServer ="/home/campuscb/ftp.campuscorkboard.com/adimages/";
$destFile = $webServer;
$destFile .= $img1_name;
if($img1_name!=""){
copy("$img1","$destFile") or die("Couldn't copy the file");
}
else{
die("No input file specified!$img1_name");
}

Dreamhost claims I must have Anon FTP activated in order to use the copy()
function.
I went ahead and set Anon FTP setup on the server. According to the admin
panel, I have the following settings:

Path:/home/campuscb/ftp.campuscorkboard.com
Directory blocks are on except for Stor

When I run it, I get the following message in the browser:
Warning: open_basedir restriction in effect. File is in wrong directory in
/home/.paco/campuscb/campuscorkboard.com/upload.php on line 28 Couldn't copy
the file

Any help would be appreciated.

Thanks,
James

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



[PHP] Re: PHP SESSION timeouts

2003-08-31 Thread Catalin Trifu
Hi,

No, there is not! You have to manage yourself
the timeout, for instance through a timestamp,
which you verify on each request. PHP does not
destry sessions by itself. It's up to you to manage
the "life" of a session.

if($_SESSION['last_seen'] && ($_SESSION['last_seen'] < time() - timeout)
{
//session is ok proceed
} else {
//session expired
$_SESSION = array();//destroy session
//whatever you want to do
}

btw! the code above does not take care of the first time
a user visits u'r page.

Cheers,
Catalin

"James Johnson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Can't find this in any of my books. Is there a default for when the
> $_SESSION array times out i.e., it's no longer available for the code?
>
> Thanks,
> James

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



[PHP] Re: trouble with array_search

2003-08-30 Thread Catalin Trifu
  Hi,

I printed the values out, and inserted it into a varibble to check if it 
finds it. In this case it works! But it only wokes if I do it like this:

array('03042003');

This does not work:
array(03042003);
When you make array(03042003) what you get is an array like this
Array ( 0 => 3042003 ); PHP convers the string you got from date to an 
integer.
So when adding the results from date() to the $dates array, you should
keep them as strings.
you could say
$d = date('mdY', timestamp);
$dates[] = "$d";//this will keep the variable added as string

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


[PHP] Re: superglobals?

2003-08-30 Thread Catalin Trifu
Stevie D Peele wrote:

What do we call things like this -- $_POST['name'], $_SERVER['remote
add']
Are they superglobals and where can I find a list of these?

Thanks


The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!
 Hi,

   Superglobals are those variables defined by PHP, like
$_SERVER, $_REQUEST, etc. 
(http://de3.php.net/manual/en/language.variables.predefined.php)
   User defined superglobals do not exist (yet at least)
   In the exmple above the variables are $_SERVER and $_POST
the others are just members of the respective arrays.

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


[PHP] Re: trouble with array_search

2003-08-30 Thread Catalin Trifu
Hi,

  You don't have to convert to string; PHP does it
automatically.
  Did you check for the $dates array, does it really contain
what you think it should.
  So, try to make a print_r($dates) and see if you have what you expect.
  FYI: array_search() returns the key of the last found element
(if any)
Cheers,
Catalin

Hi there,

I am having somee trouble with array_search.

The function should search for a given date, but it does not work since 
array_search seems only to compare strings. Thats why I tryed to cast 
it, but does not help.

Here is the problem:

(pseudo code)

while(...
$log[date][] = (string)date('mdY',$row->timestamp)
$date_search = '03042003';

$search = array_search($date_search, $dates);
if ($search !== NULL)
echo 'works';   

it always returns 0

Thanx for any help on that,

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


[PHP] Re: Using PHP to cache a flash movie

2003-08-30 Thread Catalin Trifu
Hello,

Does anyone know a method in which I can load a large flash movie in the background and only when it is done, play it. In the mean time, the user should be able to carry on surfing normally.

Any ideas?

Thank you,

- Sid

Hi,

Simply put you can not! if the user moves from one page to another,
the old request goes bye! bye!
Cheers,
Catalin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Frameworks

2003-08-30 Thread Catalin Trifu
Hi,

  Don't know if this is the place to start this,
but I'd like to hear some pros and contras for
some frameworks out there (MVC mostly).
  I mean, you have Placebo, Phrame, pehppy, aso.
  I'm getting a little bit dizzy by how many there
are and I'd like to know your oppinions on them.
Catalin

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


[PHP] Re: Hello

2003-08-30 Thread Catalin Trifu
Hi,

>The message is :
>Warning:  Unable to create
>'/home/sites/site82/web/images/photos_elt/ail.jpg':  Permission denied in
>/home/sites/site82/web/gestion_site/bve_navigation.php on line 73

it's obvious the user under which the apache server runs does not have
write permissions on /home/sites/site82/web/images/photos_elt
so: chmod it to permit writting. If the use is nobody i guess you have
to chmod it to 777

>Warning:  Unable to move '/tmp/phpeZc96V' to
>'/home/sites/site82/web/images/photos_elt/ail.jpg' in
>/home/sites/site82/web/gestion_site/bve_navigation.php on line 73
same as above.

Cheers,
Catalin

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



[PHP] Re: Foring a file download *and* page reload

2003-08-29 Thread Catalin Trifu
Hi,

You could use the  wrote in message
news:[EMAIL PROTECTED]
> I've asked about this before but could not get a working solution.
>
> I have a database. Users put data in the DB :) I have a page with a list
> of accessible data "block". Each "block" has a button next to it.
>
> When a user click a button what I would like is:
>
> - I extract the data block from the DB
> - I send the data to the browser as a file download so the user can save
> the data block to disk. (i.e. a save-file-as dialog comes up)
> - I mark the data block as inaccessible
> - I reload the page and present a new list. The data block the user as
> just selected is no longer in the list.
>
> I have figure out how to force a file download using:
>
> header("Content-disposition: attachment; filename=aFile");
> header("Content-type: application");
>
> The problem I have is that I need a way of send the user back to list
> page so I can regenerate a new listing. I can't use header("Location")
> because I've already started an output stream (the download).
>
> Some suggested using this header:
>
> header("Content-Type: multipart/mixed; boundary=\"-Boundary-12399\"");
>
> But I could quite get it to work. The example code I have been trying to
> get to work make Netscape open a save-as dialog three times and on IE 6
> just prints everything in the browser window. This is the code:
>
> (suggested by Marek Kilimajer)
>  header("Content-Type: multipart/mixed; boundary=\"-Boundary-12399\"");
>
> print "---Boundary-12399\r\n";
> print "Content-Type: text/html\r\n";
> print "\r\n";
>
> //HTML code goes here
>
> print "\n";
> print "---Boundary-12399\r\n";
> print "Content-Type: application/octet-stream\r\n";
> print "Content-Disposition: attachment; filename=foo.tar.gz\r\n\r\n";
> readfile("./foo.tar.gz");
>
> print "---Boundary-12399--\r\n";
> print "\r\n";
> ?>
>
>
> I'm sure someone has done this before :) What is the "correct" way to
> achieve this effect? Is multipart content-type the way to go?
>
> Thanks,
>
> Jean-Christian Imbeault

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



[PHP] Re: PHP won't parse under https, but will with http

2003-08-28 Thread Catalin Trifu
Hi,

Is this a virtual host ?
How did you define the AddType in httpd.conf ? as global
directive or for each vhost ?
Also check that u'r apache listens to 443. Does pure .html
page display ?

Cheers,
Catalin

"Jason Jacobs" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I'm not sure if this is the right forum for this question, but I'm hoping
someone can help nonetheless. :)

I installed an SSL Cert. on a site the other day for a checkout page, and
the php won't parse.  If I take the "s" off, it parses just fine.  I have a
feeling it's an httpd.conf setting, but I don't know where to look.  Maybe
it's a php.ini issue to make it parse on port (whatever SSL is)?  Thanks for
any suggestions.

-jason

--
web developer
Factory7.com
354-9977

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



[PHP] Re: reboot pc with PHP

2003-08-28 Thread Catalin Trifu
if you are really not interested in the security,
then you can run the apache server as root; then you have
root privileges for your PHP scripts.
then you can use the system() function with no restrictions

Cheers,
Catalin

"Petre Agenbag" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi List
>
> I've gone through the list for previous questions and the only one that
> seems to be a solution is to use sudo, however, I cannot seem to get it
> right.
>
> Just as background:
>
> I want to make a small "admin" utill for an intranet machine, so the
> security risks don't bother me at all.
>
> Instead of myself having to ssh into the box to reboot or do other
> "routine" commands, I'd like to make a simple password protected webpage
> that would have simple links on them like "reboot", "redial" etc, so
> that someone with some sort of responsibility can do it themselves.
>
> Obviously these command(s) need to be run as root, so I looked at the
> /etc/sudoers and added apache , BUT, in the error log it prompts for a
> password.
>
> I tried to add the option NOPASSWD: ALL to the file, but it says there's
> a syntax error.
>
> What am I missing?
>
> Any other ways of doing this?  PS, I don't even want to consider Webmin,
> it's way too complicated, I just want a handfull of predefined commands
> to be run, nothing else)
>
> Thanks
>

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



[PHP] Re: dealing with arrays

2003-08-27 Thread Catalin Trifu
Hi,

Insteand of using the same value for checked,
you should use different values for the checked
parameter like value="entryOneChecked" value="entryTwoChecked"
And it's a good idea to use quoting around variable names at least.

Cheers,
Catalin


"Aris Santillan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


> hi
>
>
> I Have
> Entry One
> 
> 
> 
>
> Entry Two
> 
> 
> 
>
> Entry Three
> 
> 
> 
>
> Entry Four
> 
> 
> 
>
> Entry Five
> 
> 
> 
>
> .
>
> i want to process entries only with checked checkbox
>
> how can i do this in php?
>

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



[PHP] Re: Frames: how to get the url of the top frame?

2003-08-27 Thread Catalin Trifu
Hi,

Server side there si no way to get the parent's URL
you could however client side with JS

Cheers,
Catalin

"Jean-Christian Imbeault" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am providing content for an other site. My content is getting shown in
> side a frame. My content contains links to other content I provide. It
> also has forms that the user can use to submit information.
>
> The form's submit action depends on some information that the main site
> send to me in the url, i.e.,
http://bigsite.com/index.html?submit=actionName
>
> The problem is that cannot find a way to access the URL form inside the
> frame. All the $_SERVER vars are relative to my frame.
>
> Is there a way for me to access the top (parent?) frame's URL?
>
> Thanks,
>
> Jean-Christian Imbeault

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



[PHP] Re: pear problem

2003-08-26 Thread Catalin Trifu
Hi,

Did you added the /usr/php/pear/share/pear in the php.ini
include_path option ?
Besides the mime is part of Mail_Mime extension and
SOAP needs some extensions too (don't remember exactly which)
so check if all requirements are met.
btw! what's the error message when it crashes ?

Cheers,
Catalin

"Moritz Steiner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I've a problem with pear, only the DB.php and the Mail.php are working,
all the others I installed don't work.

Installed packages:
===
Package  Version  State
DB   1.5.0RC1 stable
HTTP_Request 1.1.1stable
Mail 1.1.1stable
Mail_Mime1.2.1stable
Net_DIME 0.3  beta
Net_URL  1.0.10   stable
SOAP 0.8RC1   beta

When I have a look into the directory, it's like that:

[lxcmsb3] /usr/php/pear/share/pear > l
total 72
drwxr-xr-x6 root root 4096 Aug 26 16:24 SOAP
drwxr-xr-x6 root root 4096 Aug 26 16:24 docs
drwxr-xr-x2 root root 4096 Aug 26 16:24 HTTP
drwxr-xr-x2 root root 4096 Aug 26 16:24 Net
drwxr-xr-x4 root root 4096 Aug 26 16:24 tests
drwxr-xr-x2 root root 4096 Aug 26 16:24 Mail
drwxr-xr-x3 root root 4096 Aug 26 16:24 data
-rw-r--r--1 root root 7331 Aug 26 16:23 Mail.php
drwxr-xr-x2 root root 4096 Aug 26 16:23 DB
-rw-r--r--1 root root29165 Aug 26 16:23 DB.php



In this code snipplet the first three lines work very well, but when I
try to access a subdirectory it crashes...
1 require 'DB.php';
2 $db = DB::connect('mysql://mysql:[EMAIL PROTECTED]/mysql);
3 require 'Mail.php';
4 require 'Mail/mime.php';

It's exactly the same with require 'SOAP/Client.php' instead of line 4


Please help me.
Moritz

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



[PHP] Re: parse error with mysql_connect

2003-08-24 Thread Catalin Trifu
Hi,

The prototype for mysql_connect is:

resource mysql_connect ( [string server [, string username [, string
password [, bool new_link [, int client_flags ] )

As you can see you get parse error because the fourth argument
should be boolean, not string.

Cheers,
Catalin

35: // Initialize MySQL database
36: $h =
mysql_connect('localhost','localhost',constant("mysql_user"),constant("mysql
_password"));
37: mysql_select_db('mjec_mjecnet', $h);

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



[PHP] Re: file upload problem

2003-08-23 Thread Catalin Trifu
Hi,

> echo " = 'multipart/form-data'>\n";
I think that the methos should be POST not GET
Second, you may want to save the file first with,
move_uploaded_file (see
http://de.php.net/manual/en/function.move-uploaded-file.php),
then you will be able to see it.
Of course you will first check it's in order to save it.
Third: it might be a good idea to check your php.ini and
see if you allow file uploads and also the httpd.conf

cheers,
Catalin

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



[PHP] Re: Foreach POST VARS problem

2003-08-15 Thread Catalin Trifu
btw! if you use it inside a function, you need
to declare it as global!

Catalin

> Are you sure the data is posted from HTML
> through POST ? try adding the lines below:
>
> > $colors="";
> if(is_array($HTTP_POST_VARS) && !empty($HTTP_POST_VARS )) {
> > foreach($HTTP_POST_VARS as $ThisVar=>$ThisVal){
> > if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
> > $newVarA=explode("-", $ThisVar);
> > $colors.="$newVarA[1]:";
> > }
> > }
> }
>
> Catalin
>
>



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



[PHP] Re: Foreach POST VARS problem

2003-08-15 Thread Catalin Trifu
hi,

Are you sure the data is posted from HTML
through POST ? try adding the lines below:

> $colors="";
if(is_array($HTTP_POST_VARS) && !empty($HTTP_POST_VARS )) {
> foreach($HTTP_POST_VARS as $ThisVar=>$ThisVal){
> if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){
> $newVarA=explode("-", $ThisVar);
> $colors.="$newVarA[1]:";
> }
> }
}

Catalin



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



  1   2   >