Re: [PHP] convert a string into an array

2010-04-09 Thread Rene Veerman
On Mon, Apr 5, 2010 at 4:09 PM, Ashley Sheridan 
wrote:

>   On Mon, 2010-04-05 at 05:53 +0100, Nathan Rixham wrote:
>
> you sure you're only smoking cigarettes?
>
> has to be one of the most random replies to any php thread I've ever
> seen - awesome!
>
> regards
>
> Rene Veerman wrote:
> > yea i'm not the only one with those type of problems. sometimes times
> > slows down in my room so much not even my speakers sound normal
> > anymore; equipment that doesn't work (despite being crappy and known
> > by it's patterns of refusal to work; still EXTRA abnormal since about
> > a week or so)...
> >
> > it sounds like the "who's reading my passwords with me while i type 'm
> > in... === 'is there anyone looking over my shoulder despite no living
> > humans even in my entire properly locked room (with strong walls)'
> >
> > the idea here is; take a break. work on a different project for a week
> > or so, but the best idea is; move around through the country side and
> > realize that your car will get gas at every gasstation... check your
> > atm cards, but not your online banking account status, just to buy a
> > pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of
> > your favorite smokes(cigarettes in this case), but buy 10 packs with
> > that card, and make sure you have enough good old cash that you know
> > to be truely valid (coins are best) to get just "2 large packs of
> > cigarettes"..
> >
> > things like that will give you the confidence you need to proceed on
> > your project i think..
> >
> > the #1 rule i use (when you dont yet have any need for a #0 rule or a
> > #-1 rule (dont add those lightly and never on a whim or hope of being
> > saved from death in the next 5 minutes)) is: truely honest living
> > humans should never use the same type of lie construct in the same
> > type of situation for the second time within at least 1 to 3 weeks..
> > but hey, necessity may require you to break any rule...
> >
> > rules? only guidelines are usefull ;) (pirates of the caribean #1 movie)
> >
> >
> > On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine  wrote:
> >> Hello everyone,
> >>
> >> It's quite simple but I'm still stuck.
> >> What I need is the following: I have an array as a parameter of my
> >> custom function. However, I'd like to allow users to enter a string
> >> instead of an array. In this case (if the parameter is a string), it
> >> must be replaced with an array containing only one item - actually,
> >> that string.
> >> What I'm doing gives me (presumably) errors;
> >> function Send ($tonames, $toemails, $subject, $message) {
> >> ...
> >> if ((!is_array($tonames)) || (!is_array($toemails))) {
> >> $tonames[]=$tonames;
> >> $toemails[]=$toemails;
> >> }
> >>
> >> I can't give the new array a new name since I address it further in a
> >> loop as my function's parameter... hope you understand what I'm
> >> saying)
> >> Thanks!
> >>
> >> --
> >> With best regards from Ukraine,
> >> Andre
> >> Http://oire.org/  - The Fantasy blogs of Oire
> >> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> >> jabber.org
> >> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> >> Twitter: http://twitter.com/m_elensule
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
>
>
>
>
> Virus maybe?
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
yup, i'm on the global anti-t-viral team.
and as such more often a target of deaththreats through telepathy than most
other humans in my (economic) position.

however, if you dont believe in telepathy; KEEP IT THAT WAY :)))

"hearing voices" is only the snow on the tip of the iceberg when it comes to
telepathy (between (living) humans and non-human intelligences..

and i'll really try to make this my last telepathy-related post to this
list, this year at least...

-- 
-
Greetings from Rene7705,

I have made some free open source webcomponents designed
and written by me available through:
http://code.google.com/u/rene7705/ , or
http://mediabeez.ws (latest dev versions, currently offline)
-


Re: [PHP] convert a string into an array

2010-04-09 Thread Rene Veerman
it's about telepathy. mass-telepathy ;)

telepathic pressure.
death threats through telepathy, of which i've had quite a few in past weeks..

fear begets fear begets disease...

but thanks for the compliment ;)

