|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 14 Sep 2006 18:18:41 -0000 Issue 4347
php-general-digest-help
lists.php.net
Date: Thu Sep 14 2006 - 13:18:41 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 14 Sep 2006 18:18:41 -0000 Issue 4347
Topics (messages 241769 through 241799):
Re: Open file on a Mounted Share on Mac OS X
241769 by: Rahul S. Johari
241770 by: Rahul S. Johari
Re: How to skip browser's Warning?
241771 by: Ruben Rubio
Re: DOM Question. No pun intended.
241772 by: Satyam
241779 by: mwilliams.infinitydatasystems.com
241783 by: Satyam
241786 by: Rob
241787 by: Rob
241789 by: mwilliams.infinitydatasystems.com
241796 by: Rob
Pre-printed forms
241773 by: Man-wai Chang
241775 by: Colin Guthrie
241776 by: Man-wai Chang
241777 by: tedd
241780 by: Satyam
241785 by: Joao Candido de Souza Neto
Re: Question on explode and join.
241774 by: tedd
241781 by: Ray Hauge
241782 by: Ray Hauge
Re: security include from remote server
241778 by: Brad Fuller
241784 by: Jon Anderson
241788 by: Martin Marques
Iteration through letter
241790 by: Norbert Wenzel
241791 by: Robert Cummings
241792 by: KermodeBear
241793 by: Jon Anderson
241794 by: Ray Hauge
241795 by: Ray Hauge
241797 by: Robert Cummings
241798 by: Norbert Wenzel
R: [PHP] session_start() and fopen
241799 by: Fabri
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
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" <john
kegworks.com> wrote:
> Rahul S. Johari wrote:
>> Samba. It's an SMB share.
>>
>>
>> On 9/13/06 12:39 AM, "Chris" <dmagick
gmail.com> 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...
>
>> [root
jnichel 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: rahul
informed-sources.com
http://www.informed-sources.com
attached mail follows:
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" <john
kegworks.com> wrote:
> Rahul S. Johari wrote:
>> Samba. It's an SMB share.
>>
>>
>> On 9/13/06 12:39 AM, "Chris" <dmagick
gmail.com> 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...
>
>> [root
jnichel 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: rahul
informed-sources.com
http://www.informed-sources.com
attached mail follows:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This is php cconfiguration.
Add this to php.ini
session.cache_limiter=none
afan
afan.net 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-----
attached mail follows:
Try the properties innerHTML or outerHTML, the later will include the
enclosing tag.
Satyam
----- Original Message -----
From: "Michael Williams" <mwilliams
infinitydatasystems.com>
To: <php-general
lists.php.net>
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:
>
> <div id="name">
> <table>
> stuff
> </table>
> </div>
>
> . . .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!
attached mail follows:
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 <Satyam
satyam.com.ar>:
> Try the properties innerHTML or outerHTML, the later will include the
> enclosing tag.
>
> Satyam
>
> ----- Original Message ----- From: "Michael Williams"
> <mwilliams
infinitydatasystems.com>
> To: <php-general
lists.php.net>
> 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:
>>
>> <div id="name">
>> <table>
>> stuff
>> </table>
>> </div>
>>
>> . . .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!
>
>
attached mail follows:
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: <mwilliams
infinitydatasystems.com>
To: "Satyam" <Satyam
satyam.com.ar>
Cc: <php-general
lists.php.net>
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 <Satyam
satyam.com.ar>:
>
>> Try the properties innerHTML or outerHTML, the later will include the
>> enclosing tag.
>>
>> Satyam
>>
>> ----- Original Message ----- From: "Michael Williams"
>> <mwilliams
infinitydatasystems.com>
>> To: <php-general
lists.php.net>
>> 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:
>>>
>>> <div id="name">
>>> <table>
>>> stuff
>>> </table>
>>> </div>
>>>
>>> . . .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!
>>
>>
>
>
>
>
>
attached mail follows:
mwilliams
infinitydatasystems.com 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
attached mail follows:
mwilliams
infinitydatasystems.com 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
attached mail follows:
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 <rrichards
ctindustries.net>:
> mwilliams
infinitydatasystems.com 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
>
attached mail follows:
mwilliams
infinitydatasystems.com 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
attached mail follows:
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
attached mail follows:
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.
attached mail follows:
> 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
attached mail follows:
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
attached mail follows:
----- Original Message -----
From: "Man-wai Chang" <toylet.toylet
gmail.com>
To: <php-general
lists.php.net>
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
attached mail follows:
I use fpdf class that you can get at: http://www.fpdf.org/
"Man-wai Chang" <toylet.toylet
gmail.com> escreveu na mensagem
news:eeblk5$phn$1
sea.gmane.org...
>> 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
attached mail follows:
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:ducarom
gmail.com]
>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 "<br>string: ". $string;
>echo "<br>clean: ". $clean;
>
>On 9/13/06, Beauford <php-user
netscan.ca> 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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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:
<? $link = mysql_connect("foo.com", "bar", "PASSWORD"); ?>
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:dante
mail.telepac.pt]
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
attached mail follows:
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:
>
> <? $link = mysql_connect("foo.com", "bar", "PASSWORD"); ?>
>
> 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
attached mail follows:
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
---------------------------------------------------------
attached mail follows:
Hi,
just for fun I tried the following code:
<code>
for($letter = 'A'; $letter <= 'Z'; ++$letter) {
echo($letter . ' ');
}
</code>
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
attached mail follows:
On Thu, 2006-09-14 at 19:26 +0200, Norbert Wenzel wrote:
> Hi,
>
> just for fun I tried the following code:
>
> <code>
> for($letter = 'A'; $letter <= 'Z'; ++$letter) {
> echo($letter . ' ');
> }
> </code>
>
> 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. |
`------------------------------------------------------------'
attached mail follows:
> 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
attached mail follows:
Norbert Wenzel wrote:
> Hi,
>
> just for fun I tried the following code:
>
> <code>
> for($letter = 'A'; $letter <= 'Z'; ++$letter) {
> echo($letter . ' ');
> }
> </code>
>
> 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
attached mail follows:
On Thursday 14 September 2006 12:26, Norbert Wenzel wrote:
> Hi,
>
> just for fun I tried the following code:
>
> <code>
> for($letter = 'A'; $letter <= 'Z'; ++$letter) {
> echo($letter . ' ');
> }
> </code>
>
> 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
attached mail follows:
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:
> >
> > <code>
> > for($letter = 'A'; $letter <= 'Z'; ++$letter) {
> > echo($letter . ' ');
> > }
> > </code>
> >
> > 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
attached mail follows:
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:
> > >
> > > <code>
> > > for($letter = 'A'; $letter <= 'Z'; ++$letter) {
> > > echo($letter . ' ');
> > > }
> > > </code>
> > >
> > > 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. |
`------------------------------------------------------------'
attached mail follows:
Norbert Wenzel wrote:
> Hi,
>
> just for fun I tried the following code:
>
> <code>
> for($letter = 'A'; $letter <= 'Z'; ++$letter) {
> echo($letter . ' ');
> }
> </code>
>
> 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
attached mail follows:
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:cweldon
cerberusonline.com]
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.
cweldon
cerberusonline.com
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
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]