Re: [PHP] british date format

2008-05-09 Thread André Medeiros
Try this:

http://pt.php.net/manual/en/function.strptime.php

Use the result with mktime to get the timestamp. I also checked
set_locale but that won't interfere with strtotime :(

On Fri, May 9, 2008 at 9:58 AM, Merca, Ansta Ltd [EMAIL PROTECTED] wrote:
 Hi

 Anyone dd/mm/ as a date variable? strtotime - works fine with
 mm/dd/ but now with dd/mm/. (PHP 4.x)

 --
 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: british date format

2008-05-09 Thread André Medeiros
Shawn,

I think the idea here was to get a timestamp from a date in that
format he was telling about.

After replying however, I noticed that strptime is only implemented in
PHP5. Sorry about that mate.

On Fri, May 9, 2008 at 2:36 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Merca, Ansta Ltd wrote:

 Hi

 Anyone dd/mm/ as a date variable? strtotime - works fine with
 mm/dd/ but now with dd/mm/. (PHP 4.x)

 setlocale()

 and then...

 http://pt.php.net/manual/en/function.strftime.php

 -Shawn

 --
 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: british date format

2008-05-09 Thread André Medeiros
Yeah, that would be the way to do it ;)

On Fri, May 9, 2008 at 3:54 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
 Shawn McKenzie wrote:

 André Medeiros wrote:

 Shawn,

 I think the idea here was to get a timestamp from a date in that
 format he was telling about.

 After replying however, I noticed that strptime is only implemented in
 PHP5. Sorry about that mate.

 On Fri, May 9, 2008 at 2:36 PM, Shawn McKenzie [EMAIL PROTECTED]
 wrote:

 Merca, Ansta Ltd wrote:

 Hi

 Anyone dd/mm/ as a date variable? strtotime - works fine with
 mm/dd/ but now with dd/mm/. (PHP 4.x)

 setlocale()

 and then...

 http://pt.php.net/manual/en/function.strftime.php

 -Shawn

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


 Couldn't see any other way.  *nix strtotime is supposed to use locale.

 Fixed that for me:

 $date = '20/12/1971';
 $d = explode('/', $date);
 echo mktime(0 ,0, 0, $d[1], $d[0],$d[2]).\n;


 -Shawn

 --
 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] php.ini

2008-05-09 Thread André Medeiros
I'm not sure PHP5 would read php.ini from that directory.

You should take in account that your hosting company may _NOT_ allow
you to change certain parameters. That said, try visiting
http://us2.php.net/configuration.changes and see how that works for
you.

Good luck

On Fri, May 9, 2008 at 4:47 PM, Michael Satterwhite [EMAIL PROTECTED] wrote:
 I'm trying to turn off magic quotes for a site. I've copied the php.ini
 from /etc/php5/apache2 to the web site directory. In this file, I've changed
 magic_quotes_gpc to read
magic_quotes.gpc = Off

 When I run phpinfo() from this directory, it still shows magic quotes as being
 on. I'm guessing there is another configuration parameter (either in the
 Apache configuration or for php) that allows this to be processed. Would
 someone be so kind as to help me here; I admit ignorance.

 ---Michael

 --
 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] PHP and #if

2008-03-14 Thread André Medeiros
OK, here's how it goes:

?php
if(!defined('_THIS_PHP_FILE_PHP')) {
define('_THIS_PHP_FILE_PHP', true);

// define your classes and functions here


} // endif _THIS_PHP_FILE_PHP
?

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



Re: [PHP] error_reporting(E_ALL) doesn't show anything

2007-05-15 Thread André Medeiros

Either that, or

ini_set('display_errors', '1');

On 5/15/07, Jim Lucas [EMAIL PROTECTED] wrote:

Afan Pasalic wrote:
 hi,
 in php.ini is error_reporting turned off. and, to see an error have to
 open error_log.
 though, for me is much easier to have it on and see the errors on the
 screen.  while developing, of course.
 I put on the beginning of the file error_reporting(E_ALL) to overwrite
 php.ini but it doesn't work. still can't see anything.

 what am I doing wrong?

 thanks.

 -afan

make sure you have

display_error = On

either in your php.ini

--
Jim Lucas

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

Unknown

--
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] retrieve POST body?

2007-04-18 Thread André Medeiros

Reading from php://input on a webserver will retrieve the Body of the
HTTP Request.

On 4/18/07, Justin Frim [EMAIL PROTECTED] wrote:

Greetings,

Is there any way to retrieve the POST message body when a form is
submitted to a PHP script using multipart/form-data?

I can't use just the $_POST[] and $_FILES[] arrays because I need to
calculate the hash of an exact bit-accurate copy of the original POST
body for data verification.  (HTTP digest authentication with
qop=auth-int.)  Submitting the form using
application/x-www-form-urlencoded is not an option either because the
PHP script has to be able to handle forms with file uploads.

--
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] PHP excel capability

2007-04-18 Thread André Medeiros

1) You'll be better off using templates, AFAIK.

2) PHP has classes to generate PDF's without the need of extensions.
(http://www.fpdf.org/)

On 4/18/07, Jonathan Kahan [EMAIL PROTECTED] wrote:

Hi all,

Can PHP be used to generate an excel file that A) Contains Macros B) Allows
Graphics to be attached C) where cells can contain borders as well as cells
being merged. I know there is some PHP excel functionality so i am assume
basics like underlines, italics and i am hoping vertical alignments can be
done.

If the answer is no, then can a template that has all of these be opened and
read using php where all that needs to be done is simply place in certain
cells whatever values it is that I want to place.

Lastly, do only newer versions of PHP contain excel/pdf functionality?

I am in a bit of a time crunch so I apologize if this is not considered PHP
stuff or if I could have found my answer easily online. I could not find
this discussed in any other posts. Thanks in advance for any help you can
give.


Kind Regards
Jonathan Kahan


Systems Developer
Estrin Technologies, inc.
1375 Broadway, 3rd Floor, New York, NY, 10018

Email: [EMAIL PROTECTED]
Web: http://www.estrintech.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] retrieve POST body?

2007-04-18 Thread André Medeiros

php://input ?? ;)

On 4/18/07, Justin Frim [EMAIL PROTECTED] wrote:

Chris Shiflett wrote:
 Justin Frim wrote:

Is there any way to retrieve the POST message body when a form is
submitted to a PHP script using multipart/form-data?


 There's the always_populate_raw_post_data configuration directive and
 the $HTTP_RAW_POST_DATA. Have you tried that?

Yes, that is already configured.
It appears that $HTTP_RAW_POST_DATA only works for
application/x-www-form-urlencoded, but not multipart/form-data.  Same
thing with $GLOBALS['HTTP_RAW_POST_DATA']

--
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] retrieve POST body?

2007-04-18 Thread André Medeiros

php://stdin perhaps?

On 4/18/07, Justin Frim [EMAIL PROTECTED] wrote:

André Medeiros wrote:

 Reading from php://input on a webserver will retrieve the Body of the
 HTTP Request.

Not for me it doesn't.
That only seems to work when the form is submitted as
application/x-www-form-urlencoded.  When the form is submitted as
multipart/form-data, php://input is blank.

--
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] What is $this-

2007-02-18 Thread André Medeiros

Actually, $this-$message would be wrong, but the concept is right.

On 2/19/07, Leonard Burton [EMAIL PROTECTED] wrote:

HI,

 $this-SetFont('Arial','B',15);

what you include is a snippet from a class.  Here is a brief into to
how a class works, sort of like a function.  The $this refers to the
class from inside of the class.

?php

class write{

var $message;

function set($message){

   $this-$message = $message;
}

function display(){

  print $this-message\n;
}

}// class write

//actually use the class
$class = new write();
$class-set(This is a test message);
$class-display();

?

I hope this helps.

Leonard


--
Leonard Burton, N9URK
http://www.jiffyslides.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]

The prolonged evacuation would have dramatically affected the
survivability of the occupants.

--
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] Weird behaviour with IE

2007-01-11 Thread André Medeiros

Hi list.

I know this may be a bit out of topic, but I've decided to try.

This website I'm maintaining opens just fine in firefox, and loads
everything. However, the same doesn't happen in IE, since the status
bar reads 1 item(s) remaining on most of the pages.

That issue raises another problem, because I really need that onLoad
event to be fired ;)

Has anyone had problems like this? What did you do to solve them?

Thanks in advance,
André

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



Re: [PHP] PHP analytics

2006-12-06 Thread André Medeiros

Storing the document that is being called and get paramaters on a DB
is very simple

You would have an include like

$doc = $_SERVER['PHP_SELF'];
$get_vars = serialize($_GET);
mysql_query('INSERT INTO logs (page, vars) VALUES (' . $doc . ', '
. addslashes($get_vars) . ')');

Of course you'd need extra info like user id and such, but the
principle is there.


On 12/6/06, Rick. [EMAIL PROTECTED] wrote:

Hello



I am new to php and I would like some guidance from those who have a bit more 
expereince with PHP


I will be attempting to do a bit of tracking and web analytics. Basically, the 
user will login
and from there everything that he clicked will be recorded in a database and 
analyzed
i.e user behaviour, patterns with different user groups.

Is this possible with php and it is a major undertaking ? just trying not to 
get ahead of myself here..

are there any tutorials or scripts or books that you know of ?



Thanks
Regards
Rick







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



Re: [PHP] PHP analytics

2006-12-06 Thread André Medeiros

Not really, it's instant now. You just have to have a google account.

On 12/6/06, Edward Kay [EMAIL PROTECTED] wrote:

What you describe is certainly possible, and many sites have this
functionality.

If you're just starting out however, look into Google Analytics. It gives
you more info than you care to imagine and is free. It's also takes 2secs to
install (except I think there's a waiting list to get your account active).

Edward

 Hello

 I am new to php and I would like some guidance from those who
 have a bit more expereince with PHP


 I will be attempting to do a bit of tracking and web analytics.
 Basically, the user will login
 and from there everything that he clicked will be recorded in a
 database and analyzed
 i.e user behaviour, patterns with different user groups.

 Is this possible with php and it is a major undertaking ? just
 trying not to get ahead of myself here..

 are there any tutorials or scripts or books that you know of ?



 Thanks
 Regards
 Rick






--
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] PHP analytics

2006-12-06 Thread André Medeiros

Do those log GET params?

On 12/6/06, Vincent DUPONT [EMAIL PROTECTED] wrote:


You could look for Apache logs analysers, too

vincent

-Original Message-
From: Rick. [mailto:[EMAIL PROTECTED]
Sent: Wed 6/12/2006 12:48
To: php-general@lists.php.net
Subject: [PHP] PHP analytics

Hello



I am new to php and I would like some guidance from those who have a bit more 
expereince with PHP


I will be attempting to do a bit of tracking and web analytics. Basically, the 
user will login
and from there everything that he clicked will be recorded in a database and 
analyzed
i.e user behaviour, patterns with different user groups.

Is this possible with php and it is a major undertaking ? just trying not to 
get ahead of myself here..

are there any tutorials or scripts or books that you know of ?



Thanks
Regards
Rick

--
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] Microsoft Partners With Zend

2006-11-04 Thread André Medeiros

A bit out of topic perhaps, but is this the time to see Steve Balmer
and his developers dance all over again? ;)

H

On 11/3/06, Richard Lynch [EMAIL PROTECTED] wrote:

On Fri, November 3, 2006 12:36 pm, Curt Zirzow wrote:
 Here is the actual demo given:
 http://blogs.iis.net/bills/archive/2006/10/31/PHP-on-IIS.aspx

 As seen my numbers were off a little bit from memory.

 I'm not sure exactly what the kernel cache is, it is some thing the
 file http.sys thing does and handles requests before IIS even sees
 them, I'm thinking it probably is like a thttpd type of server.

