Re: [PHP] Open file on a Mounted Share on Mac OS X

2006-09-14 Thread Rahul S. Johari

How can I set the "drwxr-xr-x" permissions on my mounted share? I've set
everything I possibly could in the windows 2003 server to give the mac os x
user full control!


On 9/13/06 10:49 AM, "John Nichel" <[EMAIL PROTECTED]> wrote:

> Rahul S. Johari wrote:
>> Samba. It's an SMB share.
>> 
>> 
>> On 9/13/06 12:39 AM, "Chris" <[EMAIL PROTECTED]> wrote:
>> 
>>> Rahul S. Johari wrote:
 That was a good idea. I tried that... It was showing nothing for
 /Volumes/foresight ... But it did show the contents of /Volumes... And
 interestingly, 'foresight' was also listed there, but it's filetype was
 blank... Others had like "dir" or "link" or "file" But foresight's
 filetype had nothing in it!!
>>> That'll be the problem. PHP doesn't see it as a valid "type".
>>> 
>>> How is it mounted, through samba, through something else?
>> 
> 
> So it doesn't look like this...
> 
>> [EMAIL PROTECTED] staging]# ls -al
>> total 16
>> drwxr-xr-x  3 root root 4096 Sep 13 10:44 .
>> drwxr-xr-x  3 root root 4096 Sep 13 10:44 ..
>> drwxr-xr-x  1 root root 4096 Sep 13 10:46 webserver
> 
> "webserver" is a smb mount on my (Linux) machine.

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] Open file on a Mounted Share on Mac OS X

2006-09-14 Thread Rahul S. Johari
Nope.
It looks like this...


drwxr-xr-x  3 root root 4096 Sep 13 10:44 .
drwxr-xr-x  3 root root 4096 Sep 13 10:46 ..
drwx--  1 rjohari  admin  16384 13 Sep 10:38 foresight

Foresight being the mounted share.


On 9/13/06 10:49 AM, "John Nichel" <[EMAIL PROTECTED]> wrote:

> Rahul S. Johari wrote:
>> Samba. It's an SMB share.
>> 
>> 
>> On 9/13/06 12:39 AM, "Chris" <[EMAIL PROTECTED]> wrote:
>> 
>>> Rahul S. Johari wrote:
 That was a good idea. I tried that... It was showing nothing for
 /Volumes/foresight ... But it did show the contents of /Volumes... And
 interestingly, 'foresight' was also listed there, but it's filetype was
 blank... Others had like "dir" or "link" or "file" But foresight's
 filetype had nothing in it!!
>>> That'll be the problem. PHP doesn't see it as a valid "type".
>>> 
>>> How is it mounted, through samba, through something else?
>> 
> 
> So it doesn't look like this...
> 
>> [EMAIL PROTECTED] staging]# ls -al
>> total 16
>> drwxr-xr-x  3 root root 4096 Sep 13 10:44 .
>> drwxr-xr-x  3 root root 4096 Sep 13 10:44 ..
>> drwxr-xr-x  1 root root 4096 Sep 13 10:46 webserver
> 
> "webserver" is a smb mount on my (Linux) machine.

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] How to skip browser's Warning?

2006-09-14 Thread Ruben Rubio
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

This is php cconfiguration.
Add this to php.ini

session.cache_limiter=none


[EMAIL PROTECTED] wrote:
> Hi,
> Could somebody explain to me what to do to skip this message I'm getting
> after I search for some products on my page, got the list of products,
> selected a detailed view of the product and click on the Back button of
> the browser to see again list of found products (result page):
> "The Page you are trying to view contains POSTDATA that has expired from
> cache. If you resend the data, any action the form carried out such as a
> search or online purchase) will be repeated. To resend the data, click OK.
> Otherwise, click Cancel."
> 
> Thanks for any help.
> 
> -afan
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCSZpIo1XmbAXRboRAhSoAKCozvcSHiOAOpsGBkwKY6VqIM8aSACfXiEm
rgJwGNM3qRL131lqt5rETJY=
=aPUv
-END PGP SIGNATURE-

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



Re: [PHP] DOM Question. No pun intended.

2006-09-14 Thread Satyam
Try the properties innerHTML or outerHTML, the later will include the 
enclosing tag.


Satyam

- Original Message - 
From: "Michael Williams" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, September 14, 2006 2:12 AM
Subject: [PHP] DOM Question. No pun intended.



Hi All,

I'm having HTML DOM troubles.  Is there any way to output the *EXACT*
code
contained in a node (child nodes and all)?  For instance, I perform a
$doc->loadHTML($file) and all
is well.  I then search through the document for specific NODEs with
getElementsByTagName().  However, when I go to output the data from
that node
(say a specific DIV) I simply get the text without formatting and the
like.
Basically, I want the retrieved NODE to echo exactly what is
contained.  If the
div looks like the following:



stuff



