[PHP] Re: How can I stop PHP from resolving symlinks?

2006-02-25 Thread James Benson

is_link() perhaps ?



http://php.net/is_link



James

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



[PHP] Re: no newline after "?>" in the resulting HTML

2006-03-18 Thread James Benson



Rostislav Krasny wrote:

Hi,

I've tried to ask the following question on internals@lists.php.net but
has been pointed out that that mailing list isn't appropriate. So I'm
resinding it here.

I am a newbie to PHP. I've installed a php5-cgi-5.1.2_1 from FreeBSD
ports collection and access it by FastCGI protocol from nginx HTTP
server. I've tried an example of "Hello World" PHP script from the
following tutorial page:

http://www.php.net/manual/en/tutorial.firstpage.php

This is how the resulting HTML code is expected to look like, according
to the tutorial:


 
 PHP Test
 
 
 Hello World
 


And following is the HTML code I've got:


 
 PHP Test
 
 
 Hello World


Why there is no newline afer " Hello World" ?
Is it a PHP bug or the tutorial should be updated?

P.S. I'm not subscribed to this list, please Cc your reply.






I get the same results, I doubt it's a bug, the person who wrote the 
article maybe never tried what it would output since they probably know 
how the echo construct works, if you want a line break you should change 
it to:-



Hello World\n"; ?>

or:-

Hello World" . PHP_EOL; ?>

or:-

Hello World
"; ?>




James

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



Re: [PHP] db insert question

2005-07-21 Thread James Benson
Thanks for all your help, ive got it working as i needed, my db query is 
built like this, works but probably not the best way of doing it:-




$sqlStart = "INSERT INTO `tester` (";
$sqlMiddle = ") VALUES (";
$sqlEnd = ")";

$keys = array();
$values = array();


foreach($formData as $keyName => $keyValue){
  array_push($keys, "`$keyName`");
  array_push($values, "'$keyValue'");
}


$keys = implode(",", $keys);
$values = implode(",", $values);


$query = "$sqlStart$keys$sqlMiddle$values$sqlEnd";
$result = mysql_query($query);

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



Re: [PHP] Attaching a PDF in email (no body text displays)

2005-07-21 Thread James Benson

Personally  I use the MimeMail class, that works a treat,

http://www.phpguru.org/static/mime.mail.html


Their are two versions, one php4 one php5, or install via pear.




JB



Ade Smith wrote:

I am attaching a PDF document to an email, this part works great, however to
get this to work it prevents the text in the body of the message to be
displayed, what am I doing wrong?  

 


Here is the code:

 

$filename = "confirmation.pdf"; 


if(!($fp = fopen($filename, "r"))):

  $error = "Can't open file";

  echo $error;

  exit;

endif;

 


$boundary = "b" . md5(uniqid(time()));

$boundary='"'.$boundary.'"';

 


$attach = fread($fp, filesize($filename));

$attach = chunk_split(base64_encode($attach));

 


$mime = "from: [EMAIL PROTECTED]";

$mime .= "Content-type: multipart/mixed; boundary=$boundary";

 


$mime .= "--$boundary\r\n";

$mime .= "Content-type:  application/pdf; name=\"confirmation.pdf\"\r\n";

$mime .= "Content-Transfer-Encoding: base64\r\n\r\n";

$mime .= "Content-Disposition: attachment;\r\n";

$mime .= " \r\n$attach\n";

 


$mime .= "--$boundary\r\n";

$mime .= "Content-Type: text/HTML; charset=iso-8859-1\r\n";

$mime .= "Content-Transfer-Encoding: 7bit\r\n\r\n";

$mime .= "test test test";

$mime .= "--$boundary--\r\n";

 


mail("[EMAIL PROTECTED]","Your Confirmation: $confirmation_number","",$mime);

 

 

 

 





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



[PHP] phpdoc install trouble

2005-09-17 Thread James Benson
Im trying to setup the pear phpdocumentor class but running into many 
problems, i think ive nearly got all the include directories setup 
correct now, modified some paths etc, now when i get to the end of a 
compile via the command line it always says the followig with different 
files when differnt converters are used:-


Fatal error: Call to undefined function:  phpdocumentor_get_class() in 
/docs/www/phpDocumentor/Converters/HTML/Smarty/HTMLSmartyConverter.inc 
on line 1122




Also Tried with web interface but get the following two error messages:-

Parsing configuration file phpDocumentor.ini...
done
using experimental tokenizer Parser
File  Ignored
ERROR: nothing parsed

...

Parsing configuration file phpDocumentor.ini...
done
Directory '' not found



Using PHP4.4.0 Apache 1.3.33 - ubuntu 5 with tokenizer ext, my 
phpDocumentor.ini settings are as follows:-





Program_Root = /docs/www/FormGenie

;; uncomment this to set the path phpDocumentor looks in to find user files
userdir = user/

;; Use useconfig if you want to be able to run phpdoc with no 
command-line options (!!)
;; change the value of useconfig to an .ini file that is in users/ (like 
greg.ini)

;[_phpDocumentor_setting]
useconfig = demo




settings of demo.ini

target = /docs/www/FormGenie/docs


[Parse Data]
;; title of all the documentation
;; legal values: any string
title = FormGenie Documentation

;; parse files that start with a . like .bash_profile
;; legal values: true, false
hidden = false

;; show elements marked @access private in documentation by setting this 
to on

;; legal values: on, off
parseprivate = on

;; parse with javadoc-like description (first sentence is always the 
short description)

;; legal values: on, off
javadocdesc = off

;;target=/dev/null

;; add any custom @tags separated by commas here
;; legal values: any legal tagname separated by commas.
;customtags = mytag1,mytag2

;; what is the main package?
;; legal values: alphanumeric string plus - and _
defaultpackagename = FormGenie

;; output any parsing information?  set to on for cron jobs
;; legal values: on
;quiet = on

;; limit output to the specified packages, even if others are parsed
;; legal values: package names separated by commas
;packageoutput = package1,package2

;; comma-separated list of files to parse
;; legal values: paths separated by commas
;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory
;;filename =


;; comma-separated list of directories to parse
;; legal values: directory paths separated by commas
;directory = /path1,/path2,.,..,subdirectory
directory = /docs/www/FormGenie


;; comma-separated list of files, directories or wildcards ? and * (any 
wildcard) to ignore

;; legal values: any wildcard strings separated by commas
;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/
;;ignore = templates_c/,*HTML/default/*,spec/

;; comma-separated list of Converters to use in 
outputformat:Convertername:templatedirectory format
;; legal values: 
HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib 

;; 
HTML:frames:phpedit,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de 

;; 
HTML:Smarty:default,HTML:Smarty:PHP,PDF:default:default,CHM:default:default,XML:DocBook:default 


output=HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,HTML:frames:phpedit,HTML:Smarty:default,HTML:Smarty:HandS,HTML:Smarty:PHP,PDF:default:default,XML:DocBook/peardoc2:default,CHM:default:default




Thanks for any help,

James

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



[PHP] Re: php guru!!!!!

2005-09-17 Thread James Benson

http://php.net/ob_start

try something like...






bruce wrote:

hi...

i'm playing with a script/class from phpclasses.org. the script/class is
user_class. the script is straight enough, but i'm trying to figure out how
i can include/incorporate the script into a test site i'm creating...

the user_access script more or less uses the entire page. for my app, i'd
like to basically use the user_access app/class and have the different pages
be displayed in specific areas of my pages...

given that the user_class script uses 'header', i'm not sure how to
accomplish this without generating the 'headers already sent...' err msg...

if there's someone that i can talk to regarding this, i'd appreciate it..

thanks

-bruce
[EMAIL PROTECTED]


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



[PHP] Re: user can post items while outhers cannot?

2005-09-20 Thread James Benson
Probably your code, changes were made in the newer versions of PHP which 
make some older scripts unusable, register globals for instance, do you 
have the PHP.ini settings to show errors turned on, you should, if you 
post the code snippet someone will probably be able tell whether its the 
code or not if your not sure,



James



Joeffrey Betita wrote:

hello
  i installed mysql-standard-4.1.13-pc-linux-gnu-i686.tar.gz, i followed
the instruction on the INSTALL-BINARY file. after that i installed
httpd-2.0.54.tar.gz followed the instruction on the INSTALL file. also
installed php-5.0.4.tar.gz
followed the install intruction in the INSTALL file. CentOS release 4.0
(Final) is the linux distribution. some user when trying to post an item
cannot post an item. they are being redirected to the welcome page. once
they click the post item button. while other user can post an item
succesfully. i been looking at the apache access and error logs and
/var/log/messages no luck. what log files should i be looking for. did i
miss anything while installing on the ./configure [options] mysql, apache,
php etc. on our old server the version of apache-2.0.47, mysql-4.0.15a-log,
php-4.3.3 the OS is RH9 before our only problem is "too many connections
error" when they browse our website. is this a apache, MySQL, PHP etc.
problem. i just would like to know. any help would be appreciated. thank you
very much.


rgds,
Joeffrey



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.3/106 - Release Date: 9/19/2005


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



[PHP] per user php.ini

2005-10-08 Thread James Benson
Hey everyone, probably missed the bit in the manual but my current 
webhost allows uploading of my own php.ini to my home dir, my question 
is how to do this?


My guess would be to set the ./configure line to something like 
--with-config-file-path=/home/*/public_html


but I dont wanna re-compile if im wrong, can anyone tell me?

Using apache-1.3.33, php-4.4.0

Many thanks,
James Benson.

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



Re: [PHP] per user php.ini

2005-10-09 Thread James Benson

Nothing special on my configure line and the setting:-
Configuration File (php.ini) Path looks like /home/USERNAME/public_html

Only just noticed it's been switched over to CGI recently, It's also 
possible to have one php.ini per directory and the above mentioned 
setting always reflects the php.ini setting for that directory so must 
be something concerning httpd.




JB






Rory Browne wrote:

why not upload a phpinfo() file and see?

I'm personally not quite sure how this would work, and I'm interested
in finding out.

On 10/8/05, James Benson <[EMAIL PROTECTED]> wrote:


Hey everyone, probably missed the bit in the manual but my current
webhost allows uploading of my own php.ini to my home dir, my question
is how to do this?

My guess would be to set the ./configure line to something like
--with-config-file-path=/home/*/public_html

but I dont wanna re-compile if im wrong, can anyone tell me?

Using apache-1.3.33, php-4.4.0

Many thanks,
James Benson.

--
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] per user php.ini

2005-10-09 Thread James Benson

Thanks for the replies.







Rory Browne wrote:

they probably use something along the lines of mapping PHP to php -c
$HOME/php.ini

In Linux this would generally be done using binfmt_misc.

On 10/9/05, James Benson <[EMAIL PROTECTED]> wrote:


Nothing special on my configure line and the setting:-
Configuration File (php.ini) Path looks like /home/USERNAME/public_html

Only just noticed it's been switched over to CGI recently, It's also
possible to have one php.ini per directory and the above mentioned
setting always reflects the php.ini setting for that directory so must
be something concerning httpd.



JB






Rory Browne wrote:


why not upload a phpinfo() file and see?

I'm personally not quite sure how this would work, and I'm interested
in finding out.

On 10/8/05, James Benson <[EMAIL PROTECTED]> wrote:



Hey everyone, probably missed the bit in the manual but my current
webhost allows uploading of my own php.ini to my home dir, my question
is how to do this?

My guess would be to set the ./configure line to something like
--with-config-file-path=/home/*/public_html

but I dont wanna re-compile if im wrong, can anyone tell me?

Using apache-1.3.33, php-4.4.0

Many thanks,
James Benson.

--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Caching problems .. I think

2005-10-16 Thread James Benson
SOunds like your form is using POST which does what you desribe to avoid 
submitting the same info twice. only way I know is to use GET but that 
would put al data in the URL.




Søren Schimkat wrote:

Hi guys

I have a rather simple setup:

A few forms chained after each other (the first leds to the second which 
leeds to the third and so on)

I´m using sessions - and starting each page like this:

header('Expires: ' . gmdate('D, d M Y H:i:s', (time() + (60 * 10))) . ' 
GMT');

session_cache_limiter('private_no_expire');
session_start();

... which I believe gives each page (and form result) a caching time of 
10 minutes. The problem is that when using the back button in IE - IE 
complains about the page and tells med that this page is the result of a 
form and that the content has been blocked.


Can anyone tell me how to awoid this problem, so the backbutton can be 
used, and stil give each page a caching time of 10 minutes?




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



[PHP] Re: Preference for User Permissions system

2005-10-21 Thread James Benson

What I do is have different classes that build upon each other,


authentication & permissions class,
common database access extending PEAR DB.

then i have a custom class for specific actions like editing pages, my 
database is just either either an email or username and password then 
another table has permission levels in, permissions for every user are 
defined in their DB table in a comma seperated list, that way i can 
create many groups and have a user belong many groups, then page editng 
for instance can be restricted to specific users or groups, I designed 
it all to be flexible enough to reuse for all my websites I hope :)