On Mon, Apr 5, 2010 at 6:53 AM, Nathan Rixham  wrote:
> you sure you're only smoking cigarettes?
>
> has to be one of the most random replies to any php thread I've ever
> seen - awesome!
>
> regards
>
> Rene Veerman wrote:
>> yea i'm not the only one with those type of problems. sometimes times
>> slows down in my room so much not even my speakers sound normal
>> anymore; equipment that doesn't work (despite being crappy and known
>> by it's patterns of refusal to work; still EXTRA abnormal since about
>> a week or so)...
>>
>> it sounds like the "who's reading my passwords with me while i type 'm
>> in... === 'is there anyone looking over my shoulder despite no living
>> humans even in my entire properly locked room (with strong walls)'
>>
>> the idea here is; take a break. work on a different project for a week
>> or so, but the best idea is; move around through the country side and
>> realize that your car will get gas at every gasstation... check your
>> atm cards, but not your online banking account status, just to buy a
>> pack of cigarettes with an atm card. and then, buy not 1 or 2 packs of
>> your favorite smokes(cigarettes in this case), but buy 10 packs with
>> that card, and make sure you have enough good old cash that you know
>> to be truely valid (coins are best) to get just "2 large packs of
>> cigarettes"..
>>
>> things like that will give you the confidence you need to proceed on
>> your project i think..
>>
>> the #1 rule i use (when you dont yet have any need for a #0 rule or a
>> #-1 rule (dont add those lightly and never on a whim or hope of being
>> saved from death in the next 5 minutes)) is: truely honest living
>> humans should never use the same type of lie construct in the same
>> type of situation for the second time within at least 1 to 3 weeks..
>> but hey, necessity may require you to break any rule...
>>
>> rules? only guidelines are usefull ;) (pirates of the caribean #1 movie)
>>
>>
>> On Sat, Apr 3, 2010 at 1:05 AM, Andre Polykanine  wrote:
>>> Hello everyone,
>>>
>>> It's quite simple but I'm still stuck.
>>> What I need is the following: I have an array as a parameter of my
>>> custom function. However, I'd like to allow users to enter a string
>>> instead of an array. In this case (if the parameter is a string), it
>>> must be replaced with an array containing only one item - actually,
>>> that string.
>>> What I'm doing gives me (presumably) errors;
>>> function Send ($tonames, $toemails, $subject, $message) {
>>> ...
>>> if ((!is_array($tonames)) || (!is_array($toemails))) {
>>> $tonames[]=$tonames;
>>> $toemails[]=$toemails;
>>> }
>>>
>>> I can't give the new array a new name since I address it further in a
>>> loop as my function's parameter... hope you understand what I'm
>>> saying)
>>> Thanks!
>>>
>>> --
>>> With best regards from Ukraine,
>>> Andre
>>> Http://oire.org/ - The Fantasy blogs of Oire
>>> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
>>> jabber.org
>>> Yahoo! messenger: andre.polykanine; ICQ: 191749952
>>> Twitter: http://twitter.com/m_elensule
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>
>



-- 
-
Greetings from Rene7705,

I have made some free open source webcomponents designed
and written by me available through:
http://code.google.com/u/rene7705/ , or
http://mediabeez.ws (latest dev versions, currently offline)
-

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



Re: [PHP] 404 redirects "stolen" by provider

2010-04-09 Thread kranthi
header('HTTP/1.1 200 Ok');
in /subapp_members/search_user.php will do the job

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



Re: [PHP] another "useless" message.

2010-04-09 Thread Rene Veerman
On Sat, Apr 10, 2010 at 12:08 AM, Rene Veerman  wrote:
> On Fri, Apr 9, 2010 at 3:49 PM, Dan Joseph  wrote:
>> On Fri, Apr 9, 2010 at 6:28 AM, Peter Lind  wrote:
>>
>>> That said, there can be little doubt that the response you got went a
>>> tad too far - some netiquette lessons would be useful, I think.
>>>
>>>
>>
>> In defense of the people that react harshly, there has been a lot of people
>> who just spam the list over the years.  Its a natural reaction.
>>
>> You may want to put that kind of thing in your signature also.  Rather than
>> making announcements that bother people, when you participate, your message
>> will go out.  Although, don't make it 100 lines long...
>>
>> --
>> -Dan Joseph
>>
>> www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
>> Code "NEWTHINGS" for 10% off initial order
>>
>> http://www.facebook.com/canishosting
>> http://www.facebook.com/originalpoetry
>>
>
> Very good point; i've set a gmail signature, which will not change
> much i believe.
>
> --
> -
> Greetings from Rene7705,
> creator of open-source web-components: htmlMicroscope(googlecode),
> visCanvasLoaderIcon(not online atm), and buttonAnimate (jQuery based,
> not online atm).
>


ok, last one then; my sig is now this; and i'm posting this because i
took the effort to put my other components online too..

this'll be my "final" sig for a while i think.

-- 
-
Greetings from Rene7705,

I have made some free open source webcomponents designed and written
by me available through
http://code.google.com/u/rene7705/ , or
http://mediabeez.ws (latest dev versions, currently offline)
-

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



Re: [PHP] another "useless" message.

2010-04-09 Thread Rene Veerman
On Fri, Apr 9, 2010 at 3:49 PM, Dan Joseph  wrote:
> On Fri, Apr 9, 2010 at 6:28 AM, Peter Lind  wrote:
>
>> That said, there can be little doubt that the response you got went a
>> tad too far - some netiquette lessons would be useful, I think.
>>
>>
>
> In defense of the people that react harshly, there has been a lot of people
> who just spam the list over the years.  Its a natural reaction.
>
> You may want to put that kind of thing in your signature also.  Rather than
> making announcements that bother people, when you participate, your message
> will go out.  Although, don't make it 100 lines long...
>
> --
> -Dan Joseph
>
> www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
> Code "NEWTHINGS" for 10% off initial order
>
> http://www.facebook.com/canishosting
> http://www.facebook.com/originalpoetry
>

Very good point; i've set a gmail signature, which will not change
much i believe.

-- 
-
Greetings from Rene7705,
creator of open-source web-components: htmlMicroscope(googlecode),
visCanvasLoaderIcon(not online atm), and buttonAnimate (jQuery based,
not online atm).

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



Re: [PHP] another "useless" message.

2010-04-09 Thread Rene Veerman
ok, you're right, of course.

me posting that was not just about "another plug for htmlmicroscope".

there were other, secret, considerations, that led me to post that.

--!!
but i hereby promise to really try to use only bottom-posting replies
and cut-out-posting replies on this list in winter time, when i
actually can afford the concentration to supply useful programming
tips.
--!!
right now, i'm still a bit stressed. personal reasons.

On Fri, Apr 9, 2010 at 12:28 PM, Peter Lind  wrote:
> On 9 April 2010 12:20, Rene Veerman  wrote:
>> lolz :)) u try to be nice, and this is what u get?!?! :-D
>>
>
> Rene, it's nice of you to post messages on the availability of some OS
> tools. However, you should also be aware that it's a minority of
> people on this list that use those tools - which in effect means that
> you're posting stuff that at best is irrelevant to a lot of people and
> at worst is seen as spam by those people.
>
> That said, there can be little doubt that the response you got went a
> tad too far - some netiquette lessons would be useful, I think.
>
>
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> 
>

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