. . .I want it to give me exactly that when I do a NODE->textContent or
NODE->nodeValue.  I don't want just the text, I want all tags
contained, etc.
It would be nice to have DOMNode->saveHTML() similar to the
DOMDocument->saveHTML().

FYI, I'm using the technique to "screen scrape" portions of other
pages from my
site and compile items for a quick fix.  Fortunately all my DIVs have
IDs and I
can loop through and find them by that attribute's value. I just
can't output
their EXACT data once I have them.  :-\

Thanks! 


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



[PHP] Pre-printed forms

2006-09-14 Thread Man-wai Chang

How do you guys and gals use PHP+HTML+CSS to print a report to
preprinted forms with precision?

if the report is to be printed at client side, how do you do it? Via
networked printer?

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
  ^ ^   19:34:01 up 5 days 28 min 0 users load average: 1.00 1.02 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



RE: [PHP] Question on explode and join.

2006-09-14 Thread tedd

At 5:55 PM -0400 9/13/06, Beauford wrote:


The problem with scripts like these is there is so many variables to deal
with. First, this doesn't deal with uppercase. So a word like bAdWoRd would
not get detected, or a word beginning a sentence. Also, a word within a word
like wordbadwordword would not be detected, and I'm sure there are more I
haven't discovered yet. I haven't had much time to play around with it since
earlier today, so I haven't experimented with it, but ideas are welcome.



The problem of wordbadwordword is not solvable unless you have a 
dictionary of acceptable words as well. For example, words like 
"assumption" and "hellacious" would be problematic.


Furthermore, there are words that are perfectly acceptable, but their 
meanings differ in context, like "screw". So you would need a context 
checker, which presents its own problems.


tedd




Thanks

