|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help
lists.php.net
Date: Wed May 14 2008 - 15:50:17 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 14 May 2008 20:50:17 -0000 Issue 5459
Topics (messages 274290 through 274333):
Re: validating textarea using php
274290 by: Dotan Cohen
274292 by: Richard Heyes
274303 by: Dotan Cohen
274304 by: Richard Heyes
274321 by: Dotan Cohen
Re: Scripts slowing down?
274291 by: René Leboeuf
274293 by: René Leboeuf
274299 by: Per Jessen
how do I stop Firefox doing a conditional get?
274294 by: Per Jessen
274297 by: Robin Vickery
274298 by: Per Jessen
Re: Good HTML parser needed
274295 by: Shelley
274310 by: Robert Cummings
274312 by: Eric Butera
274315 by: Robert Cummings
274316 by: James Dempster
274319 by: Eric Butera
Re: Good XML Parser
274296 by: Shelley
How to get user IP address
274300 by: hce
274301 by: Eric Butera
274302 by: Chris Haensel
274313 by: Wolf
Re: validating using php
274305 by: Iv Ray
Re: $_SESSION NOT WORKING --SOLVED
274306 by: Thiago Pojda
274309 by: Daniel Brown
Re: Replacing accented characters by non-accented characters
274307 by: Bastien Koert
274324 by: Dotan Cohen
Re: using variable in php form before the form is POSTed
274308 by: Bastien Koert
Re: Safe mode story
274311 by: Philip Thompson
Re: convert query result to array
274314 by: Philip Thompson
Question about setting up FTP Upload and using the FTP suite...
274317 by: Mike McGonagle
Re: php 5.2.6 make failure
274318 by: Per Jessen
Scottish Devs
274320 by: Nathan Rixham
JavaScript and PHP
274322 by: Mrio Gamito
274323 by: Dan Joseph
274329 by: tedd
Two word array Value
274325 by: Mark Bomgardner
274326 by: Jason Murray
274328 by: Daniel Brown
274330 by: Tyson Vanover
Tracking down the elusive "expecting T_PAAMAYIM_NEKUDOTAYIM"
274327 by: Tyson Vanover
274331 by: Jay Blanchard
274332 by: Daniel Brown
Mic check 1, 2, 3...
274333 by: Jim Lucas
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
2008/5/14 Chris W <2wsxdr5
cox.net>:
>> A lot of people think that, until their host upgrades php. Have you
>> seen how many things are being removed for php6?
>
> From the article I read, that isn't one of them.
>
That issue specifically, no. However, portable code is desirable even
if your code is confined to a single machine.
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
attached mail follows:
> A lot of people think that
Can't fault them.
> until their host upgrades php.
Any host that upgrades the PHP version (a major upgrade considering it
would be 5 - 6) without notifying Customers isn't a very good hosting
company, and you really should change to a better one (Rackspace are
good). Even 1and1 don't do that and they're pants (IMO).
Plus you need to consider how long they would take to use PHP6
exclusively - my guess it would be at least a year; probably longer.
> Have you
> seen how many things are being removed for php6?
Nope. Why? It's not even out yet in beta and therefore not worth my time
considering. ISTR having read something about a 5.3 release, which I
read would have namespaces. That needs consideration before any PHP6
release.
--
Richard Heyes
+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+
attached mail follows:
2008/5/14 Richard Heyes <richardh
phpguru.org>:
> Any host that upgrades the PHP version (a major upgrade considering it
> would be 5 - 6) without notifying Customers isn't a very good hosting
> company, and you really should change to a better one (Rackspace are good).
> Even 1and1 don't do that and they're pants (IMO).
It does not matter if the customer was notified. Even if he is
notified, he needs to update his code.
> Plus you need to consider how long they would take to use PHP6 exclusively
> - my guess it would be at least a year; probably longer.
A year is nothing! I have projects from 7 years ago that I know I need
to update "when I get around to it".
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
attached mail follows:
Dotan Cohen wrote:
> 2008/5/14 Richard Heyes <richardh
phpguru.org>:
>> Any host that upgrades the PHP version (a major upgrade considering it
>> would be 5 - 6) without notifying Customers isn't a very good hosting
>> company, and you really should change to a better one (Rackspace are good).
>> Even 1and1 don't do that and they're pants (IMO).
>
> It does not matter if the customer was notified. Even if he is
> notified, he needs to update his code.
That really should be expected. You can't expect something to last
forever without tweaking it on occassion. And in the case of going from
PHP 5 - 6, the "tweaking" required may well be major, becxcause it's a
major version change.
>> Plus you need to consider how long they would take to use PHP6 exclusively
>> - my guess it would be at least a year; probably longer.
>
> A year is nothing! I have projects from 7 years ago that I know I need
> to update "when I get around to it".
Well "when you get around to it" makes it sound as though it's not
exactly important.
--
Richard Heyes
+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+
attached mail follows:
2008/5/14 Richard Heyes <richardh
phpguru.org>:
> That really should be expected. You can't expect something to last forever
> without tweaking it on occassion. And in the case of going from PHP 5 - 6,
> the "tweaking" required may well be major, becxcause it's a major version
> change.
Exactly. That's why it should be written in a relatively portable
fashion from the beginning. To avoid pitfalls later on.
>> A year is nothing! I have projects from 7 years ago that I know I need
>> to update "when I get around to it".
>
> Well "when you get around to it" makes it sound as though it's not exactly
> important.
>
It was written in a relatively portable fashion.
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
attached mail follows:
Per Jessen a écrit :
> René Leboeuf wrote:
>
>> I'm running a large website. I have some mailing scripts that take
>> days to run.
>>
>> I noticed these scripts slow down with time, sometimes going to an
>> almost complete stop (no mail sent for several minutes).
>>
>> The source code is trivial and can't contain a loop. I monitored the
>> memory usage and couldn't find a memory leak. Using APD, most of the
>> time is reported to be spent in the fgets() function (script waiting
>> for a sendmail reply). But sendmail still replies swiftly when this
>> problem occurs.
>
> It sounds like you are using SMTP to talk directly to your sendmail
> daemon?
Yes, SMTP code is provided by phpmailer.
>
>> Restarting sendmail has no effect on these scripts. Restarting the
>> scripts makes them run like hell for some hours, until the problem
>> rises again.
>
> So, if there is no loop in your script, what _does_ it contain?
Oops... The code can't contain a INFINITE loop... Of course, there is a
loop through all the members!
attached mail follows:
Peter Ford a crit :
> Ren Leboeuf wrote:
>> Hi.
>>
>> I'm running a large website. I have some mailing scripts that take days
>> to run.
>>
>> I noticed these scripts slow down with time, sometimes going to an
>> almost complete stop (no mail sent for several minutes).
>>
>> The source code is trivial and can't contain a loop. I monitored the
>> memory usage and couldn't find a memory leak. Using APD, most of the
>> time is reported to be spent in the fgets() function (script waiting for
>> a sendmail reply). But sendmail still replies swiftly when this problem
>> occurs.
>
> By this, I guesss you mean that other connections to sendmail reply
> swiftly: so the server is not just jamming up completely and refusing
> requests ?
Right, I can still create new connections that perform well, with no
noticeable delay when talking to sendmail. The mail queue doesn't grow.
> It might depend on the exact implementation of 'sendmail': for example,
> the Courier mail system which I use replaces the program 'sendmail' with
> it's own binary to do the job.
> Courier also has a 'tar-pitting' feature which is triggered by behaviour
> that looks like a spammer is trying to relay stuff: it atificially slows
> the response to the send requests if there is an unreasonably high rate
> of requests coming from a given source. At least that's how I understand
> the feature to work.
> Other mail system may implement a similar feature - it might just be
> that your mailing script looks like a spam engine to the mail server.
I disabled all the limiting features of sendmail without result
(QUEUE_LA, REFUSE_LA, confBAD_RCPT_THROTTLE...)
The user sending emails is "trusted" by sendmail, and the sending
program is located on the sendmail machine.
>> Restarting sendmail has no effect on these scripts. Restarting the
>> scripts makes them run like hell for some hours, until the problem rises
>> again.
>>
>> I'm using PHP 5.2.5
>>
>> I don't know where to look next for the source of this problem...
>
> I think you need to provide some more detail - you could start by
> explaining what method you use to send the messages. The next thing to
> do is to look at the mail logs and see if there are any messages written
> around the time that yourt script runs.
> Don't always assume that it is your code that is wrong (that's what
> managers are for)
>
Mail is sent via PHPMailer. PHPMailer offers to send mail via PHP's
mail() function, or by calling the sendmail program or using SMTP. SMTP
may use persistent connections or not. All these modes were tested and
they all slow down after a while.
I didn't notice anything special in the maillog or other logs on the
machine.
Thanks for your help.
attached mail follows:
René Leboeuf wrote:
> The user sending emails is "trusted" by sendmail, and the sending
> program is located on the sendmail machine.
>
No need to use SMTP then. You should just be calling sendmail to drop
the emails into the queue. And that should not be slowing down.
> Mail is sent via PHPMailer. PHPMailer offers to send mail via PHP's
> mail() function, or by calling the sendmail program or using SMTP.
> SMTP may use persistent connections or not. All these modes were
> tested and they all slow down after a while.
They _all_ slow down after a while? How many emails are you sending in
this way?
It's easily tested. Just generate a script with 10000 calls to the
mail() function (send to denis+NNNNN
amoureux.com with NNNNN = random
number). If that goes through without slowing down, mail() and your
sendmail daemon are not to blame.
/Per Jessen, Zürich
attached mail follows:
All,
not really PHP related, but I figured someone here would already
have solved this problem.
I've got a page with a single <img>. I change the src attribute
dynamically using javascript. Although the images being served all
have long expiry times, Firefox still does a conditional get to which
apache says "304" as it should.
The issue is - I'd like this page to appear to be as "real time" as
possible, and the occasional delay caused by the conditional get is a
nuisance. My images are clearly cached, so how do I prevent Firefox
from doing the conditional get ? There must be some HTTP header I can
use.
/Per Jessen, Zürich
attached mail follows:
2008/5/14 Per Jessen <per
computer.org>:
> All,
>
> not really PHP related, but I figured someone here would already
> have solved this problem.
> I've got a page with a single <img>. I change the src attribute
> dynamically using javascript. Although the images being served all
> have long expiry times, Firefox still does a conditional get to which
> apache says "304" as it should.
>
> The issue is - I'd like this page to appear to be as "real time" as
> possible, and the occasional delay caused by the conditional get is a
> nuisance. My images are clearly cached, so how do I prevent Firefox
> from doing the conditional get ? There must be some HTTP header I can
> use.
You can use either or both of 'Expires' or 'Cache-Control'
-robin
attached mail follows:
Robin Vickery wrote:
> 2008/5/14 Per Jessen <per
computer.org>:
>>
>> The issue is - I'd like this page to appear to be as "real time" as
>> possible, and the occasional delay caused by the conditional get is
>> a nuisance. My images are clearly cached, so how do I prevent
>> Firefox from doing the conditional get ? There must be some HTTP
>> header I can use.
>
> You can use either or both of 'Expires' or 'Cache-Control'
I've just now added 'Cache-Control' - I was already using 'Expires', but
that wasn't sufficient. Thanks.
/Per Jessen, Zürich
attached mail follows:
Thank you all.
I have made it working excellent for me now.
The solution is here: http://phparch.cn
On Tue, May 13, 2008 at 1:34 PM, Robert Cummings <robert
interjinn.com>
wrote:
>
> On Tue, 2008-05-13 at 01:27 -0400, Robert Cummings wrote:
> > On Tue, 2008-05-13 at 12:28 +0800, Shelley wrote:
> > > Maybe I didn't use that tidy correctly.
> > > I don't want html, head, body things. Just parsed string.
> >
> > So strip them...
> >
> > <?php
> > // ...
> >
> > tidy_parse_string( $html );
> > tidy_clean_repair();
> >
> > $html = tidy_get_output();
> >
> > $html = preg_replace( '#^.*<body>#Uis', '', $html )
> > $html = preg_replace( '#</body>#Uis', '', $html )
> >
> > //...
> > ?>
>
> Whoops... noticed some bugs there :B
>
> <?php
>
> $html = preg_replace( '#^.*<body>#Uis', '', $html );
> $html = preg_replace( '#</body>.*$#Uis', '', $html );
>
> ?>
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>
--
Regards,
Shelley
attached mail follows:
On Wed, 2008-05-14 at 18:50 +0800, Shelley wrote:
> Thank you all.
> I have made it working excellent for me now.
> The solution is here: http://phparch.cn
Ah, there you go... "show_body_only". I was too lazy when I used tidy a
while back to look through every option, so a quick preg stripping
sufficed :)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
On Tue, May 13, 2008 at 4:07 AM, James Dempster <letssurf
gmail.com> wrote:
> http://htmlpurifier.org/
>
> --
> /James
>
This is the only real solution.
attached mail follows:
On Wed, 2008-05-14 at 11:18 -0400, Eric Butera wrote:
> On Tue, May 13, 2008 at 4:07 AM, James Dempster <letssurf
gmail.com> wrote:
> > http://htmlpurifier.org/
> >
> > --
> > /James
> >
>
> This is the only real solution.
That depends... if I'm the webmaster and I want to input arbitrary HTML,
then htmlpurifier is unnecessary.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
>
> "Purifier will not only remove all malicious code (better known as XSS)
> with a thoroughly audited, secure yet permissive whitelist, it will also
> make sure your documents are *standards compliant."*
>
Set it up how you want it.
--
/James
On Wed, May 14, 2008 at 4:38 PM, Robert Cummings <robert
interjinn.com>
wrote:
>
> On Wed, 2008-05-14 at 11:18 -0400, Eric Butera wrote:
> > On Tue, May 13, 2008 at 4:07 AM, James Dempster <letssurf
gmail.com>
> wrote:
> > > http://htmlpurifier.org/
> > >
> > > --
> > > /James
> > >
> >
> > This is the only real solution.
>
> That depends... if I'm the webmaster and I want to input arbitrary HTML,
> then htmlpurifier is unnecessary.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>
attached mail follows:
On Wed, May 14, 2008 at 11:38 AM, Robert Cummings <robert
interjinn.com> wrote:
>
>
> On Wed, 2008-05-14 at 11:18 -0400, Eric Butera wrote:
> > On Tue, May 13, 2008 at 4:07 AM, James Dempster <letssurf
gmail.com> wrote:
> > > http://htmlpurifier.org/
> > >
> > > --
> > > /James
> > >
> >
> > This is the only real solution.
>
> That depends... if I'm the webmaster and I want to input arbitrary HTML,
> then htmlpurifier is unnecessary.
>
>
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>
OP said "users." Strip tags doesn't bother with tag attributes so
that is a security hole. Any regex type solution will encounter the
same set of issues.
Htmlpurifier actually strips down and re-builds your html from the
ground against a nice whitelist filtering system that you can
customize to your needs. No nasty tags/attributes will get through
unless you want them to.
attached mail follows:
Thank you all.
Maybe you didn't get what I meant.
I have made it working excellent for me.
I have summarized the solution: http://phparch.cn
On Wed, May 14, 2008 at 11:10 AM, Nathan Nobbe <quickshiftin
gmail.com>
wrote:
> On Tue, May 13, 2008 at 7:29 PM, Waynn Lue <waynnlue
gmail.com> wrote:
>
> > Ok, thanks so much for the help. I went with DOM-parsing to begin
> > with, I'll explore XPath + SimpleXML later.
>
>
> just fyi, youre likely to get more bang for your buck starting off w/
> SimpleXML. DOM is a successor to DOMXML from php4. its a bulky, yet
> powerful interface into the DOM. SimpleXML is also a DOM parser, however
> the interface is simpler in exchange for less power. the good news is in
> php5 you can switch back and for between DOM and SimpleXML easily at
> virtually no cost.
>
> my modo in php5 is to use SimpleXML unless there is a real need for DOM,
> and
> in that case most likey, you can get away w/ converting to DOM at runtime
> (again very little cost there) and doing a few operations, then carrying
> on
> w/ SimpleXML.
>
> -nathan
>
--
Regards,
Shelley
attached mail follows:
Hi,
How to get user IP address in a PHP server?
Thank you.
Jim
attached mail follows:
On Wed, May 14, 2008 at 8:06 AM, hce <webmail.hce
gmail.com> wrote:
> Hi,
>
> How to get user IP address in a PHP server?
>
> Thank you.
>
> Jim
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
$_SERVER["REMOTE_ADDR"]
attached mail follows:
-----Original Message-----
From: hce [mailto:webmail.hce
gmail.com]
Sent: Wednesday, May 14, 2008 2:07 PM
To: php-general
lists.php.net
Subject: [PHP] How to get user IP address
Hi,
How to get user IP address in a PHP server?
Thank you.
Jim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi
$ip = $_SERVER['REMOTE_ADDR'];
Chris
attached mail follows:
---- hce <webmail.hce
gmail.com> wrote:
> Hi,
>
> How to get user IP address in a PHP server?
>
> Thank you.
>
> Jim
RTFM, Google, PHP.net are GREAT resources
What part of the code are you having an issue with?
attached mail follows:
Sudhakar wrote:
> if( strlen(trim($name) == 0 ) || !preg_match('/^[a-zA-Z ]+$/x', $name) )
> {
> $error.="Name is blank or has special characters ";
> }
You have messed up the brackets. This -
strlen(trim($name) == 0 )
should be -
strlen(trim($name)) == 0
Then the script does what you want.
Iv
attached mail follows:
I never heard of such extension. You should report this bug :)
And you're welcome ;)
Atenciosamente,
www.softpartech.com.br
Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
thiago.pojda
softpartech.com.br
Excelncia em Softwares Financeiros
-----Mensagem original-----
De: Balpo [mailto:balpo
gmx.net]
Enviada em: tera-feira, 13 de maio de 2008 23:09
Para: Thiago Pojda
Cc: 'Daniel Brown'; 'PHP General'
Assunto: Re: $_SESSION NOT WORKING --SOLVED
Prioridade: Alta
After an all-evening debugging I found out what the problem is.
Why? Please don't ask. I have no idea.
The problem was php's extension php-colorer
How I got to the problem. Eliminating every extension until I got the
*bad* one.
Thank you: Daniel, Thiago, Jens, Verny & Dmitri for your concern.
Balpo
Thiago Pojda wrote:
> Actually his question was about why session.auto_start is not working on
> Linux, I almost answered what you both did :)
>
>
> Atenciosamente,
>
> www.softpartech.com.br
>
>
> Thiago Henrique Pojda
> Desenvolvimento Web
> +55 41 3033-7676
> thiago.pojda
softpartech.com.br
> Excelncia em Softwares Financeiros
>
>
> -----Mensagem original-----
> De: Daniel Brown [mailto:parasane
gmail.com]
> Enviada em: tera-feira, 13 de maio de 2008 16:43
> Para: Balpo
> Cc: PHP General
> Assunto: Re: [PHP] $_SESSION NOT WORKING
>
> On Tue, May 13, 2008 at 2:38 PM, Balpo <balpo
gmx.net> wrote:
>
>> Hi everyone,
>> I'm having a problem moving my code to a linux computer.
>> I won't post the whole code here, but an accurate example that
reproduces
>> exactly the error.
>>
> [snip!]
>
> Modify 2.php as follows:
>
> <?php
> session_start();
> print_r($_SESSION);
> ?>
>
> You only missed instantiating the session. The rest looks good.
>
>
attached mail follows:
On Wed, May 14, 2008 at 9:47 AM, Thiago Pojda
<thiago.pojda
softpartech.com.br> wrote:
>
> I never heard of such extension. You should report this bug :)
>
> And you're welcome ;)
I agree, Balpo. You should submit the details of your findings at
http://bugs.php.net/ and let us check it out.
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
attached mail follows:
On Tue, May 13, 2008 at 8:39 AM, Per Jessen <per
computer.org> wrote:
> Yannick Warnier wrote:
>
> > That would probably work out if it wasn't too dependent on the locales
> > to work. I'm developing an open-source product which could end up on a
> > server without the locales for French but be used by some French
> > people, which would make (as far as I can get out of one comment from
> > Richie in the PHP manual) the transliteration somewhat wrong.
>
> With the kind of rough conversion/transformation you're doing, is the
> locale really very important anyway?
>
>
> /Per Jessen, Zrich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Why should the server folder name matter? Make it a hash and store the user
provided name in a db. Then when presenting the data to the user just show
the user provided name as the folder name. This would also handle multiple
users trying to use the same folder name for their stuff.
--
Bastien
Cat, the other other white meat
attached mail follows:
2008/5/14 Bastien Koert <phpster
gmail.com>:
> Why should the server folder name matter? Make it a hash and store the user
> provided name in a db. Then when presenting the data to the user just show
> the user provided name as the folder name. This would also handle multiple
> users trying to use the same folder name for their stuff.
>
It may be that the whole folder hierarchy is publicly accesable. Some
faculties at my university do that.
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
attached mail follows:
On Tue, May 13, 2008 at 9:02 AM, tedd <tedd.sperling
gmail.com> wrote:
> At 2:44 PM -0700 5/12/08, milt wrote:
>
>> I have a form that will be filled in by the user, I want to have access to
>> the content of one of the fields in that form, in order to fill in an
>> another variable that is not part of the form. this variable is used by a
>> routine when the form is "posted". Question - is the $_post[field name]
>> availble before the submit button is pushed, or is there another way to
>> get
>> the contents of the field?
>> thanks, Milt
>>
>
> Use hidden, such as:
>
> <input type="hidden" name="step" value="1">
>
> After the form is posted, $_POST['step'] will = 1.
>
> I use this technique all the time so that I can use the same script to
> present different forms based upon which step in the form processing the
> user is on (i.e., step=1, step=2, step=3 and so on).
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> You could get funky and send that data bit via AJAX to the server to be
preprocessed. But likely handling the data bit as the first step on
submission, is gonna be simpler and faster to do
--
Bastien
Cat, the other other white meat
attached mail follows:
On May 11, 2008, at 12:06 AM, admin wrote:
[snip!]
> Safe mode has _got_ to be there for some good reason.
Read on about PHP6....
<http://www.ibm.com/developerworks/opensource/library/os-php-future/?ca=dgr-lnxw01PHP-Future
>
Scroll down to where the title is "Things removed" - notice that
'safe_mode' is listed. It may have been put in originally for a good
reason, but since then deprecated.
HTH,
~Philip
attached mail follows:
On May 13, 2008, at 6:35 AM, Sanjeev N wrote:
> fetchAll() works if php version is greater than 5.
>
> As Wang suggested, we should write our own function.
> its easy... i have done so many times for larger database.
>
> Store earch rows of the resultset in the array (multidimensional ie.
> 2). and
> then work on the array using the loops & conditions
>
> $query = "select * from tablename";
> $result = mysql_query($query);
> while($arr = somefunction($result)){
> $resultarray[] = $arr;
> }
>
> Hope it works!
Here's a way to get a 2-dimensional array of results that you can loop
through when needed. Don't know if it's what you need, but it's useful
when you have more than 1 row as a result.
<?php
function fetchObjectsAsArray ($sql)
{
$result = mysql_query ($sql);
if (!$obj['count'] = mysql_num_rows ($result)) { return null; }
while ($rows[] = mysql_fetch_array ($result)) { }
foreach ($rows as $array) {
foreach ($array as $field => $value) {
$obj[$field][] = $value;
}
}
return $obj;
}
?>
Have fun!
~Phil
> On 5/13/08, Forcey <forcey
gmail.com> wrote:
>>
>> I guess PDOStatement::fetchAll() should work?
>>
>> see http://www.php.net/manual/en/pdostatement.fetchall.php for
>> details.
>>
>>
>> - Forcey
>>
>>
>> On Tue, May 13, 2008 at 9:55 AM, Yi Wang <wangyi6854
gmail.com>
>> wrote:
>>> I think flance's meaning is whether there is a build-in function
>>> that
>>> can convert the result set to an array.
>>>
>>> The short answer is: do it yourself.
>>>
>>>
>>>
>>> On 5/12/08, Stut <stuttle
gmail.com> wrote:
>>>> On 12 May 2008, at 15:56, It flance wrote:
>>>>
>>>>> is there any function that can convert the result of query to an
>>>> associative array?
>>>>>
>>>>> what i want is the following:
>>>>>
>>>>> $query = "select * from tablename";
>>>>> $result = mysql_query($query);
>>>>> $arr = somefunction($result);
>>>>>
>>>>> where $arr should be an assoiative array whose indices have the
>> same name
>>>> as the fields names of table tablename.
>>>>>
>>>>
>>>> http://php.net/mysql_fetch_assoc
>>>>
>>>> Please please please read the manual: http://php.net/mysql
>>>>
>>>> -Stut
attached mail follows:
Hello all,
I am just trying to see if I can connect up with my internal FTP server from
our website. The server is accessible from the outside world, as we can log
in using a client, etc. I am not really sure how to troubleshoot this, but
below is the script that I have. I "found" it on the net (and can't remember
where), and changed it a bit for my needs. It would appear that the call to
'ftp_connect' is where it fails. I tried this with both a URL as well as the
actual IP address, both error at the same place with the same error. Is
there a way to get an actual error message that is a bit more explanatory as
to what is happening?
<?php
$ftp_server = "FTP.URL";
$ftp_user = "USER";
$ftp_pass = "PASSWORD";
echo "Trying to connect with $ftp_server using $ftp_user, $ftp_pass";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to
$ftp_server");
if ($conn_id) {
echo "Logging in as $ftp_user, $ftp_pass.";
$login = ftp_login($conn_id, $ftp_user, $ftp_pass);
// try to login
if ($login) {
echo "Connected as $ftp_user
$ftp_server\n";
} else {
echo "Couldn't connect as $ftp_user\n";
}
// close the connection
ftp_close($conn_id);
} else {
echo "Could not establish connection";
}
?>
Thanks for your help,
Mike
--
Peace may sound simpleone beautiful word but it requires everything we
have, every quality, every strength, every dream, every high ideal.
Yehudi Menuhin (19161999), musician
attached mail follows:
Steven Perez wrote:
> ext/openssl/openssl.o: In function `zif_openssl_sign':
> /home/sperez/php-5.2.6/ext/openssl/openssl.c:3525: undefined reference
> to `EVP_MD_CTX_cleanup'
> ext/openssl/openssl.o: In function `zif_openssl_verify':
> /home/sperez/php-5.2.6/ext/openssl/openssl.c:3565: undefined reference
> to `EVP_MD_CTX_cleanup'
> collect2: ld returned 1 exit status
> make: *** [sapi/cgi/php-cgi] Error 1
Does your openssl include files match your openssl library?
> The version of openssl I am using is the following:
>
> # ./openssl version
> OpenSSL 0.9.6l 04 Nov 2003
That's quite old. I would almost certainly update that.
/Per Jessen, Zürich
attached mail follows:
Afternoon,
Just had word of a freelance project on for the next 4 weeks, start
immediately, basically 1 static site (design already done) - an easy
job, and 1 static site + a bit of PHP, breadcrumb, site search - it's
200 GBP a day (so about 4k for the next 4 weeks), ideally for somebody
who can pop into edinburgh to meet the client/agency and maybe work on site?
I was offered but I'm committed at the minute, it's through a reputable
recruitment agency for a top edinburgh design house - so worth going for
if you have the time free.
Give me a shout on nrixham
gmail.com or nathan
rssphp.net and I'll fire
you over the details of the man you need to speak to.
God it's been ages since I posted here!
Nathan
attached mail follows:
Hi,
I have this HTML/JS page that switches images clicking on the radio
buttons and call template.php with the image ID as parameter:
http://portulan-online.net/einstein.html
Now, I need to make it a PHP page, because it is going to receive a
parameter from the URL that calls it and pass it as is to template.php
So, einstein.php will be called with a parameter (satellite):
http://portulan-online.net/einstein.php?satellite=123
After that, in einstein.php, I do:
$satellite = $_REQUEST['satellite'];
Next thing, I need the action in the JavaScript to be, for example:
http://portulan-online.net/template.php?id=3&satellite=123
What I don't know is how to mix the "PHP variable" satellite with the
image ID here:
document.getElementById('image1').src =
"http://portulan-online.net/einstein-" + ID + ".png";
I've tried putting einstein.php all inside an "echo", but the radio
buttons and the submit button stopped working.
Does anyone knows how to do this ?
Any help would be appreciated.
Warm Regards,
Mrio Gamito
attached mail follows:
On Wed, May 14, 2008 at 2:31 PM, Mrio Gamito <gamito
gmail.com> wrote:
> Hi,
>
> I have this HTML/JS page that switches images clicking on the radio buttons
> and call template.php with the image ID as parameter:
> http://portulan-online.net/einstein.html
>
> Now, I need to make it a PHP page, because it is going to receive a
> parameter from the URL that calls it and pass it as is to template.php
>
>
> So, einstein.php will be called with a parameter (satellite):
> http://portulan-online.net/einstein.php?satellite=123
>
> After that, in einstein.php, I do:
>
> $satellite = $_REQUEST['satellite'];
>
> Next thing, I need the action in the JavaScript to be, for example:
> http://portulan-online.net/template.php?id=3&satellite=123
>
> What I don't know is how to mix the "PHP variable" satellite with the image
> ID here:
> document.getElementById('image1').src = "
> http://portulan-online.net/einstein-" + ID + ".png";
>
> I've tried putting einstein.php all inside an "echo", but the radio buttons
> and the submit button stopped working.
>
> Does anyone knows how to do this ?
>
> Any help would be appreciated.
>
> Warm Regards,
> Mrio Gamito
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
document.getElementById('image1').src = "
http://portulan-online.net/einstein-" + <?php echo $_GET['satellite']; ?> +
".png";
You could do that. Also, I'd suggest using $_GET instead of $_REQUEST.
Request works,b ut it is very broad. $_GET is more specific/secure.
--
-Dan Joseph
www.canishosting.com - Plans start
$1.99/month. Reseller plans and
Dedicated servers available.
"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."
attached mail follows:
At 7:31 PM +0100 5/14/08, Mrio Gamito wrote:
>Hi,
>
>I have this HTML/JS page that switches images
>clicking on the radio buttons and call
>template.php with the image ID as parameter:
>http://portulan-online.net/einstein.html
>
>Now, I need to make it a PHP page, because it is
>going to receive a parameter from the URL that
>calls it and pass it as is to template.php
Mrio:
The key here to remember is that javascript uses
ID and php uses NAME for inputs. So, if you put
your variables in that form and they will work
between javascript and php. Such as:
<input type="radio" name="rad" id="rad" value="2"
onclick="javascript:GetImage(this);">Einstein 2
Note the change of "this" in your js call -- you
can do that and not have to provide the number.
Also put in an action="whatever" into your form
and collect the selection via $_POST['rad'];
That will do what you want.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
attached mail follows:
I am trying to use array's to populate a group of check boxes for a form. I
am getting the checkboxes to print OK, but when the form is posted I am only
getting part of the array.
Form Page:
$vars = array("Main Classroom" => "Main Classroom", "Break Out Classroom" =>
"Break Out Classroom", "Gym" => "Gym",
"Firearms Range" => "Firearms Range", "EVOC Track" => "EVOC Track");
$cols = 4;
echo "<form method=post action=twocoltests.php><table><tr><td
colspan=".$cols." align=center>Equipment Needed</td><tr>";
foreach($vars as $key => $value){
if (($cols % 4) == 0 ){ echo "</tr><tr>"; }
echo "<td><input name=".$key." type=checkbox
value=".$value."></td><td>".$value."</td>";
$cols++;
}
echo "</tr></table>";
echo "<br />";
When I submit the form I am only getting the following having checked the
boxes for Mail Classroom and Break Out Classroom. If I eliminate the spaces
between the words, I get everything, but when I put the spaces between the
words in the array, it cuts off the second word. Not sure what is
happening?
Array ( [Main] => Main [Break] => Break [Submit] => Submit )
attached mail follows:
Try:
echo "<td><input name=".urlencode($key)." type=checkbox
value=".urlencode($value)."></td><td>". $value."</td>";
On Wed, May 14, 2008 at 4:02 PM, Mark Bomgardner <mbomgardner
kletc.org>
wrote:
> I am trying to use array's to populate a group of check boxes for a form.
> I
> am getting the checkboxes to print OK, but when the form is posted I am
> only
> getting part of the array.
>
>
>
> Form Page:
>
>
>
> $vars = array("Main Classroom" => "Main Classroom", "Break Out Classroom"
> =>
> "Break Out Classroom", "Gym" => "Gym",
>
> "Firearms Range" => "Firearms Range", "EVOC Track" => "EVOC Track");
>
>
>
>
>
> $cols = 4;
>
> echo "<form method=post action=twocoltests.php><table><tr><td
> colspan=".$cols." align=center>Equipment Needed</td><tr>";
>
> foreach($vars as $key => $value){
>
> if (($cols % 4) == 0 ){ echo "</tr><tr>"; }
>
>
>
> echo "<td><input name=".$key." type=checkbox
> value=".$value."></td><td>".$value."</td>";
>
> $cols++;
>
> }
>
>
>
> echo "</tr></table>";
>
> echo "<br />";
>
>
>
> When I submit the form I am only getting the following having checked the
> boxes for Mail Classroom and Break Out Classroom. If I eliminate the
> spaces
> between the words, I get everything, but when I put the spaces between the
> words in the array, it cuts off the second word. Not sure what is
> happening?
>
>
>
> Array ( [Main] => Main [Break] => Break [Submit] => Submit )
>
>
attached mail follows:
On Wed, May 14, 2008 at 4:02 PM, Mark Bomgardner <mbomgardner
kletc.org> wrote:
> I am trying to use array's to populate a group of check boxes for a form. I
> am getting the checkboxes to print OK, but when the form is posted I am only
> getting part of the array.
[snip!]
Looks like someone's working with the police academy, or something
similar. Reminds me.... I think I have to recert my CEVO and EVOC....
Anyway, using spaces in HTML form name and ID compartments is
illegal, and you're not encapsulating the data in quotes. So HTML
thinks that the first word of the bunch is the name of the form
element, then skips the rest. For valid HTML:
<?php
// foreach....
echo "<td><input name=\"".str_replace(' ','_',$key)."\"
type=\"checkbox\" value=\"".$value."\"></td><td>".$value."</td>";
?>
Otherwise, if you still want to use spaced form field names, you
can enclose them in quotes (as shown above) and the browser will
probably automatically urlencode() the data on submit.
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
attached mail follows:
Mark Bomgardner wrote:
> When I submit the form I am only getting the following having checked the
> boxes for Mail Classroom and Break Out Classroom. If I eliminate the spaces
> between the words, I get everything, but when I put the spaces between the
> words in the array, it cuts off the second word. Not sure what is
> happening?
>
>
>
> Array ( [Main] => Main [Break] => Break [Submit] => Submit )
>
>
Look at the source of the page that this script generates. Your input
tags look like this
<td><input name=Main Classroom type=checkbox value=Main
Classroom></td><td>Main Classroom</td>
See the problem? The html attribute values have spaces in them. As far
as your browser knows "Classroom" is supposed to be an attribute like
type and value. Since it doesn't understand it it drops it.
Here is some code, notice the \" surrounding the ".$key."
<?php
$vars = array("Main Classroom" => "Main Classroom",
"Break Out Classroom" => "Break Out Classroom",
"Gym" => "Gym",
"Firearms Range" => "Firearms Range",
"EVOC Track" => "EVOC Track");
echo "<form method=post action=twocoltests.php>";
echo "<fieldset><legend>Equipment Needed</legend>";
foreach($vars as $key => $value){
echo "<div><input name=\"".$key."\" type=checkbox
value=\"".$value."\"><label for=\"".$key."\">".$value."</label></div>";
}
echo "</fieldset>";
echo "</form>";
?>
I also redid your layout. You should be able to control the layout much
better with some simple CSS. Shoot me an e-mail if you wnat help with
the CSS
attached mail follows:
I have a class that is throwing the error:
syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM ...
It is appearing in the constructor of a parent class
abstract class parent
{
protected $titles = array('title1','title2','title3');
protected $a;
function __construct($set = NULL, $special = NULL)
{
self::$this->titles = array_merge(self::$this->titles, $special);
//error
foreach($set as $key=>value)
{
if (array_key_exists($key,$this->titles)
{
$this->a[$key] = $value;
}
}
}
}
class child extends parent
{
protected $titles = array('titleA', 'titleB', 'titleC');
function __construct($set, $special = NULL)
{
self::$this->titles = array_merge(self::$this->titles, $special);
parent::__construct($set, self::$this->titles);
unset($this->titles);
}
}
Basically parent is an extensible tool for holding data with titles that
dictate behavior later in the script. Eventually I will have a dozen or
so different child classes each using an identical API. But first I
need this constructor to work. The parent constructor just tacks the
array of titles from the $special attributes onto the end of the $titles
array.
attached mail follows:
[snip]
I have a class that is throwing the error:
syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM ...
[/snip]
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM (Hebrew)
It means "there's an unexpected double colon where there shouldn't have
been".
self::$this->titles = array_merge(self::$this->titles, $special);
//error
Appears to be the trouble maker.
attached mail follows:
On Wed, May 14, 2008 at 4:05 PM, Tyson Vanover <tvanover
pdx.edu> wrote:
> I have a class that is throwing the error:
> syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM ...
You're using a Hebrew version of PHP?
That means something along the lines of "two times the two marks" in Hebrew.
However, in your case, you're checking the error on the wrong
line. Look at your foreach() statement. It should instead read as
follows:
<?php
foreach($set as $key => $value) { // You just missed the $ before value.
?>
Also, check this line:
<?php
if (array_key_exists($key,$this->titles)
?>
You're missing a ')' to close the if() statement. It's not
causing this problem, but it will cause a problem afterward.
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
attached mail follows:
Just wondering if the mailing list is working. I have not received anything
from this list today.
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]