[PHP] PHP GD and Unicode

2005-08-11 Thread Louie Miranda
Im doing a job that creates a business card that has double sided cards on 
it.

- front side; is plain english
- back side; is the desired languages

I have been successfull with the japanese fonts displaying as an image 
(jpeg), that has the fonts in it.

Now im trying the Arabic, Hebrew, Chinese. And i have no luck. Even if i try 
the aria.ttf font which supports..

*Unicode ranges*Basic Latin, Latin-1 Supplement, Latin Extended-A, Greek and 
 Coptic, Cyrillic, Cyrillic Supplementary, Hebrew, Reserved for Unicode 
 SubRanges, Arabic, Reserved for Unicode SubRanges, Arabic Presentation 
 Forms-A, Arabic Presentation Forms-B


http://www.microsoft.com/typography/fonts/font.aspx?FID=8FNAME=Arial 
 

As described on the fonts info on this page.

It displays fine on the browser if i set the correct charset

ex:meta http-equiv=Content-Type content=text/html; charset=ISO-8859-8-I
 
 

But when i try it on a image, that has been created with GD. It does 
nothing.

I just want to confirm, it what im doing with the fonts possible thru 
GD/Jpeg?

Please help, if this aint possible. I think imight purchase the PDFLib 
instead to test the unicode support.

-- 
Louie Miranda
http://www.axishift.com -- under development


Re: [PHP] force download

2005-08-11 Thread Norbert Wenzel

Sebastian wrote:

some of my users are complaining that when they try download media 
files (mp3, mpeg, etc) their media player opens and doesn't allow them 
to physically download the media. These are IE users, firefox seems to 
like my code, but IE refuses to download the file and plays it instead..


can anyone view my code and see how i can force media file downloads 
on IE?


We're using the PHP based 'Moodle' system and had the similar problems 
when downloading stuff in IE. On some IEs it worked, on some IE did 
nothing, though it was the same version. The only way to fix this, was 
to search for a 'IE' String, in the browser info and to show another 
page, with a stupid 'Save as...' link to IE users.


hope that works,
norbert

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



Re: [PHP] force download

2005-08-11 Thread Norbert Wenzel

Richard Lynch wrote:

Right-click is NOT universal.

Macs don't even *have* a right-click!


Doesn't Ctrl-Click do the same as a right click?

Norbert

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



Re: [PHP] display error line in object method

2005-08-11 Thread Norbert Wenzel

Richard Lynch wrote:

There may also be some fancy new way to output the whole stack of
functions called... I haven't really checked that out yet.


The function stack is printed by debug_backtrace(), isn't it? Supported 
by PHP since 4.3.0.


Norbert

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



[PHP] Re: dynamic object instances

2005-08-11 Thread Thomas Angst

Eli schrieb:

You're right that using eval() slows.. But using the _init() function 
as you suggested is actually tricking in a way you move the 
constructor params to another function, but the initialization params 
should be sent to the constructor!


I guess that it would be better if PHP will add a possibility to 
construct a dynamic class with variant number of params... ;-)


If your read my original posting then you would know, that I expicitly 
asked for a non-eval solution. Because we solved it with an eval too. 
But I would like to watch for a solution without an eval.


thanks anyway
Thomas

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



Re: [PHP] How efficient is OOP in PHP5?

2005-08-11 Thread Jochem Maas

TalkativeDoggy wrote:

Hi all,

I have heard that function style is 400% faster than OOP in PHP, and 
give a little agreement. So in the past year, I write more PHP code in 
function way while less in OOP way.


This morning, I read an article called How efficient is OOP in PHP
according to the author's test, writing PHP code in procedural 
way(functions) is 200%+ faster than OOP way.


But this article is written in 2003, now, I am using PHP5, how about the 
performance of OOP in PHP5? Could any one give me more efficient 
references?


objects are slower than functions.
functions are slower than straight up code.

OO in php5 is a lot better than in php4 also in terms of speed.
php5.1 brings a new execution model in the zend engine (IIRC),
regardless the change I refer to gives a not to small speed boost
for OO stuff.

bottom line - its fast enough, and if you need more speed maybe you
need to write a custom extension :-)



Any suggestion or help will be greatly appreciated.

Qin Jianxiang



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



Re: [PHP] Re: dynamic object instances

2005-08-11 Thread Jochem Maas

Thomas Angst wrote:

Eli schrieb:

You're right that using eval() slows.. But using the _init() function 
as you suggested is actually tricking in a way you move the 
constructor params to another function, but the initialization params 
should be sent to the constructor!


I guess that it would be better if PHP will add a possibility to 
construct a dynamic class with variant number of params... ;-)


If your read my original posting then you would know, that I expicitly 
asked for a non-eval solution. Because we solved it with an eval too. 
But I would like to watch for a solution without an eval.


sing it: 

you can't always get what you want,
you can'tr always get what ya need,
I can't get no ... satifaction.





thanks anyway
Thomas



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



[PHP] Regular expression question

2005-08-11 Thread Leon Vismer
Hi 

I would like to convert from one naming convention within a sql statement to 
another.

I have the following,

code
$str = insert into userComment (userID, userName, userSurname) values (0, 
'Leon', 'Vismer');

$match = array(
/([a-z]+)(ID)/,
/([a-z]+)([A-Z])/
);

$replace = array(
\$1_id,
\$1_\$2
);