-Original Message-
From: Ducarom [mailto:[EMAIL PROTECTED]
Sent: September 13, 2006 2:26 PM
To: Beauford
Cc: php
Subject: Re: [PHP] Question on explode and join.

I made some changes to the script from Butera. Now it only replaces complete
words.

$dirty = array(
   'ipsum',
   'eloquentiam',
   'Vero'
);

foreach ($dirty as $key => $word) {
$dirty[$key] = '/\b'. $word . '\b/'; }

$string = "Lorem ipsum ius no etiam veniam, usu alii novum ne, sed cu
molestiae eloquentiam. Vero invenire philosophia est ne, quo nemore timeam
an.";

$clean = preg_replace($dirty, '*', $string);

echo "string: ". $string;
echo "clean: ". $clean;

On 9/13/06, Beauford <[EMAIL PROTECTED]> wrote:


 There ya go. Works and is shorter than what I did. Thanks.

 One other question. if I have bunny and bunnyhole in the badword
 array. if someone types in bunnyhole, I end up getting *hole in the
 clean string. If I change the order of the words in the array would
 that solve the problem?

 Thanks



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



--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: Pre-printed forms

2006-09-14 Thread Man-wai Chang
> You'd probably have better luck using PHP+PDF Generation Classes of some
> sort if you need precision layouts for printing... With HTML+CSS it will
> still vary depending on the render used...

Not a bad idea. But is there free PHP class to do it?

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
  ^ ^   21:31:01 up 5 days 2:25 0 users load average: 1.03 0.98 0.99
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



Re: [PHP] Pre-printed forms

2006-09-14 Thread tedd

At 7:35 PM +0800 9/14/06, Man-wai Chang wrote:

How do you guys and gals use PHP+HTML+CSS to print a report to
preprinted forms with precision?

if the report is to be printed at client side, how do you do it? Via
networked printer?



Hi:

From my old days working with a vertical-mill, precision means to 
produce the same product repeatedly within tolerance, while accuracy 
means to hit the mark (i.e., how close you can get to the desired 
measurement).


If you want the same document to be printed with precision 
repeatedly, then use anything. The end result may not be what you 
want, but the document will look the same each time it's printed from 
the same environment.


However, if you want the document to look a specific way (i.e., pixel 
perfect), then accuracy is what you're after.


If I had a client who wanted me to produce a document that would 
match his specifications accurately, then I would create PDF 
documents. DPF documents can be created and printed with accuracy 
across different platforms.


For example, this --

http://xn--ovg.com/pdf

-- should print the same (accurately) regardless of what platform the 
user has. The precision value of this would lie in the tolerance of 
the printer and we don't have any control over that.


hth's

tedd

PS: Note to the gang -- if I'm wrong, please advise.
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: Pre-printed forms

2006-09-14 Thread Colin Guthrie
Man-wai Chang wrote:
> How do you guys and gals use PHP+HTML+CSS to print a report to
> preprinted forms with precision?

You'd probably have better luck using PHP+PDF Generation Classes of some
sort if you need precision layouts for printing... With HTML+CSS it will
still vary depending on the render used...

Col.

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



RE: [PHP] security include from remote server

2006-09-14 Thread Brad Fuller

Miguel -

>  If my solution is not viable, is there any other way of hosting my 
>  files someplace else, but still access the local database?

Yes.  Your remotely hosted code would call the database on your local
server.  Something like:



You would also need to allow the connection from the remote host in mysql.

mysql> GRANT ALL ON foo.* TO bar@'202.54.10.20' IDENTIFIED BY 'PASSWORD';

Then you need to open the mysql port on your router to point to your
database server.  I believe the default port is 3306.

Hope that helps.

Brad

-Original Message-
From: Miguel Vaz [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 13, 2006 7:48 PM
To: php-general@lists.php.net
Subject: [PHP] security include from remote server


Hi,

Heres a simple problem:

I am doing a php+mysql website at my office, hosted locally but open

to the web, but i wouldnt like to host my files on our office server. 
I could host them somewhere else but our mysql database cant be 
accessed from the outside, only from our server.
I thought about having a simple php local file that would include my

files that are hosted someplace else, and therefor be able to access 
my local database, would that be possible? My first thought would 
probably be no, but i cant really do any tests right now, thats why i 
am asking you guys.
If my solution is not viable, is there any other way of hosting my 
files someplace else, but still access the local database?

(also thought of using zend guard to protect my code, but that would

imply an install on our office server, which is out of the question)

Thanks.


Pag

-- 
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] DOM Question. No pun intended.

2006-09-14 Thread mwilliams

Satyam,

I don't see any "innerHTML" or "outerHTML" in relation to PHP DOM.  I'm 
familiar

with them from a Javascript standpoint, but no references when it comes to PHP
DOM.

Regards,
Mike


Quoting Satyam <[EMAIL PROTECTED]>:

Try the properties innerHTML or outerHTML, the later will include the 
enclosing tag.


Satyam

- Original Message - From: "Michael Williams" 
<[EMAIL PROTECTED]>

To: 
Sent: Thursday, September 14, 2006 2:12 AM
Subject: [PHP] DOM Question. No pun intended.



Hi All,

I'm having HTML DOM troubles.  Is there any way to output the *EXACT*
code
contained in a node (child nodes and all)?  For instance, I perform a
$doc->loadHTML($file) and all
is well.  I then search through the document for specific NODEs with
getElementsByTagName().  However, when I go to output the data from
that node
(say a specific DIV) I simply get the text without formatting and the
like.
Basically, I want the retrieved NODE to echo exactly what is
contained.  If the
div looks like the following:



stuff



. . .I want it to give me exactly that when I do a NODE->textContent or
NODE->nodeValue.  I don't want just the text, I want all tags
contained, etc.
It would be nice to have DOMNode->saveHTML() similar to the
DOMDocument->saveHTML().

FYI, I'm using the technique to "screen scrape" portions of other
pages from my
site and compile items for a quick fix.  Fortunately all my DIVs have
IDs and I
can loop through and find them by that attribute's value. I just
can't output
their EXACT data once I have them.  :-\

Thanks!





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



Re: [PHP] Pre-printed forms

2006-09-14 Thread Satyam
- Original Message - 
From: "Man-wai Chang" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, September 14, 2006 1:35 PM
Subject: [PHP] Pre-printed forms




How do you guys and gals use PHP+HTML+CSS to print a report to
preprinted forms with precision?

if the report is to be printed at client side, how do you do it? Via
networked printer?



To start with, I would avoid pre-printed forms it at all possible.  The best 
option is to design the 'pre-printed' part as a pdf file and then add the 
variable parts and print the whole in plain white paper or with a continuous 
security background.


PDF is the best solution either way, but anyhow, there are technical and 
mechanical problems.
If the printers are single-sheet and they are all the same mode, it is 
relatively easy, a few trials will get everything going fine.


If they are different models, each model has different printable areas so 
the setup for one is not useful in the next.  You will either have to have a 
table of settings for each printer model or a separate CSS for each model 
and a table of printers with which printer is what model and use the table 
settings or the customized CSS for that model.


Also, with HTML + CSS printing, you have the problem that browsers reserve a 
space for header and footer on each page and that is not standardized so the 
printing area, as defined by the printer model, will be further reduced in 
different degrees by the browser.


Another alternative is to have a print trial page available so that if the 
client changes printer or notices it is printing off key, they can print the 
trial page which won't contain actual data but a grid that the client can 
use to align the following printouts.  Much like one of those forms ink-jet 
printers print when you change cartridges, you would have to provide a scale 
relative to some visible line in the pre-printed so that the user enters the 
two grid values that best fit the form, you store them in the profile for 
that client/printer combination and use it on further printouts.


If the printer to be used are dot-matrix, such as if the form has to be 
printed with carbon copies, then you have the further problem that Windows 
programs would switch the printer to graphics mode, which slows them to a 
crawl.  Most pre-printed forms are designed for standard pitches of 6 or 8 
lines per inch.   Graphics environments let you get out of that grid, but it 
slows everything.  Using the normal print mode of the printer makes 
everything easier since the forms are designed for the printer pitch so once 
you get the first line going, all the rest of the page follows. 
Unfortunately there is no way, from a normal application in a graphics 
environment such as Windows, to use a purely character by character printer, 
unless you do an ActiveX control and communicate with the printer via the 
serial port.


Many alternatives, no easy solution (except for droping the pre-printed 
forms)


Satyam

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



Re: [PHP] Question on explode and join.

2006-09-14 Thread Ray Hauge
On Wednesday 13 September 2006 11:51, Beauford wrote:
> Hi,
>
> I have a form which I want to check for inappropriate words before it is
> posted. I have used explode to put the string into an array using a space
> as the delimiter and then I check it against another array that contains
> the inappropriate words.
> I then replace the inappropriate words with *'s and join the array back
> into a string.
>
> This works perfectly except for one thing.
>
> If the word in the string has a any kind of punctuation after it (period,
> comma) it won't be matched.
>
> So if  moron is an inappropriate word then "you are a moron" works, but
> "you are a moron." won't.
>
> Any ideas?
>
> Thanks
>
> This is my code.
>
> function badwords($string) {
>
>   $language = array(contains the inappropriate words);
>
>   $words = explode(" ",$string);
>   $count = count(explode(" ", $string));
>
>   for($i = 0; $i < $count; $i++) {
>   if(in_array(strtolower($words[$i]), $language)) {
>   $words[$i] = "*";
>   }
>   }
>
>   $newcomments = join(" ",$words);
>
>   return $newcomments;
> }

This website answered a lot of my questions about the same situation.  I 
tested it on my development environment, and it worked just fine.

http://www.php-mag.net/magphpde/magphpde_article/psecom,id,637,nodeid,21.html

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] Question on explode and join.