[PHP] Re: APC with horde/imp: 99.9% miss rate and only one cached file

2010-04-09 Thread Derek Chen-Becker
Well, downgrading APC from 3.1.3b1 to 3.0.19 fixed it. Working great now!

On 04/08/2010 02:21 PM, Derek Chen-Becker wrote:
> I suspect I've either done something horribly wrong or found a weird
> bug, probably the former. I'm running PHP 5.2.13 on Solaris 10 under
> Apache 2.2.14. Memory usage is 98.8% free (default 1 slice of 30MB).
> Here are stats on the cache:
> 
> Cached Files  1 (288.2 KBytes)
> Hits  4146
> Misses3579033
> Request Rate (hits, misses)   358.68 cache requests/second
> Hit Rate  0.42 cache requests/second
> Miss Rate 358.26 cache requests/second
> Insert Rate   0.00 cache requests/second
> Cache full count  0
> 
> And here is my config in php.ini:
> 
> extension=apc.so
> error_reporting = E_ALL ^ E_DEPRECATED
> apc.report_autofilter = 1
> log_errors = 1
> 
> If I restart apache, a different file gets cached each time (it rotates
> between a very small subset of all of the PHP files in horde).
> Sometimes, 2 or even 3 files get cached, but I've never had it go above
> 3. I've been googling around and reading the list archives but I can't
> find anything that seems to be related to this. Am I misunderstanding
> the purpose of APC? I thought that it would attempt to cache all PHP
> files that are requested.
> 
> I turned on the report_autofilter in an attempt to diagnose the issue,
> but nothing shows up in the error log. Here is the config as shown by
> apc.php:
> 
> apc.cache_by_default  1
> apc.canonicalize  1
> apc.coredump_unmap0
> apc.enable_cli0
> apc.enabled   1
> apc.file_md5  0
> apc.file_update_protection2
> apc.filters   
> apc.gc_ttl3600
> apc.include_once_override 0
> apc.lazy_classes  0
> apc.lazy_functions0
> apc.max_file_size 1M
> apc.mmap_file_mask
> apc.num_files_hint1000
> apc.preload_path  
> apc.report_autofilter 1
> apc.rfc1867   0
> apc.rfc1867_freq  0
> apc.rfc1867_name  APC_UPLOAD_PROGRESS
> apc.rfc1867_prefixupload_
> apc.rfc1867_ttl   3600
> apc.shm_segments  1
> apc.shm_size  30
> apc.stat  1
> apc.stat_ctime0
> apc.ttl   0
> apc.use_request_time  1
> apc.user_entries_hint 4096
> apc.user_ttl  0
> apc.write_lock1
> 
> 
> Any help would be greatly appreciated.
> 
> Thanks,
> 
> Derek
> 


-- 
--
Derek Chen-Becker
Senior Network Engineer, Security Architect
CPI Corp, Inc.
1706 Washington Ave
St. Louis, MO 63103
Phone: 314-231-7711 x6455
Fax:   314-613-6724
dbec...@cpicorp.com
PGP Key available from public key servers
Fingerprint: E4C4 26C0 8588 E80A C29F  636D 1FBE 0FE3 2871 4AE8
--

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



Re: [PHP] 404 redirects "stolen" by provider