My reading of that URL makes it sound like a Squid cache, with
configurable GET args being seen as relevant.

But, heh, 100 to 6000 improvement is definitely good for Windows users.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--
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] Finding user's timezone

2006-11-03 Thread André Medeiros

The result of that function would depend on where the server is
installed, not where the client is accessing it from, right?

On 11/3/06, Dotan Cohen [EMAIL PROTECTED] wrote:

How does php decide what timezone a user is in? Although I am in
Haifa, Israel (GMT+2), when I go to a page with date(e) I get
America/New_York displayed.

To confirm, could some users tell me what output they get on:
http://what-is-what.com/what_time_is_it.php

Let me know where you are in the world, and what timezone you are in
to confirm/ deny the correctness of the php date function. Any advise
on how to get the correct user's timezone would be most appreciated.

Note: I have considered matching the users' IP against a database, but
I'd prefer a simpler method, without the overhead of such a database.
Thanks in advance.

Dotan Cohen

http://what-is-what.com/
http://essentialinux.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] Finding user's timezone

2006-11-03 Thread André Medeiros

I second that. My company has an IP address on the mainland which is
our internet gateway, but on the azorean islands the time zone is
different.



On 11/3/06, Edward Kay [EMAIL PROTECTED] wrote:

 Hmm... in $_SERVER array you get a client IP so You know client coutry. if
 exists a list of ip numbers and coutries should be exists list
 coutries and
 timezones too, so it should be easy. Eventually you may create
 short list of
 this countries what will be visitors from (or only biggest coutries).


The IP address isn't very reliable though. Many global corporations only
have a couple of external gateways through which all traffic goes. A user in
the UK could very well have their visable IP address located in the US.

Edward

--
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] Send process to background

2006-10-13 Thread André Medeiros

Hello list,

I am working on a backup system that needs to be called through a
webpage to start the process. I am trying to do this on a
one-file-only sollution.

The thing is, the first request to the site needs to start the backup,
but I didn't want to use any command-line tools, since some of our
servers rely on safe_mode. Is there any way to send output to the
browser on this first instance, finish the request, but keeping the
PHP running and making the backup.

Thanks.

Andre

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



Re: [PHP] Send process to background

2006-10-13 Thread André Medeiros

Here's what I'm trying to do.

There is a script that is called through a web request. That same
script is responsible for backing up a whole site (and database) to
.tar.gz files.

Evidently, this will take a while. My first requirement was that it
should _NOT_ deppend on external libraries (ie. pecl, modules and
such). It has to be self-sustained. As such, it will take a bit longer
to execute.

All I need is a way to send a function to background, and to finish
the request telling the user that the backup is being made. At that
time, it should continue executing the backup untill it has been
completed. If I can manage to do this, I will be able to make an
application that pools the same page (it will store a status) to know
if it's doing anything, if it has finished, if an error ocurred, or if
the backup can be downloaded to our fileservers.

Thanks.

On 10/13/06, Paul Scott [EMAIL PROTECTED] wrote:


On Fri, 2006-10-13 at 16:05 +, André Medeiros wrote:

 The thing is, the first request to the site needs to start the backup,
 but I didn't want to use any command-line tools, since some of our
 servers rely on safe_mode. Is there any way to send output to the
 browser on this first instance, finish the request, but keeping the
 PHP running and making the backup.

Take a look at this class that I wrote a while back. It does what you
need.

http://www.phpclasses.org/browse/package/2837.html

--Paul



All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm





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



[PHP] Execution time

2006-09-08 Thread André Medeiros

Hello everyone.

This may seem as a silly question, but I went through the
documentation and it wasn't explicit on this issue, at least for me.

Let's say that I'm on an 128kb/s upload. I need to upload an 100mb
file through a POST. PHP has, by default, 90 seconds execution limit
time.

So, the question is, when I hit the submit button, does it start
timing? Or does it start timing when the PHP gets the FULL POST
headers?

Thanks in advance,
André

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



Re: [PHP] Video uploading with PHP - convert to flash on the fly?

2006-09-04 Thread André Medeiros

ffmpeg _DOES_ convert to flash video (FLV).

On 9/4/06, Paul Scott [EMAIL PROTECTED] wrote:


On Mon, 2006-09-04 at 11:50 +0200, Merlin wrote:
 thank you for the hint. ffmpeg seams to be a good way to create
 thumbnails out of the video, but how to convert it on the fly to flash
 video?

PHP extension called ming. Look for it somewhere on opaque.net

I am not sure if ming is still supported, but it used to be a really
cool extension. I have used it a lot to create flash movies in a mapping
application.

--Paul



All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm



--
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] convert byte to MB

2006-07-25 Thread André Medeiros

divide by 1024, and you'll get KB

divide again by 1024 and you'll get MB

same for GB, TB, etc

On 7/25/06, weetat [EMAIL PROTECTED] wrote:

Hi all ,

  I have data which have value in bytes for example ,

$bytes = 33554432;

   How to convert this to MB ?

THanks

  - weetat (PHP Novice)

--
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] What would cause this?

2006-06-01 Thread André Medeiros

Here's what you can do:

Have a timestamp of the last e-mail stored on a file. If time() - that
timestamp  600 (10 minutes) then don't send the e-mail.

When sending it, do this

$server_array = print_r($_SERVER, true);

and use the $server_array variable to obtain some info regarding the
client that's causing the requests.

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



Re: [PHP] corrupt pdfs

2006-05-31 Thread André Medeiros

A quick google search tells you that LONGBLOB can contain  string with
a maximum length of 4294967295 characters, which translates into
4gb+/-

Maybe a MEDIUMBLOB (16777215 characters) would already do the trick,
no? It supports as much as 16mb +/-



On 5/31/06, Chris [EMAIL PROTECTED] wrote:

Ross wrote:
 I have pdfs saved as BLOBs I create the links dynamically but only some of
 the PDFs display an error message 'error opening this files...this file
 cannot be repaired...


 Is there a file size limit in kb for Blobs and what is it?
 What size of file can a LONG BLOB accomodate?

Who knows? What database are you using? Each database is different. Have
you checked the databases documentation?

 If it is not this any ideas? It seems to fix it though!

So does it fix it or not?

--
Postgresql  php tutorials
http://www.designmagick.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] Upload files problems

2006-05-26 Thread André Medeiros

I believe that those 90 seconds start counting as soon as php starts
interpreting the request, ie. after getting the file and form, not
when it starts uploading.

The second one wouldn't make much sense.

On 5/26/06, Rory Browne [EMAIL PROTECTED] wrote:

It's very hard to read code, when either there is no comments, or the
comments are in a language you don't understand.

Hablo pocito Espanol, pero no entiendo bastante para entiender que quiere
decir.

Rory

On 5/25/06, Ing. Tomás Liendo [EMAIL PROTECTED] wrote:

 Hi!
 When the users of my system try to go up files of more than 460 K, they
 receive the message:
 Fatal error: Maximum execution time of 90 seconds exceeded in
 c:\websites\iracbiogenar48\iracbiogen.com.ar\virtual\procesa_msjpriv.php
 on
 line 2

 I'm using the following method to up load the files:

 if($archivo_name)
 {
$dpath=./archivos_recibidos/.$archivo_name;
  if(move_uploaded_file($archivo, $dpath))
  {//Se realiza la transmision del archivo al servidor.
  echo font size=2 face=Arial, Helvetica, sans-serifEl
 archivo
 .$archivo_name.. ha sido transferido exitosamente./font/div/td;
 }
 else
 {
  echo font size=2 face=Arial, Helvetica,
 sans-serifADVERTENCIA: El arcvhio .$archivo_name.. no ha podido
 enviarse./font/div/td;
 }


 Do I have control on these 90 seconds? or is a parameter of the server?
 What can I do to solve this problem?

 Ahead of time thank you very much,

 Tom.

 --
 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: Can php convert doc to HTML?

2006-05-24 Thread André Medeiros

So, here's what you need.

http://ftp.45.free.net/pub/catdoc/catdoc-0.94.2.zip

This converts doc files to .txt, although I'm not sure that it will
keep the format intact.

Take care.

On 5/24/06, Finner, Doug [EMAIL PROTECTED] wrote:

On 5/23/06, Martin Alterisio [EMAIL PROTECTED] wrote:

 If that's the case, why don't you just use the export as web page or

 save as web page tools of MS Word (if you don't have it anymore you
 can as someone who still has it, or I think OpenOffice also has a
similar tool).


 Because there are 200 of them.

 Dotan Cohen

Unless you want to do them one at a time, you'll need to write code.
Unless this is something that you need to do a lot, why not write the
code using OOo's programming language?  Seems like all the appropriate
hooks should be there to pull in each Word doc, push it off as HTML, and
repeat for all the docs.  I haven't worked with OOo for programming, but
it might be worth a look.  Hit the OOo site and see what their forums
have to offer.

Doug
___
This e-mail message has been sent by Kollsman, Inc. and is for the use
of the intended recipients only. The message may contain privileged
or confidential information. If you are not the intended recipient
you are hereby notified that any use, distribution or copying of
this communication is strictly prohibited, and you are requested to
delete the e-mail and any attachments and notify the sender immediately.

--
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] parsing/replacing for special MS Word characters

2006-05-24 Thread André Medeiros

When my clients use word to compose the contents of a website, I
always recommend them to paste the contents onto notepad and only then
pass them to the RTE on the browser so that the text looses all it's
formatting.

Sucks, but it's the only way I know. Since then, they started
formatting using predefined styles on the RTE and there was much
rejoicing

On 5/24/06, Jef Sullivan [EMAIL PROTECTED] wrote:

Start here...

http://www.php.net/manual/en/function.preg-replace.php



Jef

-Original Message-
From: Dan McCullough [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 24, 2006 8:35 AM
To: PHP LIST
Subject: [PHP] parsing/replacing for special MS Word characters

I have a friend who I wrote some very simple publishing software,
basically he takes his writtings and puts them online.  Well his
writtings are in Word and so he has alot of special characters that he
inputs, some unknowingly, into the database.  Are there any classes or
samples of what others have done to strip/replace/find these special
characters, I have asked him to be careful, but he will do it once or
twice and then forget and lapse, and I get a call saying can you help
me get these out.

Any ideas?

--
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] sorting dates with php

2005-12-21 Thread André Medeiros
You COULD sort them if the date was stored backwards, ie. Year/Month/Day

On 12/21/05, Jim Moseby [EMAIL PROTECTED] wrote:
  Have a load of dates in the format DD/MM/YY. Thet are stored
  as a VARCHAR on
  a mysql DB.
 
  I need a way to sort them into order(most recent first)
 
 
  Using the QUERY   $query = SELECT doc_date FROM papers ORDER
  BY doc_date
  DESC;
 
  this just arranges them by day. e.g
 
 
  30/12/2005
  30/11/2005
  22/12/2005
  19/12/2005
  17/12/2005
  12/12/2005
  10/12/2005
  06/12/2007
  06/09/2002
  05/12/2005
  05/09/2005
 
 
 
  Now I have tried to use strtotime() but I find this needs a
  timezone (GMT)
  to work and I don't know if the server supports it. Also I
  find strototime()
  and mktime() very confusing and a things go wrong of you work
  in GMT because
  we also have Brittish Summer Time where the clocks get put
  back/forward at
  certain time of the year.
 
  Is there a simple function like sort() that could do it??
 

 Hi!

 Its a real shame your dates aren't stored in a DATE type field instead of
 VARCHAR, because you can just sort them in your query with order by DATE.
 If its possible, you would really benefit by converting them and storing
 them in the proper DATE type field.

 That being said, I suppose you could explode() them into an array then
 figure out how to sort them from there.

 JM

 --
 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] LDAP and a pain in my neck