2006-09-14 Thread Ray Hauge
On Thursday 14 September 2006 09:47, Ray Hauge wrote:
> On Wednesday 13 September 2006 11:51, Beauford wrote:
> > Hi,
> >
> > I have a form which I want to check for inappropriate words before it is
> > posted. I have used explode to put the string into an array using a space
> > as the delimiter and then I check it against another array that contains
> > the inappropriate words.
> > I then replace the inappropriate words with *'s and join the array back
> > into a string.
> >
> > This works perfectly except for one thing.
> >
> > If the word in the string has a any kind of punctuation after it (period,
> > comma) it won't be matched.
> >
> > So if  moron is an inappropriate word then "you are a moron" works, but
> > "you are a moron." won't.
> >
> > Any ideas?
> >
> > Thanks
> >
> > This is my code.
> >
> > function badwords($string) {
> >
> > $language = array(contains the inappropriate words);
> >
> > $words = explode(" ",$string);
> > $count = count(explode(" ", $string));
> >
> > for($i = 0; $i < $count; $i++) {
> > if(in_array(strtolower($words[$i]), $language)) {
> > $words[$i] = "*";
> > }
> > }
> >
> > $newcomments = join(" ",$words);
> >
> > return $newcomments;
> > }
>
> This website answered a lot of my questions about the same situation.  I
> tested it on my development environment, and it worked just fine.
>
> http://www.php-mag.net/magphpde/magphpde_article/psecom,id,637,nodeid,21.ht
>ml
>
> --
> Ray Hauge
> Programmer/Systems Administrator
> American Student Loan Services
> www.americanstudentloan.com
> 1.800.575.1099

I didn't recognize this until after I sent the email, but the article was 
written by Chris Shiflett, so I thought I'd give him credit.  Excellent as 
always :)

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] DOM Question. No pun intended.

2006-09-14 Thread Satyam

Sorry, I immediatly thought about the client side.

No, I don't know there is any way on the server side with PHP.

Satyam

- Original Message - 
From: <[EMAIL PROTECTED]>

To: "Satyam" <[EMAIL PROTECTED]>
Cc: 
Sent: Thursday, September 14, 2006 4:16 PM
Subject: Re: [PHP] DOM Question. No pun intended.



Satyam,

I don't see any "innerHTML" or "outerHTML" in relation to PHP DOM.  I'm 
familiar
with them from a Javascript standpoint, but no references when it comes to 
PHP

DOM.

Regards,
Mike


Quoting Satyam <[EMAIL PROTECTED]>:

Try the properties innerHTML or outerHTML, the later will include the 
enclosing tag.


Satyam

- Original Message - From: "Michael Williams" 
<[EMAIL PROTECTED]>

To: 
Sent: Thursday, September 14, 2006 2:12 AM
Subject: [PHP] DOM Question. No pun intended.



Hi All,

I'm having HTML DOM troubles.  Is there any way to output the *EXACT*
code
contained in a node (child nodes and all)?  For instance, I perform a
$doc->loadHTML($file) and all
is well.  I then search through the document for specific NODEs with
getElementsByTagName().  However, when I go to output the data from
that node
(say a specific DIV) I simply get the text without formatting and the
like.
Basically, I want the retrieved NODE to echo exactly what is
contained.  If the
div looks like the following:



