[PHP] Alternative session control system

2011-12-26 Thread Francisco M. Marzoa Alonso
Hello, I need an alternative session control system different from the PHP standard one, that does not need to use the headers, because it's for a series of scripts that will be accessed through AJAX javascript code inserted in different places of a web page which headers I do not control, so I

[PHP] Problems with CURL using an HTTP Proxy on PHP5

2011-12-16 Thread Francisco M. Marzoa Alonso
Hello, The following code is failing and I do not find the cause (please, note that checkurl value and CURLOPT_PROXY are NOT the real values I'm using, of course): $ch = curl_init(); $checkurl = 'http://mycheckhost.com/'; curl_setopt ($ch, CURLOPT_TIMEOUT, 6000);

[PHP] Problems with proc_open and getmypid

2011-11-14 Thread Francisco M. Marzoa Alonso
Hello, I'm developing a PHP application that runs on GNU/Linux with php cli. A process must launch another one and store its pid, so I use proc_open and then proc_status to achieve that. The child process must also get its own pid and write it down to a file. After that, the calling process

Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
The first thing that I probably do is to check for possible errors from DB: $result = mysql_query(SELECT * FROM inf_member WHERE user_id='$user_id' ); if ( ! $result ) { die (Could not perform query $query: .mysql_error().\n); } Regards, On dom,

Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
defined on your one. I prefer to store first the query on a string to show it complete if there's an error late, because it may show also the point. On lun, 2007-01-29 at 00:39 +0100, Francisco M. Marzoa Alonso wrote: The first thing that I probably do is to check for possible errors from DB

Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote: I took the quotes off. I thought that quotes around numbers was wrong also. Quotes are no necessary around numeric values, but they aren't wrong neither, simply optional. I added the error checking and this is the error: Could not perform

Re: [PHP] Select record by ID

2007-01-28 Thread Francisco M. Marzoa Alonso
On dom, 2007-01-28 at 18:20 -0600, Larry Garfield wrote: On Sunday 28 January 2007 5:54 pm, Francisco M. Marzoa Alonso wrote: On dom, 2007-01-28 at 18:51 -0500, nitrox . wrote: I took the quotes off. I thought that quotes around numbers was wrong also. Quotes are no necessary around

[PHP] My objects eats too much (and weird!) memory

2007-01-27 Thread Francisco M. Marzoa Alonso
Hello! I'm new here, so I do not know if attachments are allowed, so I put my code below. I've written this to check memory consumption of PHP5 objects, because I'm having memory problems with an OO XMLParser that I've written. When I execute the code from cli, I get: $ php MemTest.php Obj1

Re: [PHP] My objects eats too much (and weird!) memory

2007-01-27 Thread Francisco M. Marzoa Alonso
On sáb, 2007-01-27 at 20:05 +, Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-26 20:40:34 +0100: I've written this to check memory consumption of PHP5 objects, because I'm having memory problems with an OO XMLParser that I've written. It measures something else though. The memory

Re: [PHP] Re: My objects eats too much (and weird!) memory

2007-01-27 Thread Francisco M. Marzoa Alonso
M. Marzoa Alonso wrote: AFAIK there's no other way to measure memory usage on PHP than this, if you know something better it could be more constructive if you show it. The last time I looked I think the xdebug module allowed you to get the memory consumption of a given object in PHP. I

Re: [PHP] DATE

2007-01-27 Thread Francisco M. Marzoa Alonso
On sáb, 2007-01-27 at 23:51 -0500, Ron Piggott wrote: I have date in the variable $date_reference in the format -MM-DD. How do I find out the date before this and the date after this? Ron http://us3.php.net/manual/en/function.date.php#68716 RTFM :-P signature.asc Description: This is

[PHP] Objects and sessions

2004-12-09 Thread Francisco M. Marzoa Alonso
Following code: ?php class SessionTestC { protected $value; function __construct ( $val ) { $this-value = $val; } function GetValue () { return $this-value; } } if ( isset ($_SESSION['TestObj'])) { echo 'Session Test is set to:

[PHP] [SOLUTION] Re: [PHP] Objects and sessions

2004-12-09 Thread Francisco M. Marzoa Alonso
Thomas Munz wrote: I think, its not possible to init an Objeect on a session. Yes, it can. The problem was with serialization. With session.auto_start set to 1 on php.ini, seems like session's objects are unserialized before loading the script, so the class is not loaded when the session

[PHP] Getting static member for a class which name is stored in a variable

2004-11-25 Thread Francisco M. Marzoa Alonso
I've code like follows: ?php class TestClass { public static $Data = 'This is the data'; } $Obj = new TestClass (); $ClassName = get_class ($Obj); echo $ClassName::$Data; ? It gives me an error like: Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM ... I've found googling that it

[PHP] Overriding static members?

2004-11-25 Thread Francisco M. Marzoa Alonso
Can I override static members in someway under PHP5? Is the answer is negative, Why not? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Sorting...

2004-11-17 Thread Francisco M. Marzoa Alonso
If each element of the array is a string with those contains, it should be sorted as you want just calling sort function. It will considerate also rest of characters, of course, but the most significative should be the first ones. Another alternative is to wrote a quicksort function in PHP

[PHP] explode and PATH_SEPARATOR

2004-11-15 Thread Francisco M. Marzoa Alonso
Taking this code: pre ?php define (PATH_SEPARATOR, /); $String=Root/One/Two/Three/Last; $arr = explode ( PATH_SEPARATOR, $String ); var_dump ( $arr ); $arr = explode ( /, $String ); var_dump ( $arr ); ? /pre It works fine in second case returing a five elements array, but in the first one it

[PHP] Dinamically adding methods to an object instance?

2004-11-15 Thread Francisco M. Marzoa Alonso
I've seen that's possible to add public members to objects dinamically, such as: ?php class TestClass { public $One=1; } $Obj = new TestClass (); $Obj-Two = 2; echo $Obj-Two; ? There'll be a public Two member that's not defined in the class. Is it possible to add methods dinamically to an

[PHP] Callback function as parameter

2004-11-10 Thread Francisco M. Marzoa Alonso
Hi everybody, I want to wrote a function that receives another function as parameter that will be used as a Callback. Well, better a bit of code than thousand words: class TreeNode { ... function Traverse ( CallBack ) { $rtn = CallBack ($this); foreach ($this-Sons as $Son) {

Re: [PHP] Re: Re: VOTE TODAY

2004-11-05 Thread Francisco M. Marzoa Alonso
That's true for Germany and France and probably another european countries, but in Spain by example we've just 512/128kbps paying the same that a french by 6Mbps/512kbps. Never mind, this dammed country continues being more the North of Africa than the South of Europe... Best regards, Michelle

Re: [PHP] Determining system resources

2004-11-04 Thread Francisco M. Marzoa Alonso
Greetings Robin, As far as you cannot lock another processes in the system, so this will not give you the security that the resources will not change -and probably they'll do it- while you're trying to download that file. Best regards, Robin Getz wrote: I have been unable to find a php function

[PHP] Unexpected results with object to array cast

2004-11-03 Thread Francisco M. Marzoa Alonso
This code: ?php class TestClass { private $self; function __construct () { $this-self = $this; } } $Obj = new TestClass (); print_r ( $Obj ); echo br; $Arr = (array) $Obj; print_r ( $Arr ); ? Produce the following output: TestClass Object ( [self:private] = TestClass Object

Re: [PHP] Unexpected results with object to array cast

2004-11-03 Thread Francisco M. Marzoa Alonso
logical, indeed. Francisco M. Marzoa Alonso wrote: Produce the following output: TestClass Object ( [self:private] = TestClass Object *RECURSION* ) Array ( [ TestClass self] = TestClass Object ( [self:private] = TestClass Object *RECURSION* ) ) While I expect to find for the second line something

Re: [PHP] Re: VOTE TODAY

2004-11-03 Thread Francisco M. Marzoa Alonso
This is my second and last message on this issue. Perhaps this list is not the best place to discuse about politics, but it isn't for create and follow personal issues neither. In my (not-so :-P) humble opinion everyone that follows this kind of threads is as guilty of making noise as the one

[PHP] [SOLUTION] Re: [PHP] Convert an array in an object instance

2004-10-27 Thread Francisco M. Marzoa Alonso
Ok, I've write a function that emulates the Perl's bless one. It works pretty well. The idea comes to me when Rob suggest to parse the serialized data. I think this is better -or at least faster- than parsing all serialized data to modify object values: Just convert the object to an array,

Re: [PHP] [SOLUTION] Re: [PHP] Convert an array in an object instance

2004-10-27 Thread Francisco M. Marzoa Alonso
to do it, now I must work in another thing :-| ) Francisco M. Marzoa Alonso wrote: Ok, I've write a function that emulates the Perl's bless one. It works pretty well. The idea comes to me when Rob suggest to parse the serialized data. I think this is better -or at least faster- than parsing all

Re: [PHP] Problem with Regular expression

2004-10-27 Thread Francisco M. Marzoa Alonso
Try with \s instead of \b, I meant: $pattern = /(\sand\s)|(\snot\s)|(\sor\s)|(\s\s)|(\s\s)|(\s\.\s)|(\s\+\s)|(\s\|\|\s)|(\s\|\s)/i; kioto wrote: Hi all. I have a problem: i want subs any characters from a string but i don't have fix the problem. The string that i want to manipulate is the value

[PHP] bless function

2004-10-27 Thread Francisco M. Marzoa Alonso
Ok, I think I've got it now. The code is autoexplicative, the only restriction is that the object must be converted to an array using the function obj2array instead of a direct cast. There's another ways to do this without the needless of that obj2array function, but I think this is not really

[PHP] bless function: a better aproach

2004-10-27 Thread Francisco M. Marzoa Alonso
Giving it a round, this seems to be a better aproach than the previous one. It has the advantage of provide direct access to the original array obtained from casting without boring about ___FAKE_KEYS_. ? function obj2array ( $Instance ) { $clone = (array) $Instance; $rtn = array ();

Re: [PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Francisco M. Marzoa Alonso
Nick Wilson wrote: Hello all, I was wondering if anyone might have suggestions or useful links on protecting commercial php scripts. I am about to design a system that would be pretty valuable in a very niche market and would not wish the script to be passed on to others once downloaded.

Re: [PHP] Protecting Commercial PHP Scripts

2004-10-26 Thread Francisco M. Marzoa Alonso
Nick Wilson wrote: * and then Francisco M. Marzoa Alonso declared I was wondering if anyone might have suggestions or useful links on protecting commercial php scripts. I am about to design a system that would be pretty valuable in a very niche market and would not wish the script

[PHP] Add methods to object dinamically

2004-10-26 Thread Francisco M. Marzoa Alonso
I've seen that's possible to add members to objects dinamically, in example: class MyClass { private $a; } $MyObject = new MyClass (); $MyObject-b = 1; Now $MyObject has a public member called 'b' that has a value of '1'. The question is, is it possible to add methods in the same way? I meant

[PHP] Convert an array in an object instance

2004-10-25 Thread Francisco M. Marzoa Alonso
Hi, Is it possible to convert an array in an object instance? I can convert an object in an array as follows: $Test = new MyClass (); $TestArray = (array) $Test; Then I've an array with all members of the object $Test, but it seems that I cannot simply do: $TestObject = (MyClass) $TestArray; To

Re: [PHP] Substr

2004-10-25 Thread Francisco M. Marzoa Alonso
Use regular expresions: ?php $string = pid_1_date_2004_10_25; preg_match ( '/^pid_(.*?)_date_(.*?)$/', $string, $regs ); print_r ($regs); ? Shaun wrote: Hi, I have a string as follows: pid_1_date_2004_10_25 pid tells me the Project_ID and date tells me the date(!). I need to extract this

Re: [PHP] Substr

2004-10-25 Thread Francisco M. Marzoa Alonso
You can also use split function if you do not know about regular expressions and do not want to learn: ?php $string = pid_1_date_2004_10_25; $regs = split (_, $string ); print_r ($regs); ? I think its autoexplicative. Shaun wrote: Hi, I have a string as follows: pid_1_date_2004_10_25 pid tells

Re: [PHP] Re: Convert an array in an object instance

2004-10-25 Thread Francisco M. Marzoa Alonso
[EMAIL PROTECTED] wrote: No. You need to remember that in most cases where you cast a variable from one type to another, you will experience data (precision) loss. This is also the case in converting an object to an array. Only the properties are copied over (since functions can not be part of an

Re: [PHP] Re: Convert an array in an object instance

2004-10-25 Thread Francisco M. Marzoa Alonso
Marek Kilimajer wrote: Francisco M. Marzoa Alonso wrote: [EMAIL PROTECTED] wrote: No. You need to remember that in most cases where you cast a variable from one type to another, you will experience data (precision) loss. This is also the case in converting an object to an array. Only

Re: [PHP] Re: Convert an array in an object instance

2004-10-25 Thread Francisco M. Marzoa Alonso
Curt Zirzow wrote: * Thus wrote Francisco M. Marzoa Alonso: FYI, the reason I need this is because I'm creating my own object's serialization routines. Why would you want to do this? I was walking through the forest when, suddenly, a white light comes from the west through the trees

[PHP] Serializing objects with protected members

2004-10-22 Thread Francisco M. Marzoa Alonso
Hi, I'm trying to wrote my own serialization routines and I've found a previsible problem: protected members are not visible to my serialization routine. This is ok and it should be as is, but I've seen that PHP's serialize function have access to that members anyway, so the question is: Is

Re: [PHP] change server unix-win

2004-10-20 Thread Francisco M. Marzoa Alonso
Just a point: this will be a problem if they have some forward slashes that are not specifying file paths, i.e. URLs in the code like http://www.whereveryouwant.com/ will be substituted by http:\\www.whereveryouwant.com\ Greg Donald wrote: On Wed, 20 Oct 2004 13:17:08 +0200, Patrick Fehr

[PHP] Nesting level too deep - recursive dependency?

2004-10-18 Thread Francisco M. Marzoa Alonso
This code: ?php class TestClass { public $myself; function __construct () { $this-myself = $this; } } $TestObj = new TestClass (); if ( $TestObj-myself == $TestObj ) { echo They are same.\n; } ? Gives me a Fatal error: Nesting level too deep - recursive dependency? on line

Re: [PHP] Nesting level too deep - recursive dependency?

2004-10-18 Thread Francisco M. Marzoa Alonso
Can someone tell me if I should fill a bug report about this or is it my fault??? Francisco M. Marzoa Alonso wrote: This code: ?php class TestClass { public $myself; function __construct () { $this-myself = $this; } } $TestObj = new TestClass (); if ( $TestObj-myself

Re: [PHP] Nesting level too deep - recursive dependency?

2004-10-18 Thread Francisco M. Marzoa Alonso
Ah, OK thanks for your advice Chris. Chris Dowell wrote: Francisco You really need to post this to [EMAIL PROTECTED] - this list is for us lowly users of PHP, the developers and maintainers of the language have their own list. Cheers Chris Francisco M. Marzoa Alonso wrote: Can someone tell me