Re: [PHP] Random SELECT SQL list

2007-05-16 Thread Larry Garfield
On Wednesday 16 May 2007, Eduardo Vizcarra wrote:
> Hi
>
> I would like to know if a SELECT SQL query list of records can be unsorted.
> SELECT statement retrieves a list of records from a certain table starting
> from record # 1 till record #N and when publishing the records, this is how
> it is presented, in a sequential way, is there any way to not present them
> in a sequential way ? e.g. if a user accesses a web page then he will see
> record #3 and then #7 and so on, another user accesses the same web page
> and he might see record #8 and then record#2. etc
>
> any experience on how to do this ?

This is really an SQL question, but it's quite easy.  Assuming MySQL:

$result = mysql_query("SELECT * FROM foo WHERE bar='baz' ORDER BY RAND()");
// Do stuff here.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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



Re: [PHP] Random SELECT SQL list

2007-05-16 Thread Paul Novitski

At 5/16/2007 09:40 PM, Eduardo Vizcarra wrote:

I would like to know if a SELECT SQL query list of records can be unsorted.
SELECT statement retrieves a list of records from a certain table starting
from record # 1 till record #N and when publishing the records, this is how
it is presented, in a sequential way, is there any way to not present them
in a sequential way ? e.g. if a user accesses a web page then he will see
record #3 and then #7 and so on, another user accesses the same web page and
he might see record #8 and then record#2. etc



Found on this page:
http://dev.mysql.com/doc/refman/5.1/en/select.html
"
Posted by Boris Aranovich on June 9 2004 2:33pm

I am using this way to select random row or rows:

SELECT * [or any needed fileds], idx*0+RAND() as rnd_id FROM 
tablename ORDER BY rnd_id LIMIT 1 [or the number of rows]


Meanwhile, I didn't stumble in any problems with this usage.
I picked this method in some forum, don't remember when, where or by 
who was it introduced :)

"

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



[PHP] Random SELECT SQL list

2007-05-16 Thread Eduardo Vizcarra
Hi

I would like to know if a SELECT SQL query list of records can be unsorted. 
SELECT statement retrieves a list of records from a certain table starting 
from record # 1 till record #N and when publishing the records, this is how 
it is presented, in a sequential way, is there any way to not present them 
in a sequential way ? e.g. if a user accesses a web page then he will see 
record #3 and then #7 and so on, another user accesses the same web page and 
he might see record #8 and then record#2. etc

any experience on how to do this ?

Regards
Eduardo 

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



Re: [PHP] Extracting Variables From URL

2007-05-16 Thread J R

http://www.php.net/reserved.variables

use $_SERVER['PHP_SELF'] or $_SERVER['REQUEST_URI']

just parse its value to get what you needed.


hth,

John
On 5/17/07, CK <[EMAIL PROTECTED]> wrote:


Hi All,

The following code works just fine for outputting links from an
array. The next goal, is parsing the $thisPage variable from the URL
(http://bushidodeep.com/contact.html/) so as , this variable could also be
assigned to the $links[] $key.

Moving to a dynamic link generator class, what PHP function(s) could
be used to parse the URL?


http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>


Generate Links




 \n";
foreach($links as $key){
if(strtolower($key)!= $thisPage){
echo ("$key\n");
$count ++;
 }else{
echo ("$key");
}
}
echo " \n";


/*prints key as tabindex..
$links=array("home","work","contact");
$count =0;
echo " \n";
foreach($links as $key){
echo ("$key\n");
$count ++;
}
echo " \n";
*/

?>






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





--
GMail Rocks!!!


Re: [PHP] mime type over http post?

2007-05-16 Thread Oliver Block
Hello Ray,

1. create the xml markup (dom)
2. open a connection to the 3rd party server (fsockopen)
3. send the header (fputs)
4. send the body (fputs)
5. close the connection

Additional Questions?

Best Regards,

Oliver

P.S: I just know better where to look for information:-)

- original Nachricht 

Betreff: [PHP] mime type over http post?
Gesendet: Mi, 16. Mai 2007
Von: Ray<[EMAIL PROTECTED]>