stuff



. . .I want it to give me exactly that when I do a NODE->textContent or
NODE->nodeValue.  I don't want just the text, I want all tags
contained, etc.
It would be nice to have DOMNode->saveHTML() similar to the
DOMDocument->saveHTML().

FYI, I'm using the technique to "screen scrape" portions of other
pages from my
site and compile items for a quick fix.  Fortunately all my DIVs have
IDs and I
can loop through and find them by that attribute's value. I just
can't output
their EXACT data once I have them.  :-\

Thanks!











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



Re: [PHP] security include from remote server

2006-09-14 Thread Jon Anderson

Brad Fuller wrote:

Miguel -

  
 If my solution is not viable, is there any other way of hosting my 
 files someplace else, but still access the local database?



Yes.  Your remotely hosted code would call the database on your local
server.  Something like:



You would also need to allow the connection from the remote host in mysql.

mysql> GRANT ALL ON foo.* TO bar@'202.54.10.20' IDENTIFIED BY 'PASSWORD';
If you don't want to expose your database directly to the internet, you 
could have a PHP intermediary service - your local code could be limited 
to one PHP script that would enforce HTTP authentication (over https to 
maintain security), and could forward SQL queries and responses from the 
database. Your remote code could call the local intermediary service.


I personally don't understand why you'd need to store code remotely but 
execute it locally, unless you're concerned about the office "stealing" 
your code, or using it without permission...If you aren't concerned 
about code theft, there are lots of ways you could store code remotely, 
e.g. a very raw/simple/uncomplicated/ugly:


$src = file_get_contents('http://server/code.php.txt');
file_put_contents('/tmp/code.php',$src);
include('/tmp/code.php');
unlink('/tmp/code.php');

But there are at least a few reasons why I wouldn't recommend doing that...

jon

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



[PHP] Re: Pre-printed forms

2006-09-14 Thread Joao Candido de Souza Neto
I use fpdf class that you can get at: http://www.fpdf.org/

"Man-wai Chang" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
>> You'd probably have better luck using PHP+PDF Generation Classes of some
>> sort if you need precision layouts for printing... With HTML+CSS it will
>> still vary depending on the render used...
>
> Not a bad idea. But is there free PHP class to do it?
>
> -- 
>  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
> / v \  Simplicity is Beauty! May the Force and Farce be with you!
> /( _ )\ (Ubuntu 6.06)  Linux 2.6.17.13
>  ^ ^   21:31:01 up 5 days 2:25 0 users load average: 1.03 0.98 0.99
> news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk 

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



Re: [PHP] DOM Question. No pun intended.

2006-09-14 Thread Rob

[EMAIL PROTECTED] wrote:

Satyam,

I don't see any "innerHTML" or "outerHTML" in relation to PHP DOM.  I'm 
familiar
with them from a Javascript standpoint, but no references when it comes 
to PHP

DOM.

Regards,
Mike


Now that you have the element, why not just call:
$doc->saveXML($node);

Rob

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



Re: [PHP] security include from remote server

2006-09-14 Thread Martin Marques

On Thu, 14 Sep 2006, Miguel Vaz wrote:



	I thought about having a simple php local file that would include my 
files that are hosted someplace else, and therefor be able to access my local 
database, would that be possible? My first thought would probably be no, but 
i cant really do any tests right now, thats why i am asking you guys.


It's posible (depending on the php.ini configuration), but very insecure.

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' ||
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
-
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] DOM Question. No pun intended.

2006-09-14 Thread mwilliams

Rob,

I wasn't aware that that would work.  I mean I suppose it should, but 
basically

this is what I'm doing:

1) Create a new DOMDocument
2) DOMDocument->loadHTML()
3) find the elements I want with getElementsByTag() then finding the one with
the correct attributes

. . .at this point, I need the equivalent of DOMDocument->saveHTML() so 
that it
outputs the *exact* html content.  Are you saying that saveXML() will 
do what I

want it to do; tags and all?

Regards,
Mike


Quoting Rob <[EMAIL PROTECTED]>:


[EMAIL PROTECTED] wrote:

Satyam,

I don't see any "innerHTML" or "outerHTML" in relation to PHP DOM.  
I'm familiar
with them from a Javascript standpoint, but no references when it 
comes to PHP

DOM.

Regards,
Mike


Now that you have the element, why not just call:
$doc->saveXML($node);

Rob



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



[PHP] Iteration through letter

2006-09-14 Thread Norbert Wenzel

Hi,

just for fun I tried the following code:


for($letter = 'A'; $letter <= 'Z'; ++$letter) {
echo($letter . ' ');
}


What surprised me was the output, which looked like this:

A B C [...] Y Z AA AB AC [...] YY YZ

I don't have any idea how these letters get printed out, so I'd 
appreciate any guesses or explanations.


thanks,
Norbert

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



Re: [PHP] Iteration through letter

