php-general Digest 8 Sep 2001 18:30:26 -0000 Issue 864

Topics (messages 66512 through 66538):

Re: how to execute a php script thru a cron job
        66512 by: Carry Ian

Re: run a script for any HTTP request (was: run a script on access to a directory)
        66513 by: Enrique Vadillo
        66521 by: Geoff Caplan

how to pass authentication info to SMTP server
        66514 by: Balaji Ankem

dates problem
        66515 by: Nikola Veber

Re: Ordering a query
        66516 by: Matthew Loff

manage a mail archive
        66517 by: crorepati
        66526 by: B. van Ouwerkerk
        66530 by: crorepati
        66533 by: B. van Ouwerkerk

[-= Your Vacation Winning =-]
        66518 by: Tessy103.aol.com

a general perl like pares of the query string...
        66519 by: Aaron Moore
        66525 by: CC Zona
        66535 by: Aaron Moore
        66536 by: Rasmus Lerdorf

include problem
        66520 by: mail.struempf.com
        66531 by: Gaylen Fraley

optimize question
        66522 by: Michele Schiavo

creating ZIP file from mySQL content?
        66523 by: BRACK

session_name causes break
        66524 by: Christian Haines

cURL support
        66527 by: Daniel Baldoni

Problem with Encoding
        66528 by: Harry Lau

error with socket
        66529 by: sagar

Smarty + JavaScript
        66532 by: Alexander Deruwe
        66534 by: John Lim

query string - count for records with keywords
        66537 by: sgibbs.vt.globalhealth.org

Sterilize user input function
        66538 by: Kevin

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------


thanks daniel,

but how do i add it to the cron job for daily execution ?


regards
carry


On Thursday, September 06, 2001 at 10:51:00 PM, Daniel Rezny wrote:

> Hello Carry,
> 
> Thursday, September 06, 2001, 5:05:53 PM, you wrote:
> 
> CI> hello,
> 
> 
> 
> CI> can anybody suggest me how to execute a php file thru a cron job?
> 
> CI> i have a php script which checks for invalid links in my links database and 
>mails the result to the site admin if any 400 series errors are found.
> 
> 
> 
> CI> thanks in advance.
> 
> If you have a binary php version you can do it like this:
> /path/to/php/binary /path/to/script
> 
> Or you can do it thru lynx like this:
> /path/to/lynx -dump www.some_server.com/script.php
> 
> I hope it helps.
> 
> -- 
> Best regards,
>  Daniel                            mailto:[EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


Carry Ian
e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------------------------------------
Get real solutions to all your problems.

http://www.salahkarindia.com - India's first advisory Portal

Your friend, advisor, healer,companion!!!

Register now  to  get free advice on all your problems.

--------------------------------------------------------------------------------------------------





Jason thanks! your information about those 512 bytes is VERY useful
but just a lil' too late, i already came up with a solution using a
conditional URL rewrite rule in my apache, along with a "<Location>
ForceType .." which helps me invoke my php script, if anyone is
interested i can send out the details, it actually executes the
php script for every http request received by the apache server.

Rasmus, thanks for your efforts on PHP development, we ALL owe you
big time. I hope you succeed with that request_rec stuff soon,
i spent some 4 hours making possible that a script be invoked
for every http request... <duh> this has to be easier for next
PHP version!

Thanks to everyone who *at least* tried to help.

Enrique-

>From: Rasmus Lerdorf <[EMAIL PROTECTED]>
>To: Jason Bell <[EMAIL PROTECTED]>
>CC: Enrique Vadillo <[EMAIL PROTECTED]>, 
><[EMAIL PROTECTED]>,   <[EMAIL PROTECTED]>
>Subject: Re: [PHP] Re: run a script for any HTTP request (was: run a script 
>on access to a directory)
>Date: Fri, 7 Sep 2001 15:13:10 -0700 (PDT)
>
>Sure, I know that very well, but that has nothing to do with what we are
>discussing here.
>
>-Rasmus
>
>On Fri, 7 Sep 2001, Jason Bell wrote:
>
> > IE has "Friendly Error Messages" so on a normal 404 response, IE would 
>show
> > it's own error message, and not the one from the server. The Documented 
>way
> > around this is to ensure that your 404 document is larger than 512 
>bytes.
> >
> > http://www.zdnet.com/products/stories/reviews/0,4161,2779295-3,00.html
> >
> >
> > ----- Original Message -----
> > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> > To: "Enrique Vadillo" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Friday, September 07, 2001 2:45 PM
> > Subject: Re: [PHP] Re: run a script for any HTTP request (was: run a 
>script
> > on access to a directory)
> >
> >
> > > What do you mean MSIE does not support 404 ErrorDocument?  That is a
> > > server-side function.  It has absolutely nothing to do with the 
>browser.
> > > Try going to: http://php.net/strlen
> > >
> > > That is an ErrorDocument 404 thing that kicks in and takes you to the
> > > right place in the PHP documentation.  And believe me, it works just 
>fine
> > > for people using MSIE.
> > >
> > > Right now an ErrorDocument 404 is the only way to do this.  I am 
>currently
> > > working on the framework to allow PHP scripts to be inserted at any 
>stage
> > > in the Apache request_rec handler mechanism.  This would allow you to 
>run
> > > a PHP script to translate uri's to on-disk pathnames for example, 
>write
> > > Apache authentication modules in PHP and many many other efficient 
>ways to
> > > shoot yourself in the foot.  Needs another week or two of development
> > > before it will be ready for serious testing though.
> > >
> > > -Rasmus
> > >
> > > > MSIE does not support 404 ErrorDocument, that only works fine
> > > > with Netscape. Rewriting URLs is nasty when you have to mix
> > > > it with php script writing, this could be so much simpler with
> > > > a php script.
> > > >
> > > > I know it's a tough question, anyone dares to beat the problem?
> > > >
> > > > Enrique-
> > > >
> > > > >From: Philip Hallstrom <[EMAIL PROTECTED]>
> > > > >To: Enrique Vadillo <[EMAIL PROTECTED]>
> > > > >CC: <[EMAIL PROTECTED]>
> > > > >Subject: [PHP] Re: run a script for any HTTP request (was: run a 
>script
> > on
> > > > >access to a directory)
> > > > >Date: Fri, 7 Sep 2001 14:15:52 -0700 (PDT)
> > > > >
> > > > >What's wrong with rewriting urls?  The other alternative is to make
> > sure
> > > > >that none of the urls you are accessing actually exist and then 
>setup
> > an
> > > > >ErrorDocument handler which calls the php script of your choice...
> > which
> > > > >can then do whatever you want...
> > > > >
> > > > >-philip
> > > > >
> > > > >On Fri, 7 Sep 2001, Enrique Vadillo wrote:
> > > > >
> > > > > > That was a fine idea Doug, but what if we push the subject and
> > > > > > go a little further?
> > > > > >
> > > > > > I am thinking now that i'd like to make it possible that for
> > > > > > ANY http request received by my Apache i'd like to have a php
> > > > > > script executed first, i.e.:
> > > > > >
> > > > > > http://domain.com/
> > > > > > http://domain.com/anydir/anyfile
> > > > > >
> > > > > > for any of those locations typed, i'd like to be able to
> > > > > > execute the php script. i know it's kinda weird but this is
> > > > > > what i'm really looking for. any ideas anyone?
> > > > > >
> > > > > > Enrique-
> > > >
> > > >
> > > > _________________________________________________________________
> > > > Descargue GRATUITAMENTE MSN Explorer en 
>http://explorer.msn.es/intl.asp
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: 
>[EMAIL PROTECTED]
> > >
> > >
> >
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


_________________________________________________________________
Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp





Enrique

> On Fri, 7 Sep 2001, Enrique Vadillo wrote:

> > I am thinking now that i'd like to make it possible that for
> > ANY http request received by my Apache i'd like to have a php
> > script executed first

I do this all the time - it offers all kinds of advantages.

This link explains why and how to do this

http://www.phpbuilder.com/columns/tim20000526.php3

 My own appoach is to use Apache mod_rewrite to direct all requests to my
"main" script, but leave one directory free for conventional .html or .php
files. You need something like this in your Apache configuration -

RewriteEngine on
RewriteRule !^/my_conventional_directory(.*) /my_main_file.php [nocase]

This means: "if request is not for my conventional directory, run my main
script"

Cheers

Geoff Caplan






 Hi Ramsus and Renze,
     I would like to implement sending an e-mail through SMTP server.

 Here my SMTP server needs authentication.

 How to pass the username and password to SMTP server??

Thanks in advance.
Regards
-Balaji


----------------------------------------------------------------------------------------------------------------------------------
Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers
and is intended for use only by the individual or entity to which it is
addressed, and may contain information that is privileged, confidential or
exempt from disclosure under applicable law. If you are not the intended
recipient or it appears that this mail has been forwarded to you without
proper authority, you are notified that any use or dissemination of this
information in any manner is strictly prohibited. In such cases, please
notify us immediately at mailto:[EMAIL PROTECTED] and delete this mail
from your records.
---------------------------------------------------------------------------------------------------------------------------------




I'm having a prowith determing a time interval. I need to find out how many 
seconds, minutes, days have passed since a cpecific date (1.1.1980.), but when I 
pass that dade to a time stamp , I get 1983.315529200. How am I suposed to 
handle the year (1983.) o there is smething else ? I think the only way to do this is
to make the time stamp for the interval between now and the specific date.

thanx
Nikola Veber






You could insert a ternary operation...

($order?$order:"defaultfield")

Is the same as:

if($order) 
        echo $order;
else
        echo "defaultfield";

...

$result = mysql_query("SELECT
articles.title,vote.votes,vote.total,articles.date,staff.firstname,artic
les.content,articles.id FROM staff,articles,vote WHERE articles.authorid
= staff.id AND articles.id = vote.item ORDER BY ".
($order?$order:"defaultfield") ." DESC",$db);


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Friday, September 07, 2001 10:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Ordering a query


I use the following code to order the results of the query by the
variable $order.

$result = mysql_query("SELECT
articles.title,vote.votes,vote.total,articles.date,staff.firstname,artic
les.content,articles.id FROM staff,articles,vote WHERE articles.authorid
= staff.id AND articles.id = vote.item ORDER BY `$order` DESC",$db);

I assign the variable a value according to my url,
http://www.mysite.com/file.php?order=something

My question is. Is there a way of assigning the $order variable a
default value? Like if they hit http://www.mysite.com/file.php without
the order=something can I tell the script to assign $order a default
value?

Thanks,
Nate





Hello,

We are using ezmlm mailing list on our server. 

We want to make the mailing list archive available on our website. How can 
we do this ? 

any help will be highly appreciable. 


thanks 

cp




You can use MySQL. Take a look at the ezmlm homepage, and check the ezmlm 
mailinglist archive..

Pulling data out of a MySQL table is easy.. if you don't know how, just 
look at some tutorials (www.devshed.com) more links can be found at www.php.net

Bye,



B.


At 20:28 8-9-01 +0000, crorepati wrote:
>Hello,
>
>We are using ezmlm mailing list on our server.
>We want to make the mailing list archive available on our website. How can 
>we do this ?
>any help will be highly appreciable.
>
>thanks
>cp





hello

How do I retrieve the messages from the list archive and how do i store the 
data in text files/database . 

Pl. help me out. 

thanks
cp 

 

B. van Ouwerkerk writes: 

> You can use MySQL. Take a look at the ezmlm homepage, and check the ezmlm 
> mailinglist archive.. 
> 
> Pulling data out of a MySQL table is easy.. if you don't know how, just 
> look at some tutorials (www.devshed.com) more links can be found at 
> www.php.net 
> 
> Bye, 
> 
>  
> 
> B. 
> 
> 
> At 20:28 8-9-01 +0000, crorepati wrote:
>> Hello, 
>> 
>> We are using ezmlm mailing list on our server.
>> We want to make the mailing list archive available on our website. How 
>> can we do this ?
>> any help will be highly appreciable. 
>> 
>> thanks
>> cp
> 
 




I pointed you to sources where you can find the information you need.

I don't run ezmlm with mysql support so I would need to look at the docs 
too. I'm very sorry but I don't have enough time to do the dirty work for you.

I'm not even sure about how far ezmlm and MySQL work together.. A friend 
told me he was going to put all messages in a MySQL database but I'm not 
sure if it's a default feature or his own coding.

I suggest you go to the sources mentioned previous and browse a little.

Bye,


B.


>How do I retrieve the messages from the list archive and how do i store 
>the data in text files/database .
>Pl. help me out.
>thanks
>cp





You have been specially selected to qualify for the following:

Premium Vacation Package and Pentium PC Giveaway
To review the details of the please click on the link 
with the confirmation number below:

http://wintrip.chn.net
or
http://wintrip.my163.com

Confirmation Number#Lh340
Please confirm your entry within 24 hours of receipt of this confirmation.

Wishing you a fun filled vacation!
If you should have any additional questions or cann't connect to the site 
do not hesitate to contact me direct:
mailto:[EMAIL PROTECTED]?subject=Help!




Ok if you have a query string from like file.php?bob=manager&phil=employ

how do i split the bob=manager and phil=employ dynamically?

because i may have 2 or 3 elements and i just want to sepearte them all and
access them via an array such as if ($var["bob"] = "manager")

etc.... so a loop that would parse the & and also the = signs....

appreciate the help






In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Aaron Moore) wrote:

> Ok if you have a query string from like file.php?bob=manager&phil=employ
> 
> how do i split the bob=manager and phil=employ dynamically?
> 
> because i may have 2 or 3 elements and i just want to sepearte them all and
> access them via an array such as if ($var["bob"] = "manager")

If track_vars is on (always true if version >= 4.0.3), then the global vars 
$HTTP_GET_VARS['bob'] and $HTTP_GET_VARS['phil']  are already set.

And if register_globals is on, then the global vars $bob and $phil are also 
already set.

See <http://php.net/configuration>.

-- 
CC




Well hers teh perl version of the the parser... how do i convert this to php

$tmp = $ENV{'QUERY_STRING'};
@pairs = split(/&/, $tmp);

foreach $item (@pairs) {
 ($key, $content) = split(/=/,$item,2);
 $content =~ tr/+/ /;
 $content =~ s/%(..)/pack("c",hex($1))/ge;
 $fields{$key} = $content;
}






http://php.net/parse_str

On Sat, 8 Sep 2001, Aaron Moore wrote:

> Well hers teh perl version of the the parser... how do i convert this to php
>
> $tmp = $ENV{'QUERY_STRING'};
> @pairs = split(/&/, $tmp);
>
> foreach $item (@pairs) {
>  ($key, $content) = split(/=/,$item,2);
>  $content =~ tr/+/ /;
>  $content =~ s/%(..)/pack("c",hex($1))/ge;
>  $fields{$key} = $content;
> }
>
>
>
>





Hi

I have a little Problem with include.I want to include a txt file in every php file on 
the server but some php files are in other directories and dont include this txt file.

Example :

Url for the txt file : www.domain.com/include/incl.txt

So www.domain.com/index2.php includes the txt file correctly but 
www.domain.com/shop/shop.php dont do this.

In the include command i used the serverpath to the txt file.

So what should i do ?
Thanks for support !

chris




Provide an absolute path to the file, like /path/path1/incl.txt instead of a
URL.


<[EMAIL PROTECTED]> wrote in message
003701c13854$50ecf780$0100a8c0@pentium333">news:003701c13854$50ecf780$0100a8c0@pentium333...
Hi

I have a little Problem with include.I want to include a txt file in every
php file on the server but some php files are in other directories and dont
include this txt file.

Example :

Url for the txt file : www.domain.com/include/incl.txt

So www.domain.com/index2.php includes the txt file correctly but
www.domain.com/shop/shop.php dont do this.

In the include command i used the serverpath to the txt file.

So what should i do ?
Thanks for support !

chris







Is most performant for out a sting use
echo or print ?
and if I have more print command ex:
print "aaa",
print "bbbb";

Is best use a single command with a very long string ?

Thank's michele Schiavo






I have a site where ppl can upload their text-based ideas in real 
time, so that I have new records in db every day. When I did 
uploading by hands and had over 200 files on that site I distributed 
all site content in downloadable for of zipped win-help formate. 
Well, I don't think that I can do help file dinamically but what about 
normal zip file. Can I create the script which would do it for me 
(creating zip-file of all records in db dynamically)?

Youri
<>< <>< <>< <>< God is our provider ><> ><> ><> ><> 
http://www.body-builders.org




hi all,

has anyone else had problems with specifying session_name causing data not
being input into session variables?

For example:

session_name("test");
session_start();
session_register("count");
count++;

causes count not to increment whereas

session_start();
session_register("count");
count++;

with the default PHPSESSID works ????



many thanks in advance
christian





G'day folks,

I have a site just about ready to go on-line.  All my local testing has
worked like a dream - but the cURL support on the hosting provider is
partially broken.

Actually using curl_init()...curl_exec() etc. on my box to contact remote
URIs (both over HTTP and HTTPS) has worked from day 1 (with versions 4.0.4p1,
4.0.5 and 4.0.6).

On the hosting provider, HTTPS connections don't work.  But, I'm told the
command-line version of curl does work.

So, my question is - what gives?  Are there known (intermittent) problems
with support for cURL or have the provider's staff "done something" during
the build of curl and/or PHP?

Any help would be much appreciated as I really don't like the idea of palming
off access to secure sites to yet another external program.  Thanks for any
information.

Ciao.

-- 
-------------------------------------------------------+---------------------
Daniel Baldoni BAppSc, PGradDipCompSci                 |  Technical Director
require 'std/disclaimer.pl'                            |  LcdS Pty. Ltd.
-------------------------------------------------------+  856B Canning Hwy
Phone/FAX:  +61-8-9364-8171                            |  Applecross
Mobile:     041-888-9794                               |  WA 6153
URL:        http://www.lcds.com.au/                    |  Australia
-------------------------------------------------------+---------------------
"Any time there's something so ridiculous that no rational systems programmer
 would even consider trying it, they send for me."; paraphrased from "King Of
 The Murgos" by David Eddings.  (I'm not good, just crazy)




I want to include a string into a PNG by ImageTTFText(),
where some of the chars are encoded in BIG5.
I have found the revalent TTF for BIG5.

The output really gives some Traditional Chinese chars,
but the chars are not those I want.
(I think this problem also exist in Shift-JIS encoding.)

Would anyone give me some suggestions?
Thanks a lot :)