2010-04-09 Thread Peter Lind
On 9 April 2010 23:08, Merlin Morgenstern  wrote:
>
> Am 09.04.2010 22:58, schrieb Peter Lind:
>>
>> On 9 April 2010 22:20, Merlin Morgenstern  wrote:
>>
>>>
>>> This sounds like the best solution to me. The only problem is that my
>>> regex
>>> knowledge is pretty limited. The command:
>>> RewriteRule ^(.+) /subapp_members/search_user.php
>>>
>>>
>>
>> The above rule will try to redirect everything to
>> /subapp_members/search_user.php. If you're looking to allow
>> example.com/username, then use something like:
>>
>> RewriteCond %{REQUEST_FILENAME} !-f
>> RewriteCond %{REQUEST_FILENAME} !-d
>> RewriteRule ^(.*)$ /subapp_members/search_user.php?member=$1 [L]
>>
>> This is likely to not do what you want from it, but it's the closest I
>> can guess as to what you want.
>>
>> Have a read of http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
>>
>>
>
>
> This will not work, as I do have a bunch of other redirects inside the page.
>
> What might work is a rule, that redirects urls that do not have a full stop
> or slash inside. Is this possible? My regex knowledge is unfortunatelly
> pretty limited.
>

Try:

RewriteRule ^([^./]+)$ /yourfile.php?variable=$1 [L]

Apart from that, rewrite rules work in order. If a rule above this
triggers and has the L flag, those below won't get processed.

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP] 404 redirects "stolen" by provider

2010-04-09 Thread Merlin Morgenstern


Am 09.04.2010 22:58, schrieb Peter Lind:

On 9 April 2010 22:20, Merlin Morgenstern  wrote:
   

This sounds like the best solution to me. The only problem is that my regex
knowledge is pretty limited. The command:
RewriteRule ^(.+) /subapp_members/search_user.php

 

The above rule will try to redirect everything to
/subapp_members/search_user.php. If you're looking to allow
example.com/username, then use something like:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subapp_members/search_user.php?member=$1 [L]

This is likely to not do what you want from it, but it's the closest I
can guess as to what you want.

Have a read of http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

   



This will not work, as I do have a bunch of other redirects inside the 
page.


What might work is a rule, that redirects urls that do not have a full 
stop or slash inside. Is this possible? My regex knowledge is 
unfortunatelly pretty limited.


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



Re: [PHP] 404 redirects "stolen" by provider

2010-04-09 Thread Peter Lind
On 9 April 2010 22:20, Merlin Morgenstern  wrote:
> This sounds like the best solution to me. The only problem is that my regex
> knowledge is pretty limited. The command:
> RewriteRule ^(.+) /subapp_members/search_user.php
>

The above rule will try to redirect everything to
/subapp_members/search_user.php. If you're looking to allow
example.com/username, then use something like:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subapp_members/search_user.php?member=$1 [L]

This is likely to not do what you want from it, but it's the closest I
can guess as to what you want.

Have a read of http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP] 404 redirects "stolen" by provider

2010-04-09 Thread Merlin Morgenstern


Am 09.04.2010 21:53, schrieb Ashley Sheridan:

On Fri, 2010-04-09 at 21:29 +0200, Merlin Morgenstern wrote:

Hello,

I am running a website under apache and php where I do redirects on 404
errors:

apache conf:
ErrorDocument 404 /subapp_members/search_user.php

This is done to allow ULRs with usernames like this:
www.server.com/username  

The PHP script search_user.php looks in a db if the user name is
existent and if yes shows his member page. If the name is not existent
it displays an internal 404 message.

This worked perfectly for recent years until now. Some users complain
that they do see advertisement instead of the page. A research showed
that they are using a provider called "unitymedia". As soon as a site
has a page not found error it redirects them to their own advertisement
page. This is true for all pages on the net. e.b. ebay.com/testing shows
their advertisement.

Has somebody an idea on how to fix that from my site?

Thank you for any help,

Merlin

 


It looks like the ISP is looking at the header response codes and 
capturing the 404 ones. I've seen other ISP's do this and return a 
search results page of their own sponsored content.


I think the best way round this is to use the .htaccess redirect rules 
instead to deliver the correct content:

RewriteRule ^(.+) /users.php?username=$1

Of course that's only a simple example, and you might need to tweak it 
a bit.


This way, no extra header codes are sent to the user, and can't be 
captured by anyones ISP.


Thanks,
Ash
http://www.ashleysheridan.co.uk




This sounds like the best solution to me. The only problem is that my 
regex knowledge is pretty limited. The command:

RewriteRule ^(.+) /subapp_members/search_user.php

leads to an internal server error, the syntax seams ok?! Could you help 
with the correct rewrite rule?


The script search_user.php gets the user name and looks it up in the db:
$parameter = explode('/', $_SERVER[REQUEST_URI]);
$user_name = addslashes($parameter[1]);

So I would need to redirect all potential 404s to that script. How could 
that rewriterule look like?


Re: [PHP] Re: 404 redirects "stolen" by provider

2010-04-09 Thread Ashley Sheridan
On Fri, 2010-04-09 at 21:03 +0100, Nathan Rixham wrote:

> Merlin Morgenstern wrote:
> > Hello,
> > 
> > I am running a website under apache and php where I do redirects on 404
> > errors:
> > 
> > apache conf:
> > ErrorDocument 404 /subapp_members/search_user.php
> > 
> > This is done to allow ULRs with usernames like this:
> > www.server.com/username
> > 
> > The PHP script search_user.php looks in a db if the user name is
> > existent and if yes shows his member page. If the name is not existent
> > it displays an internal 404 message.
> > 
> > This worked perfectly for recent years until now. Some users complain
> > that they do see advertisement instead of the page. A research showed
> > that they are using a provider called "unitymedia". As soon as a site
> > has a page not found error it redirects them to their own advertisement
> > page. This is true for all pages on the net. e.b. ebay.com/testing shows
> > their advertisement.
> > 
> > Has somebody an idea on how to fix that from my site?
> > 
> > Thank you for any help,
> > 
> 
> 
> yup, use a 303 See Other first of all
> 
> ErrorDocument 303 /subapp_members/search_user.php
> 
> then continue as normal; if you don't find the user set the status
> header to 404 and show your internal 404.
> 
> They may never see the internal 404; but in many browsers they won't any
> ways as most delegate it through to a "can't find, search with the
> google?? :-)" type page.
> 
> regards!
> 


Sending any headers other than a 200 is still inviting this dubious ISP
to redirect it's customers to its own pages in an effort to gain
revenue. The ideal solution is to use mod_rewrite within the .htaccess
file, as this is completely transparent and the end user is non the
wiser.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Zend DB Table - WHERE as OR?

2010-04-09 Thread Andrew Ballard
On Fri, Apr 9, 2010 at 3:15 PM, Dan Joseph  wrote:
> Hi Everyone,
>
> I'm trying to figure out if something is even an option with the Zend
> Framework.  We use the DB Table stuff.  I don't see it in the manual, so I
> figured I'd ask you all...
>
> I have:
>
> $select = $table->select()->where( "home_team_id = ?", $home_team_id )
>                                  ->where( "away_team_id = ?", $away_team_id
> );
>
> This translates the where's to "home_team_id = 12 AND away_team_id = 15"...
>
> What I'd like to have is "home_team_id = 12 OR away_team_id = 15".
>
> Is this possible?  Or would I just need to build them all into a single
> where() manually?
>
> --
> -Dan Joseph
>


Try this:

select()->where( "home_team_id = ?", $home_team_id )
 ->orWhere( "away_team_id = ?", $away_team_id );



Andrew

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



[PHP] Re: 404 redirects "stolen" by provider

2010-04-09 Thread Nathan Rixham
Merlin Morgenstern wrote:
> Hello,
> 
> I am running a website under apache and php where I do redirects on 404
> errors:
> 
> apache conf:
> ErrorDocument 404 /subapp_members/search_user.php
> 
> This is done to allow ULRs with usernames like this:
> www.server.com/username
> 
> The PHP script search_user.php looks in a db if the user name is
> existent and if yes shows his member page. If the name is not existent
> it displays an internal 404 message.
> 
> This worked perfectly for recent years until now. Some users complain
> that they do see advertisement instead of the page. A research showed
> that they are using a provider called "unitymedia". As soon as a site
> has a page not found error it redirects them to their own advertisement
> page. This is true for all pages on the net. e.b. ebay.com/testing shows
> their advertisement.
> 
> Has somebody an idea on how to fix that from my site?
> 
> Thank you for any help,
> 


yup, use a 303 See Other first of all

ErrorDocument 303 /subapp_members/search_user.php

then continue as normal; if you don't find the user set the status
header to 404 and show your internal 404.

They may never see the internal 404; but in many browsers they won't any
ways as most delegate it through to a "can't find, search with the
google?? :-)" type page.

regards!

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



Re: [PHP] 404 redirects "stolen" by provider

2010-04-09 Thread Andrew Ballard
On Fri, Apr 9, 2010 at 3:29 PM, Merlin Morgenstern  wrote:
> Hello,
>
> I am running a website under apache and php where I do redirects on 404
> errors:
>
> apache conf:
> ErrorDocument 404 /subapp_members/search_user.php
>
> This is done to allow ULRs with usernames like this:
> www.server.com/username
>
> The PHP script search_user.php looks in a db if the user name is existent
> and if yes shows his member page. If the name is not existent it displays an
> internal 404 message.
>
> This worked perfectly for recent years until now. Some users complain that
> they do see advertisement instead of the page. A research showed that they
> are using a provider called "unitymedia". As soon as a site has a page not
> found error it redirects them to their own advertisement page. This is true
> for all pages on the net. e.b. ebay.com/testing shows their advertisement.
>
> Has somebody an idea on how to fix that from my site?
>
> Thank you for any help,
>
> Merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Is there anything in the request headers from these users that the
server could use to identify that they came from this provider? If so,
you could serve the 404 response with a 200 header. Effectively,
instead of having the server reply "No such page" to those request, it
is saying "Yes, there is no such page." It's a bit broken, IMO, but
you used to have to do something similar for WebTV. Their browser
would simply show a 404 dialog instead of the custom error page.