2005-10-20 Thread André Medeiros
Check your webserver logs. If PHP couldn't use the extension, it will
accuse that in the logs.

On 10/20/05, Jay Blanchard [EMAIL PROTECTED] wrote:
 [snip]
  Call to undefined function: ldap_connect()
 
  What am I missing? TIA.


 Did you uncomment (and properly define) the 'extension_dir' directive
 in your php.ini?
 [/snip]

 Yep.

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

2005-09-18 Thread André Medeiros
OK, this might sound a bit harsh, but try using Smarty or other
templating engine. Really. It will help you a lot in this sittuation.

If you decide to run through that path, let me know so I can help you.
If not, we'll figure something else :)

On 9/18/05, bruce [EMAIL PROTECTED] wrote:
 andre..
 
 you can find the files/app at
 http://olederer.users.phpclasses.org/browse/package/1906.html.
 
 i'm basically trying to figure out how to do the following...
 
++
||
||
|   header   |
||
||
++
|  nav menu  |
++
||   |
||  new  |
||  registration |
|  login | stuff |
|  area  |   |
||   |
||   |
||   |
||   |
||   |
||   |
||   |
++
 
  basically, i'd like to have the app display the traditional login in the
 login area, as well as the 'new registration'. the app should allow the user
 to enter the login user/passwd in the login area. selecting 'register new
 user' should cause the 'registration form' to be displayed in the 'right
 area'
 
 the way i've quickly put this together is via a lot of includes based on the
 user slection of the 'nav menu items' as well as the user selecting
 different items within the various pages...
 
 however, i'm now having an issue when i try to use the 'header' function to
 redirect the user to another page after the given logic is completed.
 
 -bruce
 
 
 
 -Original Message-
 From: André Medeiros [mailto:[EMAIL PROTECTED]
 Sent: Saturday, September 17, 2005 5:29 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: php guru!
 
 
 Could you give us the full url of the class so we can look at it's
 source code? :)
 
 On 9/18/05, bruce [EMAIL PROTECTED] wrote:
  i already did...
 
  i got the same error... which is why i was/am looking for a guru
 
  -bruce
 
 
 
  -Original Message-
  From: James Benson [mailto:[EMAIL PROTECTED]
  Sent: Saturday, September 17, 2005 4:34 PM
  To: php-general@lists.php.net
  Subject: [PHP] Re: php guru!
 
 
  http://php.net/ob_start
 
  try something like...
 
  ?php
  // top of page
  ob_start();
 
 
  /* whole script goes here */
 
 
  // bottom of page
  ob_end_flush();
 
  ?
 
 
 
 
  bruce wrote:
   hi...
  
   i'm playing with a script/class from phpclasses.org. the script/class is
   user_class. the script is straight enough, but i'm trying to figure out
  how
   i can include/incorporate the script into a test site i'm creating...
  
   the user_access script more or less uses the entire page. for my app,
 i'd
   like to basically use the user_access app/class and have the different
  pages
   be displayed in specific areas of my pages...
  
   given that the user_class script uses 'header', i'm not sure how to
   accomplish this without generating the 'headers already sent...' err
  msg...
  
   if there's someone that i can talk to regarding this, i'd appreciate
 it..
  
   thanks
  
   -bruce
   [EMAIL PROTECTED]
 
  --
  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: edit $variable online?

2005-08-17 Thread André Medeiros
If I were you I'd have a file just to define those kind of values (ie.
config.php), wich would be included as needed.



On 8/17/05, Mark Rees [EMAIL PROTECTED] wrote:
 Jesús Alain Rodríguez Santos [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi, I have in a php page one ($variable = 85), I woud like to change the
  value from this variable online, without any data base, for example ussing
  a form where I can put the new value and it change the value of the
  $variable.
 
 
 
 Do you mean that you have a page like this, for example:
 
 1.php
 ?php
 $variable=85;
 if( $variable85 ){
 do things;
 }
 ?
 
 And you wish to permanently change the value of $variable to 86?
 
 You could use file rewriting functions to do this. Look in the manual for
 fputs, fread, fwrite and their friends.
 
 If you wish to change the value temporarily for a single user visit
 (session), use a session variable to store it. If you wish to change it for
 a period of time, then perhaps consider using a class to retrieve the
 variable.
 
 
 
 
 
  --
  Este mensaje ha sido analizado por MailScanner
  en busca de virus y otros contenidos peligrosos,
  y se considera que está limpio.
 
 
 --
 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] mail()

2005-08-17 Thread André Medeiros
Do you have a mail server running?

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



Re: [PHP] mail()

2005-08-17 Thread André Medeiros
If you want to receive e-mails from the outside, yes, you'll have to
register a domain, configure an MTA to work on windows and all that
jazz.

Besides, if you want to manage pop, you might as well start looking at
the php4-imap / php5-imap module to be able to work with POP more
easily.

I might be mistaken, but I believe that installing an MTA on your PC
will allow you to send/receive e-mails locally. Not sure if that
suffices for your sittuation though.

Either way, check Jay's google queries. They might give you an insight
on some MTA servers you can use (I had to code a webmail application
once and I found a few free MTA servers, so I believe you'll be able
to do that to without breaking a swet :)

Good luck with your project!

On 8/17/05, George B [EMAIL PROTECTED] wrote:
 Shaw, Chris - Accenture wrote:
  snip
  yeah I can send to the SMTP server of my ISP, but no where else.
  /snip
 
  If you can send to the smtp server then your ISP should deliver the email.
 
  If you have not filled in the sendmail_from var in the php.ini correctly,
  they cannot send back a mail saying there was a problem with the delivery.
 
 
 
 
  
 
  This message has been delivered to the Internet by the Revenue Internet 
  e-mail service
 
  *
 Ok guys! It has sent the mail succesfully everywhere! Now one more
 thing. How do I make it so I can receive mail? I am using my ISP's POP
 server but I dosent send back because my e-mail is [EMAIL PROTECTED] How
 do I setup my own domain and does it cost money for an e-mail?
 
 --
 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] protecting a directory

2005-08-14 Thread André Medeiros
Apache already has that feature.

It's a directive in .htaccess, IIRC.

On 8/14/05, jenny mathew [EMAIL PROTECTED] wrote:
 hello,
 i want to protect a directory using php username and password
 authentication.the username and passwords will be stored in .htpasswd
 file.but the problem is that how to make user to enter passwod before giving
 the rights to view directory. is there any script like this.or can anybody
 help me out.
 thanks,
 Jenny.
 


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



Re: [PHP] How to determine if a script instance is already running?

2005-08-02 Thread André Medeiros
On Tue, 2005-08-02 at 09:49 -0400, Jim Moseby wrote:
 I have a command line script that needs to run continuously, and so I plan
 to have cron execute it every so often.  I want to have the script first
 check to see if another instance is already running and, if so, die().
 
 Now, I know I can exec the process list and parse through the output, but is
 there and easier, faster, cooler, sexier, better way?  :o)
 
 JM
 

Do like some services do:

1) Check if script.pid exists
2) If it doesn't
2.1) Write the process's PID onto the file
(http://pt.php.net/manual/en/function.getmypid.php)
3) If it does
3.1) Die gracefully :)

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



Re: [PHP] How to determine if a script instance is already running?

2005-08-02 Thread André Medeiros
On Tue, 2005-08-02 at 15:09 +0100, Stut wrote:
 André Medeiros wrote:
  Do like some services do:
  
  1) Check if script.pid exists
  2) If it doesn't
  2.1) Write the process's PID onto the file
  (http://pt.php.net/manual/en/function.getmypid.php)
  3) If it does
  3.1) Die gracefully :)
 
 Personally I'd extend that slightly to have the process touch the PID 
 file every so often and to check that it's been touched recently when it 
 starts up. Alternatively use the ps shell command to check that a 
 process with that PID is still running, but that tends to be less reliable.
 
 If the process does decide to continue in spite of the PID file existing 
 it should issue a a shell kill command to kill that PID in case it's 
 hung or a zombie.
 
 -Stut

Excelent point!

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



Re: [PHP] Running a PHP script everyday

2005-08-01 Thread André Medeiros
Shit shit shit!!! I completelly forgot!

#!/usr/local/bin/php -q

Notice the -q, it's important.

Sorry :(

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



Re: [PHP] Running a PHP script everyday

2005-07-30 Thread André Medeiros
You can cron the script to run.

Do the following:

1) Add #!/usr/bin/php as the first line on your .php file. If
/usr/bin/php isn't where your php binary lives, type whereis php to
find out
2) Make sure you chmod +x your php script.
3) http://www.linuxforums.org/tutorials/1/tutorial-4017.html

On 7/30/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 In my pevious hunt through cron I didn't even notice the PHP CLI. So I will 
 be figuring that out today probably.
 
 My server runs on Linux. Not sure which distro though. I'll have to ask.
 
 My script will be getting e-mail addresses from my SQL db and sending them a 
 pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I just 
 need to figure out how to make it run without me doing anything.
 
 Thanks!
 
 Andrew Darrow
 Kronos1 Productions
 www.pudlz.com
 
 
 - Original Message -
 From: James Kaufman [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Saturday, July 30, 2005 10:07 AM
 Subject: Re: [PHP] Running a PHP script everyday
 
 
  On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] wrote:
   I have a PHP script that I need to run once a day.  I have it currently
   setup so that I just run it from my cell phone, but I would prefer 
   something
   automated. I'd looked into a cron job, but that just looks like it's for
   doing linux command line stuff on my host.
  
   I also thought about writing a never ending while loop with an if 
   statement
   that checks to see if it's time to run the script, then when it is time, 
   it
   runs. Then checks to see if it's time again.
  
   But even assuming I could get it working, do I really want to have a PHP
   script that runs all the time. This could be bad if it ate up all the CPU 
   on
   my server. I'm not even sure I have access rights to kill the process 
   once I
   start it.
  
   Any suggestions?
  
   Andrew Darrow
   Kronos1 Productions
   www.pudlz.com
  
 
  You don't state what OS you are using, but you certainly can use cron under
  Linux to run a PHP script. What really matters is what does the PHP script 
  do?
  For example, I have a PHP script that I run periodically that retrieves data
  from a database and updates a text file on the disk. What does your script 
  do?
 
  --
  Jim Kaufman
  Linux Evangelist
  public key 0x6D802619
  CCNA, CISSP# 65668
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
  --
  No virus found in this incoming message.
  Checked by AVG Anti-Virus.
  Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005
 
 


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



Re: [PHP] allowing selected file types

2005-07-30 Thread André Medeiros
You might want to read up on this:

http://en.wikipedia.org/wiki/Magic_number_%28programming%29

On 7/30/05, Sebastian [EMAIL PROTECTED] wrote:
 i know i shouldn't rely on mime types for file verification but anyways..
 
 I use application/zip which works fine on firefox and only allows zips..
 however, on Internet explorer it doesn't work since IE returns
 application/x-zip-compressed for zips.. problem with this is it also
 allow rar files.. so even checking mime types is just as useless as not
 using it.. one mime type allows two different file types. pffft.
 
 
 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005
 
 --
 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] is it possible.

2005-07-29 Thread André Medeiros
When deppending on authentication, never link the files directly.

