php-general Digest 12 Aug 2005 08:12:29 -0000 Issue 3620
Topics (messages 220467 through 220508):
Re: PHP and Active Directory
220467 by: Jay Blanchard
220468 by: xfedex
220470 by: Jay Blanchard
220471 by: John Nichel
220472 by: xfedex
220475 by: John Nichel
220476 by: Jay Blanchard
220478 by: tg-php.gryffyndevelopment.com
220479 by: xfedex
220480 by: Jay Blanchard
220481 by: xfedex
220491 by: Jochem Maas
220506 by: Esteamedpw.aol.com
making checkbox's and radio buttons sticky
220469 by: zedleon
220499 by: Jochem Maas
Re: possible bug (string equality to zero)?
220473 by: tg-php.gryffyndevelopment.com
CPU Usage
220474 by: Evert | Rooftop
220482 by: Patrick - Jupiter Hosting
220504 by: kalinga
Re: graph - dowloads/hr
220477 by: Sebastian
Re: PHP, SSL and private keys
220483 by: Manuel Lemos
Re: PHP & smarty - nested queries and arrays
220484 by: Matthew Weier O'Phinney
220489 by: Jochem Maas
220501 by: mikespook
Blatantly Evil Question
220485 by: Brian Dunning
220486 by: Brian Dunning
220487 by: Brian Dunning
220488 by: Jasper Bryant-Greene
220492 by: Jochem Maas
220493 by: Jasper Bryant-Greene
220494 by: Philip Hallstrom
220495 by: Jochem Maas
220496 by: Matthew Weier O'Phinney
220497 by: Jasper Bryant-Greene
220498 by: Jochem Maas
Re: IP & Geographical
220490 by: Rob Agar
Tip for 'New People'/Beginners/Noobs [was] Re: [PHP] PHP & smarty - nested
queries and arrays
220500 by: Jochem Maas
Getting average down to 5
220502 by: Ryan A
220503 by: Sebastian
Re: Best practices for deleting and restoring records - moving vs flagging
220505 by: James Kaufman
220507 by: Arno Coetzee
XSL namespaces and callbacks
220508 by: Torgny Bjers
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
[snip]
> Are you, at all, familiar with TFM?
>
TFM?.....mmmmm no, can you tell me where to start?
[/snip]
You can start by RTFM and STFW and STFA. I gave you a link in the last
e-mail. Here is another...
http://catb.org/~esr/faqs/smart-questions.html
--- End Message ---
--- Begin Message ---
> [snip]
> > Are you, at all, familiar with TFM?
> >
>
> TFM?.....mmmmm no, can you tell me where to start?
> [/snip]
>
> You can start by RTFM and STFW and STFA. I gave you a link in the last
> e-mail. Here is another...
>
> http://catb.org/~esr/faqs/smart-questions.html
>
Sorry, dont have time for this right now...Anyway, thanks for your answer!
pancarne.
--- End Message ---
--- Begin Message ---
[snip]
Sorry, dont have time for this right now...Anyway, thanks for your
answer!
[/snip]
You don't have time to read the manual?
--- End Message ---
--- Begin Message ---
xfedex wrote:
[snip]
Are you, at all, familiar with TFM?
TFM?.....mmmmm no, can you tell me where to start?
[/snip]
You can start by RTFM and STFW and STFA. I gave you a link in the last
e-mail. Here is another...
http://catb.org/~esr/faqs/smart-questions.html
Sorry, dont have time for this right now...Anyway, thanks for your answer!
You don't have time for RTFM/STFW/STFA?? You're not going to get a lot
of help here.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
> [snip]
> Sorry, dont have time for this right now...Anyway, thanks for your
> answer!
> [/snip]
>
> You don't have time to read the manual?
>
Jay, maybe this way you can understand my first question:
IF (have you been able to make PHP to authenticate against AD) {
echo $comments; //Only comments & experiences please
} else {
//DONT REPLY
}
So, if you dont have any 'constructive' comment, suggestion or
experience, please dont reply.
English (as you can read) is no my native language, so I lost a lot of
(precious) time repling your non-sense answers.
Salud!
pancarne.
--- End Message ---
--- Begin Message ---
xfedex wrote:
<snip who cares>
Welcome to /dev/null I hope you enjoy your stay.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
[snip]
So, if you dont have any 'constructive' comment, suggestion or
experience, please dont reply.
English (as you can read) is no my native language, so I lost a lot of
(precious) time repling your non-sense answers.
[/snip]
My non-sense answers pointed you to the LDAP functions for use with
Active Directory. That is very constructive until you ask for something
more specific.
--- End Message ---
--- Begin Message ---
Just to clearify what you're trying to do. Maybe LDAP (or the ADLDAP?
suggestion) isn't what you need.
Are you trying to have a user type their username and password into a web form
and have PHP pass that information to an active directory server? Or are you
trying to make sure that the user is authencated and get their username and
such?
If the user's computer is on the network with the AD server and they log into
the domain on their PC (either directly or via VPN), then you can get their
authenticated username from the web server (IIS at least).
In this case, the user has already logged in and you're just grabbing the
validated username for logging purposes or something like that.
You have to enable NT Integrated Auth (aka NTLM) on the web server.
Once the IIS server is properly configured and the user is logged into the
domain, you can get their username via $_SERVER['AUTH_USER'].
Make sure "Basic" and "Anonymous" auth are turned off in IIS.
If you want to transparently pass a user's authentication information from a
user's workstation all the way through to a SQL Server or something, that's a
little more complicated. But possible I believe.
Can you give more detail on what you're trying to accomplish?
-TG
= = = Original message = = =
Hi,
Have someone make PHP to authenticate against AD?
Any comment, suggestion will be greatly appreciated.
Thanks,
pancarne.
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
> My non-sense answers pointed you to the LDAP functions for use with
> Active Directory. That is very constructive until you ask for something
> more specific.
Jay,
I was specting something like:
"Yes, i have php to authenticate against AD, and i can say that is
easy/hard. I make it work using LDAP (http://www.php.net/ldap)"
or something like that.
Instead, WE lost time figuring out what would be a smart question or a
non-asked answer.
Really, is so hard to understand my original question??
Please, dont answer unless you sometime get it working (PHP + AD).
(and sorry again for my ugly english)
Saludos!
pancarne.
--- End Message ---
--- Begin Message ---
[snip]
"Yes, i have php to authenticate against AD, and i can say that is
easy/hard. I make it work using LDAP (http://www.php.net/ldap)"
[/snip]
If that is what you were expecting you didn't read my original reply...
[quote]
Are you, at all, familiar with TFM?
http://www.php.net/ldap
[/quote]
There you go. Asked and answered.
Warmest regards....
--- End Message ---
--- Begin Message ---
> Just to clearify what you're trying to do. Maybe LDAP (or the ADLDAP?
> suggestion) isn't what you need.
>
> Are you trying to have a user type their username and password into a web
> form and have PHP pass that information to an active directory server? Or
> are you trying to make sure that the user is authencated and get their
> username and such?
>
> If the user's computer is on the network with the AD server and they log into
> the domain on their PC (either directly or via VPN), then you can get their
> authenticated username from the web server (IIS at least).
>
> In this case, the user has already logged in and you're just grabbing the
> validated username for logging purposes or something like that.
>
> You have to enable NT Integrated Auth (aka NTLM) on the web server.
>
> Once the IIS server is properly configured and the user is logged into the
> domain, you can get their username via $_SERVER['AUTH_USER'].
>
> Make sure "Basic" and "Anonymous" auth are turned off in IIS.
>
>
> If you want to transparently pass a user's authentication information from a
> user's workstation all the way through to a SQL Server or something, that's a
> little more complicated. But possible I believe.
>
> Can you give more detail on what you're trying to accomplish?
>
> -TG
>
> = = = Original message = = =
>
> Hi,
>
> Have someone make PHP to authenticate against AD?
> Any comment, suggestion will be greatly appreciated.
>
> Thanks,
> pancarne.
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
>
Thanks TG! (Look Jay, thats an answer!!)
The idea is that the users dont have to login on each web aplication
im serving. So, if they are loged into de domain (using AD), they dont
need to login on each web aplication.
The server were i will host the aplications is a gentoo + apache2.
Saludos!
pancarne.
--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
[snip]
"Yes, i have php to authenticate against AD, and i can say that is
easy/hard. I make it work using LDAP (http://www.php.net/ldap)"
[/snip]
If that is what you were expecting you didn't read my original reply...
[quote]
Are you, at all, familiar with TFM?
Jay,
in Holland (maybe whole of europe?) we have a(nother) shitty
music channel called TMF - maybe he got confused.
BTW xfedex you just alienated 2 of the most prolific and experienced
php guys on this list - stupid move, your perogative. I wouldn't classify
myself in their league but I'm surely in their camp.
/dev/null meet guy with weird moniker.
http://www.php.net/ldap
[/quote]
There you go. Asked and answered.
Warmest regards....
--- End Message ---
--- Begin Message ---
Is this something you're looking for?
_http://www.phpfreaks.com/scripts/User_Authentication/16.php_
(http://www.phpfreaks.com/scripts/User_Authentication/16.php)
--- End Message ---
--- Begin Message ---
I am new to php and am in need of some guidance
I am building a sticky form and am having trouble bringing in the data
fields for
checkbox's and radio button's. Any help on how to do this would be
appreciated
HTML form sample
<input name="gmev[]" type="checkbox" id="gmev" value="September 9th"></th>
PHP
<input name="gmev[]" type="checkbox" id="gmev" value="<? echo $gmev_day
?>"></th>
am I on the right track here?
zed
--- End Message ---
--- Begin Message ---
zedleon wrote:
I am new to php and am in need of some guidance
I am building a sticky form and am having trouble bringing in the data
sticky as in honey?
fields for
checkbox's and radio button's. Any help on how to do this would be
appreciated
HTML form sample
<input name="gmev[]" type="checkbox" id="gmev" value="September 9th"></th>
PHP
<input name="gmev[]" type="checkbox" id="gmev" value="<? echo $gmev_day
?>"></th>
am I on the right track here?
maybe, partially - generally radio buttons and checkboxes have fixed values -
it's the 'are they selected' part that probably want to make dynamic...
basically you need to conditionally add the attribute 'checked' (i.e.
checked="checked") to the radios and checkboxes you want selected when the
form is first shown.
e.g.
<?
if ($thisChkBoxIsInitiallySelected) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
echo '<input name="gmev[]" type="checkbox" id="gmev"',$checked,'/>';
?>
of course there are a million different ways to write this kind of thing
(i.e. don't take my example verbatim perse) but hopefully you get the idea.
zed
--- End Message ---
--- Begin Message ---
Using === should work. This is most likely because, if I remember correctly,
when you compare a string to a integer, it essentially does an intval(string).
If the string contains no numbers, you end up with nothing.. or zero.
It definitely isn't a bug and definitely has to do with type conversion though.
the triple equalsign deal should work since it forces PHP not to convert types.
-TG
= = = Original message = = =
>> No, Christopher, that is not a bug. As long as the var is empty, and if
>> you try to compare with 0, or false, it will report true in the
>> comparison because the variable does not contain anything, which will
>> mean false for a boolean and 0 for a variable. If you are attempting to
>> discover if a string contains data, use empty() instead. You can also
>> check if the string is null or actual zero (0).
>
> But the var isn't empty.
>
> $a[] = 'blah';
> $a[] = 'blah';
> $a['assoc'] = 'array';
> foreach ($a as $k => $v)
> if ($k == 'assoc')
> # do something
>
> The 'if' statement is incorrectly executing when $k is 0. I find it strange
> that 0 == any string. The way I see it, 0 is false. false == 'a string'
> should not be true.
>
You might try "===" instead of "==" to get type checking as well...
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
Hi All,
Is there a way to determine the current cpu usage using PHP. I'm mainly
looking for a linux solution, but I would like to expand it to windows
later on.
Any ideas? The archives weren't any good =(
Thanks,
Evert
--- End Message ---
--- Begin Message ---
Actually, yes there is :)
Do a google for phpsysinfo - that's exactly what you want, I guarantee
it :)
Patrick
On Thu, 2005-08-11 at 22:22 +0200, Evert | Rooftop wrote:
> Hi All,
>
> Is there a way to determine the current cpu usage using PHP. I'm mainly
> looking for a linux solution, but I would like to expand it to windows
> later on.
>
> Any ideas? The archives weren't any good =(
>
> Thanks,
> Evert
>
--- End Message ---
--- Begin Message ---
with php you can simply create your own system monitoring classes
using php snmp functions.
mrtg (http://mrtg.org) uses SNMP to manipulate system MIBs and OIDs to
retreave device informations.
happy PHP SNMP!
~viraj.
On 8/12/05, Evert | Rooftop <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> Is there a way to determine the current cpu usage using PHP. I'm mainly
> looking for a linux solution, but I would like to expand it to windows
> later on.
>
> Any ideas? The archives weren't any good =(
>
> Thanks,
> Evert
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
On Tue, August 9, 2005 3:07 pm, Sebastian wrote:
i'd like to create a graph with the amount of downloads per hour, i am a
little confused how i should go about this.
i know i can use rrdtool/mrtg, but im looking for more 'user friendly'
graphs with custom colors,etc.
each time someone downloads a file it is incremented in the db and the
last time the file was downloaded. i am unsure about the data i would
need to store to create and if what i am storing is enough to do this.
any suggestions or tools that already exists to create this types of
graph?
select count(*) as score from downloads where date_add(download_time,
interval 1 hour) >= now() group by filename order by score desc
Then you use jpgraph on that result set.
Or just roll your own with http://php.net/gd
Richard, the last download time is store in unix timestamp.. is it
possible to still do it?
thanks.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.6/69 - Release Date: 8/11/2005
--- End Message ---
--- Begin Message ---
Hello,
on 08/11/2005 04:04 PM Evert | Rooftop said the following:
I would like to give my users the possibility to authenticate through a
private certificate to confirm their identity. I'm not really sure where
to start.
Has anyone seen a website explaining this? Some pointers would be very
welcome.
Yes, you can use this HTTP client class to perform SSL request using
private certificates:
http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
* Amanda Hemmerich <[EMAIL PROTECTED]>:
> I'm using PHP and Smarty to try to build an array of arrays using the
> results from nested queries. I am just learning about nested arrays,
> and I'm not sure what I'm doing wrong.
>
> I am hoping someone can give me a hint as to what I am doing wrong. I
> looked on php.net, but still couldn't figure it out.
>
> If I remove the PHP foreach loop, it works fine, except, of course, no
> sub projects show up. The error must be in there, but I'm just not
> seeing it.
>
> I get the following error with the code below:
>
> Warning: Smarty error: unable to read resource: "welcome/Object.tpl" in
> /usr/local/lib/php/Smarty/Smarty.class.php on line 1088
Actually, this error indicates it either cannot find or open the
template file. make sure you have a 'welcome' directory in your
templates directory, and an Object.tpl file within -- and that they have
permissions such that the web server can open them.
--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/
--- End Message ---
--- Begin Message ---
Amanda Hemmerich wrote:
Hello!
I'm using PHP and Smarty to try to build an array of arrays using the
results from nested queries. I am just learning about nested arrays,
and I'm not sure what I'm doing wrong.
...
Can anyone point me in the right direction?
Amanda please don't cross-post. it's bad karma, ok your a
girl (or woman - you choose :-) so we'll let you off this time
(and the next, and the next)
... that's not to say girls are crap at IT/programming/etc it's just
we don't have enough girls on this list ;-)
(actually one of the php core devs is a girl and she's damn good
AFAICT - Sara Golemon is her name - she wrote the 'blackmagic' runkit
extension which deserves a round of applause all on it own!)
Thanks,
Amanda
--- End Message ---
--- Begin Message ---
Warning: Smarty error: unable to read resource: "welcome/Object.tpl" in
/usr/local/lib/php/Smarty/Smarty.class.php on line 1088
You should check your Smarty`s template_dir. Put the templates into the
template_dir, then the Smarty will find them.
Like this:
$smarty = new Smarty();
$smarty->template_dir = '/home/mike/tpl/';
$smarty->display('test.tpl');
You should put the file 'test.tpl' into dir '/home/mike/tpl'.
"Amanda Hemmerich" <[EMAIL PROTECTED]>
??????:[EMAIL PROTECTED]
> Hello!
>
> I'm using PHP and Smarty to try to build an array of arrays using the
> results from nested queries. I am just learning about nested arrays, and
> I'm not sure what I'm doing wrong.
>
> I am hoping someone can give me a hint as to what I am doing wrong. I
> looked on php.net, but still couldn't figure it out.
>
> If I remove the PHP foreach loop, it works fine, except, of course, no sub
> projects show up. The error must be in there, but I'm just not seeing
> it.
>
> I get the following error with the code below:
> Warning: Smarty error: unable to read resource: "welcome/Object.tpl"
> in /usr/local/lib/php/Smarty/Smarty.class.php on line 1088
> PHP STUFF
> $query ="SELECT * FROM projects WHERE parent_project_id is NULL OR
> parent_project_id = ''";
>
> $projects = $db->getAssoc($query, DB_FETCHMODE_ASSOC);
>
> foreach ($projects as $key => $project) {
> $query ="SELECT * FROM projects WHERE parent_project_id =
> $projects[$key]['project_id']";
> $sub = $db->getAssoc($query, DB_FETCHMODE_ASSOC);
> $projects[$key]['subs'] = $sub;
> }
> $tpl->assign('projects', $projects);
> SMARTY STUFF
> {foreach from=$projects item='entry'}
> <b>{$entry.short_name}</b><br />
> <ul>
> {foreach from=$entry.subs item='sub'}
> <li>{$sub.short_name}</li>
> {foreachelse}
> <li>No subs for this project</li>
> {/foreach}
> </ul>
> {foreachelse}
> <b>No projects found</b>
> {/foreach}
>
> Can anyone point me in the right direction?
>
> Thanks,
> Amanda
--- End Message ---
--- Begin Message ---
What is the best way to cloak a site - send search engines different
content than real users?
Yes, I know it's bad practice, and I know the domain will eventually
be banned. I've found lots of different methods including huge tables
of all the possible client types sent by various spiders. I postulate
that the simplest/fastest way to do it, and no less reliably, would
be to simply consider any user whose client type includes "msie",
"netscape", or "safari" to be a person, and let the rest go.
Anyone have any practical experience with success that they'd like to
share? I know there are plenty of negative stories and reasons NOT to
do those but no need to take up the bandwidth with that; heard 'em
already. :)
--- End Message ---
--- Begin Message ---
On Aug 11, 2005, at 3:44 PM, Evert | Collab wrote:
Use robots.txt
'evil' searchengines will spoof the user-agent string anyway
Can you be more specific about what you mean by "use robots.txt"?
I just want to cloak for Google, MSN, and Yahoo. I couldn't care less
about what any other search engine (evil or not) does or sees.
--- End Message ---
--- Begin Message ---
On Aug 11, 2005, at 4:06 PM, Evert | Collab wrote:
First hit on google:
http://www.searchengineworld.com/robots/robots_tutorial.htm
Search engines check for a robots.txt on your site, in the
robots.txt file you can specify that certain or all search engines
shouldn't index your site
I know what robots.txt is, I meant how would you use that to cloak
the site. Put PHP code in robots.txt to log the IP of any requests
to a db, and then use that db to cloak the rest of the site or not?
--- End Message ---
--- Begin Message ---
Brian Dunning wrote:
On Aug 11, 2005, at 3:44 PM, Evert | Collab wrote:
Use robots.txt
'evil' searchengines will spoof the user-agent string anyway
Can you be more specific about what you mean by "use robots.txt"?
I just want to cloak for Google, MSN, and Yahoo. I couldn't care less
about what any other search engine (evil or not) does or sees.
robots.txt will not do what you want it to.
Just sniff for those robots' User-Agents (Google, MSN and Yahoo all
publish their UA strings on their websites, AFAIK) and send different
content if it's one of those.
Jasper
--- End Message ---
--- Begin Message ---
Jasper Bryant-Greene wrote:
Brian Dunning wrote:
On Aug 11, 2005, at 3:44 PM, Evert | Collab wrote:
Use robots.txt
'evil' searchengines will spoof the user-agent string anyway
Can you be more specific about what you mean by "use robots.txt"?
I just want to cloak for Google, MSN, and Yahoo. I couldn't care less
about what any other search engine (evil or not) does or sees.
robots.txt will not do what you want it to.
Just sniff for those robots' User-Agents (Google, MSN and Yahoo all
publish their UA strings on their websites, AFAIK) and send different
content if it's one of those.
they will hammer you for it eventually - AFAICT all major SEs send out their
spiders occasionally with faked user-agent strings - to catch out crap like
this.
oh and the guy that invented php is a really bigcheese down at yahoo...
and he reads this list :-) though I doubt he has the time or desire to chase
you personally.
I would recommend you don't go down this road. it's bad for your business in the
longer term and its bad for the web because your filling it with shite.
Jasper
--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
Jasper Bryant-Greene wrote:
robots.txt will not do what you want it to.
Just sniff for those robots' User-Agents (Google, MSN and Yahoo all
publish their UA strings on their websites, AFAIK) and send different
content if it's one of those.
they will hammer you for it eventually - AFAICT all major SEs send out
their
spiders occasionally with faked user-agent strings - to catch out crap like
this.
oh and the guy that invented php is a really bigcheese down at yahoo...
and he reads this list :-) though I doubt he has the time or desire to
chase
you personally.
I would recommend you don't go down this road. it's bad for your
business in the
longer term and its bad for the web because your filling it with shite.
Of course it is, but in his original post he said that he realised that
it was bad, and he didn't want to hear reasons not to do it.
I would never even attempt to do something like this on a website of my
own -- as I said in an off-list email to this guy (it was OT for the
list) it's going to harm his website more than help it. It's not exactly
hard for the search engines to detect cloaking.
Jasper
--- End Message ---
--- Begin Message ---
robots.txt will not do what you want it to.
Just sniff for those robots' User-Agents (Google, MSN and Yahoo all publish
their UA strings on their websites, AFAIK) and send different content if
it's one of those.
they will hammer you for it eventually - AFAICT all major SEs send out their
spiders occasionally with faked user-agent strings - to catch out crap like
this.
google adsense won't. I explicity asked them about this. Well, what I
asked was that if I had a password protected area, could I allow them
access to spider the content so that normal users could see the ads. I
told them the layout would be different, but the content the same.
They said that was fine.
2cents.
--- End Message ---
--- Begin Message ---
Philip Hallstrom wrote:
robots.txt will not do what you want it to.
Just sniff for those robots' User-Agents (Google, MSN and Yahoo all
publish their UA strings on their websites, AFAIK) and send different
content if it's one of those.
they will hammer you for it eventually - AFAICT all major SEs send out
their
spiders occasionally with faked user-agent strings - to catch out crap
like
this.
google adsense won't. I explicity asked them about this. Well, what I
asked was that if I had a password protected area, could I allow them
access to spider the content so that normal users could see the ads. I
told them the layout would be different, but the content the same.
They said that was fine.
but you didn't ask - 'heh is it okay to fill my public page with SEO crud but
only if a spider comes round'
they might just take a different view on that :-)
2cents.
--- End Message ---
--- Begin Message ---
* Brian Dunning <[EMAIL PROTECTED]> :
> On Aug 11, 2005, at 4:06 PM, Evert | Collab wrote:
>
> > First hit on google:
> > http://www.searchengineworld.com/robots/robots_tutorial.htm
> > Search engines check for a robots.txt on your site, in the
> > robots.txt file you can specify that certain or all search engines
> > shouldn't index your site
>
> I know what robots.txt is, I meant how would you use that to cloak
> the site. Put PHP code in robots.txt to log the IP of any requests
> to a db, and then use that db to cloak the rest of the site or not?
If you want to dynamically determine what to disallow based on the
UserAgent string, simply tell Apache, via an .htaccess file, to pass
robots.txt to PHP for handling. Then have that script do the processing
and return output compatible with the robots.txt specification.
--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/
--- End Message ---
--- Begin Message ---
Evert | Collab wrote:
Lets just put it this way:
if you don't want your site indexed, use robots.txt
if you want to hide your site from search engines [ which won't even
touch your files if you use robots.txt ] check the UA string.
I can't imagine a situation where you want to hide your content from the
major search engines, since they all use robots.txt
You misunderstand his original question. He wants to show different
content to search engines than to users. He understands this is a bad
thing to do, but just wants to know how to do it anyway.
Jasper
--- End Message ---
--- Begin Message ---
Jasper Bryant-Greene wrote:
Jochem Maas wrote:
Jasper Bryant-Greene wrote:
robots.txt will not do what you want it to.
Just sniff for those robots' User-Agents (Google, MSN and Yahoo all
publish their UA strings on their websites, AFAIK) and send different
content if it's one of those.
they will hammer you for it eventually - AFAICT all major SEs send out
their
spiders occasionally with faked user-agent strings - to catch out crap
like
this.
oh and the guy that invented php is a really bigcheese down at yahoo...
and he reads this list :-) though I doubt he has the time or desire to
chase
you personally.
I would recommend you don't go down this road. it's bad for your
business in the
longer term and its bad for the web because your filling it with shite.
Of course it is, but in his original post he said that he realised that
it was bad, and he didn't want to hear reasons not to do it.
I know - I only really replied to voice my total disdain for idiots
who are filling the search engines with shite. thats bad for all of us
(well those of us that use search engines - you get the impression that
some people here don't know what one is ;-)
if he didn't want to hear this stuf he should have googled - there is
tons of code that does this - he didn't really need the list at all to
figure out how to do it.
I would never even attempt to do something like this on a website of my
own -- as I said in an off-list email to this guy (it was OT for the
you have to go pretty far to be off topic for this list ;-)
list) it's going to harm his website more than help it. It's not exactly
hard for the search engines to detect cloaking.
I concur.
Jasper
--- End Message ---
--- Begin Message ---
PEAR::Net_GeoIP is nice..
$geoip = Net_GeoIP::getInstance('/path/to/geoip.dat',
Net_GeoIP::MEMORY_CACHE);
$countryName = $geoip->lookupCountryName($ipAddress);
http://pear.php.net/package/Net_GeoIP
Rob
> -----Original Message-----
> From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]
> Sent: Friday, 12 August 2005 1:38 AM
> To: [email protected]
> Subject: [PHP] IP & Geographical
>
>
> I have a field in my counter that collects IP addresses. Now
> the powers
> that be want be to collect that data and sort it geographically etc.
> Is there anyone who has done this? Where would I find some OS
> code? I've
> heard of it done.
> John
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Amanda Hemmerich wrote:
What is cross posting?
when you post the same question to
more than one mailing list (especially when done
at the same time).
alot of the people who regularly read/post on php-generals
also watch other php related mailing lists (I for one
am also subscribed to the Smarty list - actually I'm subscribed
to nearly all the php lists :-P)
as a sidenote - always try to show that you have researched your
problem properly - chances are people will be _much_ more willing to help
you (regardless of how simple the question might be for people who
have been playing the web/php game for a while :-)
and don't take it too personally if you get an occasional STFW or RTFM,
consider it like medicine - it tastes bad but its good for you :-)
Thanks,
Amanda
Jochem Maas wrote:
Amanda Hemmerich wrote:
Hello!
I'm using PHP and Smarty to try to build an array of arrays using the
results from nested queries. I am just learning about nested arrays,
and I'm not sure what I'm doing wrong.
...
Can anyone point me in the right direction?
Amanda please don't cross-post. it's bad karma, ok your a
girl (or woman - you choose :-) so we'll let you off this time
(and the next, and the next)
... that's not to say girls are crap at IT/programming/etc it's just
we don't have enough girls on this list ;-)
(actually one of the php core devs is a girl and she's damn good
AFAICT - Sara Golemon is her name - she wrote the 'blackmagic' runkit
extension which deserves a round of applause all on it own!)
Thanks,
Amanda
--- End Message ---
--- Begin Message ---
Hey,
Having a bit of a problem working out the logic to this one (its 5am
now...),
basically people vote on pics like hotornot.com, but here they vote on
a scale of 1-5 (one being something like what was hit by a bus at birth and
five being
the person you will never have a chance to have children with) :-D
Anyway.....how do i get the averages down to a max of 5pts?
eg:
1.2 is ok
4.5 is ok
5.0 is ok
3.1 is ok
1.1 is ok
2.2 is ok
etc
97.3 is not ok
5.3 is not ok
etc
Thanks,
Ryan
--- End Message ---
--- Begin Message ---
Ryan A wrote:
Hey,
Having a bit of a problem working out the logic to this one (its 5am
now...),
basically people vote on pics like hotornot.com, but here they vote on
a scale of 1-5 (one being something like what was hit by a bus at birth and
five being
the person you will never have a chance to have children with) :-D
Anyway.....how do i get the averages down to a max of 5pts?
eg:
1.2 is ok
4.5 is ok
5.0 is ok
3.1 is ok
1.1 is ok
2.2 is ok
etc
97.3 is not ok
5.3 is not ok
etc
Thanks,
Ryan
i assume you're using mysql and each row has a value of 1 - 5.
SELECT AVG(rating) as rating FROM table WHERE id = $id
then that will give you numbers as such:
3.4242
4.1212
etc..
then use number_format()
number_format($row['rating'], 1, '.', '');
3.4
4.1
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.6/69 - Release Date: 8/11/2005
--- End Message ---
--- Begin Message ---
On Thu, Aug 11, 2005 at 10:47:09AM -0700, Saqib Ali wrote:
> Hello All,
>
> What are best practices for deleting records in a DB. We need the
> ability to restore the records.
>
> Two obvious choices are:
>
> 1) Flag them deleted or undeleted
> 2) Move the deleted records to seperate table for deleted records.
>
> We have a complex schema. However the the records that need to be
> deleted and restored reside in 2 different tables (Table1 and Table2).
>
> Table2 uses the primary key of the Table1 as the Foriegn key. The
> Primary key for Table1 is auto-generated. This make the restoring with
> the same primary key impossible, if we move deleted data to a
> different table. However if we just flag the record as deleted the
> restoring is quite easy.
>
> Any thoughts/ideas ?
>
> --
> In Peace,
> Saqib Ali
> http://www.xml-dev.com/blog/
> Consensus is good, but informed dictatorship is better.
>
I like the approach of marking them as deleted. It's easy to modify the SELECT
query to ignore deleted records, plus it's easy to restore them if you need
them.
--
Jim Kaufman
Linux Evangelist
public key 0x6D802619
CCNA, CISSP# 65668
---
Kato, what is going on in that little yellow brain of yours?
-- Chief Inspector Clouseau,
in reference to a priceless white Steinway piano.
--- End Message ---
--- Begin Message ---
Saqib Ali wrote:
Hello All,
What are best practices for deleting records in a DB. We need the
ability to restore the records.
Two obvious choices are:
1) Flag them deleted or undeleted
2) Move the deleted records to seperate table for deleted records.
We have a complex schema. However the the records that need to be
deleted and restored reside in 2 different tables (Table1 and Table2).
Table2 uses the primary key of the Table1 as the Foriegn key. The
Primary key for Table1 is auto-generated. This make the restoring with
the same primary key impossible, if we move deleted data to a
different table. However if we just flag the record as deleted the
restoring is quite easy.
Any thoughts/ideas ?
There are pros and cons to both ways.(As you pointed out with moving the
records to another table)
I allways prefer flagging the records. The draw back with flagging the
records is that you might sacrifice some speed(depends on the number of
records in the table.) If the table does not grow that fast most def
just flag the records as deleted.
my2c worth
--
Arno Coetzee
Developer
Flash Media Group
Office : 2712 342 7595
Mobile : 2782 693 6180
--- End Message ---
--- Begin Message ---
Hello,
A while back I posted a question in relation to XSL namespaces and
callbacks, but never got a response, not even a flame, which I found a
bit odd for this list. :P I know this is pretty cutting-edge for PHP
since the XSL library has only been used in PHP 5, well, except for the
XSLT/Sablotron that was available for 4.
My original post can be found here:
http://marc.theaimsgroup.com/?l=php-general&m=112299671816888&w=2
What I am trying to do here is what the .NET framework does in XSL by
adding a custom namespace that binds to an Assembly and a class. Is this
at all possible in PHP? The reason why I am asking this is because I do
not want the end user to be able to execute any type of PHP code through
XSL, which they can if I call $xslt->registerPHPFunctions(); and enable
the php namespace through
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl">
For security reasons I would want to limit the user to a specific custom
library class instead of allowing them to use the php:function() that
can call any PHP method/function/internal.
So, instead of:
<xsl:value-of select="php:function('ClassName::Method', ./@id)"/>
I would like the call to be:
<xsl:value-of select="namespace.classname:Method(./@id)"/>
Where the stylesheet declaration looks like:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:namespace.classname="urn:namespace.classname">
Since that way they can only call the macro classes/methods that have
been validated and added as libraries when loading the XSL renderer.
Any help in this matter is greatly appreciated. Also, if somebody can
forward this matter to the PHP internals, Jochem comes to mind, it would
be awesome. I think this would definitely be a very competitive feature
for the PHP XSL implementation.
Warm Regards,
Torgny
--- End Message ---