If you are feeling particularly spiteful toward "unitymedia," you
could even take the opportunity to add a message to your not-found
page for those people recommending a different provider that doesn't
hijack requests for missing content to another site.  :-)

Andrew

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



Re: [PHP] 404 redirects "stolen" by provider

2010-04-09 Thread Ashley Sheridan
On Fri, 2010-04-09 at 21:29 +0200, Merlin Morgenstern wrote:

> Hello,
> 
> I am running a website under apache and php where I do redirects on 404 
> errors:
> 
> apache conf:
> ErrorDocument 404 /subapp_members/search_user.php
> 
> This is done to allow ULRs with usernames like this:
> www.server.com/username
> 
> The PHP script search_user.php looks in a db if the user name is 
> existent and if yes shows his member page. If the name is not existent 
> it displays an internal 404 message.
> 
> This worked perfectly for recent years until now. Some users complain 
> that they do see advertisement instead of the page. A research showed 
> that they are using a provider called "unitymedia". As soon as a site 
> has a page not found error it redirects them to their own advertisement 
> page. This is true for all pages on the net. e.b. ebay.com/testing shows 
> their advertisement.
> 
> Has somebody an idea on how to fix that from my site?
> 
> Thank you for any help,
> 
> Merlin
> 


It looks like the ISP is looking at the header response codes and
capturing the 404 ones. I've seen other ISP's do this and return a
search results page of their own sponsored content.

I think the best way round this is to use the .htaccess redirect rules
instead to deliver the correct content:

RewriteRule ^(.+) /users.php?username=$1

Of course that's only a simple example, and you might need to tweak it a
bit.

This way, no extra header codes are sent to the user, and can't be
captured by anyones ISP.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] No notices for undefined index

2010-04-09 Thread Ashley Sheridan
On Fri, 2010-04-09 at 14:15 +0100, Nathan Rixham wrote:

> Ashley Sheridan wrote:
> > can't find anything in the manual that explains what should happen when
> > you treat a string like an array in PHP. 
> 
> http://www.php.net/manual/en/language.types.string.php#language.types.string.substr
> 
> :)
> 


Thanks, and I think that page answers the whole question:

"Writing to an out of range offset pads the string with spaces.
Non-integer types are converted to integer. Illegal offset type emits
E_NOTICE. Negative offset emits E_NOTICE in write but reads empty
string. Only the first character of an assigned string is used.
Assigning empty string assigns NUL byte."

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] 404 redirects "stolen" by provider

2010-04-09 Thread Merlin Morgenstern

Hello,

I am running a website under apache and php where I do redirects on 404 
errors:


apache conf:
ErrorDocument 404 /subapp_members/search_user.php

This is done to allow ULRs with usernames like this:
www.server.com/username

The PHP script search_user.php looks in a db if the user name is 
existent and if yes shows his member page. If the name is not existent 
it displays an internal 404 message.


This worked perfectly for recent years until now. Some users complain 
that they do see advertisement instead of the page. A research showed 
that they are using a provider called "unitymedia". As soon as a site 
has a page not found error it redirects them to their own advertisement 
page. This is true for all pages on the net. e.b. ebay.com/testing shows 
their advertisement.


Has somebody an idea on how to fix that from my site?

Thank you for any help,

Merlin

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



Re: [PHP] Zend DB Table - WHERE as OR?

2010-04-09 Thread Dan Joseph
On Fri, Apr 9, 2010 at 3:25 PM, Andrew Ballard  wrote:

> Try this:
>
>  $select = $table->select()->where( "home_team_id = ?", $home_team_id )
> ->orWhere( "away_team_id = ?",
> $away_team_id );
>
>
Perfect...thank you!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


[PHP] Zend DB Table - WHERE as OR?

2010-04-09 Thread Dan Joseph
Hi Everyone,

I'm trying to figure out if something is even an option with the Zend
Framework.  We use the DB Table stuff.  I don't see it in the manual, so I
figured I'd ask you all...

I have:

$select = $table->select()->where( "home_team_id = ?", $home_team_id )
  ->where( "away_team_id = ?", $away_team_id
);

This translates the where's to "home_team_id = 12 AND away_team_id = 15"...

What I'd like to have is "home_team_id = 12 OR away_team_id = 15".

Is this possible?  Or would I just need to build them all into a single
where() manually?

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Sort two coupled arrays [my solution]

2010-04-09 Thread Robert Cummings

tedd wrote:

Rob:

You're never confused because you are always right.


I should have you mention this to my wife... I'll provide the helmet >:)


Congrats, you were the first to solve this problem this simply.

To tell the truth, I didn't fully understand how array_multisort() 
worked until I reviewed your solution. I thought array_multisort() 
was to sort multi-dimensional arrays and simply overlooked the 
description that it could also sort several arrays at once. Duh -- 
sometimes my reading/comprehension skills suck.


Many thanks for your time.


No prob... was the first time I read up on multisort too :)

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] another "useless" message.

