|
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 21 Feb 2007 04:39:28 -0000 Issue 4637
php-general-digest-help
lists.php.net
Date: Tue Feb 20 2007 - 22:39:28 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 21 Feb 2007 04:39:28 -0000 Issue 4637
Topics (messages 249096 through 249157):
Re: WHERE problem
249096 by: tg-php.gryffyndevelopment.com
249098 by: Jay Blanchard
249101 by: Németh Zoltán
249103 by: tg-php.gryffyndevelopment.com
249123 by: Mike Shanley
249129 by: Richard Lynch
249130 by: Richard Lynch
249131 by: Richard Lynch
Re: Understanding session variables with input field and register_global
249097 by: Jay Blanchard
249099 by: Németh Zoltán
249100 by: Brad Fuller
249118 by: Richard Lynch
249154 by: Haydar TUNA
Re: Change in 5.2.1 re. parsing of URL
249102 by: Fergus Gibson
249104 by: Lewis Kapell
249106 by: Jim Lucas
249132 by: Richard Lynch
Re: Manual contradiction concerning string access?
249105 by: Robert Cummings
249120 by: Richard Lynch
Re: Install / update php rpm packages with FC6
249107 by: Peter Lauri
Re: Latin letter problem!
249108 by: Dotan Cohen
249109 by: Peter Lauri
249110 by: Dotan Cohen
249121 by: Richard Lynch
249122 by: Richard Lynch
php forcing a post??
249111 by: blackwater dev
249112 by: Al
249113 by: blackwater dev
249114 by: Peter Lauri
249115 by: Peter Lauri
249116 by: Stut
249117 by: Richard Lynch
249155 by: Haydar TUNA
HTML form data to utf-8?
249119 by: Jay Paulson
249137 by: Richard Lynch
Re: Problems processing UNIX timestamps in events directory
249124 by: Jochem Maas
249126 by: Richard Lynch
Re: Language construct
249125 by: Richard Lynch
Re: Mozilla/Opera issue
249127 by: Richard Lynch
Re: Classified Ads Script
249128 by: Richard Lynch
Re: remote fopen not working, despite allow_url_fopen = on
249133 by: Richard Lynch
Re: css in mail()
249134 by: Richard Lynch
249136 by: Richard Lynch
249150 by: Sancar Saran
Re: serialize() and special ANSI characters
249135 by: Richard Lynch
Re: Another hand wringer
249138 by: Richard Lynch
Re: needed Yahoo like window for db query.
249139 by: Richard Lynch
Re: $_FILES path on client's machine?
249140 by: Richard Lynch
Re: PHP Startup: Unable to load dynamic library
249141 by: Richard Lynch
Re: Catch STDERR
249142 by: Richard Lynch
249156 by: Peter Lauri
Re: LOL, preg_match still not working.
249143 by: Richard Lynch
Re: counting hyperlink clicks in php
249144 by: Richard Lynch
Re: Securing user table with sha function
249145 by: Richard Lynch
249146 by: Richard Lynch
249147 by: Richard Lynch
Re: Quick organizational question...
249148 by: Richard Lynch
Re: reverse http authentication
249149 by: Richard Lynch
New To PHP
249151 by: Larry Chu
249152 by: Mike Shanley
249153 by: Haydar TUNA
249157 by: dhorton.iprimus.com.au
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:
Different strokes for different folks...
Might I toss a new recommendation into the mix?
SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
= = = Original message = = =
N~~meth Zolt~~n wrote:
> 2007. 02. 20, kedd keltez~~ssel 08.17-kor Jim Lucas ezt ~~rta:
>> Mike Shanley wrote:
>>> I'd like to think I understood code a little better than this, but I've
>>> got a problem with my WHERE...
>>>
>>> I know it's the WHERE because I get a good result when I leave it out.
>>> And the random function is also working... I honestly can't figure it
>>> out. Thanks in advance for help with this laughable prob.
>>> ---------------------------
>>> // How many are there?
>>>
>>> $result = mysql_query("SELECT count(*) FROM fortunes");
>>> $max = mysql_result($result, 0);
>>>
>>> // Get randomized!... the moderated way...
>>>
>>> $randi = mt_rand(1, $max-1);
>>> $q = "SELECT text FROM fortunes WHERE index = '$randi'";
>>> $choose = mysql_query($q);
>>> $chosen1 = mysql_fetch_array($choose);
>> ARRAY???
>
> what's wrong with that?
> http://hu.php.net/manual/en/function.mysql-fetch-array.php
>
> and then you can of course refer to it with indexes, both numeric and
> associative
> I don't see anything problematic with that...
>
> greets
> Zolt~~n N~~meth
>
>>> // Ready to ship...
>>>
>> Referring to it via an index... could be the problem
>>> $fortune = '<span class="quotecyc">"' . $chosen1[0] .
>>> '"<br/>-Omniversalism.com</span>';
>>>
>>> mysql_close();
>>>
>>
>> --
>> Enjoy,
>>
>> Jim Lucas
>>
>> Different eyes see different things. Different hearts beat on different
>> strings. But there are times for you and me when all such things agree.
>>
>> - Rush
>>
>
I would suggest using either assoc or row this way there is no
confusion. Plus it doesn't take as much resources. :)
--
Enjoy,
Jim Lucas
Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.
- Rush
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
attached mail follows:
[snip]
Different strokes for different folks...
Might I toss a new recommendation into the mix?
SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
[/snip]
I suggested that yesterday. :)
attached mail follows:
2007. 02. 20, kedd keltezéssel 11.39-kor tg-php
gryffyndevelopment.com
ezt Ărta:
> Different strokes for different folks...
>
> Might I toss a new recommendation into the mix?
>
> SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
>
that's not new :)
a couple of people recommended it earlier today/yesterday
this is perfect, but only if the table is not very large.
see
http://www.titov.net/2005/09/21/do-not-use-order-by-rand-or-how-to-get-random-rows-from-table/
greets
Zoltán Németh
>
>
> = = = Original message = = =
>
> N~~meth Zolt~~n wrote:
> > 2007. 02. 20, kedd keltez~~ssel 08.17-kor Jim Lucas ezt ~~rta:
> >> Mike Shanley wrote:
> >>> I'd like to think I understood code a little better than this, but I've
> >>> got a problem with my WHERE...
> >>>
> >>> I know it's the WHERE because I get a good result when I leave it out.
> >>> And the random function is also working... I honestly can't figure it
> >>> out. Thanks in advance for help with this laughable prob.
> >>> ---------------------------
> >>> // How many are there?
> >>>
> >>> $result = mysql_query("SELECT count(*) FROM fortunes");
> >>> $max = mysql_result($result, 0);
> >>>
> >>> // Get randomized!... the moderated way...
> >>>
> >>> $randi = mt_rand(1, $max-1);
> >>> $q = "SELECT text FROM fortunes WHERE index = '$randi'";
> >>> $choose = mysql_query($q);
> >>> $chosen1 = mysql_fetch_array($choose);
> >> ARRAY???
> >
> > what's wrong with that?
> > http://hu.php.net/manual/en/function.mysql-fetch-array.php
> >
> > and then you can of course refer to it with indexes, both numeric and
> > associative
> > I don't see anything problematic with that...
> >
> > greets
> > Zolt~~n N~~meth
> >
> >>> // Ready to ship...
> >>>
> >> Referring to it via an index... could be the problem
> >>> $fortune = '<span class="quotecyc">"' . $chosen1[0] .
> >>> '"<br/>-Omniversalism.com</span>';
> >>>
> >>> mysql_close();
> >>>
> >>
> >> --
> >> Enjoy,
> >>
> >> Jim Lucas
> >>
> >> Different eyes see different things. Different hearts beat on different
> >> strings. But there are times for you and me when all such things agree.
> >>
> >> - Rush
> >>
> >
> I would suggest using either assoc or row this way there is no
> confusion. Plus it doesn't take as much resources. :)
>
> --
> Enjoy,
>
> Jim Lucas
>
> Different eyes see different things. Different hearts beat on different
> strings. But there are times for you and me when all such things agree.
>
> - Rush
>
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
>
attached mail follows:
Ah.. sorry Jay. I had like 8,000 emails today and must have missed some of the original responses.
Or maybe I'm just trying to look smart by riding on your coat-tails. Either way, apologies for the repeated information.
-TG
= = = Original message = = =
[snip]
Different strokes for different folks...
Might I toss a new recommendation into the mix?
SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
[/snip]
I suggested that yesterday. :)
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
attached mail follows:
The reason I didn't go with the suggestions for this approach is that I
want to accept new submissions to the database whose default id = 0.
Thus, I can moderate them on the way in by giving them non-0 numbers.
(I've changed the database row count call to fit the implementation
since my posting of the code.)
Thanks to everyone!
tg-php
gryffyndevelopment.com wrote:
> Different strokes for different folks...
>
> Might I toss a new recommendation into the mix?
>
> SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
>
--
Mike Shanley
~you are almost there~
attached mail follows:
On Mon, February 19, 2007 2:32 pm, Bruce Cowin wrote:
>>>> Mike Shanley <thebarmy
omniversalism.com> 20/02/2007 9:23:08 a.m.
>>>> >>>
> I'd like to think I understood code a little better than this, but
> I've
> got a problem with my WHERE...
>
> I know it's the WHERE because I get a good result when I leave it out.
> And the random function is also working... I honestly can't figure it
> out. Thanks in advance for help with this laughable prob.
> ---------------------------
> // How many are there?
>
> $result = mysql_query("SELECT count(*) FROM fortunes");
> $max = mysql_result($result, 0);
>
> // Get randomized!... the moderated way...
>
> $randi = mt_rand(1, $max-1);
> $q = "SELECT text FROM fortunes WHERE index = '$randi'";
> $choose = mysql_query($q);
> $chosen1 = mysql_fetch_array($choose);
Are you certain that your 'index' field runs from 1 to $max-1 and you
will never DELETE a fortune leaving a hole in your 'index' values?...
Unless you really really really need the quality of the Merseinne
Twister random generator, you could just do:
SELECT text FROM fortunes ORDER BY rand() LIMIT 1
(Or is it random() in MySQL? I always confuse mysql/pg random
function name...)
Also, 'text' is a field type in SQL, so you may need:
SELECT `text` to make it not be reserved word.
Ditto for index -> `index` perhaps.
> // Ready to ship...
>
> $fortune = '<span class="quotecyc">"' . $chosen1[0] .
> '"<br/>-Omniversalism.com</span>';
>
> mysql_close();
As a matter of Code Style, you MAY want to consider doing:
$chosen = mysql_result($choose, 0, 0);
instead of creating a 1-element array and then accessing element 0 of
that array.
Some developers prefer to always do their PHP/mysql "the same"
Others prefer to make it clear when they are getting a singleton
database result, by using a different pattern of code.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Tue, February 20, 2007 10:46 am, Németh Zoltán wrote:
> 2007. 02. 20, kedd keltezéssel 11.39-kor
> tg-php
gryffyndevelopment.com
> ezt Ărta:
>> Different strokes for different folks...
>>
>> Might I toss a new recommendation into the mix?
>>
>> SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
>>
>
> that's not new :)
> a couple of people recommended it earlier today/yesterday
>
> this is perfect, but only if the table is not very large.
> see
> http://www.titov.net/2005/09/21/do-not-use-order-by-rand-or-how-to-get-random-rows-from-table/
Another option for extremely large tables, is to ADD a field, say,
'random_cache' of type float, and index that field.
You can then:
SELECT id FROM whatever ORDER BY random_cache LIMIT $limit;
Gather your id's together, and then:
UPDATE whatever SET random_cache = random() WHERE id in ($ids)
You'd have an index on id as well, of course.
So, in essence, as you "use up" random rows, you re-assign those rows
with a new random number, and toss them back in the "pile"
It *does* re-shape the index on the random index, so if that gets too
lop-sided and you are selecting a large $limit, the DB takesa beating,
but this is still pretty efficient for what most people are trying to
do most of the time.
It puts the heavy lifting into a DB index, which is about as efficient
as you're going to get.
It is possible for two users to get the same "random" selection, if
their queries inter-twine.
You could wrap the whole thing in a transaction, possibly, if that's
undesirable.
I use this for a playlist of ~30 songs every day out of ~60000 rows,
and it works well. But I only do the queries once a day, and store
the result, so maybe it won't scale well for heavily-trafficed site.
I'd be interested in hearing anybody who benchmarks this compared to
other methods, but confess I'm not in enough of a performance bind to
feel the need to benchmark for myself. Though I know for sure it beat
the ORDER BY random() on my usage, as that's what I had and it was
killing me.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
WHERE id > 0
would take care of that.
Or, better yet, SEPARETE your 'id' field from your 'approved' field
and don't try to be cheap with a one-byte (or even one-bit in some
DBs) field.
Over-loading the data field definition with dual meaning almost always
turns into a problem down the line, in my experience.
[Apologies if this has been said -- I'm having email threading issues
at the moment...]
On Tue, February 20, 2007 3:59 pm, Mike Shanley wrote:
> The reason I didn't go with the suggestions for this approach is that
> I
> want to accept new submissions to the database whose default id = 0.
> Thus, I can moderate them on the way in by giving them non-0 numbers.
> (I've changed the database row count call to fit the implementation
> since my posting of the code.)
>
> Thanks to everyone!
>
> tg-php
gryffyndevelopment.com wrote:
>> Different strokes for different folks...
>>
>> Might I toss a new recommendation into the mix?
>>
>> SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
>>
> --
> Mike Shanley
>
> ~you are almost there~
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
[snip]
I've an input field in a form
<input name="username" type="text" ...
and with register_global I can use this field in PHP as variable
$username. Yet if I use a session variable
$_SESSION['username'] = 'value'
the variable $username gets the same value. On the other side when I
enter a value in the input field, the session variable isn't changed. So
how can I set the session variable from the input field after it has
changed?
[/snip]
$_SESSION['username'] = $username;
But really, you should turn off register_globals (holy war will not
ensue at this point, everyone knows the value).
attached mail follows:
2007. 02. 20, kedd keltezĂ©ssel 17.32-kor Otto Wyss ezt Ărta:
> I've an input field in a form
>
> <input name="username" type="text" ...
>
> and with register_global I can use this field in PHP as variable
> $username. Yet if I use a session variable
>
> $_SESSION['username'] = 'value'
>
> the variable $username gets the same value.
the manual says ( http://hu.php.net/manual/en/ref.session.php )
"If register_globals is enabled, then the global variables and the
$_SESSION entries will automatically reference the same values which
were registered in the prior session instance. However, if the variable
is registered by $_SESSION then the global variable is available since
the next request."
that's why it is the same
I think you should read the value from $_POST and put it into $_SESSION
to change it
hope that helps
Zoltán Németh
> On the other side when I
> enter a value in the input field, the session variable isn't changed. So
> how can I set the session variable from the input field after it has
> changed?
>
> O. Wyss
>
attached mail follows:
> -----Original Message-----
> From: Otto Wyss [mailto:otto.wyss
orpatec.ch]
> Sent: Tuesday, February 20, 2007 11:32 AM
> To: php-general
lists.php.net
> Subject: [PHP] Understanding session variables with input field and
> register_global
>
> I've an input field in a form
>
> <input name="username" type="text" ...
>
> and with register_global I can use this field in PHP as variable
> $username. Yet if I use a session variable
>
> $_SESSION['username'] = 'value'
>
> the variable $username gets the same value. On the other side when I
> enter a value in the input field, the session variable isn't changed. So
> how can I set the session variable from the input field after it has
> changed?
>
> O. Wyss
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
I'm not familiar with an ini setting such as register_globals that would
give you similar functionality with session variables.
IMHO it seems unlikely that anyone would want EVERY form variable saved in
the session (Like the value of your "Submit" button :P)...
.. but if you REALLY want to do it, you could do something like this:
foreach($_POST as $key => $val)
{
$_SESSION[$key] = $val;
}
HTH,
Brad
attached mail follows:
On Tue, February 20, 2007 10:32 am, Otto Wyss wrote:
> I've an input field in a form
>
> <input name="username" type="text" ...
>
> and with register_global I can use this field in PHP as variable
> $username.
You really really should turn OFF register_global for new code
development...
> Yet if I use a session variable
>
> $_SESSION['username'] = 'value'
>
> the variable $username gets the same value. On the other side when I
> enter a value in the input field, the session variable isn't changed.
> So
> how can I set the session variable from the input field after it has
> changed?
If you want to sort out the mess of which variables are coming from
where, use $_POST and $_SESSION and $_GET instead of $username
You should not blindly put POST/GET data into your SESSION data.
NEVER trust user-supplied data.
Start reading about that here:
http://phpsec.org/
>
> O. Wyss
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Hello,
Can you send your code? I can help you :)
--
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net
""Jay Blanchard"" <jblanchard
pocket.com>, haber iletisinde sunlari
yazdi:56608562F6D5D948B22F5615E3F57E6901824708
YGEX01WAL.onecall.local...
[snip]
I've an input field in a form
<input name="username" type="text" ...
and with register_global I can use this field in PHP as variable
$username. Yet if I use a session variable
$_SESSION['username'] = 'value'
the variable $username gets the same value. On the other side when I
enter a value in the input field, the session variable isn't changed. So
how can I set the session variable from the input field after it has
changed?
[/snip]
$_SESSION['username'] = $username;
But really, you should turn off register_globals (holy war will not
ensue at this point, everyone knows the value).
attached mail follows:
Lewis Kapell wrote:
> We are already using the Content-type header (I should have mentioned
> that in my first message).
Hmmm. So you have a PHP script that sets the mimetype correctly and
then outputs straight PDF data, but the user's browser does not accept
it as a PDF because the extension of the script is PHP? I find that
strange.
If you can't find a better solution (something weird is going on in my
mind) maybe a work-around is mod_rewrite? You could link to the PHP
script with a PDF extension and then rewrite it to the PHP extension
behind the scenes.
> And to say that the user's browser is misconfigured is no solution,
> since we don't have the ability to reconfigure it. If all of our
> users were on a local network there would be no problem. But that's
> not our situation.
I agree it's not a solution, but client misconfiguration is difficult,
often impossible, to solve with server-side scripting. If you could
identify the misconfiguration, your site could offer a how-to document
to instruct users how to configure their software correctly.
attached mail follows:
Fergus Gibson wrote:
> Lewis Kapell wrote:
>> We are already using the Content-type header (I should have mentioned
>> that in my first message).
>
> Hmmm. So you have a PHP script that sets the mimetype correctly and
> then outputs straight PDF data, but the user's browser does not accept
> it as a PDF because the extension of the script is PHP? I find that
> strange.
It's rare but it does happen. We suspect it's a behavior exhibited by
certain browsers in combination with certain firewall settings, or
something like that.
>
> If you can't find a better solution (something weird is going on in my
> mind) maybe a work-around is mod_rewrite? You could link to the PHP
> script with a PDF extension and then rewrite it to the PHP extension
> behind the scenes.
I'll look into that. Thanks for the tip.
- Lewis
attached mail follows:
Lewis Kapell wrote:
> If this has nothing to do with PHP, maybe you can explain why the
> behavior was broken when I upgraded from 5.2.0 to 5.2.1, and started
> working again the instant I reverted back to 5.2.0. No other
> configuration changes were made on the web server.
>
> ??
>
> Thank you,
>
> Lewis Kapell
> Computer Operations
> Seton Home Study School
>
>
> Jochem Maas wrote:
>> Lewis Kapell wrote:
>>> There seems to be a behavior change introduced in 5.2.1 and I would like
>>> to know if it was deliberate.
>>>
> [snip]
>>
>> this is nothing to do with php - it's down to your webserver settings.
>>
>>
>
are you using the save php.ini file? If different, maybe their is
something that changed with the settings in that ini file.
Check to see if you had a auto_prepend_file setting that was taking care
of extracting that data from the URL and making it usable in the script.
I remember doing a hack for something like this that required parsing
the $_SERVER['QUERY_STRING'] back a few years ago.
--
Enjoy,
Jim Lucas
Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.
- Rush
attached mail follows:
On Mon, February 19, 2007 10:20 am, Lewis Kapell wrote:
> There seems to be a behavior change introduced in 5.2.1 and I would
> like
> to know if it was deliberate.
>
> A couple of years ago, PHP introduced functionality that made it
> possible to use a certain trick. I don't know how to describe this
> trick in words, so I will illustrate with an example.
>
> http://www.mydomain.com/mypage.php/phonypage.pdf
>
> In this example there is a PHP script called mypage.php which serves
> up
> a PDF. Putting the extra text at the end of the URL makes it appear
> to
> the user's browser that the URL ends with '.pdf' rather than '.php'.
> We
> introduced this hack at my company because a few users were unable to
> view pages containing PDF or RTF content, presumably because of some
> combination of browser and/or firewall settings.
>
> I find that version 5.2.1 breaks this behavior - attempting to visit a
> URL such as the above produces a 'page not found' error. Presumably
> because it is trying to find the file 'phonypage.pdf' which doesn't
> exist.
>
> My question is, should this be regarded as a bug which might be fixed?
> Or is this a deliberate change of behavior?
It seems MUCH more likely to be a webserver configuration issue, as
PHP has no control over what you are describing, really.
The web server chooses to invoke PHP, or not, based on web server
configuration.
Not aware of any way to mess this one up, mind you, but there it is...
So check your httpd.conf (or whatever IIS uses) settings.
BTW:
There was at least ONE browser way back in time, where the trick you
are using never worked anyway.
While I doubt that anybody on the planet is still using said browser
(we're talking a version 4.x minor IE release, I believe...) you may
want to consider the second half of this rant:
http://richardlynch.blogspot.com
So your URLs will just look like:
http://example.com/mypage.pdf
and the browser cannot POSSIBLY mess up because as far as the browser
can tell, it's just a static PDF file it is getting [*].
For example, this PDF:
http://uncommonground.com/events.pdf
is generated by this code:
http://uncommonground.com/events_pdf.phps
and it is just as dynamic as the HTML calendar, from which it springs:
http://uncommonground.com/events.htm
Some day I plan on combining the two scripts into one, actually, as
they are really mostly the same... But that's been on my "ToDo" list
for many years now, and is unlikely to get done RSN.
* To be pedantic, I should say that the browser cannot screw up any
more than it would for a static PDF, as it could still manage to screw
up quite a few things even with that... :-(
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Tue, 2007-02-20 at 17:21 +0100, Németh Zoltán wrote:
> AFAIK the english manual is more up to date, so I would follow that
>
> greets
> Zoltán Németh
>
> 2007. 02. 20, kedd keltezéssel 17.15-kor Christian Heinrich ezt írta:
> > Dear list,
> >
> > today, I read in a german PHP forum about a problem with accessing an
> > offset of a string.
> >
> > For example, if you have a variable like
> >
> > $string = "this is my string";
> >
> > and you want to access the third character at once, I would suggest to use
> >
> > $string{2}
Use [], internals recently (7 months or so ago) reversed their opinion
of on deprecating [] for strings in favour of {}. The {} almost got
deprecated itself, but was saved in lieu of user feedback on internals.
So it would seem [] is the superior choice and {} may someday get cut.
This is in spite of the PHP group original recommending {}.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
attached mail follows:
On Tue, February 20, 2007 10:15 am, Christian Heinrich wrote:
> today, I read in a german PHP forum about a problem with accessing an
> offset of a string.
>
> For example, if you have a variable like
>
> $string = "this is my string";
>
> and you want to access the third character at once, I would suggest to
> use
>
> $string{2}
>
> so this will return the "i".
>
> The (german!) manual says about that:
> (http://de.php.net/manual/de/language.types.string.php#language.types.string.substr)
>
>> *Anmerkung: * Für Abwärtskompatibilität können Sie für den selben
>> Zweck immer noch die Array-Klammern verwenden. Diese Syntax wird
>> jedoch seit PHP 4 missbilligt.
>
> (Translation:)
>
>> *Note: *For downwards compatibility you may use the array brackets
>> as
>> well. But as of PHP 4, this syntax is deprecated.
>
> The english manual says: (Link:
> http://de.php.net/manual/en/language.types.string.php#language.types.string.substr
> )
>
>> *Note: * They may also be accessed using braces like $str{42} for
>> the
>> same purpose. However, using square array-brackets is preferred
>> because the {braces} style is deprecated as of PHP 6.
>
>
> I'm a little bit confused by now. Which style should I pick? I use PHP
> 4
> and 5. Is there any other difference?
>
> It would be great if someone could solve that contradiction within the
> manual, too.
We have made a bit of a mess of this...
In early versions of PHP, it was considered "good" by the PHP Dev Team
to be able to access a string as an array.
$third = $foo[2];
$foo[2] = 'j';
Later PHP Dev Team members thought that was "icky" and decided to
change it to use {} and deprecated [].
Still others thought it was icky and one should only use substr to
read a string, and, I guess, never replace a single character directly
in a string.
Then, a backlash occurred, as far as I can tell, and [] was back in
vogue, or at least {} was deprecated.
There is still a camp that wants [] to die, and only have substr.
The German translation is "out of date", by one round of changes in
all this.
I am not 100% certain of the future status of [], but will personally
be pretty cranky if it goes away, as I happen to like it.
I know others feel differently, however, and would prefer to not have
yet another flame war on this issue, so am trying to present a
balanced view.
I suspect that even if [] is still deprecated, or again deprecated,
that it won't disappear as a feature for a long time, because it's
just "out there" in too much code, and will be almost impossible to
find and "fix"...
You may want to check in with the internals
list, as this is really
more their kind of question/discussion...
YMMV
NAIAA
IANAL
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Do you really need to use an RPM package to install a PHP on FC. Why not
"yum install php" instead... and for any extension you might want you just
install that as well "yum install php-gd" as example.
Best regards,
Peter Lauri
www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free
-----Original Message-----
From: edwardspl
ita.org.mo [mailto:edwardspl
ita.org.mo]
Sent: Tuesday, February 20, 2007 1:22 PM
To: fedora-list
redhat.com
Cc: php
Subject: [PHP] Install / update php rpm packages with FC6
Dear All,
Mine is FC6 System...
When I install the php rpm package, the problem as the following :
[svradmin
svr1 php]$ rpm -qa | grep "libc"
glibc-common-2.5-3
libcap-devel-1.10-25
libcroco-0.6.1-2.1
glibc-headers-2.5-3
glibc-2.5-3
libcap-1.10-25
libc-client2006-2006e-2.fc6
glibc-devel-2.5-3
libcroco-devel-0.6.1-2.1
[svradmin
svr1 php]$ sudo rpm -Uhv php*
warning: php-5.1.6-3.3.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key
ID 4f2a6fd2
error: Failed dependencies:
libc-client.so.1 is needed by php-imap-5.1.6-3.3.fc6.i386
[svradmin
svr1 php]$
Edward.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On 20/02/07, Delta Storm <delta.storm
hi.t-com.hr> wrote:
> Hi,
>
> I'm building an simple CMS system. I have built almost everything but
> one thing buggs me...
>
> I have a MySQL database built for publishing news
> (Id,title,newsContent,timestamp).
>
> And I have a php web page that displays that content. The problem is
> with the charset, in the database the settings are following:
>
> character set latin2 collation latin2_croatian_ci;
>
> and in the tables character set utf8;
>
> I display the data in the php page using utf8 I see all the non-PHP
> content pure HTML content capable of seeing croatian letter čćžšđ, but
> in the news section I only see čćđ. But they are on the same page!
>
> I tried putting other HTML charsets like iso-8859-1,iso-8859-2 etc...
> But in all the scenarios I get the HTMl part working but PHP not working
> vice-versa...
>
>
> Please help me it is a very important web page if you need any other
> information just ask!
>
> Thank you very much in advance!
>
Change it all to utf-8, and watch your problems disappear! I've lots
of experience with that in Hebrew website design.
Note that you will need the server to specify the utf-8 encoding in
the header. The metatag is not enough.
Dotan Cohen
http://what-is-what.com/what_is/buffer_overflow.html
http://lyricslist.com/lyrics/lyrics/47/402/pink_floyd/the_division_bell.html
attached mail follows:
How are you setting the charset of the web page? Are you using header() or
using html head section to set it?
Best regards,
Peter Lauri
www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free
-----Original Message-----
From: Delta Storm [mailto:delta.storm
hi.t-com.hr]
Sent: Tuesday, February 20, 2007 6:04 PM
To: php-general
lists.php.net
Subject: [PHP] Latin letter problem!
Hi,
I'm building an simple CMS system. I have built almost everything but
one thing buggs me...
I have a MySQL database built for publishing news
(Id,title,newsContent,timestamp).
And I have a php web page that displays that content. The problem is
with the charset, in the database the settings are following:
character set latin2 collation latin2_croatian_ci;
and in the tables character set utf8;
I display the data in the php page using utf8 I see all the non-PHP
content pure HTML content capable of seeing croatian letter čćľąđ, but
in the news section I only see čćđ. But they are on the same page!
I tried putting other HTML charsets like iso-8859-1,iso-8859-2 etc...
But in all the scenarios I get the HTMl part working but PHP not working
vice-versa...
Please help me it is a very important web page if you need any other
information just ask!
Thank you very much in advance!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On 20/02/07, Peter Lauri <lists
dwsasia.com> wrote:
> How are you setting the charset of the web page? Are you using header() or
> using html head section to set it?
>
First, the header() function. Then again in the <html> tag, and a
final time in the meta tag. This way cached pages and pages stored on
disk will display properly as well.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//HE"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="rtl" xmlns="http://www.w3.org/1999/xhtml" xml:lang="he" lang="he">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/5/112.html
http://what-is-what.com/what_is/website.html
attached mail follows:
I believe you want to send a query something like:
mysql_query("SET CHARACTER SET 'utf-8'");
to convince PHP / MySQL client/server interaction to also be in UTF-8,
on top of the internal storage engine storing things in UTF-8.
More info about this SET stuff is at:
http://dev.mysql.com/
I found the way to get PHP/MySQL to tell me what it was using, and
mine was already in UTF-8, so I didn't actually get as far as trying
it. :-v
On Tue, February 20, 2007 10:03 am, Delta Storm wrote:
> Hi,
>
> I'm building an simple CMS system. I have built almost everything but
> one thing buggs me...
>
> I have a MySQL database built for publishing news
> (Id,title,newsContent,timestamp).
>
> And I have a php web page that displays that content. The problem is
> with the charset, in the database the settings are following:
>
> character set latin2 collation latin2_croatian_ci;
>
> and in the tables character set utf8;
>
> I display the data in the php page using utf8 I see all the non-PHP
> content pure HTML content capable of seeing croatian letter
> čćžšđ, but
> in the news section I only see čćđ. But they are on the same page!
>
> I tried putting other HTML charsets like iso-8859-1,iso-8859-2 etc...
> But in all the scenarios I get the HTMl part working but PHP not
> working
> vice-versa...
>
>
> Please help me it is a very important web page if you need any other
> information just ask!
>
> Thank you very much in advance!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
PS
Mozilla-based browsers want your charset in the HTTP Content-type header
IE and IE-knockoff browsers want your charset in the META tags.
You have to do *both* to get all browsers to play nicely.
Sorry.
On Tue, February 20, 2007 10:03 am, Delta Storm wrote:
> Hi,
>
> I'm building an simple CMS system. I have built almost everything but
> one thing buggs me...
>
> I have a MySQL database built for publishing news
> (Id,title,newsContent,timestamp).
>
> And I have a php web page that displays that content. The problem is
> with the charset, in the database the settings are following:
>
> character set latin2 collation latin2_croatian_ci;
>
> and in the tables character set utf8;
>
> I display the data in the php page using utf8 I see all the non-PHP
> content pure HTML content capable of seeing croatian letter
> čćžšđ, but
> in the news section I only see čćđ. But they are on the same page!
>
> I tried putting other HTML charsets like iso-8859-1,iso-8859-2 etc...
> But in all the scenarios I get the HTMl part working but PHP not
> working
> vice-versa...
>
>
> Please help me it is a very important web page if you need any other
> information just ask!
>
> Thank you very much in advance!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
I currently have an html page that posts to a cgi function. I need to
interject some php in the middle. So, the form will post to itself, the php
page will catch the post, check on thing and then pass along to the cgi page
but the cgi page only handles posts. How can I still php in the middle and
still have it 'post' to the cgi page?
Thanks!
attached mail follows:
One simple way would be to have php send the page to the client. Then,it will
look for the response.
blackwater dev wrote:
> I currently have an html page that posts to a cgi function. I need to
> interject some php in the middle. So, the form will post to itself, the
> php
> page will catch the post, check on thing and then pass along to the cgi
> page
> but the cgi page only handles posts. How can I still php in the middle and
> still have it 'post' to the cgi page?
>
> Thanks!
>
attached mail follows:
Currently the form posts to /cgi/process
Process does all sorts of stuff. I basically just want to step in the
middle and do one small php thing and then send the form on to the process
cgi script just like the form had posted it there.
On 2/20/07, Al <news
ridersite.org> wrote:
>
> One simple way would be to have php send the page to the client. Then,it
> will
> look for the response.
>
> blackwater dev wrote:
> > I currently have an html page that posts to a cgi function. I need to
> > interject some php in the middle. So, the form will post to itself, the
> > php
> > page will catch the post, check on thing and then pass along to the cgi
> > page
> > but the cgi page only handles posts. How can I still php in the middle
> and
> > still have it 'post' to the cgi page?
> >
> > Thanks!
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
fsockopen can probably help you with that http://www.php.net/fsockopen
Best regards,
Peter Lauri
www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free
-----Original Message-----
From: blackwater dev [mailto:blackwaterdev
gmail.com]
Sent: Tuesday, February 20, 2007 9:45 PM
To: php-general
lists.php.net
Subject: [PHP] php forcing a post??
I currently have an html page that posts to a cgi function. I need to
interject some php in the middle. So, the form will post to itself, the php
page will catch the post, check on thing and then pass along to the cgi page
but the cgi page only handles posts. How can I still php in the middle and
still have it 'post' to the cgi page?
Thanks!
attached mail follows:
Or cURL: http://php.net/curl
Best regards,
Peter Lauri
www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free
-----Original Message-----
From: blackwater dev [mailto:blackwaterdev
gmail.com]
Sent: Tuesday, February 20, 2007 9:45 PM
To: php-general
lists.php.net
Subject: [PHP] php forcing a post??
I currently have an html page that posts to a cgi function. I need to
interject some php in the middle. So, the form will post to itself, the php
page will catch the post, check on thing and then pass along to the cgi page
but the cgi page only handles posts. How can I still php in the middle and
still have it 'post' to the cgi page?
Thanks!
attached mail follows:
Peter Lauri wrote:
> Or cURL: http://php.net/curl
Seems like a lot of work to me, not to mention added complexity. I
highly doubt there's anything you can do in PHP that you can't do in the
CGI script.
If you really must do this, the easiest way would be to have the CGI
call out to a PHP script, rather than trying to intercept the request
itself.
Alternatively, do an AJAX request in the onsubmit for the form that does
the PHP bit, and if the response is good, then post the form.
-Stut
> -----Original Message-----
> From: blackwater dev [mailto:blackwaterdev
gmail.com]
> Sent: Tuesday, February 20, 2007 9:45 PM
> To: php-general
lists.php.net
> Subject: [PHP] php forcing a post??
>
> I currently have an html page that posts to a cgi function. I need to
> interject some php in the middle. So, the form will post to itself, the php
> page will catch the post, check on thing and then pass along to the cgi page
> but the cgi page only handles posts. How can I still php in the middle and
> still have it 'post' to the cgi page?
>
> Thanks!
>
attached mail follows:
On Tue, February 20, 2007 1:45 pm, blackwater dev wrote:
> I currently have an html page that posts to a cgi function. I need to
> interject some php in the middle. So, the form will post to itself,
> the php
> page will catch the post, check on thing and then pass along to the
> cgi page
> but the cgi page only handles posts. How can I still php in the
> middle and
> still have it 'post' to the cgi page?
Google for "Rasmus Lerdorf" "function PostToHost"
It's a lot simpler than you'd think, actually.
You just fsockopen to port 80, compose a valid POST HTTP request and
write it out.
If you have file uploads in the original form, life gets slightly more
complex, as you have to compose a more complicated POST, I guess, but
it should still be a lot easier than you may be thinking.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Hello,
You can use the tutorial in the following link :)
http://www.phpbuilder.com/tips/item.php?id=239
--
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net
""blackwater dev"" <blackwaterdev
gmail.com>, haber iletisinde sunlari
yazdi:34a9824e0702201145o7e650711teb1a2a2a703dfbe6
mail.gmail.com...
>I currently have an html page that posts to a cgi function. I need to
> interject some php in the middle. So, the form will post to itself, the
> php
> page will catch the post, check on thing and then pass along to the cgi
> page
> but the cgi page only handles posts. How can I still php in the middle
> and
> still have it 'post' to the cgi page?
>
> Thanks!
>
attached mail follows:
Just a general question that I donąt know the answer to. I have users
inputting data via an HTML form. I want to make sure that if they cut and
paste from say Word that all the weird characters are converted to plain
text (preferably utf-8 since thatąs what my database is). How would I go
about doing this?
Thanks!
attached mail follows:
On Tue, February 20, 2007 3:49 pm, Jay Paulson wrote:
> Just a general question that I donąt know the answer to. I have users
> inputting data via an HTML form. I want to make sure that if they cut
> and
> paste from say Word that all the weird characters are converted to
> plain
> text (preferably utf-8 since thatąs what my database is). How would I
> go
> about doing this?
There are several examples in User Contributed Notes at:
http://php.net/str_replace
Probably some more examples in preg_replace.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Dave Goodchild wrote:
> Hi all. I have an odd problem.
>
> I am building an events directory and when users search, they provide a
> date
> range ie Feb 16 2007 to March 12 2007 as one of the options for searching.
> The system then creates an array of timestamps from this and then polls the
> database for all events whose lifetimes (start to end data) intersect with
> or contain the user date ranges. The system then checks how many of those
> dates map onto the dates provided by the user and returns an array of
> events
not directly related to your problem but sounds like your doing the search the
hard way .... there should be no need to create an array of timestamps ...
SELECT * FROM foo WHERE (startdate BETWEEN ? AND ?) OR enddate BETWEEN (? AND ?)
http://dev.mysql.com/doc/refman/4.1/en/comparison-operators.html
> on specific dates, all by comparing timestamps.
>
> The system is working like a dream apart from the following. If the user
> selects a start date prior to March 26 2007 or after October 29th 2007 all
> is well. If they specify a start date after March 26 the events are not
> being pulled in.
>
> I have converted the user-friendly date output to timestamps to check and
> sure enough, when the user selects a start date before March 26 2007, March
> 26 2007 is output as:
>
> 1174863600
>
> ...after that it becomes:
>
> 1174860000
>
> ...a difference of 3600
>
> Is this anything to do with leap seconds or any other clock drift
> phenomenon
> anyone has seen before? Much hair being torn out at present!
>
attached mail follows:
On Tue, February 20, 2007 8:25 am, Dave Goodchild wrote:
> I am building an events directory and when users search, they provide
> a date
> range ie Feb 16 2007 to March 12 2007 as one of the options for
> searching.
> The system then creates an array of timestamps from this and then
Why would you create a range, which could potentially be quite a large
set, instead of using the SQL "BETWEEN" operator, or even just using:
WHERE whatdate >= '$start_date'
AND whatdate <= '$end_date'
It just seems to me like you are creating a giant JOIN for no real
purpose, which is going to end up slogging your database as soon as
you extend the date range out more than a few weeks...
> polls the
> database for all events whose lifetimes (start to end data) intersect
> with
> or contain the user date ranges. The system then checks how many of
> those
> dates map onto the dates provided by the user and returns an array of
> events
> on specific dates, all by comparing timestamps.
>
> The system is working like a dream apart from the following. If the
> user
> selects a start date prior to March 26 2007 or after October 29th 2007
> all
> is well. If they specify a start date after March 26 the events are
> not
> being pulled in.
>
> I have converted the user-friendly date output to timestamps to check
> and
> sure enough, when the user selects a start date before March 26 2007,
> March
> 26 2007 is output as:
>
> 1174863600
>
> ...after that it becomes:
>
> 1174860000
>
> ...a difference of 3600
>
> Is this anything to do with leap seconds or any other clock drift
> phenomenon
> anyone has seen before? Much hair being torn out at present!
This probably is a daylight savings time issue...
But if you don't care about the hour/minute/second, you probably
should not be messing with Unix time-stamp in the first place...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Tue, February 20, 2007 8:32 am, Balasubramanyam A wrote:
> I'm new to this group and I'm learning PHP. I want to know what is the
> exact
> definition for "Language Construct". Could someone please explain
> about
> this?
It's kind of like the "core language definition" of things such as:
if (...)
while (...)
<?php and ?>
and so on
In PHP, a handful of common things that many beginners *THINK* are
functions are acutally Language Constructs:
require
include
echo
isset
I belive most of them are documented as such in the manual now.
Language Construct roughly corresponds to the "grammar" of the
language, if you will.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
We'd have to see source, but odds are really good that you are doing
something like this:
$page = $_SESSION['page'];
$query = "select stuff from reeds where .. limit 10 * $page";
$_SESSION['page'] = $_GET['page'];
So you are updating the 'page' a bit "too late"
Of course, you've got a few hundred more lines of code in between all
that, so it's not clear to you that this is happening.
Add a bunch of:
echo "page: $page<br />\n";
lines all over the place until you can track it down.
Or if this site is live, do more like:
error_log(__FILE__ . ': ' . __LINE__ . " page: $page");
If all else fails, re-post, but include a link to your actual PHP
source code.
You can copy it into a .txt file, or, for maximum geekinees, on a Un*x
based box, you can:
ln -s products_list.php products_list.phps
You then configure Apache to display .phps files as PHP Source (it
should be in there but commented out) and then a link to the .phps
file looks something like this:
http://uncommonground.com/events.phps
Only your code is probably/hopefully way more better than that old
code I wrote.
On Tue, February 20, 2007 4:40 am, Chris Aitken wrote:
> Hi All,
>
>
>
> I am clutching at straws here, but I have come across an issue that I
> don't
> know whether it's a PHP problem in my coding, or HTML, or something
> entirely
> different but I've never seen this happen before, and this list has
> always
> helped me out in the past with odd problems.
>
>
>
> I am developing a site at the moment which is causing a very unusual
> trait
> in both mozilla and opera browsers.
>
>
>
> http://www.reedsandmore.com.au/index2.php
>
>
>
> For example..
>
>
>
> * Click on Clarinet Reeds & More
> * Click on Bb Clarinet Reeds
> * You will see the first page showing the first 12 items (hopefully it
> will)
> * Scroll to the bottom and click on "Next"
> * Look at the page that gets refreshed... it's the first page again.
> Yet in the URL it shows the URL for "page=2"
> * Now to actually bring up page 2, you can click on RELOAD, or simply
> click on "Next" at the bottom of the screen again. This will bring up
> the
> proper page 2.
> * Now do the same to bring up page 3. Same thing occurs. Page 2 is
> re-displayed, and page 3 will not come up until you click on Next
> again, or
> click on RELOAD.
> * The same thing happens in reverse back down through the pages.
>
>
>
> If anyone can point me in the right direction of this or if you have
> come
> across this in the past, please any assistance would be greatly
> appreciated.
> The code is valid to XHTML 1.0 Transitional as my initial thought was
> that
> something wasn't valid.
>
>
>
> Any help will be appreciated.
>
>
>
>
>
>
>
> Regards
>
>
>
>
> Chris Aitken
> The Web Hub Designer and Programmer
> Phone : 02 4648 0808
> Mobile : 0411 132 075
>
>
>
> -------------------------------------------------
>
>
>
> Making The Web Work........ The Web Hub
> <http://www.thewebhub.com.au/> http://www.thewebhub.com.au/
> <mailto:chris
thewebhub.com.au> chris
thewebhub.com.au
>
>
>
> -------------------------------------------------
>
>
>
> Confidentiality Statement:
> This message is intended only for the use of the Addressee and may
> contain
> information that is PRIVILEDGED and CONFIDENTIAL. If you are not the
> intended recipient, dissemination of this communication is prohibited.
> If you have received this communication in error, please erase all
> copies of the message and its attachments and notify us immediately.
>
>
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Mon, February 19, 2007 6:50 pm, Matt Arnilo S. Baluyos (Mailing
Lists) wrote:
> Hello everyone,
>
> I'm planning to put up a local classified ads website and I'm looking
> for an open-source script for this.
>
> I've already had some links from Google and Sourceforge but I'd like
> to get some opinions on people who've already run a classifieds
> website as to what they're using and what they think of it.
Is Craigslists available as source?... :-)
As a surfer of classified ads, I'd have to say the most disappointing
feature, for me, is usually the search. I rarely can get it to find
what I want, and end up browsing through a lot of junk just to find
the content I desire, or giving up as I run out of time...
So without recommending any particular package, I'd suggest focusing
on the search engine a lot.
I'd also go out on a limb and suggest looking for one that's heavily
CSS based, so you have good odds on getting the look you want without
altering source code too much.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Mon, February 19, 2007 9:43 am, alex handle wrote:
> A minute ago i tried to run my test script (remote.php) on the shell
> and the
> remote fopen works!!
> The problem must be within the php apache module or apache self.
> Is there a way to debug the php apache module?
Step #1.
Create a page with <?php phpinfo();?> in it, surf to it, and find the
allow_url_fopen setting within that output.
I'm betting dollars to donuts that the php.ini you changed has not yet
been read by your webserver, because it isn't the right php.ini, or
because you forgot to re-start Apache.
Step #2.
It's possible that your httpd.conf is messed up so that Apache (and
thus PHP module) cannot manage to do a hostname lookup. If that's the
case, you probably need to be checking in httpd.conf and asking on the
Apache list...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Mon, February 19, 2007 9:03 am, Danial Rahmanzadeh wrote:
> how can i use css with mail()?
> thank u
Don't.
HTML enhanced (cough, cough) email is used predominantly by spammers,
so if you do this, you'll be back here in a few days/weeks/months
asking what you can do to get your email to get through all the spam
filters, and we'll just tell you to stop doing HTML-enhanced email.
So let's save you, and us, a month-long debacle here, okay?
If you absolutely positively cannot convince the client to not use
HTML enhanced email, the MIME email class on http://phpclasses.org
will take care of the grungy details, or you could use the PEAR class
for this or you could Google for "PHP MIME email" and find a few
zillion pages.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Mon, February 19, 2007 10:56 am, Sancar Saran wrote:
> On Monday 19 February 2007 17:03, Danial Rahmanzadeh wrote:
>> how can i use css with mail()?
>> thank u
>
> <?php
> $data ='';
> $fp = fopen ("site/themes/".$arrStat['theme']."/css/main.css","r");
> while (!feof($fp)) { $data.= fgets($fp, 16384); }
>
> $mail="
> <html>
> <head>
> <title>Title</title>
> <style>".$data."</style>
> </head>
> <body>
> Html content
> </body>
> </html>";
>
> mail('anrah
gmail.com', 'You are welcome', $mail);
> ?>
No.
This will only work on very badly-broken email clients.
I believe, in fact, that the only email client broken enough for this
to work is Outlook.
Though I suspect some very lame web-based email client might actually
work, come to think of it.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Hi,
On Wednesday 21 February 2007 01:14, Richard Lynch wrote:
> On Mon, February 19, 2007 10:56 am, Sancar Saran wrote:
> > On Monday 19 February 2007 17:03, Danial Rahmanzadeh wrote:
> >> how can i use css with mail()?
> >> thank u
> >
> > <?php
> > $data ='';
> > $fp = fopen ("site/themes/".$arrStat['theme']."/css/main.css","r");
> > while (!feof($fp)) { $data.= fgets($fp, 16384); }
> >
> > $mail="
> > <html>
> > <head>
> > <title>Title</title>
> > <style>".$data."</style>
> > </head>
> > <body>
> > Html content
> > </body>
> > </html>";
> >
> > mail('anrah
gmail.com', 'You are welcome', $mail);
> > ?>
>
> No.
>
> This will only work on very badly-broken email clients.
Really ?
I did not have to much choices to check it, In KMAIL everything looks nice.
Thanks for info
> I believe, in fact, that the only email client broken enough for this
> to work is Outlook.
>
> Though I suspect some very lame web-based email client might actually
> work, come to think of it.
attached mail follows:
Just a guess:
You could perhaps run all your data through base64 encoding or
somesuch to be certain the characters to be serialized are all "nice"
On Mon, February 19, 2007 8:56 am, Youri LACAN-BARTLEY wrote:
> Hi all,
>
> I'm just curious to find out if I'm the only person to have bumped
> into
> this kind of issue with serialize/unserialize.
>
> When I try and serialize an array containing a string value with the
> "±"
> character (alt+241 ASCII) such as :
> "120GB 2X512MB 15.4IN DVD±RW VHP FR"
>
> The resulting serialized array is truncated.
> ie. I would obtain :
>
> "a:17:{i:0;s:1:"A";i:1;s:7:"TOSHIBA";i:2;s:4:"3740";i:3;s:7:"404D862";i:4;s:31:"SATELLITE
> A100-044 CD/T2060-1.6";i:5;s:35:"120GB 2X512MB 15.4IN DVD"
>
> As you can see serialization seems to stall as soon as the "±"
> character
> shows up.
>
> Do any of you have the same issue? And what could be a work around for
> this sort of problem.
>
> This has occurred on a Windows XP box running PHP 5.2.0. The string is
> obtained from a CSV file using ANSI encoding.
>
> Thanks,
>
> Youri
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Sun, February 18, 2007 3:06 pm, jekillen wrote:
> iterator $i and given a_$i+1 names. If I test for the field names
> on post literally, a_1, a_2, a_...n, the values are getting posted
> properly.
Save yourself a LOT of headaches and index-munging and just do this:
<input name"a[1]" value="whatever" />
<input name"a[2]" value="whatever" />
<input name"a[3]" value="whatever" />
Then:
$a = $_POST['a'];
//$a is now an array with indices 1, 2, and 3.
The time you spend re-writing it this way will be paid off almost
immediately.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Use "View Source" on the Yahoo! page.
There's no PHP in this question at all.
It's all HTML, CSS, and JavaScript.
On Sun, February 18, 2007 3:23 am, Chris Carter wrote:
>
> Need some help on getting some database result in a css popup like
> yahoo. The
> requirement is to open a div or a window similar to yahoo one. As you
> can
> see from the link below.
>
> http://news.yahoo.com/s/ap/20070218/ap_on_go_co/us_iraq
>
> On this if you click on the Images next to the links "Iraq",
> "President
> Bush", "Hillary Rodham Clinton", "Pentagon", etc. This opens a div
> within
> the page with the search result. They are using some JavaScript to
> achieve
> this.
>
> Is there anyone with idea of where to find a code for a similar kind
> of
> window. I need to present data from database in a similar kind or
> window.
>
> Any link, text to search in google or code would do :-|
>
> Thanks in advance,
>
> Chris
> --
> View this message in context:
> http://www.nabble.com/needed-Yahoo-like-window-for-db-query.-tf3247592.html#a9027932
> Sent from the PHP - General mailing list archive at Nabble.com.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Sat, February 17, 2007 8:19 pm, Skip Evans wrote:
> I get the feeling from not finding an argument for
> the path on the client's machine for the complete
> path of a file in $_FILES that it might not be
> available for security reasons?
Yes.
It's none of your business where I store the file on my hard drive. :-)
Sorry.
> The reason I am interested in this is to restore
> the value of a input type='file' field in a form if
> the user has to return to the form for validation
> reasons.
One way this can be handled is the way Squirrel mail does it:
Accept the upload on your server in some kind of staging area.
Give the user the option of including that file, already uploaded,
and/or uploading another.
This has an added bonus of not making them upload a dang file just
because they mis-typed their email or whatever else failed validation.
You then just have to process the files from the staging area to the
final resting place after everything passes validation.
> I'd like to restore the full value so the user does
> not have to browse the file again.
>
> Is there a way to do this?
Not the way you are thinking, no.
> I thought perhaps there might be a
> $_FILES['image']['path'] value or something.
One can see where you would think that, and everybody thinks this at
first, until they think about it more, and realize just how much it
would reveal about the users' computer and the Privacy Issues it opens
up, and then they're like, "Ohmigod, how could I have thought that was
a Good Idea?!"
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
If those files exist, you have probably managed to mix-n-match
extension versions with your PHP install.
You can't do that.
Extension versions and PHP version have to match.
If those files don't exist at all, you forgot to ask for these
extensions when you re-compiled PHP, or forgot to use your package
manager to ask for them separately when you installed.
On Sat, February 17, 2007 7:53 pm, Noah wrote:
>
> Hi,
>
> I am running apache-2.2.4 and php5-5.2.1-2
> and I am find some php related errors accumulating in
> /var/log/messages - look below.
>
> I've rebuilt php5 and apache2.2.4 and still the same issues. what
> else
> could be going on here.
>
> also 'apache restart' is fine but 'apache graceful' core dumps.
>
> any clues,
>
> Noah
>
>
> here they are:
>
> Feb 17 17:07:03 typhoon httpd: PHP Warning: PHP Startup: Unable to
> load
> dynamic library '/usr/local/lib/php/20060613-debug/ftp.so' - Cannot
> open
> "/usr/local/lib/php/20060613-debug/ftp.so" in Unknown on
> line 0
> Feb 17 17:07:03 typhoon httpd: PHP Warning: PHP Startup: Unable to
> load
> dynamic library '/usr/local/lib/php/20060613-debug/ldap.so' - Cannot
> open "/usr/local/lib/php/20060613-debug/ldap.so" in Unknown
> on
> line 0
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Sat, February 17, 2007 2:49 pm, Peter Lauri wrote:
> I am executing exec('some cool command', $stdout, $exitcode);
>
> That is fine. I get what I in the beginning wanted. However, now I
> need to
> catch the STDERR that the command is generating as well. Some of you
> might
> tell me to redirect STDERR to STDOUT, but that is not possible as I
> need to
> use the STDOUT as is to automate a process.
>
> I know I can do fwrite(STDERR, 'Output some error\n');
>
> So could I fread(STDERR, SOMESIZE)?
Do you need STDERR to go "out" to, err, wherever it goes, *AND* get it
into your PHP script?
Perhaps 'tee' (man tee) would let you do that.
Or do you just need STDOUT in one variable, and STDERR in another,
both in PHP?
I think you could do something in shell to re-bind STDOUT to some
other file/pipe, and then run your cool command...
$tmpfile = tmpfile(); //I always get this one wrong.
exec("rebind 2 $tmpfile; some cool command', $output, $error);
$stderr = file_get_contents($tmpfile);
It's probably not called 'rebind' but I know it's some shell command
that does this.
Possibly shell-specific, so you may even need to wrap the whole thing
in a 'bash' call.
Another option is to try to write a .sh shell script to get what you
want for STDOUT to go where you want, and THEN just call that script
(which has 'some cool command' at the end) from PHP, and let the
weird-o shell stuff be done in a shell script, and not clutter up your
PHP code with a complex shell script setup/tear-down.
> Is there anyone with experience of best way of doing this? Should I
> maybe
> use proc_open or something similar and then write it to a file, and
> then
> read that file? Hrm, doesn’t make any sense to do that.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
[snip]
Do you need STDERR to go "out" to, err, wherever it goes, *AND* get it
into your PHP script?
Perhaps 'tee' (man tee) would let you do that.
Or do you just need STDOUT in one variable, and STDERR in another,
both in PHP?
I think you could do something in shell to re-bind STDOUT to some
other file/pipe, and then run your cool command...
$tmpfile = tmpfile(); //I always get this one wrong.
exec("rebind 2 $tmpfile; some cool command', $output, $error);
$stderr = file_get_contents($tmpfile);
It's probably not called 'rebind' but I know it's some shell command
that does this.
Possibly shell-specific, so you may even need to wrap the whole thing
in a 'bash' call.
Another option is to try to write a .sh shell script to get what you
want for STDOUT to go where you want, and THEN just call that script
(which has 'some cool command' at the end) from PHP, and let the
weird-o shell stuff be done in a shell script, and not clutter up your
PHP code with a complex shell script setup/tear-down.
[/snip]
I'd like to get STDERR into one variable in PHP and STDOUT into one. This so
that when we execute a script and there is an exit code different from 0 I
want to show a log of error/notices during the script. Actually I want to
show the whole process if it fails so 2>&1 for exit code not equal to 0.
I'll probably end up writing a patch for exec now :)
/Peter
www.dwsasia.com
www.lauri.se
www.carbon-free.org.uk
attached mail follows:
On Sat, February 17, 2007 8:50 am, Beauford wrote:
> I've been over this a thousand times with various users on this list
> and
> escaping this and escaping that just doesn't matter.
>
> The error is that it thinks valid characters are invalid. In the case
> of the
> example I included, the ! and the period are invalid, which they
> should not
> be.
>
> The nocomments and invalidchars are constants.
>
> Thanks
>
>> -----Original Message-----
>> From: Ray Hauge [mailto:ray
primateapplications.com]
>> Sent: February 17, 2007 9:45 AM
>> To: Beauford
>> Cc: PHP
>> Subject: Re: [PHP] LOL, preg_match still not working.
>>
>> Maybe you just copied it wrong, but nocomments and
>> invalidchars are not
>> quoted, or they're constants.
>>
>> I don't think you have to, but you might need to escape some of the
>> characters (namely * and .) in your regex. It's been a while, so
>> I'd
>> have to look it up.
>>
>> What's the error you are getting?
>>
>> Ray Hauge
>> Primate Applications
>>
>>
>> Beauford wrote:
>> > Hi,
>> >
>> > I previously had some issues with preg_match and many of
>> you tried to help,
>> > but the same problem still exists. Here it is again, if
>> anyone can explain
>> > to me how to get this to work it would be great - otherwise
>> I'll just remove
>> > it as I just spent way to much time on this.
>> >
>> > Thanks
>> >
>> > Here's the code.
>> >
>> > if(empty($comment)) { $formerror['comment'] = nocomments;
>> > }
>> > elseif(!preg_match('|^[a-zA-Z0-9!?
#$%^&*();:_.\\\\ /\t-]+$|',
I believe you want:
'|^[a-z0-9!\\?
#\\$%^&\\*\\(\\);:_\\.\\\\ /\\t-]+$|'
In particular:
? means "maybe or maybe not the last PCRE expression", so the ! was
maybe or maybe not exluded. Escape the ? with \\?
$ means "end", so escape that.
* means 0 or more, so escape that.
( and ) are used to capture the contents of a matching sub-expresson.
Escape those.
. means ANY character, so escape that.
\t would work only inside of "" in PHP, not '', so you want PHP \\t to
turn into \t for PCRE which I think turns into a tab character...
Actually, change the ' to " and use \t and then I'm *sure* it is a
tab.
I'm almost for sure that at least some of the above is utter nonsense
inside the [] where the "special" characters are not "special" at all,
but I can never remember the rules, and since '\\x' for a non-special
character turns into 'x' anyway, it doesn't "hurt" -- though it does
clutter up the PCRE for an expert, who wonders why the heck you did
that...
You should also re-read http://php.net/pcre and the two main pages
after that yet again. I've read them 500 times, and some of it has
actually sunk in, so you're probably only got another 50 or so to go
before it works for you :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Sat, February 17, 2007 1:53 pm, clive wrote:
> Denis L. Menezes wrote:
>> Dear friends.
>>
>> I have a site where I have news headers. I wish to count the clicks
>> on the
>> news headers so that I can see how many times each of the the news