Regards,
James




Richard Davey wrote:

Hi php-general,

  I'm interested to know what everyones preference is for user
  permissions / roles in php apps? For example do you employ a Unix
  style groups system, is there a ready-rolled class or package you
  use, or have you just built your own and stick with it?

Cheers,

Rich


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



[PHP] Re: Email Validation built-in? RFC

2005-10-22 Thread James Benson
It would be nice to have a php function valid_email or something but 
until then i suppose we just make do with what is available, for what I 
need I use the following:-



eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" 
."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)



Ive never had problems with it but have up to now no need for 
multilanguage validation.



What is wrong with that validation anyway?







Richard Lynch wrote:

Given:

It is unacceptable to reject perfectly valid email addresses, no
matter how arcane. [Like mine. :-)]

The CORRECT RegEx for validating an email is 3 pages long, and
performance in PHP would probably not be so good...

In today's Security-conscious world, data validation is a requirement.

The (relatively) recent changes in domain names that allow UTF
(Unicode?) characters.

Checking MX records is not reliable at all.

Forcing users to respond to email is A) burdensome to real users in
many cases, and B) no real barrier to halfway intelligent fake users.

... would it not make sense for there to be a BUILT-IN PHP function of
a TRUE email syntactic validation?

So at least one KNOWS that the email is a valid construct, before you
even try (if you try at all) to make sure that a person actually
checks it at least once in their life.

Currently, email syntax validation is being done in very limited
fashion, if not outright "wrong" by rejecting what actually ARE valid
email addresses in about 10,000,000 PHP scripts by users who don't
have any realistic options to truly "do it right" because who can
really live with that 3-page Regex in their PHP code?

Yes, in the past, I may have come down squarely on the opposite side
of this topic, but I've changed my mind.

I believe PHP needs a built-in syntactically CORRECT email validation
function, vetted and tested by professionals, instead of the mess we
now have.

PLEASE do not point me to any existing email validation code unless
you believe it is not only 100% correct and complete with RFC
definitions of syntactically valid email.  Not interested.  I've
already seen them, and been burned by them.



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



[PHP] Re: cleanly written shop-system (php5, object-oriented)?

2005-10-24 Thread James Benson
PHP5 has yet to see the maturity and stability PHP4 offers which is why 
most applications use it.


Worst thing you can do is design a website in entirely flash :)






Phillip Oertel wrote:

hi,

i want to create a "shop server" application. the shop client interface
will be in flash (communication with php over xml, soap or amfphp), the
administration interface will be html. most likely it will probably be a
long-running application that will be extended in several steps, so we
need a solid foundation. we also need to get started quickly (who
doesn't), otherwise i would consider starting from scratch.

i have already looked around quite a lot for a nicely adaptable
shop/ecommerce implementation, but haven't been very successful so far.
everything i found was conceived in php4 times, where OO wasn't as
wide-spread in the php community as it is today. some of the packages
are poorly documented (both in-code and separate documentation), have an
inconsistent coding style, are dead, are copies of oscommerce with a
worse interface, ...

feature-wise the best i found was xtcommerce (oscommerce fork)
admin interface wise: zencart (oscommerce fork)
code-wise: randshop
non of them use php5's features, though, none are written object-oriented.

i have no info on the performance of these shops, although that
shouldn't be a prob as long as it's not desastrous (to some extend, you
can always scale hardware-wise).

so i am looking for a cleanly layered application where i could swap out
the presentation layer. and all important shop data (products, product
categories, cart, etc.) should be represented as objects, so i could
extend them to implement required customizations.
it would be a big plus if the admin interface was well thought-out.

we need quite some features like multiple languages, multiple
categories, discounts on certain products, payment provider integration,
customer newsletters, possibly administration of several slightly
different shops in one installation, etc.

is there such an application or am i stuck with oscommerce and its forks?
i don't need it to be feature complete, as long as there is a way to
adapt the code without hacking the whole thing (and loosing the
possibility of upgrading).

as long as the code was open, i would be happy to pay a certain amount
for the application.

anyone?

phil


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



Re: [PHP] Re: cleanly written shop-system (php5, object-oriented)?

2005-10-24 Thread James Benson

Bad choice of words.


I was comparing PHP4 to PHP5 and how long PHP4 has been around compared 
to PHP5, it's bound to be more stable aint it?


I was not trying to say PHP5 is not stable because im sure it is very 
much so.


Or am I not allowed to say anything like that in this forum?
Ill just silently exit through the back door then :)





Jochem Maas wrote:

James Benson wrote:

PHP5 has yet to see the maturity and stability PHP4 offers which is 
why most applications use it.


Worst thing you can do is design a website in entirely flash :)



no the worst thing you can do is spread FUD.
which you have just done, unless you are capable of backing up your off 
the cuff
remarks (about the stability of php5) with hard imperical data, which I 
doubt.


actually 'the worst thing you can do' is more likely to be something like
'invading a sovereign state in order to be able to subsidise your own 
oil-addicted,
brainwashed, selfrighteous society' than something that's anything to do 
with

php or the web. but then again maybe not ;-)








Phillip Oertel wrote:


hi,

i want to create a "shop server" application. the shop client interface
will be in flash (communication with php over xml, soap or amfphp), the
administration interface will be html. most likely it will probably be a
long-running application that will be extended in several steps, so we
need a solid foundation. we also need to get started quickly (who
doesn't), otherwise i would consider starting from scratch.

i have already looked around quite a lot for a nicely adaptable
shop/ecommerce implementation, but haven't been very successful so far.
everything i found was conceived in php4 times, where OO wasn't as
wide-spread in the php community as it is today. some of the packages
are poorly documented (both in-code and separate documentation), have an
inconsistent coding style, are dead, are copies of oscommerce with a
worse interface, ...

feature-wise the best i found was xtcommerce (oscommerce fork)
admin interface wise: zencart (oscommerce fork)
code-wise: randshop
non of them use php5's features, though, none are written 
object-oriented.


i have no info on the performance of these shops, although that
shouldn't be a prob as long as it's not desastrous (to some extend, you
can always scale hardware-wise).

so i am looking for a cleanly layered application where i could swap out
the presentation layer. and all important shop data (products, product
categories, cart, etc.) should be represented as objects, so i could
extend them to implement required customizations.
it would be a big plus if the admin interface was well thought-out.

we need quite some features like multiple languages, multiple
categories, discounts on certain products, payment provider integration,
customer newsletters, possibly administration of several slightly
different shops in one installation, etc.

is there such an application or am i stuck with oscommerce and its 
forks?

i don't need it to be feature complete, as long as there is a way to
adapt the code without hacking the whole thing (and loosing the
possibility of upgrading).

as long as the code was open, i would be happy to pay a certain amount
for the application.

anyone?

phil






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



[PHP] Re: How to account for misspellings and alternatives in searching?

2005-10-27 Thread James Benson

Not sure about the numbers but soundex could be useful

http://php.net/soundex



James


Chris W. Parker wrote:

Hello,

On my site right now if someone searches for "511" (a misspelling of the
manufacturer 5.11) they are not presented with the right products
because 511 is not found anywhere in the database.

I've got a few ideas on how to solve this but I want to find one that
requires as little administrative overhead as possible.

1. I could add a field to the db for each product that would be used for
associated words for a product as well as misspellings.

PROS: Very customizable on an individual product level.
CONS: Would need to be updated for each and every product individually.

2. Make a field for each manufacturer's record for alternate
spellings/keywords.

PROS: Little administrative overhead.
CONS: Is only manufacturer name based and could not account for specific
products.

3. Both #1 and #2.

PROS: Flexible.
CONS: Lots of administrative overhead.

4. A one-to-many table that associates individual words with product
skus. This one is pretty much the opposite of #1 with one key
difference: the interface. It would be probably be easier to enter a
desired word and then choose each sku from a multi-select dropdown than
it would be to go from product to product entering one word at a time.

5. I'm not sure how this would be accomplished from a technical
standpoint but it would be nice to have the program know that when
someone types in "511" they really meant "5.11". Or (hopefully this
isn't a bad example) if they type in "dessert" (as in cake and icecream)
they really meant "desert" (as in snakes and sand).

In my case that wouldn't be a bad assumption since our site will never
contain the word desert unless it's a misspelling.


What does everyone think? What other options are out there?



Chris.


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



[PHP] Re: Trouble using DOM component with PHP 4.4.0

2005-10-27 Thread James Benson
The best solution is not to change your host at all but to change your 
local version of PHP to 4,




PHP4 DOM - http://php.net/manual/en/ref.domxml.php
PHP5 DOM - http://php.net/manual/en/ref.dom.php


The PHP5 and PHP4 extensions are not compatible with each other.



~James




Andrew Kachalo wrote:


Hi all!

I'm experiencing problems with using DOM component in PHP 4.4.0.

It works just fine on my localhost with PHP 5.0, but on host server PHP 
4.4.0 used, and can't be updated to 5.0 for several reasons. Is there 
any guided instruction how to make code using DOM (DOMDocument class, 
etc.) component work?


Please guide me what can I do to make my code work without changing it?

Thank You!

==
Best Regards
Andrew Kachalo
http://www.geocities.com/andrew_kachalo/


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



[PHP] Re: Type of form element

2005-10-28 Thread James Benson

If you have a checkbox you just test if the value is set with isset()
if it's not set they never selected the checkbox.



Or if thats not what you mean maybe this could help
http://php.net/variables.external







Shaun wrote:

Hi,

I have some checkboxes on my page which correspond with boolean fields in my 
database - actually they are TINYINT's in which I store a 0 or 1 in for 
false and true values respectively.


Is it possible to loop through all $_POST values to see if it is a checkbox? 
If so then for that element if it is equal to 'on' then change it to 1 
otherwise change it to 0?


Thanks for your advice. 


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



[PHP] Re: [DONE] Substr by words

2005-10-29 Thread James Benson

Did you actually test that?


Even better version of your function,





$string = "one two three four";

echo substr($string, -4);
echo '...';





James




Danny wrote:

Finally i found it (Google is god, you only have to ask the right question)
 function trim_text($text, $count){
$text = str_replace(" ", " ", $text);
$string = explode(" ", $text);
for ( $wordCounter = 0; $wordCounter <= $count;wordCounter++ ){
$trimed .= $string[$wordCounter];
if ( $wordCounter < $count ){ $trimed .= " "; }
else { $trimed .= "..."; }
}
$trimed = trim($trimed);
return $trimed;
}

Usage

$string = "one two three four";
echo trim_text($string, 3);


-- Forwarded message --
From: Danny <[EMAIL PROTECTED]>
Date: Oct 29, 2005 1:36 PM
Subject: Substr by words
To: php-general@lists.php.net

 Hi,
 I need to extract 50 words more or less from a description field. How can i
do that?. Substr, cuts the words. Is there any other way to that, without
using and array? I mean and implemented function in PHP 4.x
 I´ve been googling around, but wordwrap, and substr is driving me mad...
 Thanks in advance
Best Regards

--
dpc


--
dpc



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



[PHP] Re: Managing files on the client

2005-11-01 Thread James Benson

No, its not possible without asking the client to install some software!





dcook wrote:

Hello all:

Using opendir() references directories on the server.  Is there a similar 
function for referencing directoies on the client (browser) side?


-dc 


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



Re: [PHP] Re: Managing files on the client

2005-11-02 Thread James Benson

javascript CANNOT write to a clients machine (apart from cookies)

Nothing from the server can do what you want, you need to install some 
software on each machine to achieve this.





Unknown Unknown wrote:

you could also use javascript and forms, and maybe open up an iframe with
query strings probably



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



[PHP] Re: PHP web based administrator... Pyrite

2005-11-02 Thread James Benson
It should be fine for windows but how are you gonna save the php.ini on 
any linux box that typically (when setup correctly) requires root access 
to save the file, your opening up a security hole with something like 
that unless you tackle this issue some other way!



James




Zac Barton wrote:

Hi list

I have been working on a free web based app that lets you update the
php.inifrom your browser very much like Coldfusion has.

You can find a demo off the app at
http://pyrite.zacbarton.comand im
looking to see if anyone thinks this might be useful or share any
ideas/comments
before I take it any further.

The demo site is pointing to a test php.ini file so feel free to play with
it.

Regards
Zac



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



[PHP] Re: Richard Lynch's Email Address ...

2005-11-02 Thread James Benson

Would it not be better something like valid_email()

Reason:
The is_* family check for a variable type so dont think that it really 
fits into the same catagory.



James




Jochem Maas wrote:

I totally agree with Richard. about the need for
a php func for checking a correct email addr.

given that php 'is all about the web', idealogically
(still?) pragmatic and dynamically typed:

is_email_addr() or is_email()

just 'belongs' with:

is_array()
is_bool()
is_callable()
is_double()
is_float()
is_int()
is_integer()
is_long()
is_null()
is_numeric()
is_object()
is_real()
is_resource()
is_scalar()
is_string()

any devs care to comment?

kind regards


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



[PHP] Re: Looking for a string function

2005-11-02 Thread James Benson

How about substr_replace()


http://php.net/substr_replace




Phillip S. Baker wrote:

Greetigns Gents,

I seem to remember a built in php function that will take a huge block of
text.
Then just spit out X number of characters from it and follow it with an
additional string value.
But I cannot remember what it is.

I seem to remember it being something other than the substr().

I am looking to pull the first say 200 characters from an article and follow
the last character/word with something like ...

Does anyone know what I am talking about, or am I just smoking something and
my memory is going?

Blessed Be

Phillip


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



[PHP] performance suggestions

2005-11-03 Thread James Benson
Dear group, can someone suggest the best way to do the following without 
writing some lengthy script that (possibly) could lead to performance 
issues,



I have three DB fields in MySQL, each has a unique ID, I cannot think of 
any ways other than pulling each tables record then looping through to 
determine which one each belongs to which group then maybe placing into 
an array,

the association between them all goes like this,


URL:-
url_id
url_name

section:-
section_id
url_id
section_name

page:-
page_id
section_id
page_name



What I need to do is construct a navigation bar with each url, section 
then pages for that section, is their any quick ways (perhaps with SQL) 
anyone knows of,


A static array im currently using for this looks like:-

$nav = array(

1 => array('title' => "Homepage",
'url' => "/main::default"),

2 => array('title' => "About",
'url' => "/main::about",
'sub' => array(
array('title' => "Contact",
'url' => "/main::about::contact"),
)
),

);



Hope that makes sense to someone.



Thanks in advance for any suggestions/help


James



Apache: 1.3.33
PHP:4.4.1
MySQL:  4.1

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



[PHP] Re: PHP MYSQL Dynamic Select Boxes: Please Help

2005-11-03 Thread James Benson
Try asking in a newsgroup or forum specific to javascript, that has 
nothing to do with PHP






Adele Botes wrote:

I have 2 tables:

products table
product_id (INT 11 AUTOINCRE PRI)
product_name (VARCHAR 255)
product_desc (VARCHAR 255)

color table
color_id (INT 11 AUTOINCRE PRI)
color (VARCHAR 255)
image (VARCHAR 255)
product_id (INT 11)

I would like to create the first select box (pulling the options from 
the products table).


Then I would like the second select box to display the color option 
related to the product_id in the first select box, thus changing the 
options dynamically.


I've tried the following and it doesn't seem to work.
What am I doing wrong? Please help:


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en">

Cempave :: Quality cement products


src="unobtrusivedynamicselect_ex2to4.js">


window.onload = function() {
dynamicSelect("pda-brand", "pda-type");
}





Select a product...
$product_name";
}
?>



Select a 
color...

$sql1 = mysql_query("SELECT * FROM `products` LEFT JOIN `color` 
ON products.product_id = color.product_id WHERE color.product_id = 
'$product_id'");

while ($row = @mysql_fetch_array($sql1))
{
$product_id = $row['product_id'];
$color_id = $row['color_id'];
$color = $row['color'];
//print "$product_id $color_id $color";
print "value='$color'>$color";

}
?>






This is all the JavaScript code i used:
function dynamicSelect(id1, id2) {
// Feature test to see if there is enough W3C DOM support
if (document.getElementById && document.getElementsByTagName) {
// Obtain references to both select boxes
var sel1 = document.getElementById(id1);
var sel2 = document.getElementById(id2);
// Clone the dynamic select box
var clone = sel2.cloneNode(true);
// Obtain references to all cloned options
var clonedOptions = clone.getElementsByTagName("option");
// Onload init: call a generic function to display the related 
options in the dynamic select box

refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
// Onchange of the main select box: call a generic function to 
display the related options in the dynamic select box

sel1.onchange = function() {
refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
};
}
}
function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) {
// Delete all options of the dynamic select box
while (sel2.options.length) {
sel2.remove(0);
}
// Create regular expression objects for "select" and the value of 
the selected option of the main select box as class names

var pattern1 = /( |^)(select)( |$)/;
var pattern2 = new RegExp("( |^)(" + 
sel1.options[sel1.selectedIndex].value + ")( |$)");

// Iterate through all cloned options
for (var i = 0; i < clonedOptions.length; i++) {
// If the classname of a cloned option either equals "select" or 
equals the value of the selected option of the main select box
if (clonedOptions[i].className.match(pattern1) || 
clonedOptions[i].className.match(pattern2)) {
// Clone the option from the hidden option pool and append 
it to the dynamic select box

sel2.appendChild(clonedOptions[i].cloneNode(true));
}
}
}
// Attach our behavior onload
window.onload = function() {
dynamicSelect("product_name", "color");
}

Thx in adv
Adele


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



[PHP] Re: SSL & normal sessions stored differently?

Could it be you have two differnt domain names, PHP could be using a 
different cookie/session for each one.





Jesse Guardiani wrote:

Hello,

I'm running php-4.3.2-19.ent under httpd-2.0.46-44.ent on Red Hat Enterprise
Linux ES release 3 (Taroon Update 4). Here is my Session section of php.ini:

--
[Session]
session.save_handler = files
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 200
session.gc_maxlifetime = 36000
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.entropy_length = 16
session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 0
session.use_trans_sid = 1
--

My problem is that normal session variables don't seem to be accessible from an
instance of PHP servicing an SSL connection. For example, I can  put this in
test.php:

session_id('bob');
session_start();
echo var_export($_SESSION,true);

And get different results depending on whether I call:
http://www.example.com/test.php
Or:
https://secure.example.com/test.php

The session variables seem to be stored in different places, even though the
save_path is identical.

Does anyone know why this happens and/or how to work around it?

Thanks!


Jesse Guardiani
[EMAIL PROTECTED]


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



[PHP] Re: Pictureupload




twistednetadmin wrote:

I have made this script to upload pictures into a picturegallery on a
website.
The script works just as I expected, but with one huge flaw. It doesn't work
from every users computer.
I can upload pictures with no problem, but another user get's an
errormessage. 



Should we guess the error message or play hang man for it?


Can I have a P please :)

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