You can create a download.php file that gets an ID through the URL,
checks if the user is authenticated and then read the file.

You will need these functions:

http://pt.php.net/file_get_contents
http://pt.php.net/header

Header() is to send the mime type, and file_get_contents is to read the
file's contents (DOH).

If you run into trouble, you can (in the order given ;):

1) Read the user's comments on both functions. They're pretty helpful
sometimes
2) Mail the ML :)

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



Re: [PHP] PHP and ISMAP

2005-07-29 Thread André Medeiros
Why not using a rewrite rule that would point to an index.php or
somesuch?

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



Re: [PHP] Re: PHP and ISMAP

2005-07-29 Thread André Medeiros
On Fri, 2005-07-29 at 14:47 +0200, Michelle Konzack wrote:
 Please no CC, I am on the list.
 
 Am 2005-07-29 14:20:47, schrieb André Medeiros:
  Why not using a rewrite rule that would point to an index.php or
  somesuch?
 
 And then ?
 I have e.g. 8x6 click maps, pointing all to the same index.php ?
 How do the CGI know on which map I have clicked ?
 
 And using rewrites on my webserver is no option because they are
 people which can not do that.
  
 Greetings
 Michelle
 

Whenever you hit a rewrite rule, the file knows what the original
request was. So, in this case, you'd know whitch image was called ;)

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



Re: [PHP] help with ORDER BY query

2005-07-29 Thread André Medeiros
if( mysql_num_rows( $query_r )  0 ) {
while( $currentResult = mysql_fetch_array( $query_r ) ) {
// do something with the result.
}
}
else {
echo 'No results.';
}

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



Re: [PHP] PHP code in a MySQL record

2005-07-29 Thread André Medeiros
Either what Kris says, or you can use a templating engine.

See Smarty (http://smarty.php.net)

On 7/29/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
 Is there a particular reason you need *PHP* in the database?  If not,
 then use a placeholder system of some sort ( like #var# ) and str_replace():
 
 while( $row=mysql_fetch_row($result) ) {
 echo str_replace( '#var#', $that_var, $row['entry'] );
 }
 
 
 
 kgt
 
 
 
 
 Nathaniel Hall wrote:
 
 I am working on a project that uses an index.php page.  Depending on the
 variable in the URL, a different php page is included.  I have a
 config.php that contains variables that are accessible from any page.
 That is the easy part.
 
 I have some pages pulling HTML out of a database. I would like to be
 able to reference some of the variables in the config.php in the
 database blob field.  Here is an example:
 
 [EMAIL PROTECTED]
 --
 htmlhead...etc
 ?php
include 'config.php';
if (blabla) {
include thispage.php;
} else {
include thatpage.php;
}
 ?
 
 config.php
 --
 ?php
$this_var=1;
$that_var=Nothing;
 ?
 
 test.php
 --
 ?php
$query=SELECT * from table;
$result=mysql_query($query) or die (Cannot process query);
$row=mysql_fetch_row($result);
echo $row[1];
 ?
 
 MySQL record:
 --
 id,year,month,day,entry
 
 1,2005,01,01,This is a testbr? echo $that_var; ?
 
 _
 I have tried using brgt;? echo $that_var; ?lt; and I have tried
 escaping everything, but that still didn't work.  Any ideas?
 
 Nathaniel Hall
 [EMAIL PROTECTED]
 
 
 
 
 --
 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] function with argument of type array

2005-07-28 Thread André Medeiros
On Thu, 2005-07-28 at 11:08 +0200, marc serra wrote:
 Hi, i want to know if it is possible to create a function and declare 
 that one of its arguments is array type.
 
 In fact i want to do something like this
 
 function test(String $litteral, array $foo){
 .
 }
 
 I got an error when i do something like this. Can you help me please?
 
 Thx,
 
 Marc
 

There is no way to do that. What you _CAN_ do, to ensure you're getting
an array is:

function test( $stringVar, $arrayVar ) {
if( is_array( $arrayVar ) ) {
// Thsi is an array
} else {
// Do error handling here
}
}

There are a few is_* functions that will help you on that. Good luck!

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



Re: [PHP] define (true/false)

2005-07-28 Thread André Medeiros
On Wed, 2005-07-27 at 17:17 -0400, Sebastian wrote:
 i never really used constants before so this may sound stupid..
 when you define a constant using define() and want to return true/false 
 is this logical:
 
 if($bars == 3)
 {
 define('BAR', 1);
 }
 
 then:
 
 if(BAR)
 {
 // bars is true
 }
 
 or should i need to do an else statement as well:
 
 if($bars == 3)
 {
 define('BAR', 1);
 }
 else
 {
define('BAR', 0)
 }
 
 lastly is it more practical to just do:
 
 if($bars == 3)
 {
   $bar = true;
 }
 
 i am curious what most people would use.
 
 
 -- 
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.338 / Virus Database: 267.9.5/58 - Release Date: 7/25/2005
 

That's an incorrect use for constants. Use variables for that =]

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



Re: [PHP] function with argument of type array

2005-07-28 Thread André Medeiros
On Thu, 2005-07-28 at 12:45 +0100, Marcus Bointon wrote:
 On 28 Jul 2005, at 12:07, André Medeiros wrote:
 
  On Thu, 2005-07-28 at 11:08 +0200, marc serra wrote:
 
  Hi, i want to know if it is possible to create a function and declare
  that one of its arguments is array type.
 
  In fact i want to do something like this
 
  function test(String $litteral, array $foo){
 
  There is no way to do that. What you _CAN_ do, to ensure you're  
  getting
  an array is:
 
 There IS a way to do exactly this. It's called type hinting and it's  
 a PHP 5 feature:
 
 http://www.php.net/manual/en/language.oop5.typehinting.php
 
 Marcus
 -- 
 Marcus Bointon
 Synchromedia Limited: Putting you in the picture
 [EMAIL PROTECTED] | http://www.synchromedia.co.uk
 

Wow... didn't have a clue it was possible already! Seems as if it's
still a feature under development (only arrays and classes), but they're
on the good way :)

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



Re: [PHP] preg_match - help please

2005-07-28 Thread André Medeiros
On Thu, 2005-07-28 at 19:45 +0800, Jason Wong wrote:
 On Thursday 28 July 2005 01:50, André Medeiros wrote:
 
  You can have four words to describe a first and last name... you can
  have other alphabets, like arabian, chinese, etc... inserting accented
  characters alone would make that a big, nasty regex, let alone
  predicting ways you can describe first/last names.
 
  I'm not saying that I have the _BEST_ sollution. All I'm saying is that
  there are sittuations that are out of your control, and it seems to me
  this might be the easiest way out, guaranteeing that there are at least
  two words.
 
 Most Chinese would enter their name (usually 3 words, sometimes 2. rarely 
 4) WITHOUT any spaces.
 
 Not sure what the OP was trying to do, but the best way to handle it 
 (IMHO) is to give the user 2 input boxes, one for  family name, the other 
 for the rest of their name.
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 New Year Resolution: Ignore top posted posts
 

Heh... that's the best answer i've seen so far =)

That and the regexp's idea given by John (ie. forbid chars instead of
entering every letter of every alphabet) would work great.


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



Re: [PHP] define (true/false)

2005-07-28 Thread André Medeiros
On Thu, 2005-07-28 at 14:41 +0200, Jochem Maas wrote:
 André Medeiros wrote:
  On Wed, 2005-07-27 at 17:17 -0400, Sebastian wrote:
  
 i never really used constants before so this may sound stupid..
 when you define a constant using define() and want to return true/false 
 is this logical:
 
 if($bars == 3)
 {
 define('BAR', 1);
 }
 
 then:
 
 if(BAR)
 {
 
 ...
 
  
  
  That's an incorrect use for constants. Use variables for that =]
 
 WHY?
 
  
 

Well, IMHO, constants have a specific value, for stuff like

define( 'PROJECT_STATUS_PLANNING', 1 );
define( 'PROJECT_STATUS_ACTIVE', 2 );

and

if( $project_stauts == PROJECT_STATUS_PLANNING ) {
}

etc etc.

It just sounds weird...

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



Re: [PHP] Multipage form redux

2005-07-28 Thread André Medeiros
The point of sessions is that when you close your browser, you loose it.
I'm affraid that if you want sessions that last two weeks, you'll have
to make your own session handler :) but yeah, it's possible, and it
beats the crap out of the fill form, store in db, fill form, store in
db method.

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



Re: [PHP] How Can I send mail in php in HTML format?

2005-07-28 Thread André Medeiros
On Thu, 2005-07-28 at 12:30 -0700, Tomás Rodriguez Orta wrote:
 Hello friends.
 
 How Can I send mail from php in HTML format?.
 I use the mail() function, but I dont know doing.somebody can I help me?
 
 
 Best regards TOMAS
 
 
 -
 Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
 en el dominio de correo angerona.cult.cu  y no se encontro ninguna 
 coincidencia.

Use PHPMailer (http://phpmailer.sourceforge.net/)

It's very easy to use, and can do HTML, attachments and such

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



Re: [PHP] New installation of PHP 5.0.4 on Windows 2003 server

2005-07-28 Thread André Medeiros
Try looking into IIS's error log. There might be something useful there.

When, for some reason, this happens in apache, for instance, the error
log tells you what went wrong (missing simbol, missing lib, whatever).

Good luck!

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



Re: [PHP] Multipage form redux

2005-07-27 Thread André Medeiros
On Wed, 2005-07-27 at 07:51 -0400, Jack Jackson wrote:
 Hi,
 I have searched the archives and seen links to tutorials at phpclasses 
 (which seem to be down) and not found an answer to my question:
 I have a long form I want to break into seven pages. Rather than pass 
 values from page to page as hidden, I'd rather write the results to the 
 db after each page then move on.
 
 Anyone know of any tutorials on this?
 
 Thanks in advance,
 JJ
 

That's not a very good idea. Imagine the user gets to the fourth form
and gets a cup of coffee, or goes out to lunch. By the time he gets to
the computer he might have lost the session, thus having data on your DB
that is wasting space.

And what if the user closes the browser window? :)

Bad bad idea.

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



Re: [PHP] how to know referral function

2005-07-27 Thread André Medeiros
On Wed, 2005-07-27 at 15:14 +0200, Daniele Palumbo wrote:
 hi.
 
 i have a p_debug(), that print out some useful information (for me).
 
 it is called by a lot of my functions, and i want to know which one is 
 generating the error.
 the referral function :)
 
 no, i don't want to write in all call to p_debug some information on running 
 function...
 
 thanks
 daniele
 
 -- 
 PGP Key-ID: 0xF482D454
 --
 To boldly go where no man has gone before.
 

http://pt.php.net/manual/en/function.debug-backtrace.php


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



Re: [PHP] preg_match - help please

2005-07-27 Thread André Medeiros
On Wed, 2005-07-27 at 15:27 +0100, Steve Turnbull wrote:
 Hi
 
 I want to see that a user is submiting a form field in the correct manner.
 So I decided to use preg_match to verify their input.
 
 The pattern I am trying to match is;
 
 Firstname Secondname
 
 I am not bothered about character length just yet (but advise on this would
 be appreciated if it can be done with a regular expression - saves extra
 checking code), but I would like case sensitity.
 
 The code I haev so far, which doesn't seem to work is;
 
 $un = $_REQUEST['name'];
 $exp = '/^\b[a-zA-Z] [a-zA-Z]$/';
 
 if (preg_match($exp, $un)) {
 //has this matched?
 echo h2matched/h2;
 }
 
 Help would be greatly appreciated
 
 Thanks
 Steve
 