2006-09-14 Thread Robert Cummings
On Thu, 2006-09-14 at 19:26 +0200, Norbert Wenzel wrote:
> Hi,
> 
> just for fun I tried the following code:
> 
> 
> for($letter = 'A'; $letter <= 'Z'; ++$letter) {
>   echo($letter . ' ');
> }
> 
> 
> What surprised me was the output, which looked like this:
> 
> A B C [...] Y Z AA AB AC [...] YY YZ
> 
> I don't have any idea how these letters get printed out, so I'd 
> appreciate any guesses or explanations.

Read the manual and search the archives, this was beaten to a bloody
pulp several months ago. (Hint: this DOESN'T work like ascii in C).

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] Iteration through letter

2006-09-14 Thread KermodeBear
> What surprised me was the output, which looked like this:
> 
> A B C [...] Y Z AA AB AC [...] YY YZ
> 
> I don't have any idea how these letters get printed out, so 
> I'd appreciate any guesses or explanations.

http://www.php.net/manual/en/language.operators.increment.php

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



Re: [PHP] Iteration through letter

2006-09-14 Thread Jon Anderson

Norbert Wenzel wrote:

Hi,

just for fun I tried the following code:


for($letter = 'A'; $letter <= 'Z'; ++$letter) {
echo($letter . ' ');
}


What surprised me was the output, which looked like this:

A B C [...] Y Z AA AB AC [...] YY YZ

I don't have any idea how these letters get printed out, so I'd 
appreciate any guesses or explanations. 
This was discussed a lot a couple months back (Rasmus answered it about 
20 times). This is my rendition.


When you increment a string, you get:

'A' + 1 is 'B'
...
'Z' + 1 is 'AA'

Because of how string comparisons go, 'AA' is greater than 'Z' (strings 
are compared letter by letter), so the loop won't terminate at 'Z', like 
you'd expect.


jon

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



Re: [PHP] Iteration through letter

2006-09-14 Thread Ray Hauge
On Thursday 14 September 2006 12:26, Norbert Wenzel wrote:
> Hi,
>
> just for fun I tried the following code:
>
> 
> for($letter = 'A'; $letter <= 'Z'; ++$letter) {
>   echo($letter . ' ');
> }
> 
>
> What surprised me was the output, which looked like this:
>
> A B C [...] Y Z AA AB AC [...] YY YZ
>
> I don't have any idea how these letters get printed out, so I'd
> appreciate any guesses or explanations.
>
> thanks,
> Norbert

This topic was discussed at quite some length before, and Rasmus helped us all 
understand it.  The reason that happens is the next "letter" after Z is AZ, 
which alphabetically is less than Z.  You could change your statement to use 
$letter < 'AZ'.  I think that would work.

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] Iteration through letter

2006-09-14 Thread Ray Hauge
On Thursday 14 September 2006 12:41, Robert Cummings wrote:
> On Thu, 2006-09-14 at 19:26 +0200, Norbert Wenzel wrote:
> > Hi,
> >
> > just for fun I tried the following code:
> >
> > 
> > for($letter = 'A'; $letter <= 'Z'; ++$letter) {
> > echo($letter . ' ');
> > }
> > 
> >
> > What surprised me was the output, which looked like this:
> >
> > A B C [...] Y Z AA AB AC [...] YY YZ
> >
> > I don't have any idea how these letters get printed out, so I'd
> > appreciate any guesses or explanations.
>
> Read the manual and search the archives, this was beaten to a bloody
> pulp several months ago. (Hint: this DOESN'T work like ascii in C).
>
> Cheers,
> Rob.

I was typing up my response before yours came in... looks like I made the 
spoiler ;)

Later,
-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] DOM Question. No pun intended.

2006-09-14 Thread Rob Richards

[EMAIL PROTECTED] wrote:

Rob,

I wasn't aware that that would work.  I mean I suppose it should, but 
basically

this is what I'm doing:

1) Create a new DOMDocument
2) DOMDocument->loadHTML()
3) find the elements I want with getElementsByTag() then finding the 
one with

the correct attributes

. . .at this point, I need the equivalent of DOMDocument->saveHTML() 
so that it
outputs the *exact* html content.  Are you saying that saveXML() will 
do what I

want it to do; tags and all?