[PHP] Re: Pictureupload




twistednetadmin wrote:

I have made this script to upload pictures into a picturegallery on a
website.
The script works just as I expected, but with one huge flaw. It doesn't work
from every users computer.
I can upload pictures with no problem, but another user get's an
errormessage. the other user emailed the picture to me and I could upload it
with no errors.

Here's the script.









Screenshot upload





Only pictures with the .jpg extension and size 300kb or less will be
uploaded!
Imagenames should not contain quotes or any special signs!!








File: 










Comment:
















You may want to also do something like

if(filesize($filename) > 300) {
   echo "File too large";
}








copy ($_FILES['guildimage']['tmp_name'],
"/guildimages/".$_FILES['guildimage']['name']) //Copy the image to
/guildimages
 or die("Could not copy file"); //Or don't if it's wrong size or format




Here you should be using move_uploaded_file() instead of copy()

http://php.net/move_uploaded_file







 $insertSQL = sprintf("INSERT INTO guildimages (guildimage_date,
guildimage_name, guildimage_comment, posted_by) VALUES (NOW(), '%s', '%s',
'%s')",
 ($_FILES['guildimage']['name']),
 ($_POST['guildimage_comment']),
 ($_SESSION['logname']));
 $guildimage_upload = mysql_query($insertSQL) or die(mysql_error());
//insert all info to the DB




You probably want to do some checks above (before inserting), maybe use 
http://php.net/manual/en/function.is-uploaded-file.php






echo "Result:\n";
 echo "Filename: ".$_FILES['guildimage']['name']."\n";
 echo "Filesize: ".$_FILES['guildimage']['size']." byte\n";
 echo "Filtype: ".$_FILES['guildimage']['type']."\n";
 echo "Congrats! It worked!\n";
 }
 else
{

echo "Result:\n";
echo "Now that didn't seem to work... \n
Did you try a wrong format or size? \n
File that failed--> (".$_FILES['guildimage']['name'].")";

}
}

?>







Can anyone see what's wrong? Since it works from some computers and not from
all?



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



[PHP] Re: small windows odd problem

If you mean entering code directly onto the command line then you dont 
need the opening/closing PHP tags,


use something like...

php -r "echo 'hello world';"






matt VanDeWalle wrote:

hello all,
I have just installed php-4.4.0 on my windows xp system and added the 
directory to the path c:/php-4.4.0-Win32 but I am having problems with 
the cli version of php.  I can get into the program but after i type a 
bit of code, I try the following keys to get output but it never parses 
it.  I have tried ctrl-z and ctrl-m and ctrl-d but none of these will 
execute a darn thing.  The bit of code I tried is as follows


but like i said, nothing is output when i hit ctrl-m, ctrl-z, or ctrl-d
on linux i am using php 4.3.10 and the command line works perfectly


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



[PHP] Re: How can I track the value in php

Try reading the PHP manual, people put in lots of effort for newcomers 
to learn the PHP language.


http://php.net/array



To access a single array value:-

$myArray = array('email' => '[EMAIL PROTECTED]');

echo $myArray['email'];


Above would display:- [EMAIL PROTECTED]



James




shining wrote:

Hi,
I am php beginner, I have a question:
in my index page, I firstly inlcude_once a A.php file, where i defined an
array, secondly I include another .php file named B.php, where I want to use
the array, I have claimed it as global type, but it seems I can't retrieve
any value from the array.
So I want to ask:
1. Is my use way right?
2. if I want to track a variable value how it changed between php functions,
besides I print out it's value, Is there any other way to do it?
 Any suggestion and solution welcomed!
Thanks in advance.



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



[PHP] Re: to the freelancers!!

Some companies charge for support and still make money from their open 
source projects!





bruce wrote:

Hi,

Just a quick question. Had a conversation with a person who works for a
non-profit, and she was describing some of her dealings with obtaining
grants for the development of 'open source' apps.Got me to thinking. If a
company sponsored the initial development of an 'open source' kind of app
(the exact licensing would need to be fleshed out) what do yout think would
be the response of people to work on the apps..

I started to wnoder if there would be a pool of talented people who would be
interested in working on projects that are initially funded. The funding
would go to pay the resources, set up the project, do initial grass roots
marketing, etc... The idea would be to focus in on the
projects/technologies/apps that a given business would agree to initially
support/fund.

Thoughts/comments/etc...

-bruce
[EMAIL PROTECTED]

ps. I'm not talking about a freshmeat.net/sourceforge kind of environment.
The obvious goal of this kind of process would be to turn small
applications/projects into profitable applications. My curiousity is whether
you could then create applications/services that could be built along the
same model as nagios/mysql/etc.. where you have a free/open version, as well
as a fee based application/service.


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



[PHP] Re: PHP 4.4.1 on Apache 2.0.x issue


Try using require_once or include_once



Max Belushkin wrote:

   Hi list,

  after upgrading to PHP 4.4.1, I'm having the following problem: Apache is 
running in prefork mode. index.php includes func.php, which defines some 
functions and connects to MySQL. For a while (1-2 requests) everything runs 
ok, except mysql sockets keep stacking up. And then - wham, suddenly, I'm 
getting errors:



Perhaps your using persistent connections, Ive had problems like this so 
turn off persistent connection in php.ini and it goes away - could be 
your prob!



Cannot redeclare mquery() (previously declared in /home/test/func.php:9) 
in /home/test/func.php on line 9


  If I wait a few seconds, it "works" for a couple of requests again. And then 
the error is back.


  What on EARTH is happening? My wild guess is, somehow the memory gets 
shared, and the previous script is still loaded into a thread when the new 
one is called, but how can this be happening?


  I would greatly appreciate any advice...


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



[PHP] Re: No forums?

Since when is a forum more efficent than this newsgroup, forums tend to 
be more images/content and require more maintainance, this newsgroup is 
perfect for me and many other people I imagine.








GamblerZG wrote:
AFAIK, there are no "official" forums for PHP. Considering the fact that 
PHP is a web development tool, such distaste for message boards is 
ironic at the least. So why exactly there aren't any forums on php.net?


I've monitored this list long enough to predict the most probable 
replies to this message. To save everybody some time, I will ansver them 
here, without waiting someone to key them in.


Reply: There are forums on zend.com.
My Reply: zend.com != php.com.



lol, too right, php.com is nothing to do with PHP or zend.com is nothing 
to do with php.com :-)





R: There is a web interface for this mailing list.
MR: You cant' post new messages there, and it's just another way of 
showing emails anyway.