http://pt.php.net/strpos

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



Re: [PHP] preg_match - help please

2005-07-27 Thread André Medeiros
On Wed, 2005-07-27 at 15:27 +0100, Steve Turnbull wrote:
 Hi
 
 I want to see that a user is submiting a form field in the correct manner.
 So I decided to use preg_match to verify their input.
 
 The pattern I am trying to match is;
 
 Firstname Secondname
 
 I am not bothered about character length just yet (but advise on this would
 be appreciated if it can be done with a regular expression - saves extra
 checking code), but I would like case sensitity.
 
 The code I haev so far, which doesn't seem to work is;
 
 $un = $_REQUEST['name'];
 $exp = '/^\b[a-zA-Z] [a-zA-Z]$/';
 
 if (preg_match($exp, $un)) {
 //has this matched?
 echo h2matched/h2;
 }
 
 Help would be greatly appreciated
 
 Thanks
 Steve
 

A reminder... sometimes First and Last name can contain three words.
There are portuguese names, like Inês de Medeiros. Watch out for that
too.

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



Re: [PHP] preg_match - help please

2005-07-27 Thread André Medeiros
On Wed, 2005-07-27 at 16:16 +0100, Mark Rees wrote:
 André Medeiros [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  On Wed, 2005-07-27 at 15:27 +0100, Steve Turnbull wrote:
   Hi
  
   I want to see that a user is submiting a form field in the correct
 manner.
   So I decided to use preg_match to verify their input.
  
   The pattern I am trying to match is;
  
   Firstname Secondname
  
   I am not bothered about character length just yet (but advise on this
 would
   be appreciated if it can be done with a regular expression - saves extra
   checking code), but I would like case sensitity.
  
   The code I haev so far, which doesn't seem to work is;
  
   $un = $_REQUEST['name'];
   $exp = '/^\b[a-zA-Z] [a-zA-Z]$/';
  
   if (preg_match($exp, $un)) {
   //has this matched?
   echo h2matched/h2;
   }
  
   Help would be greatly appreciated
  
   Thanks
   Steve
  
 
  A reminder... sometimes First and Last name can contain three words.
  There are portuguese names, like Inês de Medeiros. Watch out for that
  too.
 
 Or even four - like Rafael van der Vaart for example - so make sure that the
 surname box matches spaces as well, and special characters like the ê, as
 well as ' as in John O'Kane
 

Yeah, that's why strpos will make his life much easier :)

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



RE: [PHP] preg_match - help please

2005-07-27 Thread André Medeiros
On Wed, 2005-07-27 at 11:41 -0400, Mike Johnson wrote:
 From: André Medeiros [mailto:[EMAIL PROTECTED] 
 
  On Wed, 2005-07-27 at 16:16 +0100, Mark Rees wrote:
  
   Or even four - like Rafael van der Vaart for example - so 
  make sure that the
   surname box matches spaces as well, and special characters 
  like the ê, as
   well as ' as in John O'Kane
   
  
  Yeah, that's why strpos will make his life much easier :)
 
 Can you explain how you'd use strpos() in this situation? I was going to ask 
 earlier, but didn't bother, but now I'm curious...
 

That's not very nice of you, saying that to people who try to help ;)

if( strpos( $_POST['frmName'], ' ' ) === false ) {
// Do error handling here
} else {
// All is OK :)
}

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



Re: [PHP] preg_match - help please

2005-07-27 Thread André Medeiros
On Wed, 2005-07-27 at 11:55 -0400, John Nichel wrote:
 André Medeiros wrote:
  That's not very nice of you, saying that to people who try to help ;)
  
  if( strpos( $_POST['frmName'], ' ' ) === false ) {
  // Do error handling here
  } else {
  // All is OK :)
  }
  
 
 How does that match Firstname Lastname better than a regex?  That will 
 return true as long as there is at least one space, no matter what the 
 rest of the submission is.  I could submit $^#^$# )([EMAIL PROTECTED], 
 or I 
 could submit just a single space, and that would return true. strpos() 
 has it's uses, but this isn't one of them.
 
 -- 
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]
 

There is a large number of sittuations that the regex won't work in.
Special characters aren't included (from what I can understand using my
weak regex knowlege), you could even be chinese, and it wouldn't work.

If you use strpos with trim and strlen cleverlly, you won't have to
worry about it again.

My $0.02

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



Re: [PHP] preg_match - help please

2005-07-27 Thread André Medeiros
On Wed, 2005-07-27 at 12:30 -0400, John Nichel wrote:
 André Medeiros wrote:
  On Wed, 2005-07-27 at 11:55 -0400, John Nichel wrote:
  
 André Medeiros wrote:
 
 That's not very nice of you, saying that to people who try to help ;)
 
 if( strpos( $_POST['frmName'], ' ' ) === false ) {
 // Do error handling here
 } else {
 // All is OK :)
 }
 
 
 How does that match Firstname Lastname better than a regex?  That will 
 return true as long as there is at least one space, no matter what the 
 rest of the submission is.  I could submit $^#^$# )([EMAIL 
 PROTECTED], or I 
 could submit just a single space, and that would return true. strpos() 
 has it's uses, but this isn't one of them.
  
  There is a large number of sittuations that the regex won't work in.
  Special characters aren't included (from what I can understand using my
  weak regex knowlege), you could even be chinese, and it wouldn't work.
  
  If you use strpos with trim and strlen cleverlly, you won't have to
  worry about it again.
  
  My $0.02
 
 You can trim whitespace and check the length until the cows come home, 
 and that still won't stop a string such as #T* [EMAIL PROTECTED].  A regex 
 can 
 cover practicaly every situation for a name submission; it all depends 
 on how deep you want to validate.  strpos() has too narrow of a scope to 
 match a complex pattern.
 
 -- 
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]
 

You can have four words to describe a first and last name... you can
have other alphabets, like arabian, chinese, etc... inserting accented
characters alone would make that a big, nasty regex, let alone
predicting ways you can describe first/last names.

I'm not saying that I have the _BEST_ sollution. All I'm saying is that
there are sittuations that are out of your control, and it seems to me
this might be the easiest way out, guaranteeing that there are at least
two words. 

If you find a way to fit accented characters / other alphabets there
nicelly, be my guest :)

Take care.

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



[PHP] MySQL + PHP question

2005-07-26 Thread André Medeiros
Hi guys.

I'm having some trouble here regarding a project. I have a table with
projects, wich can be recursive (ie. sub-projects) and it is related to
itself.

By making the following query

-8--
SELECT * FROM projects LEFT JOIN projects proj_parent ON
projects.project_parent = proj_parent.parent_id WHERE project_id = 1234
-8--

i need to be able to access to the parent project's fields, but I have a
slight problem here.