$nstr = preg_replace($match, $replace, $str);
echo $nstr .\n;
/code

the above gets me to 
insert into user_Comment (user_id, user_Name, user_Surname) values (0, 'Leon', 
'Vismer')

however I want to get to

insert into user_comment (user_id, user_name, user_surname) values (0, 'Leon', 
'Vismer')

Some help from the regex experts ;-)

Many thanks
--
Leon

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



Re: [PHP] Re: dynamic object instances

2005-08-11 Thread Jochem Maas

Eli wrote:

Jochem Maas wrote:


Eli wrote:


?
$obj_eval=return new $class(;
for ($i=0; $icount($args); $i++)
   $obj_eval.=\$args[$i],;
$obj_eval=substr($obj_eval,0,-1).);;
$obj=eval($obj_eval);
?




I believe that this is the kind of clever, evil stuff the OP was 
trying to avoid...
(evil - eval :-) - besides eval is very slow - not something you (well 
me then) want to
use in a function dedicated to object creation which is comparatively 
slow anyway
(try comparing the speed of cloning and creating objects in php5 for 
instance


regardless - nice one for posting this Eli - I recommend anyone who 
doesn't understand

what he wrote to go and figure it out, good learning material :-)



You're right that using eval() slows.. But using the _init() function as 
you suggested is actually tricking in a way you move the constructor 
params to another function, but the initialization params should be sent 
to the constructor!


true enough, thats why I suggested the OP might want to reevaluate the whole
idea ... personally I don't see much point in a create() function for new 
objects.

but anyway :-)



I guess that it would be better if PHP will add a possibility to 
construct a dynamic class with variant number of params... ;-)


there is always runkit.





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



Re: [PHP] How efficient is OOP in PHP5?

2005-08-11 Thread TalkativeDoggy

Thanks for your help!

That is just what I wana hear.

Actually, in most web applications, the real bottle-neck of performance 
is the Database, but not the PHP scripts-of coz, I don't take obvious 
mistakes.


So I don't wana write my application without OOP or functions, just for 
this bit performance improvement. I need a well maintianed product.

Jochem Maas wrote:

TalkativeDoggy wrote:


Hi all,

I have heard that function style is 400% faster than OOP in PHP, and 
give a little agreement. So in the past year, I write more PHP code in 
function way while less in OOP way.


This morning, I read an article called How efficient is OOP in PHP
according to the author's test, writing PHP code in procedural 
way(functions) is 200%+ faster than OOP way.


But this article is written in 2003, now, I am using PHP5, how about 
the performance of OOP in PHP5? Could any one give me more efficient 
references?



objects are slower than functions.
functions are slower than straight up code.

OO in php5 is a lot better than in php4 also in terms of speed.
php5.1 brings a new execution model in the zend engine (IIRC),
regardless the change I refer to gives a not to small speed boost
for OO stuff.

bottom line - its fast enough, and if you need more speed maybe you
need to write a custom extension :-)



Any suggestion or help will be greatly appreciated.

Qin Jianxiang



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



Re: [PHP] How efficient is OOP in PHP5?

2005-08-11 Thread Jochem Maas

TalkativeDoggy wrote:

Thanks for your help!

That is just what I wana hear.

Actually, in most web applications, the real bottle-neck of performance 
is the Database, but not the PHP scripts-of coz, I don't take obvious 
mistakes.


So I don't wana write my application without OOP or functions, just for 
this bit performance improvement. I need a well maintianed product.


my thought exactly - script speed is not that important;
maintainability, readability and extensibility are paramount unless you like
long hours and big headaches ;-)


Jochem Maas wrote:


TalkativeDoggy wrote:


Hi all,

I have heard that function style is 400% faster than OOP in PHP, 
and give a little agreement. So in the past year, I write more PHP 
code in function way while less in OOP way.


This morning, I read an article called How efficient is OOP in PHP
according to the author's test, writing PHP code in procedural 
way(functions) is 200%+ faster than OOP way.


But this article is written in 2003, now, I am using PHP5, how about 
the performance of OOP in PHP5? Could any one give me more efficient 
references?




objects are slower than functions.
functions are slower than straight up code.

OO in php5 is a lot better than in php4 also in terms of speed.
php5.1 brings a new execution model in the zend engine (IIRC),
regardless the change I refer to gives a not to small speed boost
for OO stuff.

bottom line - its fast enough, and if you need more speed maybe you
need to write a custom extension :-)



Any suggestion or help will be greatly appreciated.

Qin Jianxiang





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



[PHP] optional rule quick_form

2005-08-11 Thread Uroš Gruber

Hi!

I have one checkbox. I checkbox is checked I show additional fields 
(just set visiblity to true).  But some of that fields are required only 
if this checkbox is checked. Is this possible with quick_form. I try 
myself with grouping but without any luck.


regards

Uros

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



Re: [PHP] optional rule quick_form

2005-08-11 Thread Torgny Bjers
I am assuming that this is after a post operation. If it's JavaScript, I
think the question should be directed to another list. So, if you group
the elements that should be validated after the checkbox has been
checked, you can activate/deactivate the group validation rules based on
the state of the checkbox. Makes sense?

Regards,
Torgny

Uroš Gruber wrote:

 Hi!

 I have one checkbox. I checkbox is checked I show additional fields
 (just set visiblity to true).  But some of that fields are required
 only if this checkbox is checked. Is this possible with quick_form. I
 try myself with grouping but without any luck.

 regards

 Uros


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