R: There is a newsgroup interface.
MR: Yeah, I'm using it right now. But it requires special software, and 
is terribly slow, unless you have very good connection and moderately 
powerful PC.





Most desktop systems come with an email client as standard so what 
special software is required!




R: Forums suck, mailing lists rule.
MR: Not if you don't like receiving 200 messages + spam every day.




If you bother to look when suscribing you would notice two choices,

1. Digest
2. Normal
The first being the one where you get emails, the second is for those 
who just open their mail client at their own leisure,




R: Synchronizing mail lists and forums is very difficult and nobody will 
do it.

MR: There is no need to synchronize anything.



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



Re: [PHP] Re: PHP 4.4.1 on Apache 2.0.x issue




Max Belushkin wrote:

Try using require_once or include_once


Well, here's all the fun starting. This is relatively long, but please bear 
with me.

First of all, yes, I did include_once, require_once, even resorted to "if (!
$inc_done) include_once("func.php")", and setting $inc_done in func.php. 
No-go, was still getting the "Cannot redefine mquery()" error message.

Now for the fun.
I've had a different set of scripts employing a different "func.php". Let's 
say, for simplicity, /home/test1/index.php included /home/test1/func.php, 
and /home/test2/index.php included /home/test2/func.php. However, in both of 
those, mquery() is defined. But they do *not* include anything else, and the 



So you defined mquery() in both files and one include's or require's the 
other file?



If so thats your problem, you cannot re-define functions



paths where set as written above. And, what do you know? If I worked inside 
test1 for a while, and went to test2, I'd get:
Cannot redefine mquery() in /home/test2/func.php line 9 (first defined 
in /home/test1/func.php on line 9). Voila.


  Going through PHP 4.4.1 release notes, I noticed the change stating "fixed a 
memory corruption bug in include()". Now, I don't know how FreeBSD ported the 
PHP code into it's ports tree, but for me, on FreeBSD 5.1, PHP 4.4.1 
*introduced* a memory corruption bug in include.


  I downgraded to 4.4.0, and everything works perfectly fine again.

  I've written to the freebsd-questions mailing list, but got no sensible 
reply so far (only one was "upgrade the ports that use PHP to newer versions, 
but my own simple set of scripts exhibits this very strange behaviour, so 
it's not a solution).


  I'll wait a few days to see if anyone else in FreeBSD experiences the same 
behaviour (the port was only introduced 2-3 days ago) before posting a bug 
report, else if no one else sees the same thing I did, I'll have to dig 
through PHP code to see what was modified in the include()-related code, I 
guess, and see what influences the behaviour I'm seeing...


  Comments?


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



Re: [PHP] Re: PHP 4.4.1 on Apache 2.0.x issue

Ok fair enough, I see your problem now, cant say ive had this and been 
using 4.4.1 since the day it came out (compiled my own on debian 
though), maybe you should try calling that function from the second file 
but without actually defining the function for that file to see whether 
you can access the in-memory function, if it works then you have an 
issue with memory like you say, but why are you using two identical 
functions in two different files anyway, that sounds like a very bad 
thing to do if two scripts are called the same time with the same 
function name its gonna cause problems aint it?



It would also be helpful to see the mquery() script - maybe someone else 
may know more then!



You may also want to try compiling your own PHP and see if its PHP or 
the distro bundled version causing problems.




HTH




Max Belushkin wrote:

On Saturday 05 November 2005 17:49, James Benson wrote:


I've had a different set of scripts employing a different "func.php".
However, in both of those, mquery() is defined. But
they do *not* include anything else, and the




So you defined mquery() in both files and one include's or require's the
other file?



  I'm sorry, but what wasn't clear in my post? A *separate* set of scripts 
includes a *separate* "func.php", and even not by relative, but by absolute 
paths! Example:

/home/test1/index.php:

/home/test2/index.php:


Both func.php are the same, defining a function mquery, which connects to 
mysql, and returns.


  After working with the index.php in Test1 until I get the "Cannot redefine 
error", I go to test2, and I get the error that *that function was defined 
in /home/test1/func.php". Test1, while I'm in Test2, and that never ever ever 
ever (...) includes *anything* from Test1. So the *Test1* func.php is still 
sitting somewhere in memory in the thread test2 is being loaded on - thus, 
include_once does not help, as the test2 func.php is NOT included. The weird 
thing is, $inc_done isn't defined either for the PHP thread, as when I tried 
the piece of code I quoted in my last message, the include_once still went 
through.


  How can this be happening? I do not know, but since a downgrade to 4.4.0 
fixed it all back proper, I am seriously beginning to suspect a problem or 
undocumented (widely documented, at least) change in PHP 4.4.1 on FreeBSD 
ports.


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



Re: [PHP] Re: PHP 4.4.1 on Apache 2.0.x issue

I cant see this being an issue with PHP because it would do that for 
every function, have you tried using a different function, something 
simple say,



function echo_this($param)
{
echo "$param";
}



Try that like your mquery function in both files and see what happens, 
could be your script considering your not prepared to share your code 
nobody could say for sure that it's not your code until they actually 
see it!



Hope you find the solution!


James





Max Belushkin wrote:

It would also be helpful to see the mquery() script - maybe someone else
may know more then!



  Well, mquery is simply "mysql_query($query);", in the stipped-down version 
I've had to resort to for testing. Basically, does nothing, since even 
mysql_connect that USED to be at the start of func.php got removed in the 
tests.


  I'm quessing this is a FreeBSD 5.1-PHP 4.4.1 specific issue by now, but 
until now, no one on the FreeBSD mailing lists seems to have cried "wolf", so 
I'll wait and see what on earth is going on...


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



[PHP] Re: Template style question


Give smarty a try rather than re-inventing the wheel


http://smarty.php.net




James



Leonard Burton wrote:

Greetings,

HI All, I hope all is well.

I have set up a template parser.  Basically, it parses the template
and finds tags with tag_name.dat file and then includes the
tag_name.dat file.  I have considered a few other options but as of
now I think I like what I have come up with.

The only problem that I have in my design is that I have to hard code
tables in the dat file mixing php and html.  I would prefer to be able
to do something like:

[[tag with db query]]

colnamecolnamecolname
%var1%%var2%%var3%

[[/tag with db query]]

I would like it to be able to parse the line with the %var1% (which is
the column name with % or some other indicator on each side) in it and
then have it generate how many ever rows as nessecary.

Currently, my parsing engine loads the template, preg_splits() it so
each template tag is on a new line, and then passes through the
resulting array and executes the code for whatever tag is chosen.

There are a couple ideas that I have thought of but have not thought
of any real good way so I am turning to the list.

Thanks for all of your help on this list!

--
Leonard Burton, N9URK
[EMAIL PROTECTED]


"The prolonged evacuation would have dramatically affected the
survivability of the occupants."


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



Re: [PHP] Re: Template style question


Robert Cummings wrote:

On Sat, 2005-11-05 at 14:55, James Benson wrote:


Give smarty a try rather than re-inventing the wheel

http://smarty.php.net



What's wrong with re-inventing the wheel? I guess your car or bike has
wooden wheels eh!? I mean if nobody had re-invented the wheel from the
wooden version, that's all that would exist. I guess if nobody had
re-invented the operating system we'd all be stuck with MS-DOS or
whatever came before that, and so on and so forth. "Don't re-invent the
wheel" is such an ignorant statement.

Cheers,
Rob.




Their is nothing at all wrong with re-inventing the wheel but where 
templating engines are concerned I dont see anyone coming up with new 
ideas that has not already been thought up by some tom, dick or harry, 
plus with all the 1000's of engines already created their is bound to be 
one that suits everyones requirements.



My suggestion could save hours, weeks or maybe even months of 
programming time dont you think?




James

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



Re: [PHP] Re: Template style question




Robert Cummings wrote:

On Sat, 2005-11-05 at 15:25, James Benson wrote:


Robert Cummings wrote:


On Sat, 2005-11-05 at 14:55, James Benson wrote:



Give smarty a try rather than re-inventing the wheel

http://smarty.php.net



What's wrong with re-inventing the wheel? I guess your car or bike has
wooden wheels eh!? I mean if nobody had re-invented the wheel from the
wooden version, that's all that would exist. I guess if nobody had
re-invented the operating system we'd all be stuck with MS-DOS or
whatever came before that, and so on and so forth. "Don't re-invent the
wheel" is such an ignorant statement.

Cheers,
Rob.




Their is nothing at all wrong with re-inventing the wheel but where 
templating engines are concerned I dont see anyone coming up with new 
ideas that has not already been thought up by some tom, dick or harry, 
plus with all the 1000's of engines already created their is bound to be 
one that suits everyones requirements.



Perhaps, but similar issues crop up for content management systems and
many people end up rolling their own after being disgusted with none of
the myriad of existing system fitting their needs.


My suggestion could save hours, weeks or maybe even months of 
programming time dont you think?



Maybe, unless he's just enjoying the learning experience, which IMHO can
be priceless.

Either way, I jumped on your reply because you didn't word it as a
suggestion, you worded it as a command.

Cheers,
Rob.




Fair enough, everyone has their own opinion :-)

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



[PHP] Re: FileExists?


Read the manual, it clearly states the following:-


Tip: As of PHP 5.0.0 this function can also be used with some URL 
wrappers. Refer to Appendix M for a listing of which wrappers support 
stat() family of functionality.






Gustav Wiberg wrote:

Hi there!

File_exists doesn't seem to work with URLs that point to another domain. 
What to use?


$x = fopen(http://www.stammis.com/getstart.php);
if file_exists($x) 



/G
http://www.varupiraten.se/


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



[PHP] Re: Session's across Domains...


Take a look at the PEAR sessionServer class

http://pear.php.net/package/HTTP_SessionServer






Tony Di Croce wrote:

I have a server with a few virtual hosts. All of my scripts use
"session_start()", and $_SESSION[] to share data between invocations of
different scripts.

The problem I'm having is that if a form on site A submits to a script on
site B the values stashed in $_SESSION[] appear to be lost...

Should this work? If not, then what alternatives exist? I suppose I could
pass the session id as a POST argument to the site B script (and theirs
probably a method in PHP that given a session_id() makes available all of
that sessions $_SESSION[] variables) but is that the best way?

td

--
for only the most hard core geekstas...
http://geekstasparadise.blogspot.com



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



Re: [PHP] performance suggestions


Thanks




Richard Lynch wrote:

On Thu, November 3, 2005 8:29 am, James Benson wrote:


Dear group, can someone suggest the best way to do the following
without
writing some lengthy script that (possibly) could lead to performance
issues,


I have three DB fields in MySQL, each has a unique ID, I cannot think
of
any ways other than pulling each tables record then looping through to
determine which one each belongs to which group then maybe placing
into
an array,
the association between them all goes like this,


URL:-
url_id
url_name

section:-
section_id
url_id
section_name

page:-
page_id
section_id
page_name



http://info.com/mysql+join



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



[PHP] Re: comment more than a question

It takes some getting used to I admit but PHP errors turned up full is 
far than enough to fix any script, in my experience






matt VanDeWalle wrote:
I don't really have a question, I just have noticed in working with php 
for about a year off and on, so you could probably say i'm a bit new 
still, what an error says it is, or what line it is on, is hardly ever 
the case, e.g, several different times until i figured out what this 
meant, i would get the "unexpected $ on line the script> error, I've figured out that actually means you are missing 
a closing } or a few
also tonight, I was working on a script, I figured this out about an 
hour later but i was getting an error about "unexpected '\' ascii 92 in 
, something to that effect; I infact  did not have a stray \, but 
the script i was calling in this particular function apparently didn't 
sit well with the code, so, i just read the code into the function 
instead of include'ing the script and everything is happy again
so I guess just letting new or somewhat new, users know not to take the 
php's errors for what they say always, sometimes it works that way, not 
much, or, in my experience anyway


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



[PHP] Re: php session in ie




sunaram patir wrote:

Hi, i am having problem with internet explorer. i am working on a
project on building a website where i need to keep track of the users
i.e. i use a login system in there in short. with the following code i
check whether the user is logged in or not.




You should use an absolute path for the header redirection,

header("Location: http://example.com/login.php";);




if the user is not logged in, it redirects to the login page login.php
as is shown in the above code. now the user is allowed to log in
through the following code:


http://schools.zenrays.com".$_SESSION['myurl']);
 else
header("Location: http://schools.zenrays.com/students";);

   }


}
?>


User Authentication



LoginID:

Password:










then the user is redirected back to the page he visited. it workd fine
in firefox and msn explorer. in internet explorer, when i visit to a
link in any page it asks for the login details again. could anyone
please help me out?!


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



[PHP] Re: Can't use secure file wrappers - Windows


Could use the xampp package or just the openssl & php from it,


http://www.apachefriends.org/en/xampp.html





Chuck Anderson wrote:
[I've had this posted in the php.windows group for a few days, but I got 
no replies there.]