It is the best option, though in reality there may not be a way to do 
this exactly as you want due to HTML not having to be valid XML. By 
exact, unless the input is valid XHTML, loadHTML is going to cause the 
HTML to be fiexed to be proper XML, so using $doc->saveXML($node) you 
will get the serialized of the element as it was created when loading 
the HTML (this includes any "fixes" the parser may have made.


Rob

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



Re: [PHP] Iteration through letter

2006-09-14 Thread Robert Cummings
On Thu, 2006-09-14 at 12:51 -0500, Ray Hauge wrote:
> On Thursday 14 September 2006 12:41, Robert Cummings wrote:
> > On Thu, 2006-09-14 at 19:26 +0200, Norbert Wenzel wrote:
> > > Hi,
> > >
> > > just for fun I tried the following code:
> > >
> > > 
> > > for($letter = 'A'; $letter <= 'Z'; ++$letter) {
> > >   echo($letter . ' ');
> > > }
> > > 
> > >
> > > What surprised me was the output, which looked like this:
> > >
> > > A B C [...] Y Z AA AB AC [...] YY YZ
> > >
> > > I don't have any idea how these letters get printed out, so I'd
> > > appreciate any guesses or explanations.
> >
> > Read the manual and search the archives, this was beaten to a bloody
> > pulp several months ago. (Hint: this DOESN'T work like ascii in C).
> >
> > Cheers,
> > Rob.
> 
> I was typing up my response before yours came in... looks like I made the 
> spoiler ;)

Doh! :)


-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Re: Iteration through letter

2006-09-14 Thread Norbert Wenzel

Norbert Wenzel wrote:

Hi,

just for fun I tried the following code:


for($letter = 'A'; $letter <= 'Z'; ++$letter) {
echo($letter . ' ');
}


What surprised me was the output, which looked like this:

A B C [...] Y Z AA AB AC [...] YY YZ

I don't have any idea how these letters get printed out, so I'd 
appreciate any guesses or explanations.


thanks,
Norbert


Thanks for all your replies and sorry about asking a question answered 
in the manual. I was too surprised of the result, so I didn't even think 
I could find that topic in the manual. Sorry.


Norbert

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



[PHP] R: [PHP] session_start() and fopen

2006-09-14 Thread Fabri
Hi Christopher: this is just a simplified code, I use it to generate some
xml file, no loop is present.

Try it as it is: you will find that two files will be generated while it
should be only one.
If you remove 'session_start()' then only one file will be generated: that's
correct!

Fabri 