RE: [PHP] Redisplaying information from a HTML form

2005-08-11 Thread Jim Moseby
 Is there a way I can make these boxes and buttons 
 retain their value?

Without a code example, I am forced to give a generic answer.  Here's one
way to do it:

? 
$selection=5; // User previously picked option 5
$ddselection[$selection]=' selected ';
?

select name=D1
option? echo $ddselection[1]; ? value=1Option 1/option
option? echo $ddselection[2]; ? value=2Option 2/option
option? echo $ddselection[3]; ? value=3Option 3/option
option? echo $ddselection[4]; ? value=4Option 4/option
option? echo $ddselection[5]; ? value=5Option 5/option
option? echo $ddselection[6]; ? value=6Option 6/option
option? echo $ddselection[7]; ? value=7Option 7/option
option? echo $ddselection[8]; ? value=8Option 8/option
/select


JM

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



Re: [PHP] How efficient is OOP in PHP5?

2005-08-11 Thread TalkativeDoggy

I can't agree any more!
Maintainability is the most important, and if there is no readability or 
extensibility, there is no maintainability.


So I recongnize what I should do now.


Jochem Maas wrote:

TalkativeDoggy wrote:


Thanks for your help!

That is just what I wana hear.

Actually, in most web applications, the real bottle-neck of 
performance is the Database, but not the PHP scripts-of coz, I don't 
take obvious mistakes.


So I don't wana write my application without OOP or functions, just 
for this bit performance improvement. I need a well maintianed product.



my thought exactly - script speed is not that important;
maintainability, readability and extensibility are paramount unless you 
like

long hours and big headaches ;-)


Jochem Maas wrote:


TalkativeDoggy wrote:


Hi all,

I have heard that function style is 400% faster than OOP in PHP, 
and give a little agreement. So in the past year, I write more PHP 
code in function way while less in OOP way.


This morning, I read an article called How efficient is OOP in PHP
according to the author's test, writing PHP code in procedural 
way(functions) is 200%+ faster than OOP way.


But this article is written in 2003, now, I am using PHP5, how about 
the performance of OOP in PHP5? Could any one give me more efficient 
references?





objects are slower than functions.
functions are slower than straight up code.

OO in php5 is a lot better than in php4 also in terms of speed.
php5.1 brings a new execution model in the zend engine (IIRC),
regardless the change I refer to gives a not to small speed boost
for OO stuff.

bottom line - its fast enough, and if you need more speed maybe you
need to write a custom extension :-)



Any suggestion or help will be greatly appreciated.

Qin Jianxiang





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



RE: [PHP] what should I look for with this error