I have been plugging away at this for some time now and I can not figure 
out how to get https and ftps as registered streams in my Windows 
installation of Php (4.4.0).  My direct need is to use fopen on secure 
URLs - https.


(I've installed openssl - enabled the Php openssl extension - and 
verified that my copy of Php was compiled with the openssl module.)


The latest thing I have read says that I need a "special" copy of 
php4ts.dll in order to enable secure streams (https, ftps) in Php on 
Windows (XP, in my case).


The posts I read point to copies of php4ts.dll for Php 4.3.4.

I am running Php 4.4.0.  Where can I find a copy of php4ts.dll for 
Php4.4.0 that enables secure streams?


(And is that really the solution in Php 4.4.0?)

Thanks in Advance


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



[PHP] Re: SOAP and PHP




Petr Smith wrote:

Torgny Bjers wrote:


Angelo Zanetti wrote:



Hi guys.

I've googled but found so many pages that I'm not sure what to use.

I want to use PHP to make use of SOAP.

I've found:
-nuSoap
-libxml(2)
-php-soap
-and others which seemed less important.

Can you recommend which one to use? and which one is the most supported.
Also if I've missed some that you feel I should know about please let
me know.
Thanks in advance.

Angelo





Not sure, but there's already a couple of relevant classes in PEAR:
http://pear.php.net/search.php?q=soap&in=packages&x=0&y=0

A hot tip is to always search in the packages there. :)
http://pear.php.net/packages.php

Warm Regards,
Torgny



Who uses PEAR? Mess of old unsupported and undocumented libraries which 
only their authors (maybe) can use?





LOL, what does your code look like huh?

I use pear when documentation is available or API docs are easily 
understood.


DB, Mime_Mail, HTTP_REQUEST are a few Ive used and still do, your 
obviously not experienced enough to read and reuse others code




I would recommend PHP5 SOAP extension, based on libxml2. It works 
without problems and without messing with PEAR.


You can start with this tutorial: 
http://www-128.ibm.com/developerworks/library/os-phpws/?ca=dgr-lnxw06PHP5soap 



Petr


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



[PHP] Re: Server Client Architecture, best parctice


Are both servers on the same machine?




Yaswanth Narvaneni wrote:

Hi!

I would like to know what does the community think of the best
architecture for server client communication and why? That is, if
there is a server in C++ (say a game server) and the PHP has to 'read'
data 'from' the server then what is the best form of communication?

a) Shared Memory : Server opens the shared memory in write and the PHP
scripts open it in read and gets the data
b) TMPFS (just like shared memory): Server opens a file in tmpfs in
write and PHP in read
c) Databases: Server Updates a table in the DB and client reads from the table
d) Files: Same as TMPFS

Regards,
Yaswanth

--
"In theory there is no difference between theory and practice.
In practice there is." -- Fortune Cookie


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



[PHP] Re: unsubscribing

Read the instructions on php.net, their are two different ways to 
unsuscribe, either email or use the web interface,



http://php.net/mailing-lists.php



wayne wrote:

I tried to unsubscribe on several occasion without
success. I followed the instruction at the bottom 
of the email. Can someone take me off the list.

Thank You.


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



[PHP] Re: Server Client Architecture, best parctice

Each has its own benefits, if on a shared server then a database would 
be the most secure I think, if its a dedicated server then tmpfs or just 
plain old files will probably be the best, it also depends on various 
other factors like, server hardware and bandwith, only you can select 
the best option for your particular setup.



James





Yaswanth Narvaneni wrote:

Hi!

I would like to know what does the community think of the best
architecture for server client communication and why? That is, if
there is a server in C++ (say a game server) and the PHP has to 'read'
data 'from' the server then what is the best form of communication?

a) Shared Memory : Server opens the shared memory in write and the PHP
scripts open it in read and gets the data
b) TMPFS (just like shared memory): Server opens a file in tmpfs in
write and PHP in read
c) Databases: Server Updates a table in the DB and client reads from the table
d) Files: Same as TMPFS

Regards,
Yaswanth

--
"In theory there is no difference between theory and practice.
In practice there is." -- Fortune Cookie


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



[PHP] Re: Wierd error

There is nothing weird when this function takes a variable as the 
argument and your using an object, read the manual



http://php.net/settype



You could try:-

$dbObject = (null) $dbObject;


Ive not tested that but think it should work!



James




Chris Boget wrote:

I'm seeing the following line showing up in my logs:

08:08:30  [warning] [Unknown][0]: Unknown(): Unable to call () - 
function does not exist


and I've narrowed it down to this line of code:

settype( &$dbObject, "null" );

When I comment out the above line, the error goes away.  When
I uncomment it out, the error comes back.  I've used both single
and double quotes, I've tried using different types, I've tried passing
the object both by value and by reference but nothing seems to help.

What's going on?

thnx,
Chris


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



[PHP] Re: plese help






Aftab Alam wrote:

Hello,

I want to create a trigger in PostgresSQL ,

In trigger, Before inserting the record i  want to check that data is
available or not, if data is  not there then the  insert script execute
otherwise trigget check the next insert script.

Please reply.





What, and you expect someone to code this for you?

What was your question?





Regards,
  _

Aftab Alam




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Monday, October 17, 2005 4:06 PM
To: php-general@lists.php.net
Subject: php-general Digest 17 Oct 2005 10:35:46 - Issue 3742



php-general Digest 17 Oct 2005 10:35:46 - Issue 3742

Topics (messages 224207 through 224218):

Funky array question
224207 by: Brian Dunning
224209 by: Minuk Choi
224210 by: Jordan Miller
224211 by: Jordan Miller
224212 by: Jordan Miller

Re: editor
224208 by: yangshiqi1089

a couple of problems with PHP form
224213 by: Bruce Gilbert
224218 by: Mark Rees

Re: OPTIMIZING - The fastest way to open and show a file
224214 by: Ruben Rubio Rey
224215 by: Ruben Rubio Rey
224216 by: ac

can't get IIS to run php if the script is not directly under wwwroot
224217 by: tony yau

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:
php-general@lists.php.net


--


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



[PHP] Re: How to build a XML DTD on "the fly"?


Learn DTD and how it works first then you will know :-)


A DTD is contained in an external file and not in XML, so you would 
create a DTD file then link it from the XML like so,









Erik Franzén wrote:
The code below lacks the part where the folling DTD attribute is 
created: 


How can I create the above DTD attribute in the code below?

createDocumentType('document', null, null);

// Creates a DOMDocument instance
$oDom = $oDomImp->createDocument("", "", $oDomDtd);

// Set other properties
$oDom->encoding = 'iso-8859-1';
$oDom->standalone = true;

// Create an empty element
$oElement = $oDom->createElement('document', 'test');
$oElement->setAttribute('id', '123');
// Append the element
$oDom->appendChild($oElement);

// Retrieve and print the document
echo $oDom->saveXML() . "\n";

echo "TagName: " . $oDom->getElementById('123')->tagName;
?>

Now the code produces the following result:



test

TagName:


Thanks
/Erik


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



[PHP] Re: better way to mix html and php code?

None, their all messy and terribly hard to read, I would use CSS instead 
of tables, that way their would be not much need to change any HTML code 
incase you wanted to re-design your webpage with another style or make 
slight alterations etc, HTML coders should be able to understand CSS so 
would be able to identify the bits of HTML within your PHP code if it 
needed changing, your code would be a lot easier to read using CSS, 
easier to alter and take up roughly 25% less space.



James

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



[PHP] Re: problem in create new diretory..


try 0777 instead of 777


http://php.net/chmod





ganu ullu wrote:

Hello all,
I have created a new dir, with php code .. which is like that

function mkDirE($dir,$dirmode=777)
{
if (!empty($dir))
{
if (!file_exists("./microsite/".$dir))
{
preg_match_all('/([^\/]*)\/?/i', $dir,$atmp);
$base="";
foreach ($atmp[0] as $key=>$val)
{
$base=$base.$val;
if(!file_exists("./microsite/".$base)){
 if (!mkdir("./microsite/".$base,777))
{
echo "Error: Cannot create ".$base;
return 2;
}
//echo "Inside mk";
touch("./microsite/".$base."/index.php");
$source = "./microsite/index.php";
$destination = "./microsite/".$base."/index.php";
$copy_file = copy($source,$destination);
}
}
}
else
if (!is_dir($dir))
{
//echo "Error: ".$dir." exists";
return "Error: ".$dir." already exists";
}
}
return 0;
}
-
this will create a new folder in my root folder,
Locally every thing is working fine
but when I upload the files then in my live server dir is creating
but with the permission 410 drx--t

can any body help me ... wt is the problem 

thnx...



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



[PHP] Re: how to resolve this conflict?


You obviously need to remove the old package or compile your own from source



Bing Du wrote:

Hello,

I've already posted it on the MySQL General Discussion list.  Thought I 
wanted to try this list as well in case somebody knows.


5.0.11-beta-standard is already running.  Now I need to install php-mysql
which requires mysql-3.23.58-15.RHEL3.1.i3.

Here is what I did and the errors I got:


$ sudo up2date -i php-mysql
Password:

Fetching Obsoletes list for channel: rhel-i386-ws-3...

Fetching Obsoletes list for channel: rhel-i386-ws-3-extras...

Fetching Obsoletes list for channel: dag-ws...

Fetching Obsoletes list for channel: isl-channel-ws...

Fetching Obsoletes list for channel: dag...

Fetching rpm headers...


NameVersionRel
--
php-mysql   4.3.2  26.ent  i386


Testing package set / solving RPM inter-dependencies...

Downloading headers to solve dependencies...

php-mysql-4.3.2-26.ent.i386 ## Done.
mysql-3.23.58-15.RHEL3.1.i3 ## Done.
Preparing  ### [100%]
An error has occurred:
Failed running transaction of  packages:
('file /usr/bin/comp_err from install of mysql-3.23.58-15.RHEL3.1
conflicts with file from package MySQL-devel-standard-5.0.11-0.rhel3', (7,
'/usr/bin/comp_err', 0L))
('file /usr/bin/mysql_config from install of mysql-3.23.58-15.RHEL3.1
conflicts with file from package MySQL-devel-standard-5.0.11-0.rhel3', (7,
'/usr/bin/mysql_config', 0L))

See /var/log/up2date for more information
///

More information I found in /var/log/up2date is:

//
[Thu Dec  1 12:50:02 2005] up2date updating login info
[Thu Dec  1 12:50:02 2005] up2date logging into up2date server
[Thu Dec  1 12:50:03 2005] up2date successfully retrieved authentication
token from up2date server
[Thu Dec  1 12:50:03 2005] up2date availablePackageList from network
[Thu Dec  1 12:50:03 2005] up2date Unable to import repomd support so
repomd support w
ill not be available
[Thu Dec  1 12:50:15 2005] up2date solving dep for: 
['libmysqlclient.so.10']
[Thu Dec  1 12:50:19 2005] up2date solving dep for: 
['libmysqlclient.so.10']

[Thu Dec  1 12:50:22 2005] up2date installing packages:
['php-mysql-4.3.2-26.ent', 'mysql-3.23.58-15.RHEL3.1']
[Thu Dec  1 12:50:25 2005] up2date Failed running transaction of  packages:
('file /usr/bin/comp_err from install of mysql-3.23.58-15.RHEL3.1
conflicts with file from package MySQL-devel-standard-5.0.11-0.rhel3', (7,
'/usr/bin/comp_err', 0L))
('file /usr/bin/mysql_config from install of mysql-3.23.58-15.RHEL3.1
conflicts with file from package MySQL-devel-standard-5.0.11-0.rhel3', (7,
'/usr/bin/mysql_config', 0L))

[Thu Dec  1 12:50:25 2005] up2date   File "/usr/sbin/up2date", line 1265,
in ?
sys.exit(main() or 0)
   File "/usr/sbin/up2date", line 800, in main
fullUpdate, dryRun=options.dry_run))
   File "/usr/sbin/up2date", line 1137, in batchRun
batch.run()
   File "/usr/share/rhn/up2date_client/up2dateBatch.py", line 90, in run
self.__installPackages()
   File "/usr/share/rhn/up2date_client/up2dateBatch.py", line 174, in
__installPackages
self.kernelsToInstall =
up2date.installPackages(self.packagesToInstall, self.rpmCallback)
   File "/usr/share/rhn/up2date_client/up2date.py", line 749, in
installPackages
runTransaction(ts, added, removed,rpmCallback, rollbacktrans =
rollbacktrans)
   File "/usr/share/rhn/up2date_client/up2date.py", line 634, in
runTransaction
rpmUtils.runTransaction(ts,rpmCallback, transdir)
   File "/usr/share/rhn/up2date_client/rpmUtils.py", line 520, in
runTransaction
"Failed running transaction of  packages: %s") % errors, deps=rc)
//