> Hello,
> I'm trying to write a web-based aplication that talks to a third party
> server. 
> I'm having a hard time getting support from from them. the method of 
> comunication (direct quote from their docs is:
> "Data will be transferred to [server] via an HTTP POST operation using the 
> MIME type, text/xml"
> 
> can anybody tell me what this means or how I do it using php?
> Thanks,
> Ray
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- original Nachricht Ende 

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



[PHP] Extracting Variables From URL

2007-05-16 Thread CK

Hi All,

The following code works just fine for outputting links from an  
array. The next goal, is parsing the $thisPage variable from the URL 
(http://bushidodeep.com/contact.html/) so as $thisPage=strtolower("contact");?>, this variable could also be  
assigned to the $links[] $key.


Moving to a dynamic link generator class, what PHP function(s) could  
be used to parse the URL?



"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

http://www.w3.org/1999/xhtml";>



Generate Links




 \n";
foreach($links as $key){
if(strtolower($key)!= $thisPage){
echo ("$key\">$key\n");

$count ++;
}else{
echo ("$key");
   }
}
echo " \n";


/*prints key as tabindex..
$links=array("home","work","contact");
$count =0;
echo " \n";
foreach($links as $key){
echo ("$key\">$key\n");

$count ++;
}
echo " \n";
*/

?>






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



Re: [PHP] Download speed limit

2007-05-16 Thread Rangel Reale

Between 90 and 350 MB.

- Original Message - 
From: "Jim Lucas" <[EMAIL PROTECTED]>

To: "Rangel Reale" <[EMAIL PROTECTED]>
Cc: 
Sent: Wednesday, May 16, 2007 6:41 PM
Subject: Re: [PHP] Download speed limit



Rangel Reale wrote:

Hello!

For my application I need to limit the speed that my application sends 
data, in my case a binary file.


I need to send the speed as a parameter, like:

sendfile.php?speed=2

Would send the file at 20kb/s (forgetting about real byte counts for this 
example).


To send the file, I am doing:

$fp=fopen($this->contentfile,"rb");
while(!feof($fp)){
print(fread($fp,1024*8));
flush();
ob_flush();
}
fclose($fp);

If after ob_flush I do a sleep(), I can limit the speed, but I would like 
to limit at the speed of the parameter.


Is there a way to do this?

Thanks,
Rangel


on average, how big are the files that you will be sending?

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




--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 
269.7.0/803 - Release Date: 13/5/2007 12:17





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



Re: [PHP] delete_global_variable & session_unset

2007-05-16 Thread Stanislav Malyshev
Best to ask the php-internals list - they write the C code that does all 
of this work ;)


Yeah, I know, clicked on wrong item, already resent there.
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

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



Re: [PHP] using preg_match

2007-05-16 Thread Chris

Ed Curtis wrote:

I'm trying to use preg_match to find a string in a system path.

What I need to do is see if the string '/realtors' exists in a variable 
named '$path'.


I know '/' is used as a container within the command itself. How do I 
escape it to find the string '/realtors'?


http://www.php.net/preg_quote

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] delete_global_variable & session_unset

2007-05-16 Thread Chris

Stanislav Malyshev wrote:

I recently noticed that session_unset in 5.2 (and probably in 6) uses
delete_global_variable which looks up global scope and then deletes
variable from it. Fine so far, but it does it in a loop - meaning it
looks for the global scope each time anew for each session variable! 
Also it seems to go through all CVs every time, which seems to be a 
waste of time too. Any reason not to do it this way:


1. Fetch the global scope
2. For each CV in the global scope, check if it should be deleted 
against session hash (since we have hashes it should be quick).


This way instead of stack depth*number of CVs*number of session vars we 
get only stack depth+number of CVs*hash lookup time. Which should be 
much better. So anybody sees any reason not to do it?


Best to ask the php-internals list - they write the C code that does all 
of this work ;)


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Mysqli insert / OO Design Problem - Call to a member function bind_param() on a non-object in...

2007-05-16 Thread Chris

Lee PHP wrote:

Hi there,

I'm new to OO-PHP and have encountered a problem that I just can't
figure out. I have a class called DBAccess that extends mysqli. In a
nutshell, it looks like this:





If I execute the following code:

$conn = DBAccess::getInstance();


Does that give you an object? Check with:

var_dump($conn);

If that works, does:


$someClass = new Class();


set up the $someClass->conn variable properly?

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] Download speed limit

2007-05-16 Thread Jim Lucas

Rangel Reale wrote:

Hello!

For my application I need to limit the speed that my application sends data, in 
my case a binary file.

I need to send the speed as a parameter, like:

sendfile.php?speed=2

Would send the file at 20kb/s (forgetting about real byte counts for this 
example).

To send the file, I am doing:

$fp=fopen($this->contentfile,"rb");
while(!feof($fp)){
print(fread($fp,1024*8));
flush();
ob_flush();
}
fclose($fp);

If after ob_flush I do a sleep(), I can limit the speed, but I would like to 
limit at the speed of the parameter.

Is there a way to do this?

Thanks,
Rangel


on average, how big are the files that you will be sending?

--
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] Download speed limit

2007-05-16 Thread Rangel Reale
Hello!

For my application I need to limit the speed that my application sends data, in 
my case a binary file.

I need to send the speed as a parameter, like:

sendfile.php?speed=2

Would send the file at 20kb/s (forgetting about real byte counts for this 
example).

To send the file, I am doing:

$fp=fopen($this->contentfile,"rb");
while(!feof($fp)){
print(fread($fp,1024*8));
flush();
ob_flush();
}
fclose($fp);

If after ob_flush I do a sleep(), I can limit the speed, but I would like to 
limit at the speed of the parameter.

Is there a way to do this?

Thanks,
Rangel


Re: [PHP] mime type over http post?

2007-05-16 Thread Tijnema !

On 5/16/07, Ray <[EMAIL PROTECTED]> wrote:

On Wednesday 16 May 2007 11:12 am, Stephen wrote:
> > I'm having a hard time getting support from from them. the method of
> > comunication (direct quote from their docs is:
> > "Data will be transferred to [server] via an HTTP POST operation using
> > the MIME type, text/xml"
>
> They want you to mimic what a browser would send to a web site when the
> user clicks a "send" button in a form.

Hi,
They have supplied very detailed docs for the XML,  but the part that really
throws me Is the mime type. Is this just another header?
Thanks,
Ray


Yes, it is just another header, you could analyze the headers sent to
and from with for example a network sniffer. Or you just connect to
the protocol directly with programs like putty or telnet.

Tijnema


>
> You use PHP to create the header for the page request, but you need to
> study HTTP documentation to understand what you need to send. It seems
> very unreasonable of them to have not supplied sample code.
>
> Good luck.
> Stephen

--
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] Static methods have access to private members

2007-05-16 Thread Theodore Root
I have a question regarding static methods in PHP5.x. Specifically, it 
seems that one can access member variables declared private from static 
methods, just as you can from instance methods.  I was wondering if this 
is by design, or if this "feature" might go away.  I have worked up an 
example, hopefully it won't get mangled:


  
   public static function loadAllObjects()

   {
   $vars = array();
   $tempVar = new TestClass();
   $tempVar->myVar = "Example";
   $vars[] = $tempVar;
   return $vars;   
   }

}


$test = TestClass::loadAllObjects();

print_r($test);


?>


This code executes fine on PHP 5.2.0 with no errors or warnings, even 
though one might say that I have accessed the private $myVar from 
"outside" the instance of TestClass created in $tempVar.  This "feature" 
is useful to me because I'd like to create a static method on my 
DB-persisted objects that lets me load an array of all of a given type 
of object from a database, building each one without having to use 
setters/getters for each member variable (not because thats difficult, 
but because its nice to be able to have private members that can't be 
accessed at all from the outside world), while avoiding "lazy loading".  
So essentially, my questions is, is the above functionality intended?



Thanks!

-TJ

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



[PHP] delete_global_variable & session_unset

2007-05-16 Thread Stanislav Malyshev

I recently noticed that session_unset in 5.2 (and probably in 6) uses
delete_global_variable which looks up global scope and then deletes
variable from it. Fine so far, but it does it in a loop - meaning it
looks for the global scope each time anew for each session variable! 
Also it seems to go through all CVs every time, which seems to be a 
waste of time too. Any reason not to do it this way:


1. Fetch the global scope
2. For each CV in the global scope, check if it should be deleted 
against session hash (since we have hashes it should be quick).


This way instead of stack depth*number of CVs*number of session vars we 
get only stack depth+number of CVs*hash lookup time. Which should be 
much better. So anybody sees any reason not to do it?

--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

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



RE: [PHP] Boilerplate Requirements Document for Web Site Kinda' OT

2007-05-16 Thread Jay Blanchard
[snip]
Can anyone provide or direct me to the subject?

I need more than a checklist of what to include. Something to go over 
with the client, complete the sections, and create a document to 
determine scope and determine price.
[/snip]

Web sites are like elbows and opinions. Everyone has one or two and they
are almost always never the same. I have been in the industry for a long
time and have never seen a boilerplate requirements document for a web
site. It has always been my opinion that the developer is responsible
for listening to the customer and then writing a requirements document.
That document is subject to many revisions before becoming final...and
everyone signs off on it.

Having said that there are some questions to ask (none of them technical
mind you, because the customer doesn't know how a developer
develops...and really does not care);

What do you want your web site to do for you? (advertise, build
community, sell stuff, etc.)
Who will supply the graphics? (you or a design firm)
Who will design the layout? (you or a design firm)
Do you need;
   a. a __ for staff or users (forum, gallery, etc)
   b. e-commerce (order fulfillment, payment acceptance, etc.)
   c. a maintenance contract (with all conditions spelled out, including
delivery times, do you [the developer] provide a warranty of any type
and what does it cover)
Who will update content? (you or them, and if them what tools do they
expect)

These questions will beget many othersgood luck!

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



Re: [PHP] mime type over http post?