2005-08-11 Thread Jay Blanchard
[snip]
Your HEREDOC appears to be messed up. On line 623 the closing identifier
is not in first column of the line (when I cut n paste the code into an
editor. That is a requirement for the heredoc.

You also didn't close the PHP block after END_FORM;
Then you need to open a PHP block at about line 635 before the if
statement.
[/snip]

Were you able to resolve this?

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



Re: [PHP] Redisplaying information from a HTML form

2005-08-11 Thread Torgny Bjers
Ravi Gogna wrote:

[snip]

 I've managed to write the checking program in such a way that clicking
 submit launches an 'error' page which displays at the top of the page
 which field is wrong, and then redisplays the form. (The form
 redisplay is done using a function which uses the variables I used in
 the HTML form page). My problem is this: when the 'error' page comes
 up all of the text boxes will quite happily redisplay the data that
 was put into them, but I have a couple of drop-down boxes and radio
 buttons which lose their value. Is there a way I can make these boxes
 and buttons retain their value?


The easiest way to do this is to keep all the select option items in an
associative array and iterating this with foreach or for to output the
option/ elements. That way you can directly check the value of each
option to detect which was selected.

MailerCode(tm):

?php
$select = array('a' = 'Item 1', 'b' = 'Item 2', 'c' = 'Item 3');
?
form ...
select name=MySelect id=MySelect
?php
foreach ($select as $value = $text) {
$selected = '';
if (!empty($_POST['MySelect'])  $_POST['MySelect'] == $value) {
   $selected = ' selected';
}
printf('option value=%s%s%s/option%s', $value, $selected,
$text, \r\n);
}
?
/select
/form

Warm Regards,
Torgny

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



Re: [PHP] optional rule quick_form

2005-08-11 Thread Uroš Gruber

Torgny Bjers said the following on 11.8.2005 14:44:

I am assuming that this is after a post operation. If it's JavaScript, I
think the question should be directed to another list. So, if you group
the elements that should be validated after the checkbox has been
checked, you can activate/deactivate the group validation rules based on
the state of the checkbox. Makes sense?


If I understand your idea the code would look like this
$form-addElement('text', 'taxNumber', 'Tax:');
$checkbox = HTML_QuickForm::createElement('checkbox', 'isCompany','');

if ($checkbox-getChecked()) {
$form-addRule('taxNumber','required','Tax number is required');
}

if ($form-validate()) {


Btw yes it must be checked when user submit this. But If it's possible 
client option on rule, would be better.


regards



I have one checkbox. I checkbox is checked I show additional fields
(just set visiblity to true).  But some of that fields are required
only if this checkbox is checked. Is this possible with quick_form. I
try myself with grouping but without any luck.


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



Re: [PHP] optional rule quick_form

2005-08-11 Thread Torgny Bjers
Uroš Gruber wrote:

 Torgny Bjers said the following on 11.8.2005 14:44:

 I am assuming that this is after a post operation. If it's JavaScript, I
 think the question should be directed to another list. So, if you group
 the elements that should be validated after the checkbox has been
 checked, you can activate/deactivate the group validation rules based on
 the state of the checkbox. Makes sense?


 If I understand your idea the code would look like this
 $form-addElement('text', 'taxNumber', 'Tax:');
 $checkbox = HTML_QuickForm::createElement('checkbox', 'isCompany','');

 if ($checkbox-getChecked()) {
 $form-addRule('taxNumber','required','Tax number is required');
 }

 if ($form-validate()) {
 


That would be the idea, yes. It was some time since worked with
Quick_Form, so there might be a specific order you need to perform the
adding of the rule in relation to the validate() method call on the
$form object.

 Btw yes it must be checked when user submit this. But If it's possible
 client option on rule, would be better.


I am not sure about this, is there even client-side validation support
in Quick_Form? Haven't really looked into this. I would suggest writing
a manual javascript evaluation for the specific fields that should be
visible when the checkbox is checked, or to have a postback between. The
JavaScript option sounds most tempting, since it makes it a bit more
user-friendly. That way you can use the JavaScript alert() function to
present the fields that have erroneous information as well as altering
styles in the fields in question to perhaps have a red border to
indicate errors.

Regards,
Torgny

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



Re: [PHP] Regular expression question

2005-08-11 Thread b-bonini
n Thu, 11 Aug 2005, Leon Vismer wrote:

 Hi

 I would like to convert from one naming convention within a sql statement to
 another.

 I have the following,

 code
 $str = insert into userComment (userID, userName, userSurname) values (0,
 'Leon', 'Vismer');

 $match = array(
 /([a-z]+)(ID)/,
 /([a-z]+)([A-Z])/
 );

 $replace = array(
 \$1_id,
 \$1_\$2
 );

 $nstr = preg_replace($match, $replace, $str);
 echo $nstr .\n;
 /code


 the above gets me to
 insert into user_Comment (user_id, user_Name, user_Surname) values (0, 'Leon',
 'Vismer')

 however I want to get to

 insert into user_comment (user_id, user_name, user_surname) values (0, 'Leon',
 'Vismer')

 Some help from the regex experts ;-)


Just a quick note; why dont' you search on user since it's the constant and 
replace 'user[A-Z]' with 'user_[a-z]' or in the case of userID 'user[A-Z]{2}'

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



[PHP] PHP script for removing/forwarding suspected spam from pop3 mailbox

2005-08-11 Thread I. Gray

Hi.

I'd like to find or write a script that I can run every so often (hourly 
for example) from cron that will check my pop3 mailboxes for any emails 
with SPAM in the subject line and either delete them or forward 
them to another email address.  The best way would be to bundle all the 
emails together and forward these as attachments to another email 
address that I would use as spam.


I have found the documentation on using php for pop3 a little confusing 
as it seems to be geared towards imap. I know it can be used for pop3 
it's just the documentation on this seems to be a little scarce. Can 
anyone help me find an already written script or give me some ideas on 
how I can write my own.


Many thanks,

IG

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



RE: [PHP] REGEX for query

2005-08-11 Thread Jay Blanchard
[snip]
Assuming unix, I'd do the following from the root of the application to
get a list
of files that contain queries:

$ egrep =[:space:]*\.*\b(SELECT|INSERT|UPDATE)\b * -ril
...

Anyway, that's how I'd do it.  Hope you got something out of this... :)
[/snip]

That is a good start, now all I need to do is get the whole query(s)

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



Re: [PHP] what should I look for with this error

2005-08-11 Thread Bruce Gilbert
yea, I was able to get the  form to display, thanks.