-Messaggio originale-
Da: Christopher Weldon [mailto:[EMAIL PROTECTED] 
Inviato: mercoledì 13 settembre 2006 22.28
A: Fabri
Cc: php-general@lists.php.net
Oggetto: Re: [PHP] session_start() and fopen

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Fabri wrote:
> Hello, would you please help me on this issue that is making me crazy?
> 
>  
> 
>  
> 
> I start a session with session_start() and I need to write a file, the
file
> is written twice! If I remove session_start the code works obviously fine.
> 
> I used  the date as name of file so I can see the problem, otherwise the
> file is overwritten.
> 
>  
> 
> session_start();
> 
> $nome = date("Ymd-His");
> 
> $path = $nome . ".xml";
> 
> $fh = fopen($path, 'w');
> 
> if ($fh) {
> 
> fwrite($fh, 'ciao');
> 
> fclose($fh);
> 
> echo $path;
> 
> } 
> 
>  
> 
> does someone have an answer?
> 
> 

Yes, I believe you need to elaborate more on your objectives for the
code and what exactly you mean by the file being written twice. From the
code snippet above, it seems as though you are just going to overwrite a
file and destroy it's contents, not write to it twice.

This isn't being called from any sort of loop, is it?

- --
Christopher Weldon, ZCE
President & CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCGnIZxvk7JEXkbERAj4OAKCVUc3lLkx7JcbwYavK/Qc/DYKtEQCfbU9w
EevaaQyHxc87B7qFwZxS0E4=
=BbS2
-END PGP SIGNATURE-

Chiacchiera con i tuoi amici in tempo reale!
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com


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



Re: [PHP] R: [PHP] session_start() and fopen

2006-09-14 Thread Christopher Weldon
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Fabri wrote:
> Hi Christopher: this is just a simplified code, I use it to generate some
> xml file, no loop is present.
> 
> Try it as it is: you will find that two files will be generated while it
> should be only one.
> If you remove 'session_start()' then only one file will be generated: that's
> correct!
> 
> Fabri 

Hey Fabri,

I cannot replicate this bug (PHP 4.2.3 on older server). I'm only
getting one file written. What version of PHP are you using?

- --
Christopher Weldon, ZCE
President & CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCa33Zxvk7JEXkbERAkT6AJwODHyP1uvE7UjlAOsjSlTf83LS0ACgifny
XRbhB2bRYZsKCvCl09QLkS0=
=lSIJ
-END PGP SIGNATURE-

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



[PHP] R: [PHP] R: [PHP] session_start() and fopen

2006-09-14 Thread Fabri
Hi Chris,
thanks for your feedback: at least now I know that the script is correct, I
am using version 4.3.10, I will investigate if some bug is present in this
version.

Fabri

-Messaggio originale-
Da: Christopher Weldon [mailto:[EMAIL PROTECTED] 
Inviato: giovedì 14 settembre 2006 21.31
A: Fabri
Cc: php-general@lists.php.net
Oggetto: Re: [PHP] R: [PHP] session_start() and fopen

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Fabri wrote:
> Hi Christopher: this is just a simplified code, I use it to generate some
> xml file, no loop is present.
> 
> Try it as it is: you will find that two files will be generated while it
> should be only one.
> If you remove 'session_start()' then only one file will be generated:
that's
> correct!
> 
> Fabri 

Hey Fabri,

I cannot replicate this bug (PHP 4.2.3 on older server). I'm only
getting one file written. What version of PHP are you using?

- --
Christopher Weldon, ZCE
President & CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCa33Zxvk7JEXkbERAkT6AJwODHyP1uvE7UjlAOsjSlTf83LS0ACgifny
XRbhB2bRYZsKCvCl09QLkS0=
=lSIJ
-END PGP SIGNATURE-

Chiacchiera con i tuoi amici in tempo reale!
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com


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



RE: [PHP] Question on explode and join.

2006-09-14 Thread Beauford
I read your email, but I'm not using sessions and not really planning too.
But some of your code may be able to be modified to do what I need.

Thanks for the input.

B


  _  

From: Dave Goodchild [mailto:[EMAIL PROTECTED] 
Sent: September 14, 2006 8:52 AM
To: Beauford
Subject: Re: [PHP] Question on explode and join.


Hi. If you re-read my reponse you will see that it uses preg_replace with
the i flag which ignores case and will match banned words within words. With
a little modification (I can help if you like) you can easily use it in your
case. 


Re: [PHP] security include from remote server

2006-09-14 Thread Miguel Vaz



Yes, right on the spot. Main reasons being code theft and 
using it on other projects. This being done by our office (its 
actually a college and i work in a multimedia department) system 
administrators, which are nothing left than arrogant leaches.


All i was missing from your suggestion was the fact that i 
would need to have my files remotely hosted and not using the .php 
extension. Great help, thanks.



Pag





I personally don't understand why you'd need to store code remotely 
but execute it locally, unless you're concerned about the office 
"stealing" your code, or using it without permission...If you aren't 
concerned about code theft, there are lots of ways you could store 
code remotely, e.g. a very raw/simple/uncomplicated/ugly:


$src = file_get_contents('http://server/code.php.txt');
file_put_contents('/tmp/code.php',$src);
include('/tmp/code.php');
unlink('/tmp/code.php');

But there are at least a few reasons why I wouldn't recommend doing that...

jon


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



Re: [PHP] security include from remote server

2006-09-14 Thread Jon Anderson

Miguel Vaz wrote:
Yes, right on the spot. Main reasons being code theft and 
using it on other projects. This being done by our office (its 
actually a college and i work in a multimedia department) system 
administrators, which are nothing left than arrogant leaches.


All i was missing from your suggestion was the fact that i 
would need to have my files remotely hosted and not using the .php 
extension. Great help, thanks. 
If your sysadmins are trying to steal the code, all they'd have to do is 
download the same code your local scripts refer to 
(http://server/code.php.txt)...Seems to me that you might be better off 
using an encoder of some kind so they don't get their hands on the 
source. Using what I suggested is in no way secure or fast.


jon

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



[PHP] Months between two dates

2006-09-14 Thread Phillip Baker

Greetings Gents,

I want to take two dates formatted as
11/1/1998
10/1/2008

And find out how many months have elapsed between them.
I was wondering if there was a quick and dirty way to do this without a for
loop.

--
Blessed Be

Phillip

The House has passed a law that would abandon the Internet's First Amendment
-- a principle called Network Neutrality that prevents companies like AT&T,
Verizon and Comcast from deciding which Web sites work best for you -- based
on what site pays them the most. If the public doesn't speak up now, our
elected officials will cave to a multi-million dollar lobbying campaign.
Please contaxct your Senators to defeat this bill in the Senate.
http://www.savetheinternet.com
http://www.coanews.org/tiki-read_article.php?articleId=995
http://www.coanews.org/internetfreedom.html?page=netfreedom
http://www.gnn.tv/headlines/9484/
http://www.dearaol.com/


Re: [PHP] Months between two dates

2006-09-14 Thread Kyle
I will assume that your dates are stored in two variables $date1 and $date2


$date1array = explode("/",$date1);
$date2array = explode("/",$date2);

// Assume Date 2 is later than Date 1

$months_apart = ($date2array[2] - $date1array[2])*12;

// Month is later in date 1 than in date 2
// Find the difference of months
if( $date1array[0] > $date2array[0] )
{
$months_apart -= $date1array[0] - $date2array[0];
}
else
{
$months_apart += $date2array[0] - $date1array[0];
}

// $months_apart should now contain months apart


And there is your quick and dirty method,
I haven't really debugged it, but I am pretty sure that should work.
Some (int) casting my be necessary, but I think PHP will automatically
do that for you.

Good luck,
Kyle

Phillip Baker wrote:
> Greetings Gents,
> 
> I want to take two dates formatted as
> 11/1/1998
> 10/1/2008
> 
> And find out how many months have elapsed between them.
> I was wondering if there was a quick and dirty way to do this without a for
> loop.
> 

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