Harry








hi,

I'm using win98/apache/php4
But it's giving an error saying undefined function when i use socket() function.
On advice of some one i've also tried socket_create(). but in vain.
I think that i dont have the socket libs in my php. where can i get them.
do u think that i'm correct ?

pl help as soon as possible.

/sagar





Hey all,

If anyone else out there is using Smarty as templating engine, how do you put 
JavaScript into the template? It seems to barf on the opening and closing 
braces of every JS function, rendering JS totally useless. I must be missing 
something.

ad.




>From the smarty manual

{literal}
        <script language=javascript>

                <!--
                        function isblank(field) {
                        if (field.value == '')
                                { return false; }
                        else
                                {
                                document.loginform.submit();
                                return true;
                                }
                        }
                // -->

        </script>
{/literal}

Alternately use ldelim,rdelim

Bye, John
"Alexander Deruwe" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey all,
>
> If anyone else out there is using Smarty as templating engine, how do you
put
> JavaScript into the template? It seems to barf on the opening and closing
> braces of every JS function, rendering JS totally useless. I must be
missing
> something.
>
> ad.






I'm trying to get a count of the number of records in a database that have
the keyword "cat", for example. Below is the original code; I added the
query with count at the bottom of this code but it doesn't seem to be
working.  I just get a return of "4" which doesn't correspond correctly with
the true number of records (also, I get the same return of "4" regardless of
the keyword I want to search).