On 8/11/05, Jay Blanchard [EMAIL PROTECTED] wrote:
 [snip]
 Your HEREDOC appears to be messed up. On line 623 the closing identifier
 is not in first column of the line (when I cut n paste the code into an
 editor. That is a requirement for the heredoc.
 
 You also didn't close the PHP block after END_FORM;
 Then you need to open a PHP block at about line 635 before the if
 statement.
 [/snip]
 
 Were you able to resolve this?
 


-- 
::Bruce::

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



Re: [PHP] Regular expression question

2005-08-11 Thread Leon Vismer
Hi

 Just a quick note; why dont' you search on user since it's the constant
 and replace 'user[A-Z]' with 'user_[a-z]' or in the case of userID
 'user[A-Z]{2}'

This is part of my problem user will not always be constant, I basically want 
to be able to change between two naming conventions.

Example:

userID becomes user_id
clientID becomes client_id
tableName becomes table_name
anotherTableName becomes another_table_name
etc.

Thanks
--
Leon

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



Re: [PHP] REGEX for query

2005-08-11 Thread Robin Vickery
On 8/11/05, Jay Blanchard [EMAIL PROTECTED] wrote:

 That is a good start, now all I need to do is get the whole query(s)

Get them from the mysql logs?

 -robin

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



RE: [PHP] rename an uploaded file.

2005-08-11 Thread Ford, Mike
On 10 August 2005 22:19, Richard Lynch wrote:

 You can also, in some versions, get away with having \
 inside of  so
 long as the following character isn't special:
 $string = C:\homedirectory\uploadedfiles\\newfile.gif;
 
 Note that the 'n' character is special (newline) but 'h' and 'u' are
 not (I don't think) so this should work
 
 That doesn't make it Good Practice.

Especially as \u is likely to be a special sequence in the Unicode-enabled
PHP 6.0 when it comes out!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] what should I look for with this error

2005-08-11 Thread John Nichel

Jochem Maas wrote:

John Nichel wrote:


Bruce Gilbert wrote:
snip a ton of un-needed code

Your heredoc is messed up.  Look into getting an editor which will 
highlight the errors for you.  This mailing list isn't here to syntax 
check (unless it's 4:30 on a Friday).



can we hold you to that John ;-)


I might pull time zone rules and say that your 4:30 is my 5:30, and that 
I'm already home. ;)


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



[PHP] Re: Regular expression question

2005-08-11 Thread TalkativeDoggy

How about using the lower() function?

Leon Vismer wrote:
Hi 

I would like to convert from one naming convention within a sql statement to 
another.


I have the following,

code
$str = insert into userComment (userID, userName, userSurname) values (0, 
'Leon', 'Vismer');


$match = array(
/([a-z]+)(ID)/,
/([a-z]+)([A-Z])/
);

$replace = array(
\$1_id,
\$1_\$2
);

$nstr = preg_replace($match, $replace, $str);
echo $nstr .\n;
/code

the above gets me to 
insert into user_Comment (user_id, user_Name, user_Surname) values (0, 'Leon', 
'Vismer')


however I want to get to

insert into user_comment (user_id, user_name, user_surname) values (0, 'Leon', 
'Vismer')


Some help from the regex experts ;-)

Many thanks
--
Leon


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



RE: [PHP] REGEX for query

2005-08-11 Thread Jay Blanchard
[snip]
 
 That is a good start, now all I need to do is get the whole query(s)

Get them from the mysql logs?
[/snip]

While that sounds like a good idea there are two things that hamper the
effectiveness of this is a total solution;

1. The logs have many queries from other applications that *don't count*
in this scenario.
2. Not all of the queries may run frequently enough to appear in the
logs.

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



RE: [PHP] what should I look for with this error

2005-08-11 Thread Jay Blanchard
[snip]
I might pull time zone rules and say that your 4:30 is my 5:30, and that

I'm already home. ;)
[/snip]

Another space-time continuum snafu brought to you by the Consortium For
Creative PHP Development

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



Re: [PHP] Regular expression question

2005-08-11 Thread Robin Vickery
On 8/11/05, Leon Vismer [EMAIL PROTECTED] wrote:
 Hi
 
 I would like to convert from one naming convention within a sql statement to
 another.
 
 I have the following,
 
 code
 $str = insert into userComment (userID, userName, userSurname) values (0,
 'Leon', 'Vismer');
 
 $match = array(
 /([a-z]+)(ID)/,
 /([a-z]+)([A-Z])/
 );
 
 $replace = array(
 \$1_id,
 \$1_\$2
 );

?php
$str = insert into userComment (userID, userName, userSurname) values
(0, 'Leon', 'Vismer');

$match  = '/(?=[a-z])([A-Z]+)/e';
$replace = 'strtolower(_$1)';
print preg_replace($match, $replace, $str);
?

insert into user_comment (user_id, user_name, user_surname) values (0,
'Leon', 'Vismer')

 -robin

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



RE: [PHP] REGEX for query

2005-08-11 Thread Michael Sims
Jay Blanchard wrote:
 [snip]
 Assuming unix, I'd do the following from the root of the application
 to get a list
 of files that contain queries:

 $ egrep =[:space:]*\.*\b(SELECT|INSERT|UPDATE)\b * -ril
 ...

 Anyway, that's how I'd do it.  Hope you got something out of this...
 :) [/snip]

 That is a good start, now all I need to do is get the whole query(s)

I guess I misunderstood your goal.  You said before that you needed to LOCATE 
the
queries, which the above will do (if certain assumptions are true).  What 
exactly
are you wanting to accomplish?  Are you trying to write a script that will 
extract
the entire query from a set of PHP files?

If so, and given this:

$variableName = INSERT INTO bar (foo) ;
$variableName .= VALUES ('.$foo.') ;

Would you expect:
INSERT INTO bar (foo) VALUES ('')

or something else?

At any rate, if you are trying to automatically extract entire queries, I'd say
that's pretty tricky, unless your code uses very strict idioms for defining 
queries
that it doesn't stray from.  For example, if the code always do this:

$query = select .;
$query .= from .;
$query .= where ;

That's one thing, but if it sometimes does this:

$query = select .
 from ..
 where .;

Then that's something entirely different.

Assuming the first, you could perhaps use a two-pass approach where you first go
through a file and find the beginning of a query assignment (using a regex like 
the
one above), then extract the variable name and line number.  Then on a second 
pass
start from each line number you saved and process line number + N lines (where 
N is
the largest number of lines the code normally takes to define a query, 
arbitrarily
chosen) and look for lines where the variable name is followed by an assignment
operator (= or .=).  Then use a regex on those lines to extract everything 
between
quotes (hopefully just double quotes, unless the code tends to switch between 
double
and single).  But then you run into problems when your N is too large and the 
end of
one chunk overlaps into the beginning of the next.  I would imagine something 
like
this would take a lot of time to get right, and even then only be an 80% 
solution,
if that.