2010-04-09 Thread Dan Joseph
On Fri, Apr 9, 2010 at 6:28 AM, Peter Lind  wrote:

> That said, there can be little doubt that the response you got went a
> tad too far - some netiquette lessons would be useful, I think.
>
>

In defense of the people that react harshly, there has been a lot of people
who just spam the list over the years.  Its a natural reaction.

You may want to put that kind of thing in your signature also.  Rather than
making announcements that bother people, when you participate, your message
will go out.  Although, don't make it 100 lines long...

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Sort two coupled arrays [my solution]

2010-04-09 Thread tedd

At 10:26 AM -0400 4/8/10, Robert Cummings wrote:

tedd wrote:

At 8:28 AM -0400 4/8/10, Andrew Ballard wrote:

On Wed, Apr 7, 2010 at 6:46 PM, Ryan Sun  wrote:

 >

 rsort(array_combine(array2, array1));

 you should expect array(
  'Personal Email' => 75,
  'USPS mail' => 40,
  'Personal Phone' => 31,
  'Web site' => 31,
  'Text Message' => 31
 )

 logically, the items are your key but not the count of votes


That's the ticket. The solution is pretty simple now that we
understand the nature of the problem.  :-)

Andrew


Andrew:

Half the solution is understanding the problem.

However, the above solution only solves half the problem.


Maybe I'm confused... but can't the following be used?



Cheers,
Rob.


Rob:

You're never confused because you are always right.

Congrats, you were the first to solve this problem this simply.

To tell the truth, I didn't fully understand how array_multisort() 
worked until I reviewed your solution. I thought array_multisort() 
was to sort multi-dimensional arrays and simply overlooked the 
description that it could also sort several arrays at once. Duh -- 
sometimes my reading/comprehension skills suck.


Many thanks for your time.

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



Re: [PHP] No notices for undefined index

2010-04-09 Thread Nathan Rixham
Ashley Sheridan wrote:
> can't find anything in the manual that explains what should happen when
> you treat a string like an array in PHP. 

http://www.php.net/manual/en/language.types.string.php#language.types.string.substr

:)

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



RE: [PHP] Forgot what to install

2010-04-09 Thread Bob McConnell
From: David McGlone

> On Fri, 2010-04-09 at 08:37 +0530, kranthi wrote:
>> you forgot httpd
>> KK.
>> 
>> On Fri, Apr 9, 2010 at 08:32, David McGlone 
wrote:
>> > Hey guys, quick question. I had to re-install my Ubuntu, and I
forgot
>> > what package I needed so firefox will display the php files and not
ask
>> > me to if I want to download them. I've done installed PHP5, mysql,
and
>> > php-mysql. What did I miss. I know the package name, but it's
completely
>> > slipping my mind right now.
> 
> Thanks everyone for the suggestions. Last night before I went to bed I
> replied to my own question to let everyone know that all I needed to
do
> was restart apache, but what I didn't realize until I got up this
> morning was when I hit reply, I replied to myself so only I got the
> message.

Sometimes that's all that matters. But thanks for letting us know you
solved your problem.

Bob McConnell

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



Re: [PHP] Forgot what to install

2010-04-09 Thread David McGlone
On Fri, 2010-04-09 at 08:37 +0530, kranthi wrote:
> you forgot httpd
> KK.
> 
> 
> 
> On Fri, Apr 9, 2010 at 08:32, David McGlone  wrote:
> > Hey guys, quick question. I had to re-install my Ubuntu, and I forgot
> > what package I needed so firefox will display the php files and not ask
> > me to if I want to download them. I've done installed PHP5, mysql, and
> > php-mysql. What did I miss. I know the package name, but it's completely
> > slipping my mind right now.

Thanks everyone for the suggestions. Last night before I went to bed I
replied to my own question to let everyone know that all I needed to do
was restart apache, but what I didn't realize until I got up this
morning was when I hit reply, I replied to myself so only I got the
message.


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



RE: [PHP] No notices for undefined index

2010-04-09 Thread Bob McConnell
From: Shawn McKenzie

> Bob McConnell wrote:
>> In the first case, $a=5 creates a multi-typed variable. The
interpreter
>> makes its best guess how the next two expressions should be
interpreted.
>> In both cases, they look a lot like an index into a character array
>> (string), and 'test' evaluates numerically to zero. Both are valid
>> offsets for a string, so no messages are generated.
>> 
>> In the second case, $a is explicitly declared as an array. This give
the
>> interpreter a lot more detail to work from. The two expressions are
now
>> an index and a key for the array. But both of them evaluate to
offsets
>> that have not been assigned, which raises a flag and creates the
>> warnings.
>> 
>> Such are the joys of loosely typed languages.
> 
> Yes, this is what I was thinking as well, however:
> 
> $a=5;
> print $a[0];   // if it is index 0 then it should print 5 yes?
> print $a[100]; // there is no index 100 so why no notice?