First off, I have to make the LEFT JOIN. I don't know if the project can
be parent (therefore not finding a project_id = 0 wouldn't show the row)
and I need to add some kind of prefix to the proj_parent's fields so
that I can access them (or that they can't overwrite the project i'm
getting info on.

Well... there is an obvious sollution here: use an associative array
instead of an object, and access the properties by doing $array[0],
$array[1], etc. By my experience, this is a nightmare, maintenence-wise,
so I'd only use it as a _LAST_ resource.

Does anyone have any experience with this? The answer should be pretty
obvious, but I can't seem to figure it out :(

Thanks in advance.

André

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



RE: [PHP] MySQL + PHP question

2005-07-26 Thread André Medeiros
On Tue, 2005-07-26 at 11:45 +0100, Shaw, Chris - Accenture wrote:
 Hello,
 
 Consider this:
 tbl_project(id, name, parent)
 
   1 6
  / \   / \
 2   3 7   8
/\
   4  5
 
 if tbl_project.parent = 0 then the project is the top parent.
 Therefore, 1 and 6 have the field parent = 0.
 
 So, say if you have project 5, do you want to find out its parent (2), or do
 you want to find out all its parents including grandparents (2) and (1)?
 

I just need to find it's parent. This is part of a permission system i'm
building, and I need to somewhat register the objects in the permission
system so I can manage things easilly from there.

So to sum it up, this is my attempt to save queries :)

 What do you need to know?

Projects can only be parent or children. No more recursiveness than that
(it's possible, but we've implemented business rules that prevent it.)
What I'm trying to do is to add some sort of prefix to the fields
returned by the proj_parent table (wich is the projects table the same,
but with different info, and will overwrite the object's properties).

If not... heck, I'll have to make another query or use the associative
array sollution (wich neither will make me very happy, but that's life).

Thanks for your prompt reply :)

 
 C.
 -Original Message-
 From: André Medeiros [mailto:[EMAIL PROTECTED]
 Sent: 26 July 2005 12:18
 To: php-general@lists.php.net
 Subject: [PHP] MySQL + PHP question
 
 
 *
 
 This e-mail has been received by the Revenue Internet e-mail service.
 
 *
 
 Hi guys.
 
 I'm having some trouble here regarding a project. I have a table with
 projects, wich can be recursive (ie. sub-projects) and it is related to
 itself.
 
 By making the following query
 
 -8--
 SELECT * FROM projects LEFT JOIN projects proj_parent ON
 projects.project_parent = proj_parent.parent_id WHERE project_id = 1234
 -8--
 
 i need to be able to access to the parent project's fields, but I have a
 slight problem here.
 
 First off, I have to make the LEFT JOIN. I don't know if the project can
 be parent (therefore not finding a project_id = 0 wouldn't show the row)
 and I need to add some kind of prefix to the proj_parent's fields so
 that I can access them (or that they can't overwrite the project i'm
 getting info on.
 
 Well... there is an obvious sollution here: use an associative array
 instead of an object, and access the properties by doing $array[0],
 $array[1], etc. By my experience, this is a nightmare, maintenence-wise,
 so I'd only use it as a _LAST_ resource.
 
 Does anyone have any experience with this? The answer should be pretty
 obvious, but I can't seem to figure it out :(
 
 Thanks in advance.
 
 André
 
 --
 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 
 
 This message has been delivered to the Internet by the Revenue Internet 
 e-mail service
 
 *

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



Re: [PHP] MySQL + PHP question

2005-07-26 Thread André Medeiros
One thing I didn't quite explain myself well... I'm building this to
register objects on a permission system.

The SQL weight is heavy as it is, and I want to save queries as much as
possible. Making two queries to extract information about a project and
it's parent is not something I'd want to do. I know recursiveness, but
thanks for the pointers and for the reply :)

Best regards

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



RE: [PHP] MySQL + PHP question

2005-07-26 Thread André Medeiros
You're missing the point here. I know how to get the parent project's
info. I know recursiveness. I _JUST_ don't know how to get the current
and parent project's info in just ONE QUERY (since I'm trying to save
them because the sql weight is getting pretty heavy).

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



Re: [PHP] Playing Audio

2005-07-26 Thread André Medeiros
On Tue, 2005-07-26 at 13:47 +0100, Tom Chubb wrote:
 This seems really silly, but I can't find a way of doing it!
 How can I play/stream an audio file, that may be upto an hour long and
 keep it playing while visitors view other pages?
 Is it possible to use sessions so that the file will continue playing
 when they hit the next page.
 (It wouldn't really matter if there was a small pause while they changed)
 (I don't really want to play it from a popup window.)
 Any help would be greatly appreciated.
 Tom
 

Using frames?

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



Re: [PHP] MySQL + PHP question

2005-07-26 Thread André Medeiros
On Tue, 2005-07-26 at 13:39 +0100, Mark Rees wrote:
 André Medeiros [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  One thing I didn't quite explain myself well... I'm building this to
  register objects on a permission system.
 
  The SQL weight is heavy as it is, and I want to save queries as much as
  possible. Making two queries to extract information about a project and
  it's parent is not something I'd want to do. I know recursiveness, but
  thanks for the pointers and for the reply :)
 
  Best regards
 
 I must admit I still don't really get what you are looking for. Does this
 query help?
 
 select c.field1 AS childfield1,
 c.field2 AS childfield2,
 (etc)
 p.field1 AS parentfield1,
 p.field2 AS parentfield2,
 (etc)
 FROM
 child AS c
 LEFT JOIN
 parent AS p
 ON c.parent=p.id
 
 ?
 

Yeah, that might do, thanks!

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



Re: [PHP] stipping raw text from rss story

2005-07-26 Thread André Medeiros
On Tue, 2005-07-26 at 09:28 -0400, Krypto 76 wrote:
 I want to write a j2me midlet that displays a story headline and
 description. This is working great.
 However I want to write a php script that I can hit the url/page of
 the full story with then pull all of the stories text and remove all
 html/script/menu/imagee etc. So the phone can display it.
 
 How can I effectively get (mostly) just the text?
 
 Jay
 

http://pt.php.net/manual/en/function.strip-tags.php

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



Re: [PHP] Very Basic question: What IDE/tools I need to begin using PHP?

2005-07-26 Thread André Medeiros
You would actually only need Zend Studio Client.

It's the best PHP IDE i've ever tried (and believe me, i've been around ;)

On 7/26/05, Taksam [EMAIL PROTECTED] wrote:
 Hi everybody, I am learning PHP, and have this very basic question:
 
 What software/tools I need to begin?
 What is the best IDE I can use? (in windows) Please tell me about FULL-IDEs, 
 not just super text editors that can syntax-highlight PHP code. I want to 
 debug, deploy... ALL!
 I have just downloaded Zend Studio Client AND Zend Studio Server. Is that all 
 I need to begin?...
 
 Tak
 
 
 -
  Start your day with Yahoo! - make it your home page


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



Re: [PHP] Re: System specific information gathering

2005-07-24 Thread André Medeiros
Or that... :P

On 7/24/05, Joe Wollard [EMAIL PROTECTED] wrote:
 As always, look for someone else's existing project and see how they
 did it. ;-)
 
 http://phpsysinfo.sourceforge.net/
 
 Good Luck!
 -Joe
 
 On Jul 23, 2005, at 9:25 AM, André Medeiros wrote:
 
  First of all, you want to have the two values in seperate variables.
  After reading the contents from the file, do something like:
 
  -8---
  --
  function parseUptimeSeconds( $seconds ) {
  $resultArray = Array( 'weeks' = 0, 'days' = 0, 'hours' = 0,
  'minutes' = 0, 'seconds' =  0);
 
  // check weeks
  while( $seconds  604800 ) {
  $resultArray['weeks']++;
  $seconds -= 604800;
  }
 
  // check days
  while( $seconds  86400) {
  $resultArray['days']++;
  $seconds -= 86400;
  }
 
  // check hours
  while( $seconds  3600) {
  $resultArray['hours']++;
  $seconds -= 3600;
  }
 
  // check minutes
  while( $seconds  60) {
  $resultArray['minutes']++;
  $seconds -= 60;
  }
 
  $resultArray['seconds'] = $seconds;
 
  return( $resultArray );
  }
 
  // separate both values
  list( $uptimeSeconds, $idleSeconds ) = explode( ' ',
  $lineReadFromFile );
  $uptimeElements = parseUptimeSeconds( $uptimeSeconds );
  $idleElements = parseUptimeSeconds( $idleSeconds );
  -8---
  --
 
  I know there might be a more efficient way of doing this, like using
  the modulus operator, but hey :)
 
  On 7/23/05, Ramil Sagum [EMAIL PROTECTED] wrote:
 
  On 7/23/05, Vidyut Luther [EMAIL PROTECTED] wrote:
 
  Ok,
If I use the file_get_contents.. how do I actually parse the
  contents on /proc/uptime
  cat /proc/uptime
  1400293.13 1317047.64
 
 
 
  The first number is the total uptime in seconds, the second number is
  the total idle time.
 
  --
  
 
 
 
  ramil
  http://ramil.sagum.net/
 
  --
  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: System specific information gathering

2005-07-23 Thread André Medeiros
First of all, you want to have the two values in seperate variables.
After reading the contents from the file, do something like:

-8-
function parseUptimeSeconds( $seconds ) {
$resultArray = Array( 'weeks' = 0, 'days' = 0, 'hours' = 0,
'minutes' = 0, 'seconds' =  0);

// check weeks
while( $seconds  604800 ) {
$resultArray['weeks']++;
$seconds -= 604800;
}

// check days
while( $seconds  86400) {
$resultArray['days']++;
$seconds -= 86400;
}

// check hours
while( $seconds  3600) {
$resultArray['hours']++;
$seconds -= 3600;
}

// check minutes
while( $seconds  60) {
$resultArray['minutes']++;
$seconds -= 60;
}

$resultArray['seconds'] = $seconds;

return( $resultArray );
}

// separate both values
list( $uptimeSeconds, $idleSeconds ) = explode( ' ', $lineReadFromFile );
$uptimeElements = parseUptimeSeconds( $uptimeSeconds );
$idleElements = parseUptimeSeconds( $idleSeconds );
-8-

I know there might be a more efficient way of doing this, like using
the modulus operator, but hey :)

On 7/23/05, Ramil Sagum [EMAIL PROTECTED] wrote:
 On 7/23/05, Vidyut Luther [EMAIL PROTECTED] wrote:
  Ok,
If I use the file_get_contents.. how do I actually parse the
  contents on /proc/uptime
  cat /proc/uptime
  1400293.13 1317047.64
 
 
 The first number is the total uptime in seconds, the second number is
 the total idle time.
 
 --
 
 
 
 
 ramil
 http://ramil.sagum.net/
 
 --
 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] Help with a home-grown function

2005-07-22 Thread André Medeiros
On Thu, 2005-07-21 at 13:37 -0700, Dan Trainor wrote:
 Hello, all -
 
 I've been looking around for a function that would tell me if a $value
 in a $key=$value array was empty, and I could not find one.  So I
 decided to make my own.  Even if I am re-inventing the wheel, I thought
 that the practice might be good for me.
 
 However, my function doesn't *quite* work, and I'm having a difficult
 time finding out why.  The code is as follows:
 
 function findMissingVals($workingArray) {
   $newcount = count($workingArray);
   for ($i = 0; $i = $newcount; $i++) {
   if (empty($workingArray['$i'])) {
   return 1;
   }
   }
 }
 
 So it takes in $workingArray as an array, runs a loop, checks $i, yada
 yada.  The thing is, that sometimes the function does not return 1, even
 when it should.
 
 I was hoping some experienced eyes could take a gander at this and give
 me some pointers.
 
 Thanks!
 -dant
 
8-
function findMissingVals( $workingArray ) {
$arrayMissingVals = Array();
foreach( $arrayMissingVals as $key = $value ) {
if( is_array( $value ) ) {
array_merge( $arrayMissingVals, findMissingVals( 
$value ) );
}
else if( empty( $value ) ) {
array_push( $arrayMissingVals, $workingArray[$key] );
}

}

return( $arrayMissingVals );
}
8-

Recursive function that will check arrays and return references to the
empty keys. Then, you can do whatever you like.

If you need something simpler, do

8-
if( in_array( $workingArray, null ) ) {
// Do something
}
8-

Same goes for 0, '', etc.

Good luck!

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



Re: [PHP] On register_shutdown_function: What might be the problem?

2005-07-22 Thread André Medeiros
Given it's a fatal error, it's as bad as a syntax error. It cancels
everything it's doing and leaves.

Remember that, even the shutdown function has to obey the time limit. 

On 7/22/05, Liang ZHONG [EMAIL PROTECTED] wrote:
 ?php
 
 set_time_limit(0);
 function f(){
 $count=1000;
 for($i=0; $i$count; $i++){ }
 
 exec(touch  /tmp/ccc);
 }
 
 
 register_shutdown_function('f');
 
 header(Content-type: text/plain);
 header(Location: y.html);
 ?
 
 
 When the time_limit is set to 0, the redirect page will be shown in 20
 second after the file ccc is created.
 When the time_limit is set to 5, the redirect page will be shown in 5 second
 and the ccc file is not created. The error from curl command line tool is
 as:
 ---
 br /
 bFatal error/b:  Maximum execution time of 5 seconds exceeded
 inb/./y.php/b on line b6/bbr /
 
 
 What might be the problem that my register shudown function can not
 continuously run after the main program end?
 What is the correct way to keep the function running after I redirect a
 existing page to http client and then  immediately close the connection?
 
 Thank you very much for your help.
 
 --
 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] Howto connect to the internet using php

2005-07-21 Thread André Medeiros
On Thu, 2005-07-21 at 12:10 +0200, Steven wrote:
 Is there any way for me to use php to make my windows xp pc connect to 
 the internet, either by starting the windows dialer or by some other 
 means?  The windows machine uses a standard 56k dialup to connect to the 
 internet.
 
 Thanks
 Steve
 

There might be a way of doing it through rundll32, although I'm not sure
wich. 

On the php side, once you uncovered how to do it, you would just
exec() / system() the function :)

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



Re: [PHP] Howto connect to the internet using php

2005-07-21 Thread André Medeiros
On Thu, 2005-07-21 at 12:10 +0200, Steven wrote:
 Is there any way for me to use php to make my windows xp pc connect to 
 the internet, either by starting the windows dialer or by some other 
 means?  The windows machine uses a standard 56k dialup to connect to the 
 internet.
 
 Thanks
 Steve
 

http://www.dx21.com/SCRIPTING/RUNDLL32/VIEWITEM.ASP?OID=126CMD=P-A

:)


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



Re: [PHP] mail will not send attachment

2005-07-21 Thread André Medeiros
Try http://phpmailer.sourceforge.net/

Works awesomelly great. I've been using it for quite some time now, and
I don't want to look at mail() again :)




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



Re: [PHP] Before I pull anymore hair out.. Is anyone Using..

2005-07-20 Thread André Medeiros
On Wed, 2005-07-20 at 10:21 -0500, Chuck Carson wrote:
 Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
 10g support and using apache 2.0.54? I have looked at every 10 times
 over. I have built php with oracle support probably 100 times on 5
 different platforms and never had as many issues as I have had so far
 with this system.
 
 After finally getting php to build with everything I needed, I am
 getting seg faults when accessing a php page that connects to the
 oracle database. (but it doesn't happen _every_ time, it is
 inconsistent)
 
 I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
 stable platform up this week. =(
 
 Thx
 CC
 

Do you have CLI compiled?

I had some issues developing a module myself, and found out that
enabling the module in CLI and calling a dummy file to test the
functions I just created helped me getting an insight about what was
wrong.

Install gdb, then do:

gdb php
(and inside gdb)
run -q file_with_oracle_functions.php

It will segfault. Do a backtrace. There you might have a good idea on
what's going wrong :)

Good luck!

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



RE: [PHP] My Project

2005-07-19 Thread André Medeiros
On Tue, 2005-07-19 at 17:46 +0100, Shaw, Chris - Accenture wrote:
 Taxi for one..
 
 -Original Message-
 From: George B [mailto:[EMAIL PROTECTED]
 Sent: 19 July 2005 17:39
 To: php-general@lists.php.net
 Subject: [PHP] My Project
 
 
 Hey guys! This is gona be one of my last questions (hopefully) But here
 I will include all the info about my new project.
 It is going to be like a RPG Game written in PHP. There is going to be a
 store where you could buy weapons etc... The thing I want to ask you
 guys is this. Lets say There is a knife i want to buy. It costs 10
 points. And I have 100 points. How would I make it so when I click BUY!!
 My money automaticaly subtracts from 100 to 90. How do I do that?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 
 
 This message has been delivered to the Internet by the Revenue Internet 
 e-mail service
 
 *
 

You could read up on AJAX.

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



Re: [PHP] My Project

2005-07-19 Thread André Medeiros
On Tue, 2005-07-19 at 17:57 +0100, Mikey wrote:
 George B wrote:
 
  Paul Waring wrote:
 
  On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:
 
  And I have 100 points. How would I make it so when I click BUY!! My 
  money automaticaly subtracts from 100 to 90. How do I do that?
 
 
 
  Where is your money being stored? In a database? A text file? A cookie?
  Do you want the buy link to work on the client side using Javascript
  or AJAX or have it submit to a PHP script?
 
  Paul
 
  My money is being stored in a database. And I want everythign to be in 
  PHP, no java script. And the BUY!! Button is a input button from a 
  form. :)
 
 $money = $money - 10;
 

$money -= 10;

saves some chars ;)

 I wish you the best of luck with your project :^)
 
 Mikey
 

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