It seems to get this 100% right you'd have to have a full-fledged PHP parser, 
which
means hacking the parser that PHP itself uses.  Even hacking the PHP parser 
probably
wouldn't get you a 100% solution because the compile stage won't be 
enoughthere
is going to be code that may or may not be evaluated at runtime and I think it 
would
be impossible to know without actually running it.

So...if you absolutely have to have this done programmatically (as opposed to 
just
locating the beginning of the queries and manually extracting them) then I 
would say
good luck to you. :)  Hopefully someone else has some ideas...

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



Re: [PHP] what should I look for with this error

2005-08-11 Thread John Nichel

Jay Blanchard wrote:

[snip]
I might pull time zone rules and say that your 4:30 is my 5:30, and that

I'm already home. ;)
[/snip]

Another space-time continuum snafu brought to you by the Consortium For
Creative PHP Development



picard
Remember the Prime Directive, Number One.
/picard

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



[PHP] XML manipulation using PHP

2005-08-11 Thread Anas Mughal
Could someone please share with me sample code for:

- Adding an XML node to an existing XML document.
- Modifying the value for a given XML node in an existing XML document.

Thank you.
-- 
Anas Mughal


RE: [PHP] XML manipulation using PHP

2005-08-11 Thread Jay Blanchard
[snip]
Could someone please share with me sample code for:

- Adding an XML node to an existing XML document.
- Modifying the value for a given XML node in an existing XML document.
[/snip]

Have you looked at the documentation?

http://www.php.net/xml

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



Re: [PHP] XML manipulation using PHP

2005-08-11 Thread Jochem Maas

Jay Blanchard wrote:

[snip]
Could someone please share with me sample code for:

- Adding an XML node to an existing XML document.
- Modifying the value for a given XML node in an existing XML document.
[/snip]

Have you looked at the documentation?


hey Jay take it easy on the long words. ;-)



http://www.php.net/xml



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



[PHP] IP Geographical

2005-08-11 Thread John Taylor-Johnston
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



Re: [PHP] IP Geographical

2005-08-11 Thread Greg Donald
On 8/11/05, John Taylor-Johnston [EMAIL PROTECTED] wrote:
 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.

http://sourceforge.net/projects/geoip/


-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



Re: [PHP] IP Geographical

2005-08-11 Thread Duncan Hill
On Thursday 11 August 2005 16:37, John Taylor-Johnston typed:
 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

maxmind.

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



Re: [PHP] IP Geographical

2005-08-11 Thread Greg Donald
On 8/11/05, Greg Donald [EMAIL PROTECTED] wrote:
 http://sourceforge.net/projects/geoip/

Actually, here's a better URL:

http://freshmeat.net/projects/geoip/


-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



Re: [PHP] IP Geographical

2005-08-11 Thread Jarratt Ingram
Hello John 

http://www.ip-to-country.com/ provides a downloadable csv database
that should help you along your way.

HTH

On 8/11/05, John Taylor-Johnston [EMAIL PROTECTED] wrote:
 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
 


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



[PHP] possible bug (string equality to zero)?

2005-08-11 Thread Christopher J. Bottaro
Is it a bug that ($var == 0) is always true for any string $var?

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



RE: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread Jay Blanchard
[snip]
Is it a bug that ($var == 0) is always true for any string $var?
[/snip]

You are comparing a string to an integer.

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



Re: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread Torgny Bjers
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).

Regards,
Torgny

Christopher J. Bottaro wrote:

Is it a bug that ($var == 0) is always true for any string $var?


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



Re: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread Scott Noyes
 [snip]
 Is it a bug that ($var == 0) is always true for any string $var?
 [/snip]
 
 You are comparing a string to an integer.

Right.  This is clearly documented at http://www.php.net/operators.comparison

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



Re: [PHP] Regular expression question

2005-08-11 Thread Leon Vismer
Hi Robin

Many thanks for this,

how would one extend this to support the following:
$str = insert into userComment (userID, userName, userSurname) values (0, 
'Leon', 'mcDonald');

one does not want

$str = insert into user_comment (user_id, user_name, user_surname) values (0, 
'Leon', 'mc_donald');