All I want to do is put the record number in parantheses next to the
category so that people visiting the site will be able to tell if new
submissions have been added since they last visited.

Am I missing something really obvious? 

Thanks for your help, Shawna

<? 


// original code

if($search == "or"){
        $op = "or";
        $query = "0";
}else{
        $op = "and";
        $query = "1";
        };

if($title){
        $title = addslashes($title);
        $query .= " " . $op . " title like '%$title%'";
        };
if($keywords){
        $foo = "(0";
        $keywords = addslashes($keywords);

        $strings = explode(" ", $keywords);
        $num_strings = count($strings);

        for($i=0;$i<$num_strings;$i++){
                $curstring=$strings[$i];

                $foo .= " or keywords like '%$curstring%'";
                };
        
        $query .= " " . $op . " $foo)";
        };
if($category){
        $query .= " " . $op . " category like '%$category%'";
        };
if($type){
        $query .= " " . $op . " type like '%$type%'";
        };      
if($language){
        $language = addslashes($language);
        $query .= " " . $op . " language like '%$language%'";
        };
if($region){
        $query .= " " . $op . " region like '%$region%'";
        };
if($author){
        $author = addslashes($author);
        $query .= " " . $op . " author like '%$author%'";
        };

$offset = addslashes($offset);
if(!($offset)){$offset = 0;};

$results = mysql_db_query("$db", "select id, title,
date_format(sources.datetime, '%e/%c/%y') as datetime, category, type,
description from sources where  ( $query ) and approved = 'y' order by id
desc limit $offset, 10");


//my code
$keywordsearch = mysql_db_query("$db", "select count(*) from sources where
keywords = 'cat' and approved = 'y'");

?>




I am looking for general a function to that would render user input
harmless.

I would write my own but don't know what to strip from the input that could
make it potentially damaging on linux boxes.  I need to accept email and
phone numbers.

Thanks in advance,

Kevin



Reply via email to