Re: [PHP] Re: Trimming Text

2005-07-17 Thread André Medeiros
I've succeded on doing this task :)

I had to make a few assumptions (like HTML is formatted correctly),
but, other than that, it worked just fine.

I'll post the code on monday.

Thanks for all your help guys. You've been GEAT (you know... like
Tony says ;) )

On 7/17/05, Al [EMAIL PROTECTED] wrote:
 Al wrote:
  André Medeiros wrote:
 
  Greetings.
 
  I am trying to trim some text containing HTML tags. What I want to do is
  to trim the text without trimming the tags or html entities like nbsp;
  and such, wich completelly break the design.
 
  Has anyone succeded on doing such a thing? phpclasses.org won't help :(
 
  Thanks in advance.
  André
 
 
  Consider...
 
  Making a preg pattern to capture everything between tags and then use
  preg_replace_callback() process the captured text with the called
  function.
 
  It will work; but it's a bit tricky.
 
  Here is a similiar code snip to get you started...
 
  $pattern= %[\w-/]+%;
 
  $text=
  preg_replace_callback($pattern,
  create_function('$matches', 'return strtolower($matches[0]);'), $text);
 
  This converts all tags to lowercase.
 
  You probably should use a regular callback function rather than creating
  one.
 
 
 Here is a pattern that will get you close
 $pattern= %([\s\S]+?)([\s\S]+?)(/[\s\S]+?)%;
 
 The first bracket will get your first tag; second bracket, your text; third, 
 the end tag.
 
 Try this...
 
 $num= preg_match_all($pattern, $your_string, $matches);
 
 print_r($matches);
 
 I didn't test this; but, you should see all your tags and text neatly in an 
 array.
 
 You can then use foreach($matches[x] $key=$value) {
 
 your code to trim, etc.
 
 $new_array[$key}= $new_string;
 }
 
  From the print_r() you can see what x should be.  And, you'll need to 
 reassemble your $new_array.
 
 Finally, reconstruct your output string with another foreach()
 
 The preg_replace_callback() will do all the foreach() stuff in one line.  
 Your argument for the
 callback function will be x.
 
 --
 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] Question about apache-php concurrent process control

2005-07-17 Thread André Medeiros
I did something like that for a newsletter sending script. Basiclly, I
had two scripts:

a) AddEdit.php that would list the newsletter's items and allow it to send
b) Send.php that was a script I ran on the background

When pressed Send on AddEdit, it would do something like

$tempName = tempnam( '/tmp', 'newsletter' );
$fp = fopen( $tempName, 'w+' );
fputs( $fp, #!/bin/sh\n/path/to/script/Send.php 12 \n );
fclose( $fp );
chmod( $tempName, 0755 );
system( $tempName . ' ' );

That way, it would launch the second script into the background,
checking if the script altered the newsletter's state for Sent
everytime a user saw the newsletter's details.

Hope it helped.

On 7/16/05, Rory Browne [EMAIL PROTECTED] wrote:
 On 7/16/05, rouvas [EMAIL PROTECTED] wrote:
  Hi Liang,
 
  trying to get conclusive results with browsers is futile. Use a command-line
  tool (like curl) to invoke the web pages and get the results. Or you can use
 Although personally I think that telnet-to-port-80 would be a better
 idea, in this case when you're trying to check what is outputted
 first. Either that or a TCP sniffer.
 
 I also agree with the microtime() suggestion, mentioned below. It will
 get you around the problem of caches - which is a major problem for
 something like this. I'm not sure what the situation with apache is
 regarding caches.
 
  PHP's own function to query the web server and do your own timing with
  microtime() function or another suitable for your purposes.
 
  In order for flush() results to reach you (in a browser) they have to pass
  from multiple caches like PHP's, Apache's, the occasional proxies and 
  finally
  the browser's own cache. So you cannot get dependaple results measuring 
  times
  or responses from your browser. Try the methods above.
 
  And a final tip... When Rasmus speaks, you don't question him:-) Period.
 
 Unless you didn't understand what he said and want clarification.
 
 
 
  Have a nice day,
  -Stathis
 
  On Saturday 16 July 2005 04:41, Liang ZHONG wrote:
   Hi Rasmus,
  
   You are right. It was the problem with the browser. I used Mozilla Firefox
   to try, and do not know what consideration it just serialized the 
   identical
   url http requests. I then turned to use 2 IE 6.0 windows, 2 tabs within
   Maxthon browser, one IE windows and one Firefox, to test. Then I got the
   conclusion as you told. Thank you very much for the help.
  
   BTW, I could not get the flush() work, neither flush() with ob_flush(). I
   tried almost all methods mentioned in the followed posts under
   http://us2.php.net/flush, but none of them can really pushed the buffer
   out. The site is configurated with http://liang.ns2user.info/php/info.php
   on Red head, kernel 2.4.29. What can I do to get it work?
  
   Thank you again.
  
   Liang ZHONG wrote:
 Could you please explain it a little bit more?
 I did test this way.

 The code is the same for a.php and b.php
 ?php

sleep(20);
print  Done. br /;

 ?

 I place request from 2 browser windows.
 First time, I placed with http://baseURL/a.php with both 2 browsers,
 starting times have 5 second interval. Then the first Done shows
 after 20 seconds and the second Done shows 20 seconds after the 
 first
   
   Done.
   
 Then, I placed one browser with http://baseURL/a.php and the second 
 one
 with http://baseURL/b.php, with starting time of 5 second interval.
 Then I got the first browser showing Done after 20 seconds and 5
 seconds later, the second browser showed Done, too.

 Thus it seems that the apache can spoon out multiple php interpreters
 responding to http requests, while php can not deal with concurrent
 process from one program.
   
   I have no idea what you did to configure it this way.  I wouldn't even
   know how to do that if you asked me to.  As far as PHP is concerned it
   has no idea which processes are handling which script files at any one
   point.  So whether you request a.php and b.php at the same time or a.php
   twice at the same time, it makes absolutely no difference to PHP.  If
   you are really seeing this, then the limitation is in your browser or
   somewhere else.  Try making a.php output stuff so it becomes easier to
   see.  As in for($i=0;$i20;$i++) { echo $i; flush(); sleep(1); }
   You should see the counter start counting as soon as you hit the page.
   
   -Rasmus
   
   --
   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] Is GD available

2005-07-15 Thread André Medeiros
On Fri, 2005-07-15 at 07:06 -0700, Todd Cary wrote:
 I have php 4.3.11 available, and when I do a phpinfo()
 
 http://209.204.172.137:81/testphp.php
 
 I see it in the configuration, but it is not listed elsewhere.  How can 
 I test to see if it is available?
 
 gd_info() is not in 4.3.11 and extension_loaded('gd') gives a false.
 
 Todd
 

Check if the extension is loaded on php.ini

If it is, check apache's errorlog.

Good luck

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



[PHP] Trimming Text

2005-07-15 Thread André Medeiros
Greetings.

I am trying to trim some text containing HTML tags. What I want to do is
to trim the text without trimming the tags or html entities like nbsp;
and such, wich completelly break the design.

Has anyone succeded on doing such a thing? phpclasses.org won't help :(

Thanks in advance.
André

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



Re: [PHP] Is GD available

2005-07-15 Thread André Medeiros
On Fri, 2005-07-15 at 07:25 -0700, Todd Cary wrote:
 In php 4.3.11, ini files are placed in /etc/php.d that have
 extension=.  I have one (i.e. gd.ini) with
 extension=libgd.so.2  and libgd.so.2 is in /usr/lib/php4.
 
 Todd
 
 André Medeiros wrote: 
  On Fri, 2005-07-15 at 07:06 -0700, Todd Cary wrote:

   I have php 4.3.11 available, and when I do a phpinfo()
   
   http://209.204.172.137:81/testphp.php
   
   I see it in the configuration, but it is not listed elsewhere.  How can 
   I test to see if it is available?
   
   gd_info() is not in 4.3.11 and extension_loaded('gd') gives a false.
   
   Todd
   
   
  
  Check if the extension is loaded on php.ini
  
  If it is, check apache's errorlog.
  
  Good luck
  
  


Try putting it on php.ini

There's something wrong that makes the extension not being loaded.

Did you check apache's error logs?

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



Re: [PHP] Is GD available

2005-07-15 Thread André Medeiros
On Fri, 2005-07-15 at 07:41 -0700, Todd Cary wrote:
 Damn!  I should have checked the error_log first!
 
 PHP Warning:  Unknown(): Invalid library (maybe not a PHP library)
 'libgd.so.2'  in Unknown on line 0
 
 And this is the library from the rpm specified in ww.php.net:
 http://www.boutell.com/gd/.  However, the site says that gd should be
 supported out of the box.  I am going to try and find the rpm for
 php-4.3.11 and reinstall it.
 
 Todd
 
 André Medeiros wrote: 
  On Fri, 2005-07-15 at 07:25 -0700, Todd Cary wrote:

   In php 4.3.11, ini files are placed in /etc/php.d that have
   extension=.  I have one (i.e. gd.ini) with
   extension=libgd.so.2  and libgd.so.2 is in /usr/lib/php4.
   
   Todd
   
   André Medeiros wrote: 
   
On Fri, 2005-07-15 at 07:06 -0700, Todd Cary wrote:
  
  
 I have php 4.3.11 available, and when I do a phpinfo()
 
 http://209.204.172.137:81/testphp.php
 
 I see it in the configuration, but it is not listed elsewhere.  How 
 can 
 I test to see if it is available?
 
 gd_info() is not in 4.3.11 and extension_loaded('gd') gives a false.
 
 Todd
 
 
 
Check if the extension is loaded on php.ini

If it is, check apache's errorlog.

Good luck


  
  
  
  Try putting it on php.ini
  
  There's something wrong that makes the extension not being loaded.
  
  Did you check apache's error logs?
  
  


Being an extension developer... I know these things happen :)

Good luck!

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



Re: [PHP] Trimming Text

2005-07-15 Thread André Medeiros
On Fri, 2005-07-15 at 15:40 +0100, Raz wrote:
 Take a look at http://uk.php.net/manual/en/ref.pcre.php - plenty of
 useful functions for this sort of thing...
 
 raz

Implementing regular expressions on this kind of task would be a big
PITA... and that's if it works (read my previous e-mail).