I'm assuming that the PHP interpreter works much like a C compiler. i.e.
It doesn't keep track of the size of strings. It knows that $a maps to a
memory location, and $a[100] maps to that location plus 100 characters.
As long as that is still a valid memory address for this process, it
doesn't see anything wrong. If it is outside the process memory, you are
more likely to get a General Protection Fault, or the equivalent OS
error.

In security parlance, this is what is known as a buffer overflow error.
The application programmer is responsible for keeping track of string
sizes and insuring that indexes don't move past the end of the allocated
space. It is also why functions like snprintf should be used instead of
sprintf.

Bob McConnell

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



Re: [PHP] another "useless" message.

2010-04-09 Thread Peter Lind
On 9 April 2010 12:20, Rene Veerman  wrote:
> lolz :)) u try to be nice, and this is what u get?!?! :-D
>

Rene, it's nice of you to post messages on the availability of some OS
tools. However, you should also be aware that it's a minority of
people on this list that use those tools - which in effect means that
you're posting stuff that at best is irrelevant to a lot of people and
at worst is seen as spam by those people.

That said, there can be little doubt that the response you got went a
tad too far - some netiquette lessons would be useful, I think.


-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP] another "useless" message.

2010-04-09 Thread Rene Veerman
lolz :)) u try to be nice, and this is what u get?!?! :-D


On Fri, Apr 9, 2010 at 11:52 AM, Nilesh Govindarajan  wrote:
> Somebody ban this person. He/she is creating nuisance here. ^)
>
> --
> Nilesh Govindarajan
> Site & Server Administrator
> www.itech7.com
> मेरा भारत महान !
> मम भारत: महत्तम भवतु !
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] another "useless" message.

2010-04-09 Thread Nilesh Govindarajan

Somebody ban this person. He/she is creating nuisance here. ^)

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

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



Re: [PHP] Beginner's question: How to run a PHP web application locally?

2010-04-09 Thread Rene Veerman
cmon, just search for "ubuntu install lamp" via google..

or google for "download ubuntu", select the stable branch (karmic),
install it, and then type this into a terminal window:

sudo apt-get install apache2 mysql5 php5

from there, running LAMP development on linux should be a breeze for you.


On Thu, Apr 8, 2010 at 1:42 PM, Bastien Helders  wrote:
> Hi List,
>
> The other day, I read an article that mentioned about a tool that would
> permit to simulate a web environment for PHP, so that testing could be made
> before uploading the page on the server. Unfortunately, I don't seem to find
> the article again.
>
> So here am I with this question: What should I need to set my test
> environment? I'm working on Windows, but I'm all ears for solution on Linux
> systems.
>
> Best Regards,
> Bastien
>

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



Re: [PHP] No notices for undefined index

2010-04-09 Thread Ashley Sheridan
On Fri, 2010-04-09 at 07:52 +0530, kranthi wrote:

> >> print $a[0];   // prints 5
> >> print $a[100]; // Notice: Uninitialized string offset:  100
> Yup, this should happen when 5 is treated as an array of characters.
> In other words as a string.
> $a = '5';
> echo $a[0];
> echo $a[100];
> gives you the expected result
> 
> regarding the original question, i think that the interpreter is
> prefilling the variable with null
> 
> $a = 5;
> var_dump(isset($a[0]));
> var_dump($a[0]);
> 
> since $a[0] is already assigned (to null) the interpreter is not
> throwing a notice
> 
> $b = null;
> var_dump(isset($b));
> var_dump($b);
> 


If $a is treated as an array of characters, then $a[0] is always the
first character, not null.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] Sending e-mail through an SMTP with authentification

2010-04-09 Thread Andre Polykanine
Hello everyone,
Sorry, don't remember who exactly needed this functionality. My class
is finally ready and approved by the site admins)
http://www.phpclasses.org/package/6128

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



[PHP] another "useless" message.

2010-04-09 Thread Rene Veerman
Service Announcement :))

htmlMicroscope on http://mediabeez.ws/ is down because of technical
difficulties, not-related to the body of the owner of the machine that
runs mediabeez.ws atm.
That mediabeez.ws runs on a home PC (ubuntu karmic), but i'm away from
home atm, travelling around, and the thing has died on me too many
times, so i'm not even going to try to ssh to it atm..

Please apologize my earlier -way out of line for a list like this-
remarks about "letting programmers hit me, and me taking them down
without any effort". I was _STRESSED_ when i wrote that.

Again, please take this as: mediabeez.ws will be back up, with the 3
open-source gifts i have.
If you need the "latest" development copy of htmlMicroscope (something
to look at very large arrays in a browser with), then google for
"htmlmicroscope" and use the googlecode.com(?) link.

My other components, visCanvasLoaderGraphic/Icon and buttonAnimated
(jQuery based), are not available online anywhere.
But you may pass them around of course, as per open source contract styles..

Good luck,
and take care of your loved ones, as i am doing atm.

Greetings,
 Rene Veerman
 Somewhere in .nl, nice weather atm.

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