So any way to walk around this conflict?  Thanks in advance for any
suggestions.

Bing
Bing


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



[PHP] Re: Question about Request.php


Try checking for the error after:- $Req->sendRequest();

Example:-


$response = $Req->sendRequest();

if (PEAR::isError($response)) {
die($response->getMessage());
}

$Response = $Req->getResponseBody();



You may also want to include some options like so:-


$options = array(
'method' => 'GET',
'http' => '1.1',
'allowRedirects' => true,
'saveBody' => true,
);

$Req = &new 
HTTP_Request("http://www.geoportal.com.br/mapapp/avl/xservmapa1.asp";,

$options);




James


Danilo Azevedo wrote:

Hi, my name is Danilo, i am from Brazil
I need your assistence with a code made by your self, if you are not too
busy :P
I am using PHP/XML with your request.php file, but i cant get some
attributes from a Tag, everything is working fine, but it :(
The Tag name is "RUA" and have some attributes that i need for my
application, i am adding all Tags and if i do a echo $Response i cant
see any attributes.

If you cant help please tell me where can i find some support!! please!! :)
Thanks for all and sorry for my badly english :D

Danilo

--
my request code:
...

$Response = '';
$Req = &new HTTP_Request("
http://www.geoportal.com.br/mapapp/avl/xservmapa1.asp";)
;
$Req->setMethod(HTTP_REQUEST_METHOD_POST);
$Req->clearPostData();
$Req->addHeader("Ticket",$HTTP_SESSION_VARS["ticket"]);
$Req->addPostData('CX', $LongC);
$Req->addPostData('CY', $LatC);
$Req->addPostData('Z',  $LargM);
$Req->addPostData('N',  1);
$Req->addPostData('P1', "MAX");
$Req->addPostData('X1', $Long);
$Req->addPostData('Y1', $Lat);
$Req->addPostData('RT1',$Texto);
$Req->addPostData('E1', "SXCAR1-32;D30");
$Req->addPostData('H',  $Alt);
$Req->addPostData('W',  $Larg);
$Req->addPostData('RINFO', 100);
$Req->addPostData('INFO', "S");

if (empty($Zoom)){
   if (!empty($LongI) || !empty($LatI)){
   $Req->addPostData('XP',$LongI);
   $Req->addPostData('YP',$LatI);
   switch ($TCentr){
   case 1:
   $Req->addPostData('CMD',"C");  break;
   case 2:
   $Req->addPostData('CMD',"C+"); break;
   case 3:
   $Req->addPostData('CMD',"C-"); break;
   default:
   $Req->addPostData('CMD',"C");  break;
   }
   }
}else{
   $Req->addPostData('XP',round($Larg / 2));
   $Req->addPostData('YP',round($Alt / 2));
   if ($Zoom == 1)
   $Req->addPostData('CMD',"C+");
   elseif ($Zoom == -1)
   $Req->addPostData('CMD',"C-");
}
$Req->sendRequest();
$Response = $Req->getResponseBody();
...

--

echo $Response dont show the attributes (NroIni, NroFim, Bairro) :(
here is how the server send a correct XML request, look at the RUA tag:



 // dados sobre a localização do CENTRO DO MAPA
   nome da cidade
   sigla do estado
   
   
   url do GIF gerado
   longitude do centro do mapa
   latitude do centro do mapa
   zoom
   quantidade de pontos
 // Haverão N itens do tipo PONTO
   identificação do ponto
   longitude
   latitude
   posição do ponto sobre o GIF. Coordenada em
pixels
   posição do ponto sobre o GIF. Coordenada em
pixels
 // dados sobre a localização do PONTO
   nome da
cidade
   nome da cidade
   sigla do estado
   
   
   




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



[PHP] Re: PHP server problem

It probably modified your httpd.conf, if your being prompted to download 
the file it sounds like the following line is missing from it,


AddType application/x-httpd-php .php .phtml





Eric Lommatsch wrote:

Hello,
 
This is my first time posting to this particular list, so please be patient

with me.
 
I am not exactly sure if this is the right list to post this to or if the

description of what is happening will be enough to really make what my
questions is 
 
We have a Linux server that we use to run several PHP based programs on. Up

until today it has been working well. Today we tried to install a new PHP
based accounting program called "NolaPro" which also includes the Zend
optimizer as part of the installation. when I got finished installing this
program and said that the Zend optimizer was not installed. I tried
Installing this program again and the results were the same. But, trying to
get this program is now my secondary concern.
 
Since I have run this installation program none of the other PHP scripts that

we have installed on this server run anymore but instead are now asking if we
try to open them if I want to save the file to disk or open them in our PHP
editing tools. It appears that Apache is no longer recognizing and serving
PHP scripts.
 
I have tried reinstalling PHP but the results are still the same. Can

somebody please help me get back to the point where PHP is back running on
this server?
 
Thank you
 
Eric H. Lommatsch

Programmer
MICRONix, Inc.
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939
Fax 303-778-0378
 
[EMAIL PROTECTED]
 



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



Re: FW: [PHP] PHP server problem


Have you tried removing the 


James





Eric Lommatsch wrote:
 
I have looked at this page and and in the httpd.conf file that file had this

information in it. But when I look at the httpd2.conf file this file is
missing this information I have tried adding this information to this file I
am still getting the same result. One thing that I did notice in looking at
the httpd.conf is that these statement have an  statement
around them. But that is the version of PHP that is installed on this system.

Thank you
 
Eric H. Lommatsch

Programmer
MICRONix, Inc.
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939
Fax 303-778-0378
 
[EMAIL PROTECTED]


-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 01, 2005 3:07 PM

To: php-general@lists.php.net
Subject: Re: [PHP] PHP server problem

Eric Lommatsch wrote:


Hello,

This is my first time posting to this particular list, so please be 
patient with me.


I am not exactly sure if this is the right list to post this to or if 
the description of what is happening will be enough to really make 
what my questions is


We have a Linux server that we use to run several PHP based programs 
on. Up until today it has been working well. Today we tried to install 
a new PHP based accounting program called "NolaPro" which also 
includes the Zend optimizer as part of the installation. when I got 
finished installing this program and said that the Zend optimizer was 
not installed. I tried Installing this program again and the results 
were the same. But, trying to get this program is now my secondary concern.


Since I have run this installation program none of the other PHP 
scripts that we have installed on this server run anymore but instead 
are now asking if we try to open them if I want to save the file to 
disk or open them in our PHP editing tools. It appears that Apache is 
no longer recognizing and serving PHP scripts.


I have tried reinstalling PHP but the results are still the same. Can 
somebody please help me get back to the point where PHP is back 
running on this server?



Look at steps 14 and 15 under "Example 4-1..." on this page, and ensure those
lines are in your httpd.conf

http://www.php.net/manual/en/install.unix.php


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--
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: FW: [PHP] PHP server problem

I cant see why you have two httpd.conf files, unless that app installed 
another, in which case I would remove the  block, im 
sure thats only their for when/if you need to disable PHP




James


Eric Lommatsch wrote:
 
I have looked at this page and and in the httpd.conf file that file had this

information in it. But when I look at the httpd2.conf file this file is
missing this information I have tried adding this information to this file I
am still getting the same result. One thing that I did notice in looking at
the httpd.conf is that these statement have an  statement
around them. But that is the version of PHP that is installed on this system.

Thank you
 
Eric H. Lommatsch

Programmer
MICRONix, Inc.
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939
Fax 303-778-0378
 
[EMAIL PROTECTED]


-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 01, 2005 3:07 PM

To: php-general@lists.php.net
Subject: Re: [PHP] PHP server problem

Eric Lommatsch wrote:


Hello,

This is my first time posting to this particular list, so please be 
patient with me.


I am not exactly sure if this is the right list to post this to or if 
the description of what is happening will be enough to really make 
what my questions is


We have a Linux server that we use to run several PHP based programs 
on. Up until today it has been working well. Today we tried to install 
a new PHP based accounting program called "NolaPro" which also 
includes the Zend optimizer as part of the installation. when I got 
finished installing this program and said that the Zend optimizer was 
not installed. I tried Installing this program again and the results 
were the same. But, trying to get this program is now my secondary concern.


Since I have run this installation program none of the other PHP 
scripts that we have installed on this server run anymore but instead 
are now asking if we try to open them if I want to save the file to 
disk or open them in our PHP editing tools. It appears that Apache is 
no longer recognizing and serving PHP scripts.


I have tried reinstalling PHP but the results are still the same. Can 
somebody please help me get back to the point where PHP is back 
running on this server?



Look at steps 14 and 15 under "Example 4-1..." on this page, and ensure those
lines are in your httpd.conf

http://www.php.net/manual/en/install.unix.php


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--
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] Re: Problems with PHP and Apache 2.x 404 ErrorDocument handlers

Well if all other PHP scripts work then it must be a problem with your 
script or something changed in the latest PHP version that your script 
used, if you post the code someone may be able to say if something is 
wrong with it.


James



Jason Z wrote:

I used to have a number of sites direct 404 errors towards PHP scripts for
error handling and the such.  Recently I upgraded my PHP installs to 4.4.1(from
4.3.11) with the configure parameters listed below.  Now, none of my PHP
handlers are functioning.  They are all returning 0 size responses.  After
quite a bit of troubleshooting I have determined it is not Apache as it's
ErrorHandler functions are working correctly and I can drop a Perl (or other
language) script in place of the PHP script and they function as desired.

Has anybody else run into this problem lately, and if so, does anybody know
how to resolve it?

The configure parameters used are as follows:
 --with-apxs2=/usr/local/apache2/bin/apxs
 --enable-force-cgi-redirect
 --enable-discard-path
 --enable-fastcgi
 --enable-magic-quotes
 --with-openssl
 --with-kerberos
 --with-zlib
 --enable-calendar
 --with-curl
 --enable-exif
 --with-dom
 --enable-ftp
 --with-gd
 --with-jpeg-dir
 --with-png-dir
 --with-xpm-dir
 --with-xlib-dir
 --with-imap-ssl
 --with-pspell
 --with-recode
 --with-readline
 --with-snmp
 --with-imap
 --enable-sockets
 --with-pdflib=/Archives/Linux/PDFLib/5.0.4/PDFlib-5.0.4-Linux/bind/c
 --with-pspell
 --with-swf=/Archives/Linux/LibSWF/dist
 --with-xmlrpc
 --with-pear
 --with-mysql
 --with-gmp
 --with-expat-dir=/usr

Thank you for any assistance anyone is able to offer regarding this issue.

Jason Ziemba



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



[PHP] Re: Automatic log out

Store the last time someone accessed their session into the $_SESSION 
array then when requesting a protected page just check x amount of time 
has not passed, if x amount has time has passed redirect to a login page 
 or re-enter their user password



small example you would use on the top of every page,


session_start();

if(isset($_SESSION['timeout'])) {

if(time() > $_SESSION['timeout']) {
// session has expired, redirect to login...

} else {
// reset the timeout time...
$_SESSION['timeout'] = time() + 3600;
}

} else {
$_SESSION['timeout'] = time() + 3600;
}




James


Adrian Bruce wrote:

Hi

I currently use an automatic logout out system that sets a time out  in 
two ways.


(If the ip address on computer is recognized then set timeout to 10 
mins, if not then set to 2 mins.)


1) The time out setting is used to create a meta refresh tag that will 
re-direct the user to the logout page after X seconds. 2) At the 
beginning of each page i set a variable with the current time and check 
to see if the difference between the previously set variable and the now 
current time is greater than X seconds, if so then log the user out.
I know meta refresh is not to be relied on and that is why i use the 2nd 
method as well, but i have had varied reports that this system does not 
work, i.e. it logs people out to quickly.
Does anyone know a better way of doing this or improvements?? it would 
also be nice to stop the pages displaying after a time out when a user 
presses the back button!


Thanks a lot in advance

Adrian


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



[PHP] Re: Automatic log out



"it would also be nice to stop the pages displaying after a time out 
when a user

presses the back button!"



For that you would need to destroy the session data, use session_destroy();

http://php.net/session_destroy

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



[PHP] Re: Performance question

I dont think either will give a performance decrease any less than the 
other will do.






Anders Norrbring wrote:


I've been spending some time to find performance pros and cons, but so 
far haven't had any real luck.


Can someone on this list say which is better than the other, and also 
why, when it comes to these kinds of syntax:


1.
php code
?>


$variable";
echo "$var2";
more php code

In both cases, some processing is done, not that 'echo' uses a lot of 
cpu time, but still...
On the other hand, there are more jumps in and out for the interpreter 
in the first example...


I'd love some thoughts on this.


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



Re: [PHP] safe mode question

Your php.ini should have root as its owner and be set to 600, if your 
using apache server then apache must start as root, the php.ini file is 
read only once by root when the server starts - so that setting should 
not cause problems, however if using the cli then you should also make 
/etc/php.ini readable by all other users (permissions 644).