Thanks for the suggestion anyway :)

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



Re: [PHP] Trimming Text

2005-07-15 Thread André Medeiros
On Fri, 2005-07-15 at 15:49 +0100, Raz wrote:
 Are you trying to turn, for example
 
 p Some text here. /p
 
 into
 
 pSome text here./p
 
 ?

Let's say that I have an original string like:

This is regular text span class=textwith some text inside a
span/span

Let's say I want to trim it to 25 chars.

Brainless trimming would give me something like

This is regular text sp

Wich would completelly mess the design.

However, if I finish the tag, the following text will be formatted by
the span class=text tag, thus messing the design also.

It also happened to trim nbsp; to half, having the same effect.

I want to find a smart way to do this trimming in order not to have any
side effects.

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



Re: [PHP] Trimming Text

2005-07-15 Thread André Medeiros
On Fri, 2005-07-15 at 16:12 +0100, Raz wrote:
 If you really want to do it, you're gonna have to get your hands
 dirty, I'm afraid...;)
 
 ...off with the gloves...!

I was affraid that would happen :(

Thanks anyway :)

Take care!

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



RE: [PHP] Trimming Text

2005-07-15 Thread André Medeiros
On Fri, 2005-07-15 at 10:02 -0500, Jay Blanchard wrote:
 [snip]
 Let's say that I have an original string like:
 
 This is regular text span class=textwith some text inside a
 span/span
 
 Let's say I want to trim it to 25 chars.
 
 Brainless trimming would give me something like
 
 This is regular text sp
 
 Wich would completelly mess the design.
 
 However, if I finish the tag, the following text will be formatted by
 the span class=text tag, thus messing the design also.
 
 It also happened to trim nbsp; to half, having the same effect.
 
 I want to find a smart way to do this trimming in order not to have any
 side effects.
 [/snip]
 
 Trim it to 25 characters? I think we may be missing the point of your
 question. Can you clarify this for us? Are you wanting
 
 This is regular text sp
 an class=textwith som
 e text inside a span/sp
 an
 
 ?

I am wanting to

This is regular text sp... (see more)

;)

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



Re: [PHP] Trimming Text

2005-07-15 Thread André Medeiros
On Fri, 2005-07-15 at 16:03 +0100, Richard Davey wrote:
 Hello André,
 
 Friday, July 15, 2005, 4:24:23 PM, you wrote:
 
 AM I am trying to trim some text containing HTML tags. What I want to
 AM do is to trim the text without trimming the tags or html entities
 AM like nbsp; and such, wich completelly break the design.
 
 The problem as I see it, is that while it's easy to trim some text and
 then check to see if you were inside an HTML tag or not, it becomes
 MUCH harder to check if you were inside nested tags (for example
 strongem)
 
 If there are no nested tags then it's much easier.. just trim the
 string at X characters and then search for the last occurrence of a
 '' and the last occurance of '' - if the first is LESS than the second
 value, then you're in the middle of a tag.
 
 This of course doesn't handle nested tags.
 
 Best regards,
 
 Richard Davey
 -- 
  http://www.launchcode.co.uk - PHP Development Services
  I do not fear computers. I fear the lack of them. - Isaac Asimov
 

Yeah... that's the point :( Nested tags are very possible.

I am not sure how one would go here tho

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



Re: [PHP] Re: How to read PHP variables.

2005-07-15 Thread André Medeiros
What about...

form action=saveConfig.php method=post

Database Host: input type=text name=config[database][host]
value=?=$config['database']['host']? /br /
Database User: input type=text name=config[database][user]
value=?=$config['database']['user']? /br /

!-- some more fields here --

/form

And then...

?php
$newConfigValues = $_POST['config'];

$fileCode = ?php\n// AUTOMATICLLY CREATED CONFIG FILE. DO NOT EDIT!
\n;
foreach( $newConfigValues as $parentConfigKey = $parentConfigValue ) {
if( is_array( $parentConfigValue ) {
foreach( $parentConfigValue as $childConfigKey = 
$childConfigValue )
{

$fileCode .= 
$config['$parentConfigKey']['$childConfigKey'] =
'$childConfigValue';\n;

}
}
else {
$fileCode .= $config['$parentConfigKey'] = 
'$parentConfigValue'\n;
}
}

$fileCode .= ?;

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



Re: [PHP] sockets

2005-07-12 Thread André Medeiros
On Tue, 2005-07-12 at 16:49 +0200, daro wrote:
 Hi.
 I'm writing a TCP/IP server and client.
 On your website I found ready php script http://pl2.php.net/sockets but I 
 have a question.
  
 For TCP/IP server the example script from your website has to be put on 
 server as index.php file and the access to it could be f.e. 
 http://192.168.1.11/index.php ?
  
  I don't know where should I put this script to be able to receive all datas 
 and respond with proper strings.
  
  Your sincerely
 Dariusz Chorążewicz
 
 -
 Rozwiązania sms www.statsms.net, www.smscenter.pl
 GG: 346444
 Tel: 696 061 543
 
 

You have to run your script from the command-line. Don't depend on
apache to have it running.

Also remember to set_time_limit(0) ;)

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



Re: [PHP] sockets

2005-07-12 Thread André Medeiros
On Tue, 2005-07-12 at 09:58 -0500, Greg Donald wrote:
 On 7/12/05, daro [EMAIL PROTECTED] wrote:
   I don't know where should I put this script to be able to receive all 
  datas and respond
  with proper strings.
 
 You would run the script as a shell script from the command line.
 
 On windows you can just save the code as a regular php script then
 start it up from a DOS prompt like:
 
 c:\PHP\php.exe -f yoursocketfile.php
 
 or if you are using a *nix setup run it just as it is, making sure the
 first line points to your php binary, for example mine is
 /usr/bin/php.  Chmod it so it's executable.
 
 
 -- 
 Greg Donald
 Zend Certified Engineer
 MySQL Core Certification
 http://destiney.com/
 

More specificlly,

--8-
#!/usr/bin/php
?php
// your script here
?
--8-

And then
$ chmod +x socket.php
$ ./socket.php 


OR

$ /usr/bin/php -q socket.php 


If your on *NIX, remember the last  to put the process on the
background. Not sure how one would go on windows tho :(

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



Re: [PHP] max_file_size

2005-07-12 Thread André Medeiros
On Tue, 2005-07-12 at 11:35 -0400, Sebastian wrote:
 Each time i try setting MAX_FILE_SIZE in a form and using the upload 
 error code to check if the file is large it always uploads the entire 
 file before showing the error that the file is too big.. either the 
 manual is incorrect or this does not work as every method i've tried 
 always waits for the file to be uploaded before it errors. eg:
 
 form enctype=multipart/form-data method=post
 input type=hidden name=MAX_FILE_SIZE value=1048576 /
 input type=file name=userfile size=29 /
 input type=submit name=submit value=Upload /
 /form
 
 switch($_FILES['userfile']['error'])
 {
case 1:
 $message[] = 'Error #1 - ...';
break;
 
case 2:
 $message[] = 'Error #2 - File is too big';
break;
 
case 3:
 $message[] = 'Error #3 - File was partially uploaded';
break;
 }
 
 --snip
 -- IF no error then start upload...
 --snip
 
 yet it waits for file to upload before error.
 I've been using php for serveral years and i cant remember ever getting 
 this to work like the manual states.
 

There is no way for you to check the file's size before it gets fully
uploaded. This happens because Apache only checks the filesize when it's
on the server's temporary files. The client doesn't send any info about
the file except it's name and it's contents.

Even if you want to turn to javascript, I don't think there's a way to
do what you want to do. File input fields can only be read from my
experience, and through javascript there isn't any way to access a
file's properties through the client-side unless you have some sort of
ActiveX control or somesuch.

The only thing I saw that would do that was a Java applet :)

Good luck!

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



Re: [PHP] sockets

2005-07-12 Thread André Medeiros
Please, PLEASE Reply to All!

Yes, you have to add something like 

--8-
while(true) {

// code here

if( $someConditionThatWillMakeMeExit ) {
break;
}

sleep(1); // to prevent excessive processor usage

}
--8-

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



Re: [PHP] max_file_size

2005-07-12 Thread André Medeiros
On Tue, 2005-07-12 at 12:38 -0400, John Nichel wrote:
 Sebastian wrote:
 snip
  it doesnt seem to work on IE or Firefox.. two of the most popular 
  browsers..
  this shoudn't even be in the manual then because if it doesnt work for 
  these two browsers then i would consider it pointless to use.
 /snip
 
 It may not be your browser that it's not working with...it may be your 
 system's security settings, or your firewall (if you're behind one) not 
 allowing the information thru.
 
 -- 
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]
 

Sure, it could be that. But, in this sittuation, the error says that the
file is too big. Even it the firewall didn't let the file go through
(wich I doubt, because a firewall won't parse HTTP requests and make
those checks, unless you have a request max size or something), you'd
just get an error page saying that the request didn't go through.

DO NOT trust the browsers to do something. If all of them complied 100%
to standards, we would live in a (almost) perfect world :)

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



Re: [PHP] sockets

2005-07-12 Thread André Medeiros
Since there was no reference to that on the PHP manual, I thought about
mentioning it just to be safe.

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



Re: [PHP] constructors in PHP

2005-07-11 Thread André Medeiros
On Mon, 2005-07-11 at 16:44 +0200, Alessandro Rosa wrote:
 Is there the possibility to have in PHP multiple class constructors
 as in C++ or just one ?
 I would be sure about it in order to prevent useless mad investigations
 in the code I'm writing.
 
 Thanks in advance ...
 
 Alessandro Rosa

You can't make several definitions of constructors. What you _CAN_ do is
to use func_get_args ( www.php.net/func_get_args ) to determine how many
args were passed :)

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



Re: [PHP] Two websites need to share part of one database, suggestions please

2005-07-11 Thread André Medeiros
What about using web-services (something ala xml?). Could that be
considered an option?

On 7/11/05, Brad Pauly [EMAIL PROTECTED] wrote:
 On 7/8/05, Chris W. Parker [EMAIL PROTECTED] wrote:
 
  Which option should I go for? Is there another option I'm not
  considering?
 
 Another possibility would be adding a new table that relates products
 to sites. This allows a one (product) to many (sites) relationship
 without changing the products table. The same could be applied to the
 other tables.
 
 - Brad
 
 --
 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] Two websites need to share part of one database, suggestions please

2005-07-11 Thread André Medeiros
XML is quite easy. Let's say you're making a search for books, and you
have site1.com searching site2.com for some stuff.

site2.com could have some sort of back end like

http://site2.com/_backend/search.php?keywords=a+book

That would search it's database for the keywords a book.

It could generate XML like:

searchResults
searchResult
id1/id
bookTitleA Children's Book/bookTitle
/searchResult
searchResult
id2/id
bookTitleA Book about Everything!/bookTitle
/searchResult
/searchResults

To do this request, PHP has the fopen command, that will allow you to
read from URLs too (see http://pt.php.net/fopen).

After reading the XML code into a string, just parse it. There are
hundreds of classes on phpclasses.org. Just take a pick :)

I hope this was helpful. If you need me to explain something more
thoroughly, let me know.

Good luck :)

On 7/11/05, Chris W. Parker [EMAIL PROTECTED] wrote:
 André Medeiros mailto:[EMAIL PROTECTED]
 on Monday, July 11, 2005 12:44 PM said:
 
  What about using web-services (something ala xml?). Could that be
  considered an option?
 
 No because I don't how to use that stuff. :)
 
 
 Chris.


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



  1   2   >