php-general Digest 6 Apr 2009 01:08:26 -0000 Issue 6051
Topics (messages 291088 through 291106):
Re: AJAX with POST
291088 by: Phpster
Re: Possible Server Infection?
291089 by: Phpster
291096 by: Marc Christopher Hall
Re: I'm new
291090 by: Ashley Sheridan
291092 by: Ashley Sheridan
291095 by: Michael A. Peters
Re: problem with PHP simplexml and doxygen generated XML
291091 by: hessiess.hessiess.com
291102 by: Andrew Williams
291103 by: hessiess.hessiess.com
Newibie: fetch Obj question - data not showing.
291093 by: MEM
291094 by: 9el
291097 by: MEM
291098 by: 9el
291101 by: MEM
Too many open files
291099 by: Larry Garfield
291100 by: Daniel Brown
phpMyAdmin, suhosin, proper solutions
291104 by: Michael A. Peters
291105 by: Chris
291106 by: Michael A. Peters
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On Apr 4, 2009, at 21:33, Skip Evans <s...@bigskypenguin.com> wrote:
But my function using GET does seem to wait.
Granted I cobbled it together from various samples and didn't author
it from my own deep understanding of the exact process, but here's
the snippet that does the real work.
req.open('GET', url, false);
The false param above is the (a)synchronous flag. By setting it to
false, you are asking for a synchronous call, hence the wait. Set it
to true and the call becomes asynchronous and the user would not have
to wait. It would depend on what you are doing with the return call to
see if that flag is set appropriate to the application goals.
req.send(null);
if(req.responseText) {
if(req.responseText.substring(0,7) == 'debug!!') {
alert(req.responseText.substring(7));
}
}
return(req.responseText);
It seems to wait until it has data to return, because it works
perfectly. I can send it a URL from another function and get the
data back from server to the function as expected.
The only part of it I'm unsure of is this:
req.send(null);
The null indicates to the server that all data has been sent.
What does that do? As I said, I cobbled this function from examples,
got it working, and presto, was off and running.
Skip
Brad Broerman wrote:
Well, as the "A" in Ajax is asynchronous, there's no real way to
make it
wait. What you would normally do is use a callback:
function createXHRObject( )
{
if (typeof XMLHttpRequest != "undefined")
{
return new XMLHttpRequest();
}
else if (typeof ActiveXObject != "undefined")
{
return new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
throw new Error("XMLHttpRequest not supported");
}
}
function sendAjaxRequest( websvcurl , params, callbackFn )
{
var xhrObject = createXHRObject();
xhrObject.open("POST", websvcurl, true);
xhrObject.onreadystatechange = function()
{
if (xhrObject.readyState == 4)
{
if( xhrObject.responseXML != null )
{
callbackFn (xhrObject.responseXML);
}
}
}
xhrObject.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
xhrObject.setRequestHeader("Content-length", params.length);
xhrObject.setRequestHeader("Connection", "close");
xhrObject.send(params);
}
-----Original Message-----
From: Skip Evans [mailto:s...@bigskypenguin.com]
Sent: Saturday, April 04, 2009 5:30 PM
To: php-gene...@lists.php.net
Subject: AJAX with POST
Hey all,
At the risk of being told this is a PHP and not a JS list, but
also knowing the discussions on this list, to the benefit of
all I believe, very wildly, I'm posting this JS code snippet
for some advice.
As I posted earlier, my AJAX app that uses a GET to post to
the server (and get a response), fails on IE with larger data,
so I thought I'd take a shot at writing a POST function, but
so far I can get it to get the data back, but the problem is
by the time the data has come back the function has already
returned null back to the calling function. What I need this
function to do is wait for the data to come back and then send
it back to caller. Here's the function. Any advice would be
greatly appreciated. (The code to get the appropriate object
per browser has been omitted.)
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", url.length);
http.setRequestHeader("Connection", "close");
http.send(url);
http.onreadystatechange = function() {//Call a function when
the state changes.
if(http.readyState == 4 && http.status == 200) {
alert('['+http.responseText+']');
return (http.responseText);
}
}
--
====================================
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://bigskypenguin.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut
--
====================================
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://bigskypenguin.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hth
Bastien
--- End Message ---
--- Begin Message ---
On Apr 4, 2009, at 21:51, "TG" <tg-...@gryffyndevelopment.com> wrote:
Had to deal with a rogue PHP based backdoor situation recently. Two
remote
management scripts were installed somehow that would allow you to do
something like what you describe.
You probably want to download a fresh copy of the entire site
(assuming you
don't have remote shell access and/or the desire to use remote *nix
commands to do any of this) and see if whatever your favorite editor
is
has a "find in files" function.
Using this, I searched for all the files that may contain the PHP
"eval"
function, or "fopen" or other commands that could potentially allow
editing/creating files or executing *nix commands or arbitrary PHP
functions.
Also, check the permissions on the files and directories on your site.
Another thing I did was to use a version control software to see if
any
files changed after I redownloaded the site and if any new files were
added. I'm sure there's a way to do this with SVN or CVS or GIT or
something, but I used a Windows based system called Code Co-op.
If/when you find the script that may have allowed this, you can look
at
your raw web logs and see who was accessing that file. You should be
able to at least get their IP address and with that, you can get some
information about them. Or just hand it over to the authorities or
whatever you want to do.
If you're really curious... if you find the backdoor script file,
you can
modify it to either not function, or appear to function but not
really do
anything bad, etc. More importantly, you could modify it to collect
information (what little you can at least) about the person
accessing it.
This could include some javascript to get additional information about
their browser, OS, etc. Google "Browserhawk" for an example of what
information you can get from someone's browser.
Anyway, just some thoughts. Good luck!
-TG
----- Original Message -----
From: sono...@fannullone.us
To: php-gene...@lists.php.net
Date: Sat, 4 Apr 2009 16:12:06 -0700
Subject: [PHP] Possible Server Infection?
Hi all,
I was wondering if someone might know about a problem I'm having
on
my server. It appears that I've been infected by a rogue PHP
script(?). Something has gone through my server and placed .htaccess
files in every directory that didn't have one with contents that look
like this:
Options -MultiViews
ErrorDocument 404 //graphics/cc/111152.php
The path is different for each file and corresponds to the
directory
that it's in. The php document name is a different number for each
file I've found.
Does this sound familiar to anyone? What would be the purpose of
placing files like these in the directories? As far as I know, there
isn't a file called "111152.php" anywhere on my site, so this doesn't
make any sense to me.
I realize that this is a very general question, but I'm hoping
that
someone has seen or heard of this type of thing before and can help
me
eliminate the problem.
I'm using A2 Hosting and they don't know why this happened.
Thanks,
Frank
--
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
It's likely happened because something was not validated correctly
after an upload by a hacker. Perhaps form field data was not cleaned
properly or an image/ document was uploaded and the type was not
filtered out.
Also note that you can run strip_tags() on an image to prevent code
from being embedded in the image.
Once you figure out how yoursite got hijacked, do your best to close
that door and learn from the experience to help improve your code.
Bastien
--- End Message ---
--- Begin Message ---
I recommend switching to Hostgator for your ded and ask them for their
custom modsec. I'm not affiliated with them except that I am a customer and
have been for 6 years. I do bring this up because you stated that they "do
not know" which if true tells me that do not know how to do even the
smallest things necessary to manage a box. Of course, as an afterthought,
are you paying for a managed or unmanaged server?
Just my 2 cents.....
-----Original Message-----
From: sono...@fannullone.us [mailto:sono...@fannullone.us]
Sent: Saturday, April 04, 2009 7:12 PM
To: php-gene...@lists.php.net
Subject: [PHP] Possible Server Infection?
Hi all,
I was wondering if someone might know about a problem I'm having on
my server. It appears that I've been infected by a rogue PHP
script(?). Something has gone through my server and placed .htaccess
files in every directory that didn't have one with contents that look
like this:
Options -MultiViews
ErrorDocument 404 //graphics/cc/111152.php
The path is different for each file and corresponds to the directory
that it's in. The php document name is a different number for each
file I've found.
Does this sound familiar to anyone? What would be the purpose of
placing files like these in the directories? As far as I know, there
isn't a file called "111152.php" anywhere on my site, so this doesn't
make any sense to me.
I realize that this is a very general question, but I'm hoping that
someone has seen or heard of this type of thing before and can help me
eliminate the problem.
I'm using A2 Hosting and they don't know why this happened.
Thanks,
Frank
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________ Information from ESET Smart Security, version of virus signature
database 3988 (20090404) __________
The message was checked by ESET Smart Security.
http://www.eset.com
__________ Information from ESET Smart Security, version of virus signature
database 3988 (20090404) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--- End Message ---
--- Begin Message ---
On Sat, 2009-04-04 at 18:29 -0400, Andrés Robinet wrote:
> > -----Original Message-----
> > From: doctortomor...@gmail.com [mailto:doctortomor...@gmail.com] On Behalf
> > Of 9el
> > Sent: Sábado, 04 de Abril de 2009 12:52 p.m.
> > To: Andrés Robinet; php-gene...@lists.php.net
> > Subject: Re: [PHP] I'm new
> >
> > <snip>
> > Hi Roly,
> >
> > As previously advised, the best you can do to get started is to
> > install a bundle
> > http://www.apachefriends.org/en/xampp-windows.html
> >
> > If you are a native Spanish speaker (I'm guessing, because of your
> > "salu2")
> > check the PHP-MySQL tutorials here http://www.illasaron.com/, you can find
> > single lessons or full courses on the left sidebar here
> > http://www.illasaron.com/html/ and a supporting forum here
> > http://www.illasaron.com/phpBB2/viewforum.php?f=24. You'll need to
> > register for
> > accessing the direct downloads, registering is free (there are also
> > .torrent
> > downloads for the illasaron courses at thepiratebay.org)
> >
> > Regards,
> >
> > Rob
> >
> > </snip>
> >
> > Rob, please keep the mail to the list. It came to me individually
> > only! where as I didn't ask for the solution :)\
> >
> > Well, yes ApacheFriend's XAMPP is one of the best suites ever with
> > lots of things in there.
> >
> > And www.nettuts.com just last month released really nice tutorials for
> > beginners on PHP so thats really recommended if anyone wants to start
> > learning PHP + MySQL
> >
> > Regards
> >
> > Lenin
> > www.twitter.com/nine_L
>
> Ooops! I forgot the "reply to all" trick ;)
>
> I pointed out illasaron.com because it's Spanish and there's a Spanish
> community
> around. I thought Roly is a Spanish speaker, because "salu2" is a short for
> "saludos" (=greetings/regards) and he said he's also learning English.
>
> Illasaron PHP+MySQL course starts from basic HTML all the way up to session
> handling, OOP, XML Processing in PHP, building a shopping cart and creating a
> small CMS. You can download single "lessons" (there are about 50 I think) or
> the
> whole DVD as an ISO. I have nothing against nettuts.com, It's just that I
> prefer
> facing one challenge at a time rather than three at once (learning English,
> installing apache+php+mysql, learning PHP). By the time I started with English
> PHP courses I could understand written and oral English already, and by the
> time
> I learnt to install and set up a WAMP or LAMP suite from scratch, I already
> knew
> enough PHP to do more than "hello world".
>
> It's just that he can learn English by reading eBooks and listening to the BBC
> (http://www.bbc.co.uk/worldservice/meta/tx/nb/live/www15.asx). He can learn to
> manually install and set up a full Apache+PHP+MySQL suite later. One challenge
> at a time avoids frustration, that's just my experience and point of view.
>
> Regards,
>
> Rob
>
> Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
> 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
> TEL 954-607-4296 | FAX 954-337-2695 |
> Email: i...@bestplace.net | MSN Chat: b...@bestplace.net | SKYPE:
> bestplace |
> Web: bestplace.biz | Web: seo-diy.com
>
>
I'd recommend easyPHP, it includes everything you need to get going and
it is very quick to set up.
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Sun, 2009-04-05 at 08:24 -0700, ®0L¥ wrote:
> hello thank you so much, I will try with wampserver, this software has
> apache php and mysqlo ?? everything ?? and later I can, programate in
> my page a search bar for my web, a login and password for customers
> and when the customers enter your zip code the page show the near
> locations for they, is to difficult to do like this with PHP and
> MySQL ?? I have no idea..... thank's so much for you reply.
>
> 2009/4/5 Ashley Sheridan <a...@ashleysheridan.co.uk>
>
> On Sat, 2009-04-04 at 18:29 -0400, Andrés Robinet wrote:
> > > -----Original Message-----
> > > From: doctortomor...@gmail.com
> [mailto:doctortomor...@gmail.com] On Behalf
> > > Of 9el
> > > Sent: Sábado, 04 de Abril de 2009 12:52 p.m.
> > > To: Andrés Robinet; php-gene...@lists.php.net
> > > Subject: Re: [PHP] I'm new
> > >
> > > <snip>
> > > Hi Roly,
> > >
> > > As previously advised, the best you can do to get started
> is to
> > > install a bundle
> > > http://www.apachefriends.org/en/xampp-windows.html
> > >
> > > If you are a native Spanish speaker (I'm guessing,
> because of your
> > > "salu2")
> > > check the PHP-MySQL tutorials here
> http://www.illasaron.com/, you can find
> > > single lessons or full courses on the left sidebar here
> > > http://www.illasaron.com/html/ and a supporting forum
> here
> > > http://www.illasaron.com/phpBB2/viewforum.php?f=24.
> You'll need to
> > > register for
> > > accessing the direct downloads, registering is free
> (there are also
> > > .torrent
> > > downloads for the illasaron courses at thepiratebay.org)
> > >
> > > Regards,
> > >
> > > Rob
> > >
> > > </snip>
> > >
> > > Rob, please keep the mail to the list. It came to me
> individually
> > > only! where as I didn't ask for the solution :)\
> > >
> > > Well, yes ApacheFriend's XAMPP is one of the best suites
> ever with
> > > lots of things in there.
> > >
> > > And www.nettuts.com just last month released really nice
> tutorials for
> > > beginners on PHP so thats really recommended if anyone
> wants to start
> > > learning PHP + MySQL
> > >
> > > Regards
> > >
> > > Lenin
> > > www.twitter.com/nine_L
> >
> > Ooops! I forgot the "reply to all" trick ;)
> >
> > I pointed out illasaron.com because it's Spanish and there's
> a Spanish community
> > around. I thought Roly is a Spanish speaker, because "salu2"
> is a short for
> > "saludos" (=greetings/regards) and he said he's also
> learning English.
> >
> > Illasaron PHP+MySQL course starts from basic HTML all the
> way up to session
> > handling, OOP, XML Processing in PHP, building a shopping
> cart and creating a
> > small CMS. You can download single "lessons" (there are
> about 50 I think) or the
> > whole DVD as an ISO. I have nothing against nettuts.com,
> It's just that I prefer
> > facing one challenge at a time rather than three at once
> (learning English,
> > installing apache+php+mysql, learning PHP). By the time I
> started with English
> > PHP courses I could understand written and oral English
> already, and by the time
> > I learnt to install and set up a WAMP or LAMP suite from
> scratch, I already knew
> > enough PHP to do more than "hello world".
> >
> > It's just that he can learn English by reading eBooks and
> listening to the BBC
> >
> (http://www.bbc.co.uk/worldservice/meta/tx/nb/live/www15.asx).
> He can learn to
> > manually install and set up a full Apache+PHP+MySQL suite
> later. One challenge
> > at a time avoids frustration, that's just my experience and
> point of view.
> >
> > Regards,
> >
> > Rob
> >
> > Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
> > 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort
> Lauderdale, FL 33308 |
> > TEL 954-607-4296 | FAX 954-337-2695 |
> > Email: i...@bestplace.net | MSN Chat: b...@bestplace.net
> | SKYPE: bestplace |
> > Web: bestplace.biz | Web: seo-diy.com
> >
> >
>
> I'd recommend easyPHP, it includes everything you need to get
> going and
> it is very quick to set up.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> --
> salu2 ®0L¥
no problems, the list is here to help!
wamp does come with what you need to get started. and if you have a look
around online, you can find examples of other peoples code which might
help you with what you want to achieve on your website.
also, it's best to reply back to the list, as your questions might help
others, and it's always good to have as much feedback as you can from
everyone on the list!
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
also, it's best to reply back to the list, as your questions might help
others, and it's always good to have as much feedback as you can from
everyone on the list!
I think this may be the only major list I'm on that does not default
reply to the list.
It's rather annoying, but, I guess that's the way it is.
--- End Message ---
--- Begin Message ---
>
>
> On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote:
>
>> I have bean trying to right a PHP script to generate XHTML code from
>> the
>> class documentation xml files created by Doxygen(the HTML it outputs
>> is
>> invalid, messy and virtually imposable to integrate into another web
>> page). One thing has bean causing problems, the tags which start
>> with `@',
>> for example:
>>
>> Code:
>> SimpleXMLElement Object
>> (
>> [...@attributes] => Array
>> (
>> [kind] => function
>> [id] => classhello_1f06929bd13d07b414a8be07c6db88074
>> [prot] => private
>> [static] => no
>> [const] => no
>> [explicit] => no
>> [inline] => yes
>> [virt] => non-virtual
>> )
>> ...
>>
>> I cannot seam to find a way to access these with simplexml, the
>> following
>> code generates a syntax error for example.
>>
>> Code:
>>
>> print_r($xml->compounddef->sectiondef->memberdef[1]->@attributes);
>>
>> Any advice would be gratily appreciated.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> What about first stripping out the @ characters with str_replace and
> then attempting to load the XML? Maybe run it thru a few to do the
> best possible clean up?
>
> Bastien
>
Found out what I was doing wrong, the problem has nothing to do with the
XML code, tag attributes are put into the @attributes section, which must
be accsessed with the attributes() function.
--- End Message ---
--- Begin Message ---
I HAVE THE SAME PROBLEM, PLEASE HOW HAVE YOU DONE IT
On Sun, Apr 5, 2009 at 4:08 PM, <hessi...@hessiess.com> wrote:
> >
> >
> > On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote:
> >
> >> I have bean trying to right a PHP script to generate XHTML code from
> >> the
> >> class documentation xml files created by Doxygen(the HTML it outputs
> >> is
> >> invalid, messy and virtually imposable to integrate into another web
> >> page). One thing has bean causing problems, the tags which start
> >> with `@',
> >> for example:
> >>
> >> Code:
> >> SimpleXMLElement Object
> >> (
> >> [...@attributes] => Array
> >> (
> >> [kind] => function
> >> [id] => classhello_1f06929bd13d07b414a8be07c6db88074
> >> [prot] => private
> >> [static] => no
> >> [const] => no
> >> [explicit] => no
> >> [inline] => yes
> >> [virt] => non-virtual
> >> )
> >> ...
> >>
> >> I cannot seam to find a way to access these with simplexml, the
> >> following
> >> code generates a syntax error for example.
> >>
> >> Code:
> >>
> >> print_r($xml->compounddef->sectiondef->memberdef[1]->@attributes);
> >>
> >> Any advice would be gratily appreciated.
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> > What about first stripping out the @ characters with str_replace and
> > then attempting to load the XML? Maybe run it thru a few to do the
> > best possible clean up?
> >
> > Bastien
> >
>
> Found out what I was doing wrong, the problem has nothing to do with the
> XML code, tag attributes are put into the @attributes section, which must
> be accsessed with the attributes() function.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Best Wishes
Andrew Williams
--- End Message ---
--- Begin Message ---
> I HAVE THE SAME PROBLEM, PLEASE HOW HAVE YOU DONE IT
>
> On Sun, Apr 5, 2009 at 4:08 PM, <hessi...@hessiess.com> wrote:
>
>> >
>> >
>> > On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote:
>> >
>> >> I have bean trying to right a PHP script to generate XHTML code from
>> >> the
>> >> class documentation xml files created by Doxygen(the HTML it outputs
>> >> is
>> >> invalid, messy and virtually imposable to integrate into another web
>> >> page). One thing has bean causing problems, the tags which start
>> >> with `@',
>> >> for example:
>> >>
>> >> Code:
>> >> SimpleXMLElement Object
>> >> (
>> >> [...@attributes] => Array
>> >> (
>> >> [kind] => function
>> >> [id] => classhello_1f06929bd13d07b414a8be07c6db88074
>> >> [prot] => private
>> >> [static] => no
>> >> [const] => no
>> >> [explicit] => no
>> >> [inline] => yes
>> >> [virt] => non-virtual
>> >> )
>> >> ...
>> >>
>> >> I cannot seam to find a way to access these with simplexml, the
>> >> following
>> >> code generates a syntax error for example.
>> >>
>> >> Code:
>> >>
>> >> print_r($xml->compounddef->sectiondef->memberdef[1]->@attributes);
>> >>
>> >> Any advice would be gratily appreciated.
>> >>
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>
>> >
>> > What about first stripping out the @ characters with str_replace and
>> > then attempting to load the XML? Maybe run it thru a few to do the
>> > best possible clean up?
>> >
>> > Bastien
>> >
>>
>> Found out what I was doing wrong, the problem has nothing to do with the
>> XML code, tag attributes are put into the @attributes section, which
>> must
>> be accsessed with the attributes() function.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Best Wishes
> Andrew Williams
>
Just use the attributes() function, for example:
$xml->compounddef->sectiondef->memberdef[0]->attributes()->kind
Also, no need to shout ;)
--- End Message ---
--- Begin Message ---
Hello,
1)
Ok, with mysqli, to fetch data from a database to a select drop down list, we
would do something like this right? :
<?php
$result = $mysqli->query("SELECT id_cliente, nome_cliente FROM cliente");
echo "<select id='listacliente' name='listacliente'>";
while($row = mysqli_fetch_assoc($result)) {
echo "<option value=".$row['id_cliente'].">".$row['nome_cliente']."</option>";
}
echo "</select>";
?>
2)
What I’m trying to achieve?
The same thing, but using PDO, the prepare/execute methods, and FETCH_OBJ
method to fetch data.
3)
Here is what I have done so far:
For simplifying I’m just trying to echo:
$queryh=$conn->prepare('SELECT id_cliente, nome_cliente FROM cliente');
$queryh->execute();
/*trys to access the method fetchObject of the PDOStatement generated by the
execute() PDO method, and save it on $row variable:*/
$row=$queryh->fetchObject();
/*now I'm trying to echo the results. The 'id_cliente' and 'nome_cliente' are
the column names of my database and, if I get it right, the fectchObject()
method should allow me to access those names as anonymous properties. So: */
echo "Id: ".$row->id_cliente." - Nome: ".$row->nome_cliente."</ br>";
4)
Here is the issue that I’m getting:
I’m getting no values from the database upon echo request.
5)
Question:
What is wrong with this code? :(
Regards,
Márcio
--- End Message ---
--- Begin Message ---
On Sun, Apr 5, 2009 at 10:08 PM, MEM <tal...@gmail.com> wrote:
> Hello,
>
> 1)
> Ok, with mysqli, to fetch data from a database to a select drop down list,
> we would do something like this right? :
> <?php
> $result = $mysqli->query("SELECT id_cliente, nome_cliente FROM cliente");
> echo "<select id='listacliente' name='listacliente'>";
>
> while($row = mysqli_fetch_assoc($result)) {
> echo "<option
> value=".$row['id_cliente'].">".$row['nome_cliente']."</option>";
> }
>
> echo "</select>";
> ?>
>
> 2)
> What I’m trying to achieve?
> The same thing, but using PDO, the prepare/execute methods, and FETCH_OBJ
> method to fetch data.
>
> 3)
> Here is what I have done so far:
> For simplifying I’m just trying to echo:
>
> $queryh=$conn->prepare('SELECT id_cliente, nome_cliente FROM cliente');
> $queryh->execute();
>
> /*trys to access the method fetchObject of the PDOStatement generated by
> the execute() PDO method, and save it on $row variable:*/
> $row=$queryh->fetchObject();
>
> /*now I'm trying to echo the results. The 'id_cliente' and 'nome_cliente'
> are the column names of my database and, if I get it right, the
> fectchObject() method should allow me to access those names as anonymous
> properties. So: */
> echo "Id: ".$row->id_cliente." - Nome: ".$row->nome_cliente."</ br>";
>
>
> 4)
> Here is the issue that I’m getting:
> I’m getting no values from the database upon echo request.
>
>
> 5)
> Question:
> What is wrong with this code? :(
>
There is something definitely wrong with your code. But why did you forget
to use the debugging functions :
print_r()
and var_dump() for the results?
So, you'll get some idea beforehand of posting the problem here. I am
looking at the code in a hurry so I cant help you much right away.
Lenin
www.twitter.com/nine_L
--- End Message ---
--- Begin Message ---
>why did you forget to use the debugging functions :
>
>print_r()
>and var_dump() for the results?
>
>So, you'll get some idea beforehand of posting the problem here. I am
looking at the code in a hurry so I cant >help you much right away.
>
>Lenin
>
> <http://www.twitter.com/nine_L> www.twitter.com/nine_L
Because I've never debug on my entire life of programming (2 months). :D
In the meanwhile, I will search how to debug using print_r and var_dump.
Thanks.
--- End Message ---
--- Begin Message ---
>
> Because I’ve never debug on my entire life of programming (2 months). :D
>
> In the meanwhile, I will search how to debug using print_r and var_dump.
>
> ROFL ha hahaha
echo '<pre>', print_r($array),'</pre>'; // here pre is used to
keep the way its outputed in HTML
echo '<pre>', var_dump($array),'</pre>';
please dont forget to study the online php manual and also the
php_manual.chm version downloaded to your PC.
Its never a good idea to not to debug.
--- End Message ---
--- Begin Message ---
>On Behalf Of 9el
>
>
>On Sun, Apr 5, 2009 at 10:08 PM, MEM < <mailto:tal...@gmail.com>
tal...@gmail.com> wrote:
>Hello,
>
>1)
>Ok, with mysqli, to fetch data from a database to a select drop down list,
we would do something like this >right? :
><?php
>$result = $mysqli->query("SELECT id_cliente, nome_cliente FROM cliente");
>echo "<select id='listacliente' name='listacliente'>";
>
>while($row = mysqli_fetch_assoc($result)) {
>echo "<option
value=".$row['id_cliente'].">".$row['nome_cliente']."</option>";
>}
>
>echo "</select>";
>?>
>
>2)
>What Im trying to achieve?
>The same thing, but using PDO, the prepare/execute methods, and FETCH_OBJ
method to fetch data.
>
>3)
>Here is what I have done so far:
>For simplifying Im just trying to echo:
>
>
>$queryh=$conn->prepare('SELECT id_cliente, nome_cliente FROM cliente');
>$queryh->execute();
>
>/*trys to access the method fetchObject of the PDOStatement generated by
the execute() PDO method, and >save it on $row variable:*/
>$row=$queryh->fetchObject();
>
>/*now I'm trying to echo the results. The 'id_cliente' and 'nome_cliente'
are the column names of my database >and, if I get it right, the
fectchObject() method should allow me to access those names as anonymous
>properties. So: */
>echo "Id: ".$row->id_cliente." - Nome: ".$row->nome_cliente."</ br>";
>
>
>4)
>Here is the issue that Im getting:
>Im getting no values from the database upon echo request.
>
>
>5)
>Question:
>What is wrong with this code? :(
>
>There is something definitely wrong with your code. But why did you forget
to use the debugging functions :
>
>print_r()
>and var_dump() for the results?
>
>So, you'll get some idea beforehand of posting the problem here. I am
looking at the code in a hurry so I cant >help you much right away.
>
>Lenin
>
>www.twitter.com/nine_L
Despite the debug Im still not getting whats going wrong. ;( Any help
would be greatly appreciated.
Regards,
Márcio
--- End Message ---
--- Begin Message ---
I've a site on a shared host that is for the most part working well. However,
more recently I've started getting the following error:
failed to open stream: Too many open files in system in <filename> on line
<blah>.
When it happens it will happen to everyone for a short period, and then stop.
There does not seem to be much if any functionality failure when that error
appears (I am just seeing the error in my application logs so I can't be
sure), but it is still highly annoying and worrisome. The number of files used
by my application has not changed in months, however.
I know PHP has a max-files-open limit somewhere. Is that per process, per
user, or per server? Is this even something I can address myself in my app,
or does it indicate that the server itself is getting over-busy and I have to
just beg my web host for a less busy server? Any other thoughts as to how to
respond?
Cheers.
--
Larry Garfield
la...@garfieldtech.com
--- End Message ---
--- Begin Message ---
On Sun, Apr 5, 2009 at 12:57, Larry Garfield <la...@garfieldtech.com> wrote:
>
> I know PHP has a max-files-open limit somewhere. Is that per process, per
> user, or per server? Is this even something I can address myself in my app,
> or does it indicate that the server itself is getting over-busy and I have to
> just beg my web host for a less busy server? Any other thoughts as to how to
> respond?
Is your PHP suExec'd through Apache?
Also, you (or, since you're on a shared server, your admin) should
check the output from `ulimit -a`. Most likely, it's set too low
(perhaps to the default 256) and someone else on the server is opening
multiple files simultaneously, an influx in customers is collectively
exceeding the limit, or someone's not closing their file handles.
In such a case, the admin should edit /etc/system and up the
limits on 'rlim_fd_cur' and 'rlim_fd_max.' Just warn them to watch
what numbers they use, and not to go over 1024. This is kernel
tuning, so once the changes have been made, the server needs to reboot
(power cycle, not an Apache reload) for them to take effect.
--
</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000
--- End Message ---
--- Begin Message ---
Hi - my phpMyAdmin and suhosin are not playing nice.
The reality is that I'm only using phpMyAdmin for stuff I haven't yet
written an admin interface to in my app, to avoid having to log in via
ssh to change stuff. But I'll probably keep phpMyAdmin around anyway.
Yes, I read the documentation on how to make them play nice, and to me
it is unacceptable to change suhosin settings intended to protect my
users and my site from a malicious user so that I can use a web app that
is not open to the public.
There are a couple solutions I can think of, I'm interested in both
thoughts and alternatives.
1) Run an alternate web server that supports both SSL and php, and don't
use suhosin with that build.
Major downside is that I can't bind it to port 443 because I already am
binding 443 to apache, so I'd have to run ssl on a non standard port.
Upside to using a non standard port though is it is far less likely to
be hit by the script kiddies looking for stuff.
2) Build and install php4 and run it side by side with php5 - use an
apache directive to only use php4 for the php files in the phpMyAdmin
directory. I did a similar thing when helping a company migrate from
php3 to php4 way back when, and it worked quite well - but I don't know
how well that works with php4 and php5 running side by side. Major
downside is that php4 is no longer officially supported for security
fixes, but I can keep phpMyAdmin in a password protected directory (it
is already) so that the pages are not even available unless an attacker
can get around apache authentication. Major downside is I would have to
use the older version of phpMyAdmin (which is still maintained) as
current version requires php 5.2+. As long as 2.x is maintained that is
acceptable, but for how much longer will it be?
Thoughts?
--- End Message ---
--- Begin Message ---
Yes, I read the documentation on how to make them play nice, and to me
it is unacceptable to change suhosin settings intended to protect my
users and my site from a malicious user so that I can use a web app that
is not open to the public.
No idea what the problems are (couldn't find a list of what the problems
are) but
Can you change the suhosin settings with a .htaccess? With the apache
htpasswd protection it should be ok to disable some stuff for a
particular directory.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Chris wrote:
Yes, I read the documentation on how to make them play nice, and to me
it is unacceptable to change suhosin settings intended to protect my
users and my site from a malicious user so that I can use a web app
that is not open to the public.
No idea what the problems are (couldn't find a list of what the problems
are) but
Can you change the suhosin settings with a .htaccess? With the apache
htpasswd protection it should be ok to disable some stuff for a
particular directory.
I don't think you can change suhosin directive in a .htaccess file.
I know you can't in a script itself (at least I couldn't)
I think I'll try the php4 method.
--- End Message ---