Not sure why the suse folks would put both --enable-cli and 
--disable-cli but i notice they also have --with-pear and 
--without-pear, which takes precedence im not completely sure but would 
think the last one would so you probably have pear and the cli installed 
despite the --disable and --without lines, if i remember correctly the 
cli is required to use pear so --disable-cli would force --without-pear, 
i would suggest you compile your own version.



~James



(Robin) wrote:
Doh - 


I figured it out (for those who were interested). The permissions on 
/etc/php.ini was set to 600 (owner == root). Changing this it other read, fixes 
the issue.

Any idea why Suse would do this?

Thanks
-robin


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



[PHP] Re: Sending mail with php-

You need a domain name pointing to your IP address for a start, then you 
either need to configure php.ini to use the correct email or you should 
pass the additional param to sendmail, as shown below.



Taken from  php.net:

The additional_parameters parameter can be used to pass an additional 
parameter to the program configured to use when sending mail using the 
sendmail_path  configuration setting. For example, this can be used to 
set the envelope sender address when using sendmail with the -f sendmail 
option.


The user that the webserver runs as should be added as a trusted 
user to the sendmail configuration to prevent a 'X-Warning' header from 
being added to the message when the envelope sender (-f) is set using 
this method. For sendmail users, this file is /etc/mail/trusted-users.




 The additional_parameters parameter can be used to pass an additional 
parameter to the program configured to use when sending mail using the 
sendmail_path.





James


Dotan Cohen wrote:

On my home Fedora Core 4 box I run Apache 2.0. Sometimes when sending
mail with php no mail is delivered, and I find this in the logs:

<<< 550-Verification failed for <[EMAIL PROTECTED]>
<<< 550-unrouteable mail domain "localhost.localdomain"
<<< 550 Sender verify failed

So I changed the only email address in httpd.conf to:
ServerAdmin [EMAIL PROTECTED]

But I still get the error! I did restart apache and even went so far as to
reboot the machine. If I cannot modify the parameter within apache,
then where should I modify it? Within php? Within sendmail?

Thank you.

Dotan Cohen
http://technology-sleuth.com/question/what_are_the_advantages_of_lcd_monitors.html
(-)


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



[PHP] Re: array of checkbox values


Do something like:

$checkboxes = array('food','drink','smoking');

// display the checkboxes
foreach($checkboxes as $checkbox) {
echo "$checkbox: ";
}



Then when processing the form input check if each of the $checkboxes 
array values are present, if not, you can set to something else such as 
N, like so.




$sent_data = array();
foreach($checkboxes as $checkbox) {
  if(isset($_REQUEST[$checkbox])) {
$sent_data[$checkbox] = 'Y';
  } else {
$sent_data[$checkbox] = 'N';
  }
}





James



Sjef Janssen wrote:

Hallo,
I have a form with a number of checkboxes grouped together. The value of
these boxes is stored in an array: $used[]. Now I found that the value of
checked boxes (value = 'Y') are stored in the array while non checked boxes
are not stored at all. This makes the array incomplete as I want to have all
checkbox values in the array.
For example: for 4 checkboxes the values are
checkbox 1: array index  = 0 value = "Y"
checkbox 2: array index = 1 value = "Y"
checkbox 3: value = "N" : it does not occur in the array
checkbox 4: array index = 2 value = "Y"

Is there a way to, as it were, complete the array and have all values
stored, even the "N" values? So that array index 2 has a value of "N", and
array index 3 is "Y".

Thxs

Sjef


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



[PHP] Re: Sending mail with php-


alter the sendmail configuration file: /etc/mail/local-host-names

If that dont work you need to setup DNS for your machine.





James Benson wrote:
You need a domain name pointing to your IP address for a start, then you 
either need to configure php.ini to use the correct email or you should 
pass the additional param to sendmail, as shown below.



Taken from  php.net:

The additional_parameters parameter can be used to pass an additional 
parameter to the program configured to use when sending mail using the 
sendmail_path  configuration setting. For example, this can be used to 
set the envelope sender address when using sendmail with the -f sendmail 
option.


The user that the webserver runs as should be added as a trusted 
user to the sendmail configuration to prevent a 'X-Warning' header from 
being added to the message when the envelope sender (-f) is set using 
this method. For sendmail users, this file is /etc/mail/trusted-users.




 The additional_parameters parameter can be used to pass an additional 
parameter to the program configured to use when sending mail using the 
sendmail_path.





James


Dotan Cohen wrote:


On my home Fedora Core 4 box I run Apache 2.0. Sometimes when sending
mail with php no mail is delivered, and I find this in the logs:

<<< 550-Verification failed for <[EMAIL PROTECTED]>
<<< 550-unrouteable mail domain "localhost.localdomain"
<<< 550 Sender verify failed

So I changed the only email address in httpd.conf to:
ServerAdmin [EMAIL PROTECTED]

But I still get the error! I did restart apache and even went so far 
as to

reboot the machine. If I cannot modify the parameter within apache,
then where should I modify it? Within php? Within sendmail?

Thank you.

Dotan Cohen
http://technology-sleuth.com/question/what_are_the_advantages_of_lcd_monitors.html 


(-)


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



[PHP] Re: test variable value?


If your talking values in submitted form data I would use:


if(isset($var) && trim($var) == '') {
   echo "Please give a value";
}




James




William Stokes wrote:

Hello

What is the best way to determine if a variable has no value?

if ($var= '')

or

if ($var= 'null')


Can 'null' be used here?

Thanks
-Willa 


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



[PHP] Re: problem with large arrays in php 4.3.2



Their should be no problem with what your trying to do, try the 
following function, should act pretty much like array_diff();





if(!function_exists('array_diff')) {
function array_diff($array1, $array2)
{
$difference = array();
foreach($array1 as $key => $value)
{
if(is_numeric($key)) {
if(!in_array($value, $array2)) {
$difference[] = $value;
}
} else {
if(!array_key_exists($key, $array2)) {
$difference[] = $key;
}
}
}
return $difference;
}
}




// small test
$array1 = array_fill(0, 2, 'banana');
$array2 = array();
print_r(array_diff($array1, $array2));




It also depends how much data the arrays contain

James



Jesse Guardiani wrote:

Hello,

I have an old version of php (4.3.2) that is acting rather strangely. I'm
searching two large arrays (approx 22,000 records in each) using
array_diff_key() from the PEAR PHP_Compat library:

$result = $args[0];
foreach ($args[0] as $key1 => $value1) {
for ($i = 1; $i !== $array_count; $i++) {
foreach ($args[$i] as $key2 => $value2) {
if ((string) $key1 === (string) $key2) {
unset($result[$key2]);
break 2;
}
}
}
}

And I'm getting aweful performance. I know it's a ton of records (22,000 *
22,000), but it shouldn't take 16 minutes on a P4 Xeon 2.4ghz!

Has anyone seen this before? Is this a bug? Or are my math skills lacking and
this is perfectly normal performance for the size of the data set?

Thanks!



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



[PHP] most reliable way to test if using https

What is the most reliable way to test if a connection is already using 
the https protocol, is their a PHP constant or something builtin already?




Thanks,
James

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



[PHP] Re: odd behavior


Could these help?


http://www.php.net/manual/en/faq.installation.php#faq.installation.phprc
http://php.net/configuration



James



Jay Blanchard wrote:

When I expire you will find my hands wrapped tightly around the throat of a
Windows network administrator.

I had PHP installed on a web server, and all was working OK, save for one
small thing. phpinfo() indicated that the path to the php.ini was c:\WINNT,
which it was not. So I copy the file from the c:\php directory to the
c:\winnt directory and restart IIS. Now, when I click a link to take me to a
directory with an index.php I get a 404, not found error. If I refresh the
page shows up just fine. So I remove the ini page, start and stop the IIS
server, click the link, and no problem...the page is delivered just fine.

Has anyone experienced this behavior before, and how do I fix that damned
path to the ini? TIA!


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



[PHP] fsockopen, openssl error

Im running into the followng error when trying to use fsockopen with the 
openssl extension,




Warning: fsockopen(): php_stream_sock_ssl_activate_with_method: failed 
to create an SSL context


Warning: fsockopen(): failed to activate SSL mode 1

Socket Error: Operation now in progress




Anyone have any clues as to what this may be or why its happening?

Perhaps a compile problem, anyway, I probably will try 4.4.0 because ive 
not made any changes to the script for a few months but have upgraded to 
4.4.2 recently then get this error, very suspicious i think?




James

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



[PHP] Re: fsockopen, openssl error


Seems like he can't start TLS.´

Have you tried a newer version of PHP than 4.4.2?

If so, i would like to know what happened.

Barry





Just compiled 5.1.2 and 4.4.1, it happended again with 4.4.1 but not 
with 5.1.2, I dont have time to try 4.4.0 but will do later.



One thing i forgot to say is I have recently switched from fedora core 4 
to ubuntu 5.1, would that make any difference?



BTW, Im using apache 2.2.0, openssl 0.9.8a



Thanks,

James

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



[PHP] Re: using sessions instead of cookie



http://php.net/manual/en/ref.session.php




Ross wrote:
 I have never used sessions before.  How do I change the follow from COOKIES 
to SESSIONS in php (I do not know how to set a session)...


At present the script uses an iframe with cookies but I believe if I use 
sessions I can leave out the iframe.


http://www.ecurry.net/menu.phps

http://www.ecurry.net/order2.phps

The scipt adds a name and count to the cookie array, then works out the 
total using the order2 script.


if (isset($add)){

${$food} = intval($_COOKIE['cookie'][$food]);

ob_clean();
$new= $$food+1;
  include('names.php');
setcookie("cookie[$food]", "$new $name");

}
;


if (isset($minus)){

${$food} = intval($_COOKIE['cookie'][$food]);
if (${$food} == 0) {

}
else {;
ob_clean();
$new= $$food-1;
include('names.php');

setcookie("cookie[$food]", "$new $name");
}
}


and the order2 script...


if (isset($_COOKIE['cookie'])) {
   foreach ($_COOKIE['cookie'] as $name => $quantity) {

 if ($name == "pakora") {$sub_total = $sub_total + ($priceA * 
$quantity);  $pricecode= $priceA; check_zero($quantity, $pricecode);}
  if ($name == "haggis_fritter") {$sub_total = $sub_total + ($priceB * 
$quantity); $pricecode= $priceB;check_zero($quantity, $pricecode);}


}}


--



-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



[PHP] Re: security of uploaded gif files

Even if you can embed PHP in a GIF it would still need to be executed by 
PHP as PHP code, would PHP actually execute that file when it looks like 
an image, I would think PHP would output an error?



More importantly though, you should be checking the file extension of 
uploaded files to make sure it is only a .gif




James



jonathan wrote:
what is the best way to prevent malicious code from being uploaded via a 
.gif file? A friend showed me how php could be embedded within the .gif 
file. Does this problem also exist for .jpeg's?


thanks,

jon


--



-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



[PHP] Re: put method


change the $_PUT to $_FILES, their is no global variable in PHP called $_PUT

reading this page will give a working example you can modify:

http://php.net/features.file-upload


James





-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



[PHP] Re: $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]


Take a look at the following functions:-


http://php.net/serialize
http://php.net/unserialize



James




-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



[PHP] Re: Variable variables




Mark Steudel wrote:

I was wondering if you could create variable variables for objects, please
see examples below, Im having problems getting it to work.

$data['fieldname'] = foo;
 
// without variable variables

$res =& $db->query( "SELECT foo FROM table" );
 
while( $res->fetchInto( $db_data ) )

{
echo $db_data->foo; // pretend this echos bar
}
 
 
 // with variable variables

$varVar = '$db_data->'.$data['fieldname']; // should be $db_data->foo
 



Try using double quotes, ie.

$varVar = "$db_data->".$data['fieldname'];




James

-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



[PHP] Google using PHP @ http://www.google-store.com

Looks like google are using PHP and oscommerce for their web store: 
http://www.google-store.com


Nice to see :)






James


-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



Re: [PHP] Re: $_SESSION saves all values but Class -- works on one server butnot another?! [second plead for help]


Daevid Vincent wrote:

Thank you, but again, not the problem.

The same code is on both servers. I'm not transfering from one server to
another. Only from page to page ON THE SAME SERVER. 


This has to be a configuration problem IMHO.


-Original Message-
From: James Benson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 24, 2006 3:45 PM

To: php-general@lists.php.net
Subject: [PHP] Re: $_SESSION saves all values but Class -- 
works on one server butnot another?! [second plead for help]


Take a look at the following functions:-

http://php.net/serialize
http://php.net/unserialize






Im sure if you tried those functions I suggested it will work, it does 
not matter whether you are using a different server or different page, 
with serialize it will rebuild the saved object back into how it was 
origanally and you should be able to retain the object values across 
multiple script requests!