unfortunately lookbehind assertions does not support non-fixed length chars so
/(?=(?!')[a-z])([A-Z]+)/e will work for 'mDonald' but the following will not 
work.

/(?=(?!')([a-z]+))([A-Z]+)/e

Any ideas?

Many thanks
--
Leon

 ?php
 $str = insert into userComment (userID, userName, userSurname) values
 (0, 'Leon', 'Vismer');

 $match  = '/(?=[a-z])([A-Z]+)/e';
 $replace = 'strtolower(_$1)';
 print preg_replace($match, $replace, $str);
 ?

 insert into user_comment (user_id, user_name, user_surname) values (0,
 'Leon', 'Vismer')

  -robin

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



[PHP] Re: date field

2005-08-11 Thread John Taylor-Johnston

Thanks Ben!
John

Ben Ramsey wrote:


In PHP, you could do something like:

$updated  = strtotime($db_result['updated']);
$one_year_ago = strtotime('-1 year');

if ($updated  $one_year_ago) {
// updated date is older than a year ago
}


John Taylor-Johnston wrote:

I have a field 'updated' How can I tell if the date is older than 1 
year ago (or should I think of 365 days)?


`updated` date NOT NULL default '1999-12-12'

I've looked at: http://ca3.php.net/manual/en/function.getdate.php

Thanks,
John






--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.

 ' ' 'Collège de Sherbrooke:
ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
   - 819-569-2064

 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064

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



Re: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread Chris Shiflett

Christopher J. Bottaro wrote:

Is it a bug that ($var == 0) is always true for any string $var?


For any string? How about the string 5? :-)

PHP tries to help you out, but there's not much it can do when you ask 
it to compare a string like 'foo' to an integer. It scans your string 
from left to right and uses the leading numbers to create the integer. 
For example, 53chris is 53, but chris53 is 0 (no leading numbers).


Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



[PHP] Re: possible bug (string equality to zero)?

2005-08-11 Thread Christopher J. Bottaro
Torgny Bjers wrote:

 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.

Thanks for the reply,
-- C

 Regards,
 Torgny
 
 Christopher J. Bottaro wrote:
 
Is it a bug that ($var == 0) is always true for any string $var?

 

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



[PHP] Re: possible bug (string equality to zero)?

2005-08-11 Thread Christopher J. Bottaro
Scott Noyes wrote:

 [snip]
 Is it a bug that ($var == 0) is always true for any string $var?
 [/snip]
 
 You are comparing a string to an integer.
 
 Right.  This is clearly documented at
 http://www.php.net/operators.comparison
 

Oh, I see...it converts the string into number, not the other way around. 
Thanks for the link.

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



RE: [PHP] Re: possible bug (string equality to zero)?

2005-08-11 Thread Jay Blanchard
[snip]
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.
[/snip]

I changed this sample to the following;

?php

$a[] = 'blah';
$a[] = 'blah';
$a['assoc'] = 'array';
print_r($a);
foreach ($a as $k = $v){
  if ($k == 'assoc'){
echo $v . \n;
  }
}
?

Andf the output was;

Array
(
[0] = blah
[1] = blah
[assoc] = array
)
blah
array

Does it begin to make more sense now? 

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



[PHP] Oracle Question

2005-08-11 Thread xfedex
Hi,

Can PHP connect to a remote Oracle db?
Because all oracle connecting functions only require 'user' and 'pass'

http://us3.php.net/manual/en/function.oci-connect.php
http://us3.php.net/manual/en/function.ora-plogon.php

Thanks,
Regards,
pancarne.

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



[PHP] Best practices for deleting and restoring records - moving vs flagging

2005-08-11 Thread Saqib Ali
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.

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



Re: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread xfedex
Hi,

 Is it a bug that ($var == 0) is always true for any string $var?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

Check this out!
http://us3.php.net/manual/en/types.comparisons.php

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



[PHP] PHP smarty - nested queries and arrays

2005-08-11 Thread Amanda Hemmerich

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}/bbr /
   ul
   {foreach from=$entry.subs item='sub'}
   li{$sub.short_name}/li
   {foreachelse}
   liNo subs for this project/li
   {/foreach}
   /ul
{foreachelse}
   bNo projects found/b
{/foreach}

Can anyone point me in the right direction?

Thanks,
Amanda

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



[PHP] PHP and Active Directory

2005-08-11 Thread xfedex
Hi,

Have someone make PHP to authenticate against AD?
Any comment, suggestion will be greatly appreciated.

Thanks,
pancarne.

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



RE: [PHP] PHP and Active Directory

2005-08-11 Thread Jay Blanchard
[snip]
Have someone make PHP to authenticate against AD?
Any comment, suggestion will be greatly appreciated.
[/snip]

Are you, at all, familiar with TFM?

http://www.php.net/ldap

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



RE: [PHP] PHP and Active Directory

2005-08-11 Thread Nathan Tobik
Here is a php class for Active Directory:

http://adldap.sourceforge.net/


Nate Tobik
(412)661-5700 x206
VigilantMinds

-Original Message-
From: xfedex [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 11, 2005 2:41 PM
To: php-general@lists.php.net
Subject: [PHP] PHP and Active Directory

Hi,

Have someone make PHP to authenticate against AD?
Any comment, suggestion will be greatly appreciated.

Thanks,
pancarne.

-- 
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] Oracle Question

2005-08-11 Thread tg-php
Yeah, you can connect to Oracle remotely.  The standard PHP functions should do 
it probably, but I've done it using ADODB.

I don't know if this is the same on a *nix box, but I was running PHP on a 
Windows box and needed special Oracle stuff installed on my machine to connect 
to the Oracle DB.   There's a file..something like tsnames.ora that has the 
database information.  Sort of like their version of ODBC.  You give it an 
aliased name, then give it all the server info, then when you connect to 
Oracle, you give it the name that's entered into tsnames.ora (or whatever the 
file is) and the username/password combo.

Maybe that'll give you a nudge in the right direction.

Good luck!  Let us know what you find!

-TG

= = = Original message = = =

Hi,

Can PHP connect to a remote Oracle db?
Because all oracle connecting functions only require 'user' and 'pass'

http://us3.php.net/manual/en/function.oci-connect.php
http://us3.php.net/manual/en/function.ora-plogon.php

Thanks,
Regards,
pancarne.

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


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Re: possible bug (string equality to zero)?

2005-08-11 Thread Philip Hallstrom

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...

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



[PHP] PHP, SSL and private keys

2005-08-11 Thread Evert | Rooftop

Hi,

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.

Thanks!
Evert

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



Re: [PHP] Oracle Question

2005-08-11 Thread Joseph Oaks
xfedex, yes you can connect to a remote Oracle DB, I'm doing for an app
I'm trying to write. You have to configure php with the oracle version
you have, more than likely with the --with-oci8=/u1/oracle/product/10g
line, of course your oracle location will differ.

I chose to use the PEAR::DB to do my oracle stuff instead of the oci calls.
This made it simple, and easy to read for me as I'm still learning.
The code looks cleaner also.



xfedex ([EMAIL PROTECTED]) wrote:

 Hi,

 Can PHP connect to a remote Oracle db?
 Because all oracle connecting functions only require 'user' and 'pass'

 http://us3.php.net/manual/en/function.oci-connect.php
 http://us3.php.net/manual/en/function.ora-plogon.php

 Thanks,
 Regards,
 pancarne.

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



-- 
Computers are like air conditioners - they stop working properly when you
open Windows

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



Re: [PHP] PHP and Active Directory

2005-08-11 Thread xfedex
 [snip]
 Have someone make PHP to authenticate against AD?
 Any comment, suggestion will be greatly appreciated.
 [/snip]
 
 Are you, at all, familiar with TFM?
 

TFM?.m no, can you tell me where to start?

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



RE: [PHP] PHP and Active Directory

2005-08-11 Thread Jay Blanchard
[snip]
 Are you, at all, familiar with TFM?
 

TFM?.m 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

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



Re: [PHP] PHP and Active Directory

2005-08-11 Thread xfedex
 [snip]
  Are you, at all, familiar with TFM?
 
 
 TFM?.m 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.

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



[PHP] making checkbox's and radio buttons sticky

2005-08-11 Thread zedleon
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

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



RE: [PHP] PHP and Active Directory

2005-08-11 Thread Jay Blanchard
[snip]
Sorry, dont have time for this right now...Anyway, thanks for your
answer!
[/snip]

You don't have time to read the manual?

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



Re: [PHP] PHP and Active Directory

2005-08-11 Thread John Nichel

xfedex wrote:

[snip]


Are you, at all, familiar with TFM?



TFM?.m 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]

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