2007-05-16 Thread Ray
On Wednesday 16 May 2007 11:12 am, Stephen wrote:
> > I'm having a hard time getting support from from them. the method of
> > comunication (direct quote from their docs is:
> > "Data will be transferred to [server] via an HTTP POST operation using
> > the MIME type, text/xml"
>
> They want you to mimic what a browser would send to a web site when the
> user clicks a "send" button in a form.

Hi,
They have supplied very detailed docs for the XML,  but the part that really 
throws me Is the mime type. Is this just another header? 
Thanks, 
Ray

>
> You use PHP to create the header for the page request, but you need to
> study HTTP documentation to understand what you need to send. It seems
> very unreasonable of them to have not supplied sample code.
>
> Good luck.
> Stephen

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



Re: [PHP] PHP debugger

2007-05-16 Thread Miles Thompson

On 5/16/07, Arno Kuhl <[EMAIL PROTECTED]> wrote:

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: 16 May 2007 02:15
To: PHP List
Subject: Re: [PHP] PHP debugger

>
>
> -Original Message-
> From: Miles Thompson [mailto:[EMAIL PROTECTED]
> Sent: 15 May 2007 08:21
> To: PHP List
> Subject: [PHP] PHP debugger
>
>
> I am trying to load a PHP debugger in our most recent build of PHP 5.2.1.
>
> The debugger which I am trying to set up is the free, pre-compiled
> Linux version of dbg ( DBG 2.15.5 dbg modules), from
> http://dd.cron.ru/dbg/, and all of the instructions have been followed
> as posted on the NuSphere site.
>
> Yes, Apache has been stopped and restarted!!
>
> There is no difference in the output from phpinfo(). The line
> "with DBG v2.11.30, (C) 2000,2004 by Dmitri Dmitrienko, http://dd.cron.ru";
> does not appear.
>
> PHP is compiled without debugging, but I did consider that was for the
> purpose of debugging PHP itself, not scripts.
>
> Suggestions will be most welcome. Also, I'm not married to this, so if
> anyone thinks there is a better debugger, please jump in.
>
> Regards - Miles Thompson
< snipped some trivial comments>
>

On 5/16/07, Arno Kuhl <[EMAIL PROTECTED]> wrote:
> If you don't see any change in phpinfo then maybe it's not picking up the
> dbg extension in your php.ini. Presumably you've also put the other
debugger
> directives in your ini?
>
> You can also try download the trial version of PHPEd from Nusphere,
install
> that, and check how it configures the debugger. The trial lasts a month I
> think, so maybe you'll sort out your problems in that time anyway. Just be
> sure to completely uninstall it afterwards because I think the free dbg
> version is not the same as the version integrated in PHPEd. Any version
> differences cause the extension to not load, though in that case it should
> report an error. You can't use the dbg integrated in PHPEd after uninstall
> because it doesn't work without PHPEd.
>
> Arno

From my php.ini 
; added debug extension "dbg.so-5.2.x" and
; see [debugger] section of this file -  20050515 - mthompson
;
extension=dbg.so  ;dbg.so-5.2.x

and the [debugger] section ...
; Added [debugger] section 20050515 - mthompson
; Note:  DBG versions 2.15 (free) does not support debugger.hosts_allow,
; debugger.hosts_deny or debugger.ports settings.
;
[debugger]
debugger.enabled=on
debugger.profiler_enabled=on
debugger.hosts_allow= <>
debugger.hosts_deny=ALL
debugger.ports=7869, 1/16
; end [debugger] section

Couple of notes:
1. Tried this with extension pointing to both dbg.so and dbg.so-5.2.x.
(The latter is what the instructions specified, but that did not seem
correct.)

2. Also tried it, in combination with above, with  debugger.hosts_allow,
debugger.hosts_deny and debugger.ports all commented out.

3. PHP version is 5.2.1, compiled from source on a Ubuntu Edgy Eft server.

I'm wondering it I should download the source and compile it. That
might be a better way home than assuming the binary is correct.

Arno, your suggestion to install the NuSphere editor is a good one.
I'm just reluctant to add more junk to my Windows box and to allow
something other than atp-get / dselect to mess with server
configuration. (Although it is a development box, so errors are not
terminal!)

Thanks to everyone for suggestions.

Regards - Miles

--

Hi Miles

I'm not sure I follow your configuration - are you running on Windows or
Linux? You shouldn't need to compile anything as far as I'm aware, just use
the binaries.

I'm using PHPEd 5.0 for Windows, so my config won't be the same as yours.

My ini setup is:


extension=php_dbg.dll-4.4.x

[debugger]
debugger.enabled=On
debugger.profiler_enabled=On


I've been using PHPEd for about 3 years so there are several dbg files in my
extensions dir, but the latest is "php_dbg.dll-4.4.x" (that is the actual
file name in extensions directory) which coincides with the name in the ini
file, and the timestamp coincides with the ver 5.0 release date. According
to your description for your Linux box I reckon you should be using
"dbg.so-5.2.x" in your ini file and in your extensions dir.

From previous experience I know the dbg extension is very fussy. You can't
specify more than one dbg in your ini, and the dbg must be the correct one
for your platform and your version of php. You can't change the name of the
file, and if the binary is for one specific ver of php then you must have
that ver of php running. Any error here and it just doesn't work.

Hope that helps

Cheers
Arno



Arno,

Arno,

Thanks for providing the relevant bits of your php.ini. You just
reinforced all of the docs in a very positive way.

So in php.ini the lines in the [debugger] section which are not
supported by the free version are now commented out, the extension is
back to its original name and that's the name pointed to in php.ini.
Apache has been stopped and r

[PHP] Boilerplate Requirements Document for Web Site

2007-05-16 Thread Stephen

Can anyone provide or direct me to the subject?

I need more than a checklist of what to include. Something to go over 
with the client, complete the sections, and create a document to 
determine scope and determine price.


Thanks
Stephen

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



Re: [PHP] mime type over http post?

2007-05-16 Thread Stephen


I'm having a hard time getting support from from them. the method of 
comunication (direct quote from their docs is:
"Data will be transferred to [server] via an HTTP POST operation using the 
MIME type, text/xml"
  
They want you to mimic what a browser would send to a web site when the 
user clicks a "send" button in a form.


You use PHP to create the header for the page request, but you need to 
study HTTP documentation to understand what you need to send. It seems 
very unreasonable of them to have not supplied sample code.


Good luck.
Stephen

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



Re: [PHP] using preg_match

2007-05-16 Thread M.Sokolewicz

Ed Curtis wrote:

Christian Haensel wrote:

Hi Ed,

did you try the backslash as escape character?




 That's what did it. I was thinking the \ was the escape for the command 
but wanted to make sure.


Thanks!
Why didn't you just test it yourself? Most people (well, I hope) would 
try it out, find out it worked, and used it. Instead you asked it on a 
mailinglist, waited, and then got your answer. It took you longer to do 
this, it cost you more (because `time is money!`(TM)) why???


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



[PHP] mime type over http post?

2007-05-16 Thread Ray
Hello,
I'm trying to write a web-based aplication that talks to a third party server. 
I'm having a hard time getting support from from them. the method of 
comunication (direct quote from their docs is:
"Data will be transferred to [server] via an HTTP POST operation using the 
MIME type, text/xml"

can anybody tell me what this means or how I do it using php?
Thanks,
Ray

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



[PHP] Mysqli insert / OO Design Problem - Call to a member function bind_param() on a non-object in...

2007-05-16 Thread Lee PHP

Hi there,

I'm new to OO-PHP and have encountered a problem that I just can't
figure out. I have a class called DBAccess that extends mysqli. In a
nutshell, it looks like this:

class DBAccess extends mysqli {
   private static $instance;
   private static $preferences;

   /** Create an instance of DBAccess. */
   private function __construct($host, $port, $user, $pass, $name) {
   self::$instance = parent::__construct($host, $user, $pass, $name);
   }

   /** Populate and/or return an instance of DBAccess. */
   public function getInstance() {
   if (empty(self::$instance)) {
   $preferences = Preferences::getInstance();

   // Let's set the database defaults if not previously set.
   if (self::$host == null) {
   DBAccess::setHost($preferences->getProperty("TestDbHost"));
   }

   if (self::$port == null) {
   DBAccess::setPort($preferences->getProperty("TestDbPort"));
   }

   if (self::$user == null) {
   DBAccess::setUser($preferences->getProperty("TestDbUser"));
   }

   if (self::$pass == null) {
   DBAccess::setPass($preferences->getProperty("TestDbPass"));
   }

   if (self::$name == null) {
   DBAccess::setName($preferences->getProperty("TestDbName"));
   }

   self::$instance = new DBAccess(self::$host, self::$port,
   self::$user, self::$pass, self::$name);

   return self::$instance;
   }
   }

   .
   .
   .
}

I also have a class, call it MyClass, that tries to connect using
DBAccess and insert a record. It can connect to the database, but
encounter a problem (Call to a member function bind_param() on a
non-object) when I try to insert a record. Here's the MyClass class
(some of the complexity removed):

class MyClass {
   private static $conn;
   private static $preferences;

   /** Create an instance of ContactInformation. */
   public function __construct() {
   self::$conn = DBAccess::getInstance();
   self::$preferences = Preferences::getInstance();
   }

   /** Populate instance. */
   public function set($args) {
  // Calls to $this->set;
   }

   /** Insert record. */
   public function insert() {
   $sql = "INSERT INTO table (" .
   "field_1, " .
   "field_2, " .
   "field_3) " .
   "?, " .
   "?, " .
   "?)";
   echo "Server version: " .  self::$conn->server_info;
   $stmt = self::$conn->prepare($sql);
   $stmt->bind_param('s',
   $this->getField1(),
   $this->getField2(),
   $this->getField3());
   $stmt->execute();
   $stmt->close();
   }
}

If I execute the following code:

$conn = DBAccess::getInstance();
$someClass = new Class();
$someClass->set(insert();

I see the following output:

Server version: 5.0.21-Debian_3ubuntu1-log
Fatal error: Call to a member function bind_param() on a non-object in
C:\blah\blah\blah

The fact that the server version is correctly displayed, suggests that
it is connecting. Why is it having issues with the $stmt? Anyone know?

The smallprint:
The DBAccess class looks a little funky - I'm playing around with the
Singleton Design Pattern, and plan to refine it once I get the kinks
(like this) worked out.

Thanks in advance for any thoughts.

- Leee

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



[PHP] pdo-oracle + nls_lang environment variable...

2007-05-16 Thread Javier Ruiz

Hi,

I'm using pdo-oci on php-5.2.2 against an oracle-10g server, using
oracle-instantclient (compiled oracle with
'--with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib').

The problem...:
I make a simple php script that makes a select from a table. The table
contains spanish characters so I set the enviroment variable NLS_LANG to
SPANISH_SPAIN.AL32UTF8 before running apache (also tried other values that
use iso8859-1...). If I run the script in console (using the CLI version of
php) the returned data is in the desired collation, so I can see the spanish
special characters like "ñ", "ó" and so on... The problem is that running
exactly the same script via HTTP (apache2) I always get question marks
replacing the special characters...

I tried many things... I export the enviroment variable as root and as the
user running the apache daemon, I modified the apache init script to export
the variables just before starting apache, I tried using the putenv function
in php code and no luck at all...

I realized about something that maybe is related... a php script running in
CLI can access any environmental variable, but no any env-var running in
apache... for example the following code:  
will return my locale setting in CLI but returns nothing via http... is it
normal?

TIA!


[PHP] Large amount of data over SOAP / MTOM

2007-05-16 Thread Gal
Hello,

I'll appreciate your answer to the following questions:

1) What standard modules in PHP (5.x) enable to move large amount of
data over
a SOAP response  (I know about DIME support)?
2) Is there a plan to support MTOM in PHP (if you're involved with
php/pear development)?

Thank you in advance,
Gal

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



[PHP] Re: Bounty, NOW!

2007-05-16 Thread Michelle Konzack
Am 2007-05-15 02:51:17, schrieb Brad Sumrall:
> Yes, I do still need legit help. But obviously I needed to make a point to
> all the script kiddies out there that you are playing with fire if you even
> attempt to miss use an admin password or access a server that does not
> belong to you.
> As a prior USMC Network Admin and DoD network security specialist.
> Back off Big brother is watching!
> 
> I come to the list as a legit person seeking intelligent minds.
> Not games.
> 
> So yes, respond to me as a professional or an up and coming and let's talk
> business!
> 
> Brad
- END OF REPLIED MESSAGE -

Maybe you should contact ?

Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSN LinuxMichi
0033/6/6192519367100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] Re: using preg_match

2007-05-16 Thread Rob Desbois

[re-sending, forgot to include list :-|]
If you're matching a string and not a pattern then it is far more efficient
to use strpos:

if (strpos($path, '/realtors') !== FALSE) {
  echo 'Success';
}

rob

On 5/16/07, Al <[EMAIL PROTECTED]> wrote:


The "container", as you called it, are delimiters.  They can be about any
character you choose; but, stay away from preg
control characters. Personally, I use "%" most of the time.

It's a good habit to use delimiter characters that you can be certain will
not be included in your strings. Then, you
don't need to worry about escaping them in your string.

Ed Curtis wrote:
> I'm trying to use preg_match to find a string in a system path.
>
> What I need to do is see if the string '/realtors' exists in a variable
> named '$path'.
>
> I know '/' is used as a container within the command itself. How do I
> escape it to find the string '/realtors'?
>
> Thanks,
>
> Ed

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





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
"There's a whale there's a whale there's a whale fish" he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[PHP] Re: using preg_match

2007-05-16 Thread Al
The "container", as you called it, are delimiters.  They can be about any character you choose; but, stay away from preg 
control characters. Personally, I use "%" most of the time.


It's a good habit to use delimiter characters that you can be certain will not be included in your strings. Then, you 
don't need to worry about escaping them in your string.


Ed Curtis wrote:

I'm trying to use preg_match to find a string in a system path.

What I need to do is see if the string '/realtors' exists in a variable 
named '$path'.


I know '/' is used as a container within the command itself. How do I 
escape it to find the string '/realtors'?


Thanks,

Ed


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



Re: [PHP] using preg_match

2007-05-16 Thread Ed Curtis

Christian Haensel wrote:

Hi Ed,

did you try the backslash as escape character?




 That's what did it. I was thinking the \ was the escape for the 
command but wanted to make sure.


Thanks!

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



Re: [PHP] using preg_match

2007-05-16 Thread Christian Haensel

Hi Ed,

did you try the backslash as escape character?



Works for me :o)

Maybe try http://de3.php.net/manual/en/function.preg-match.php too see some 
examples.


Good luck

Chris

- Original Message - 
From: "Ed Curtis" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, May 16, 2007 2:12 PM
Subject: [PHP] using preg_match



I'm trying to use preg_match to find a string in a system path.

What I need to do is see if the string '/realtors' exists in a variable 
named '$path'.


I know '/' is used as a container within the command itself. How do I 
escape it to find the string '/realtors'?


Thanks,

Ed

--
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 debugger

2007-05-16 Thread Miles Thompson



-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: 15 May 2007 08:21
To: PHP List
Subject: [PHP] PHP debugger


I am trying to load a PHP debugger in our most recent build of PHP 5.2.1.

The debugger which I am trying to set up is the free, pre-compiled
Linux version of dbg ( DBG 2.15.5 dbg modules), from
http://dd.cron.ru/dbg/, and all of the instructions have been followed
as posted on the NuSphere site.

Yes, Apache has been stopped and restarted!!

There is no difference in the output from phpinfo(). The line
"with DBG v2.11.30, (C) 2000,2004 by Dmitri Dmitrienko, http://dd.cron.ru";
does not appear.

PHP is compiled without debugging, but I did consider that was for the
purpose of debugging PHP itself, not scripts.

Suggestions will be most welcome. Also, I'm not married to this, so if
anyone thinks there is a better debugger, please jump in.

Regards - Miles Thompson

< snipped some trivial comments>




On 5/16/07, Arno Kuhl <[EMAIL PROTECTED]> wrote:

If you don't see any change in phpinfo then maybe it's not picking up the
dbg extension in your php.ini. Presumably you've also put the other debugger
directives in your ini?

You can also try download the trial version of PHPEd from Nusphere, install
that, and check how it configures the debugger. The trial lasts a month I
think, so maybe you'll sort out your problems in that time anyway. Just be
sure to completely uninstall it afterwards because I think the free dbg
version is not the same as the version integrated in PHPEd. Any version
differences cause the extension to not load, though in that case it should
report an error. You can't use the dbg integrated in PHPEd after uninstall
because it doesn't work without PHPEd.

Arno



From my php.ini 

; added debug extension "dbg.so-5.2.x" and
; see [debugger] section of this file -  20050515 - mthompson
;
extension=dbg.so  ;dbg.so-5.2.x

and the [debugger] section ...
; Added [debugger] section 20050515 - mthompson
; Note:  DBG versions 2.15 (free) does not support debugger.hosts_allow,
; debugger.hosts_deny or debugger.ports settings.
;
[debugger]
debugger.enabled=on
debugger.profiler_enabled=on
debugger.hosts_allow= <>
debugger.hosts_deny=ALL
debugger.ports=7869, 1/16
; end [debugger] section

Couple of notes:
1. Tried this with extension pointing to both dbg.so and dbg.so-5.2.x.
(The latter is what the instructions specified, but that did not seem
correct.)

2. Also tried it, in combination with above, with  debugger.hosts_allow,
debugger.hosts_deny and debugger.ports all commented out.

3. PHP version is 5.2.1, compiled from source on a Ubuntu Edgy Eft server.

I'm wondering it I should download the source and compile it. That
might be a better way home than assuming the binary is correct.

Arno, your suggestion to install the NuSphere editor is a good one.
I'm just reluctant to add more junk to my Windows box and to allow
something other than atp-get / dselect to mess with server
configuration. (Although it is a development box, so errors are not
terminal!)

Thanks to everyone for suggestions.

Regards - Miles

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



[PHP] using preg_match

2007-05-16 Thread Ed Curtis

I'm trying to use preg_match to find a string in a system path.

What I need to do is see if the string '/realtors' exists in a variable 
named '$path'.


I know '/' is used as a container within the command itself. How do I 
escape it to find the string '/realtors'?


Thanks,

Ed

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



RE: [PHP] RE: Bounty

2007-05-16 Thread Jay Blanchard
[snip]
Where are the list administrators to ban this guy??
[/snip]

This is an un-moderated list, so that makes us the police of our own
list. 

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



Re: [PHP] RE: Bounty

2007-05-16 Thread Tijnema !

On 5/15/07, Brad Sumrall <[EMAIL PROTECTED]> wrote:

Ok, maybe most of my fun will come from schmucks!



Hehehehe

75.34.61.72 from Baltimore is already giving it a whack!!!





Hehehehehe

Ok, this may be a fun night!



Where are the list administrators to ban this guy??

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



Re: [PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Micky Hulse

Robin Vickery wrote:

use parse_url()
http://www.php.net/parse_url
then append the 'path' part to document root ?


OMG, that looks like it will do the trick!

Jeez, how did I miss that. I feel like a dufus.

Are list members allowed at least one "RTFM" question per month? :D

Thanks Robin! I appreciate the help.

Have a great day/night.
Cheers,
Micky



--
Wishlists: 
   Switch: 
 BCC?: 
   My: 

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



Re: [PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Robin Vickery

On 16/05/07, Micky Hulse <[EMAIL PROTECTED]> wrote:

Hi folks, I hope everyone is having a good week. :)

Let me cut to the chase... Basically, I need to get this:

http://www.site.com/folder/foo

To work like this:

$_SERVER['DOCUMENT_ROOT'].'folder/foo/file.ext';

For use with getimagesize() and a few other functions (trying to avoid
possible open_basedir restrictions.) Here is what I got so far:

# Determine http type:
$http_s = ($_SERVER['HTTPS'] == on) ? 'https://' : 'http://';
# Get root path:
$from_root = str_replace($http_s.$_SERVER['SERVER_NAME'], '',
http://www.site.com/folder/foo);
echo
$_SERVER['DOCUMENT_ROOT'].$from_root;
/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/

So, do you think I can rely upon the above script? I have a feeling the
answer will be no Or, anyone have any tips/improvements?


use parse_url()

http://www.php.net/parse_url

then append the 'path' part to document root ?

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



Re: [PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Micky Hulse

Micky Hulse wrote:

/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/


Ooops, typed that wrong, example output should be:

/web1/httpd/htdocs/folder/foo

--
Wishlists: 
   Switch: 
 BCC?: 
   My: 

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



[PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Micky Hulse

Hi folks, I hope everyone is having a good week. :)

Let me cut to the chase... Basically, I need to get this:

http://www.site.com/folder/foo

To work like this:

$_SERVER['DOCUMENT_ROOT'].'folder/foo/file.ext';

For use with getimagesize() and a few other functions (trying to avoid 
possible open_basedir restrictions.) Here is what I got so far:


# Determine http type:
$http_s = ($_SERVER['HTTPS'] == on) ? 'https://' : 'http://';
# Get root path:
$from_root = str_replace($http_s.$_SERVER['SERVER_NAME'], '', 
http://www.site.com/folder/foo);

echo
$_SERVER['DOCUMENT_ROOT'].$from_root;
/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/

So, do you think I can rely upon the above script? I have a feeling the 
answer will be no Or, anyone have any tips/improvements?


Thanks!
Cheers,
Micky


--
Wishlists: 
   Switch: 
 BCC?: 
   My: 

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



RE: [PHP] PHP debugger

2007-05-16 Thread Arno Kuhl
If you don't see any change in phpinfo then maybe it's not picking up the
dbg extension in your php.ini. Presumably you've also put the other debugger
directives in your ini?

You can also try download the trial version of PHPEd from Nusphere, install
that, and check how it configures the debugger. The trial lasts a month I
think, so maybe you'll sort out your problems in that time anyway. Just be
sure to completely uninstall it afterwards because I think the free dbg
version is not the same as the version integrated in PHPEd. Any version
differences cause the extension to not load, though in that case it should
report an error. You can't use the dbg integrated in PHPEd after uninstall
because it doesn't work without PHPEd.

Arno


-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: 15 May 2007 08:21
To: PHP List
Subject: [PHP] PHP debugger


I am trying to load a PHP debugger in our most recent build of PHP 5.2.1.

The debugger which I am trying to set up is the free, pre-compiled
Linux version of dbg ( DBG 2.15.5 dbg modules), from
http://dd.cron.ru/dbg/, and all of the instructions have been followed
as posted on the NuSphere site.

Yes, Apache has been stopped and restarted!!

There is no difference in the output from phpinfo(). The line
"with DBG v2.11.30, (C) 2000,2004 by Dmitri Dmitrienko, http://dd.cron.ru";
does not appear.

PHP is compiled without debugging, but I did consider that was for the
purpose of debugging PHP itself, not scripts.

Suggestions will be most welcome. Also, I'm not married to this, so if
anyone thinks there is a better debugger, please jump in.

Regards - Miles Thompson

PS Why are we doing this? Because we are getting tired of debugging
with Javascript alert()  boxes. /mt

PPS And we are using those because of Joomla!  Some things are buried
so deeply we cannot use print() or echo(). /mt

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