James



-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



[PHP] Re: usr VAR value as a VAR Name





if(isset($_POST['NAME_OF_FORM_VALUE'])) {
  // radio button was selected
}




Fernando Anchorena wrote:

I'm stuck trying to get  work this :

This is an example
page1.php
===

$sql_pro ="SELECT Sid FROM table";
$res_pro = @mysql_query( $sql_pro);
 while ($campo_pro = @mysql_fetch_array($res_pro)) {
 $sid_pro = $campo_pro["Sid"];  //  *sid_pro = 4*
 $sid_pro = 'p'.$sid_pro; // I'm trying to use de value of 
$sid_pro as a VAR name *$sid_pro = p4*
 print " *value='SOLVE_ME'/>* ";  // *name=p4 *

  BLA BLA BLA
  }
 SUBMIT FORM
===

page2.php
===
$sqlname = "SELECT Sid FROM Table";
$res = mysql_query ($sqlname) ;
while ($campo_pro = mysql_fetch_array($res)) {
  $name1 = $campo_pro["Sid"];  // *$name1 = 4*
  $radio = '$'.'p'.$name1 ; // *$radio = $p4
  --
  Now the Problem
  **How can I get the Value SOLVE_ME  from the submited form ?*

  }
==


Thanks in Advance


--



-

http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer


http://www.jamesbenson.co.uk

-

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



Re: [PHP] way to write mysqli result set to disk


jonathan wrote:
hmm is this a mysql 5 feature. could be interesting but haven't 
heard much about it.






You cannot see the mysql 5 plastered all over the page?


I can see at least 5 different sections that say MySQL 5

James

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



[PHP] Re: Workaround ISP's redirect of 404 Not Found PHP pages?


 PHP is running as a CGI on the shared hosting servers, which is
 why your .htaccess isn't working for it.

 You will have to create the error rule within a php.ini file.





That is so much bull, how then can it work for NON .php files?

I know for a fact that CGI does not prevent you using .htaccess or the 
ErrorDocument directive in apache because Im using one myself right now 
in CGI mode and it works just fine, does your webhost use a custom error 
page that advertises its own services or provides a link to their 
website by any chance?





James

-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] Re: query regard forms in PHP



suresh kumar wrote:
>  hai,
> i am having 3 files,namely page1,page2  and page3,when i enter 
> username and password in my first page i want 2  display  my username and 
> password  in my third page through  second page.
>   
>  A.suresh
>   
> 
>   
> -
>  Jiyo cricket on Yahoo! India cricket




You want to be using sessions


http://php.net/session




-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] Re: Support between MySQL and PHP

Downgrading to MySQL 4.1 should fix the problem.




Philip R. Thompson wrote:
> Hi all.
> 
> I figured this question was suitable for both the MySQL list and the 
> PHP-General list. Here's what I'm running into.
> 
> I just installed MySQL5 and currently have PHP 4.3.11 installed. I 
> am wanting to connect to the mysql database on localhost, but I 
> get the following results:
> 
> --
> 
> "Client does not support authentication protocol requested by 
> server; consider upgrading MySQL client"
> --
> 
> Well, I have the lastest stable version of MySQL, so I did some more 
> research on what the problem might be. When I checked my 
> information for PHP using phpinfo(), it gave me the "Client API 
> version" for MySQL was 3.23.49. So, I'm thinking my version of PHP 
> cannot connect to my version of MySQL. I then considered if I 
> installed the MySQLi extension for PHP (supports versions of MySQL 
>> 4.1), would that help me? Or, if I just upgraded PHP to version 5, 
> would that help me?
> 
> Does anyone have any suggestions on the direction I should go?
> 
> Thanks in advance,
> ~Philip

-- 



-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] strange behaviour with strtotime()


Im encountering some very weird behaviour when using the following:-


echo date("M", strtotime("next month"));


outputs: Mar



while


echo date("r",time());

outputs: Tue, 31 Jan 2006 11:21:47 +



anyone know why?




-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



Re: [PHP] strange behaviour with strtotime()

"Because 1 month from 31-Jan is 31-Feb -- which is taken to mean 02-Mar,
hence the output of date("M" ...)."



why though, one month from now is 31 Feb, why would it take it as
something else?

That does not make sense to me!



James





-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] Re: strange behaviour with strtotime()

The case makes no difference, because...


echo date('r', strtotime ("next Month"))."\n";
echo date('r', strtotime ("next month"))."\n";


gives...

Fri, 03 Mar 2006 12:52:54 +
Fri, 03 Mar 2006 12:52:54 +



BTW, Im using Debian, PHP 4.4.2 and my machines time zone is Europe/London

Few more tests I did:-


echo date('r', strtotime ("last month"))."\n";


works ok!

Sat, 31 Dec 2005 12:54:38 +


echo date('r', strtotime("next day"))."\n";


works ok

echo date('r', strtotime("next year"))."\n";

works ok



Very strange!

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



Re: [PHP] strange behaviour with strtotime()



Barry wrote:
> Ford, Mike wrote:
> 
>>
>> Because 1 month from 31-Jan is 31-Feb -- which is taken to mean
>> 02-Mar, hence the output of date("M" ...).
>>
>> 2 months from now is 31-Mar, which is ok; 3 months from now would be
>> 31-Apr, which would likewise be taken to mean 01-May.
>>
>> This is all as expected -- no bug here.
>>
>> Cheers!
>>
>> Mike
>>
> so the 31 feb would be 30 days right?
> and since +1 month would be 2nd march wouldnt be +2 month then 2nd april?
> Sinze its 2nd march +1 month
> 
> see ->
> echo strftime("%d %m %Y",strtotime ("+1
> Month",mktime(13,0,0,3,2,2006)))."\n";
> 
> ^^ gives 2nd april! ^^
> 
> echo "date 1:".strftime("%d %m %Y",strtotime ("+1 Month",strtotime("+1
> Month")))."\n";
> 
> ^^ gives 3rd april ^^
> 
> So its not logic.
> month +2 should output 2nd april!
> 
> Barry



ok i understand now, that is fairly fd up if you ask me, the
documentation should state this side affect, one month should be one
month from that date not +31 days, if i wated +31 days i would ask for it :)





James



-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] Re: strange behaviour with strtotime()


> try that:
> echo "strtotime1:".strtotime ("next Month")."\n";
> echo "strtotime2:".strtotime ("next month")."\n";
> echo "time:".time()."\n";
> echo "time1:".strftime("%d %m %Y",strtotime("next Month"))." |
> time2:".strftime("%d %m %Y",time());
> 
> (probably causing error because of "m"onth / "M"onth;
> 
> Post result please.
> 
> i get:
> strtotime1:1143801588
> strtotime2:1143801588
> time:1138707588
> time1:31 03 2006 | time2:31 01 2006
> 
> 
> thats indeed funny O_o



strtotime1:1141390219
strtotime2:1141390219
time:1138711819
time1:03 03 2006 | time2:31 01 2006




different!!

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



Re: [PHP] strange behaviour with strtotime()

cheers for the help :)






Barry wrote:
> Ford, Mike wrote:
>> Yes, but 1 apple is 1 apple is 1 apple.
>>
>> 1 month can be 28 days, or 31 days, or anything in between. 2 months
>> can be anything from 59 to 62 days.
>>
>> A month is an imprecise measure, and adding them together will get you
>> an even more imprecise result.
>>
>> Deal with it -- that's just the way it is.
>>
>> Cheers!
> 
> And now you tell me how the strtotime function tells what to use
> either 28 days or 31 days or 4 3/87 days.
> 
> And that would help.
> 
>> Deal with it -- that's just the way it is.
> 
> It's not a bug, it's a feature!
> 
> Yeah sure ...

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



[PHP] Re: CR \ LFs being represented as ascii characters in output of mail()





Murray @ PlanetThoughtful wrote:
> Hi All,
> 
> I'm having an odd problem with formatting of line feeds in an email my
> site automatically sends to me when someone comments on one of my blog
> entries.
> 
> For some reason "\r\n" characters are coming through exactly like that
> in the email, and yet the same value being stored in the backend MySQL
> database seems to represent the carriage-return \ line-feed characters
> as it should.
> 
> A typical example of the value when sent in the email would be:
> 
> Lol, hi Duncan.\r\n\r\nIt\'s possible that this post once had some
> comments. I lost most of PT at one point when my host had a harddrive
> crash, and salvaged a lot of entries from local copies on my computer,
> and notes I\'d scribbled in my journals and so on.\r\n\r\nStill, it\'s
> great to see you commenting on the post that made you a legend on
> PT!\r\n\r\nMuch warmth,\r\n\r\nMr Banderas
> 
> The odd thing is that the rest of the email is correctly interpreting
> line-feed characters, it's only the value entered on the comment form
> that represents CR \ LFs as normal characters.
> 
> I'm not sure if this is the culprit, but because my remote host for this
> site has magic_quotes_gpc on, and my local setup doesn't, I run the
> following function every time a page is requested where form processing
> is performed:
> 
>   function traverse ( &$arr )
>   {
>   if ( !is_array ( $arr ) )
>   return;
> 
>   foreach ( $arr as $key => $val )
>   is_array ( $arr[$key] ) ? traverse ( $arr[$key] ) : (
> $arr[$key] = stripslashes ( $arr[$key] ) );
>   }
> 
> Can anyone give me any thoughts on how to represent these CR \ LF
> characters properly in the email?
> 
> Many thanks,
> 
> Murray
> 



you probably have it surrounded in single quotes, PHP only converts \n
or \r\n when its enclosed within double quotes


James



-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] Re: Help retrieving an HTML array



Mauricio Pellegrini wrote:
> Hi ,
>  I have a HTML page with a form in which there are some inputs like
> these:
> 
>   input type=text  name=xname value="3303"
>   input type=text  name=xname value="9854"
>   
>   input type=text  name=xname value="n..."
> 
> 
> the name of the input is always the same ( xname )
> 
> This generates automatically generates an array named xname in HTML 
> with all the diferent values assigned to a diferent position.
> 
> 
> My question is :
> 
> How do I retrieve that array from within PHP ?
> 
> 




See this webpage:-


http://www.php.net/manual/en/faq.html.php#faq.html.arrays





James



-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] Re: Preparing site content for RSS XML feed



Murray @ PlanetThoughtful wrote:
> Hi All,
> 
> I currently generate a simple rss.xml file for syndication from my site,
> containing nothing more than the subject of the post and a link to the
> article on my site.
> 
> I'd like to syndicate the the actual content of each of the posts, but
> as I understand it RSS / XML is somewhat demanding in what it expects of
> how various html entities are treated etc?
> 
> I don't suppose, by any chance, that there are any PHP tools that can be
> easily factored in to a process to take content that would include
> normal HTML (ie DIV and SPAN tags, links, TABLEs etc)?
> 
> Failing that, does anyone know of a good guide on what steps need to be
> taken to create a valid RSS feed where the content contains HTML?
> 
> Any help appreciated!
> 
> Much warmth,
> 
> Murray
> 

-- 



Why dont you look at other feeds see how they do this?


Enclosing the HTML data within a cdata section should suffice!





James



-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] Re: PHP Newsletter




Jedidiah wrote:

I send out a daily email to an email list.  I have only been doing this for
about a week, and realized today that each one of them so far has had at
least one mysterious exclamation point somewhere in the email.  This is
sometimes in the middle of the word or sentence, but always out of place.  I
have tried replacing my quotation marks with single quotes, ", and
adding a backslash before them as I was told the issue had something to do
with these, but none of this has helped.  

 


So first question.How do I lose this exclamation point?

 


And second questions.Is there anyway around changing my quotation marks to
something else or is that just part of it?

 


Thanks,

 

Jedidiah 









I dont think anyone knows, post your code and maybe you will get an answer.



James

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



[PHP] Re: How to user curl_setopt?


should it not be:-
 G:\\test\ssl\mes1.cer'

notice how I changed the path to reflect a proper windows drive path!


James





lhb wrote:

Hello,

Now I need to use curl to connect to a secure website,
I have three certificates files, two .cer files and one .pfx file.
After I import the certificates into IE browser, the visit is OK.
However, when I use curl_setopt to configure the certificates, it failed.
Can anybody help me?
Thanks.

The code is below:


lhb


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



[PHP] Re: how to build custom/private pear packages


Jochem Maas wrote:

hi people,

I have been thinking about how I rollout some of my code (stuff
that gets reused alot) and I thought it would be nice if I could have
basic functionality available for my projects via a custom pear
package server (referred to as a 'pear channel'??) - so what I would
like to figure out is how to set up a 'package server' and how to
roll my own packages.

I have been searching but I've drawn a bit of a blank - anyone know
some good reading material that could get me started?

rgds,
Jochem






Have you seen this ?


http://pear.chiaraquartet.net/




James

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