Re: [PHP] PHP and Active Directory

2005-08-11 Thread xfedex
 [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.

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



Re: [PHP] Re: possible bug (string equality to zero)?

2005-08-11 Thread tg-php
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.

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



[PHP] CPU Usage

2005-08-11 Thread Evert | Rooftop

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



Re: [PHP] PHP and Active Directory

2005-08-11 Thread John Nichel

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]

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



RE: [PHP] PHP and Active Directory

2005-08-11 Thread Jay Blanchard
[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.

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



Re: [PHP] graph - dowloads/hr

2005-08-11 Thread Sebastian

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

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



Re: [PHP] PHP and Active Directory

2005-08-11 Thread tg-php
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.

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



Re: [PHP] PHP and Active Directory

2005-08-11 Thread xfedex
 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.

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



RE: [PHP] PHP and Active Directory

2005-08-11 Thread Jay Blanchard
[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

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



Re: [PHP] PHP and Active Directory

2005-08-11 Thread xfedex
 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.

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



Re: [PHP] CPU Usage

2005-08-11 Thread Patrick - Jupiter Hosting
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
 

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



[PHP] Re: PHP, SSL and private keys

2005-08-11 Thread Manuel Lemos

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

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



[PHP] Re: PHP smarty - nested queries and arrays

2005-08-11 Thread Matthew Weier O'Phinney
* 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/

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



[PHP] Blatantly Evil Question

2005-08-11 Thread Brian Dunning
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.  :)


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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Brian Dunning

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.


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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Brian Dunning

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?


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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Jasper Bryant-Greene

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

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



Re: [PHP] PHP smarty - nested queries and arrays

2005-08-11 Thread Jochem Maas

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



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



RE: [PHP] IP Geographical

2005-08-11 Thread Rob Agar
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: php-general@lists.php.net
 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
 

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



Re: [PHP] PHP and Active Directory

2005-08-11 Thread Jochem Maas

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



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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Jochem Maas

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



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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Jasper Bryant-Greene

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

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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Philip Hallstrom

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.

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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Jochem Maas

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.



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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Matthew Weier O'Phinney
* 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/

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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Jasper Bryant-Greene

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

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



Re: [PHP] Blatantly Evil Question

2005-08-11 Thread Jochem Maas

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



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



Re: [PHP] making checkbox's and radio buttons sticky

2005-08-11 Thread Jochem Maas

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



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



[PHP] Tip for 'New People'/Beginners/Noobs [was] Re: [PHP] PHP smarty - nested queries and arrays

2005-08-11 Thread Jochem Maas

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





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



[PHP] Re: PHP smarty - nested queries and arrays

2005-08-11 Thread mikespook
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}/bbr /
ul
{foreach from=$entry.subs item='sub'}
li{$sub.short_name}/li
{foreachelse}
liNo subs for this project/li
{/foreach}
/ul
 {foreachelse}
bNo projects found/b
 {/foreach}

 Can anyone point me in the right direction?

 Thanks,
 Amanda 

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



[PHP] Getting average down to 5

2005-08-11 Thread Ryan A
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

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



Re: [PHP] Getting average down to 5

2005-08-11 Thread Sebastian

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

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



  1   2   >