php-general Digest 20 Jan 2002 23:34:28 -0000 Issue 1123

Topics (messages 81261 through 81295):

Re: Upload & View Image
        81261 by: Malte Fucks
        81277 by: Jason Wong

eval()
        81262 by: Kunal Jhunjhunwala
        81263 by: Michael Waples
        81264 by: Kunal Jhunjhunwala
        81265 by: Nick Wilson
        81266 by: Michael Waples
        81267 by: Kunal Jhunjhunwala

Re: Php.ini file missing
        81268 by: Michael Sciascia

calling cvs checkout from php
        81269 by: Janez

agh - what am I doing wrong - regular expressions
        81270 by: sgibbs.vt.globalhealth.org

SendMail Problem
        81271 by: Gimenez Blanco

php login scripts
        81272 by: xx xx

Re: Upload & View Image : Database Thingy!!!!
        81273 by: Thomas Edison Jr.
        81275 by: Jason Wong
        81279 by: Malte Fucks

system(), passthru(), exec() not working as from command line
        81274 by: Peter Janett

Number of rows reurned?
        81276 by: Daniel Alsén
        81278 by: Jason Wong
        81280 by: Daniel Alsén

Printing structure and data of array
        81281 by: Daniel Alsén

Re: open/read file/directory and file test
        81282 by: bvr

While on array?
        81283 by: Daniel Alsén

Re: Include inside a function?
        81284 by: Emile Bosch

Having a problem with sessions?
        81285 by: Henrik Hudson

PHP-JavaScript
        81286 by: Mċrten Andersson
        81293 by: Richard Crawford

Confusing Problem
        81287 by: Tj Corley
        81288 by: DL Neil
        81289 by: Tj Corley
        81291 by: Jason Bell

Opening more than one database at a time?
        81290 by: Jeff Lewis
        81292 by: Ing. Daniel Manrique

Edit program
        81294 by: Mehmet Kamil ERISEN

manual : Call-time pass-by-reference has been deprecated
        81295 by: Bruce BrackBill

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]


----------------------------------------------------------------------
--- Begin Message ---
oops... should be if($yourfile) instead of if($file)... sorry 

--- End Message ---
--- Begin Message ---
On Saturday 20 January 2001 19:39, Malte Fucks wrote:

> To control the size of an image is a matter of your HTML... do something
> like
> <img src="yourimage" width="40px" height="40px">. Its even possible to
> insert height and width-values in percent...

This only sets the display size of the image *after* the whole image 
(whatever size it may be) is downloaded into the browser. 

The original post mentions limiting the size of the images that will be 
transferred. The way to do it would be to use either the 'builtin' php image 
manipulation functions, or to call some command-line program from within php. 
This would be probably be done at the time of the upload.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
"I have just one word for you, my boy...plastics."
- from "The Graduate"
*/
--- End Message ---
--- Begin Message ---
Hey
Does anybody know if its wise to use eval() ? I know Vbulletin uses it.. but
there is something about it I just cant digest.. it seems to be a very
powerfull function which can be very easily exploited... anyone else have
any thoughts?
Regards,
Kunal

--- End Message ---
--- Begin Message ---
Kunal Jhunjhunwala wrote:
> 
> Hey
> Does anybody know if its wise to use eval() ? I know Vbulletin uses it.. but
> there is something about it I just cant digest.. it seems to be a very
> powerfull function which can be very easily exploited... anyone else have
> any thoughts?
> Regards,
> Kunal

 Loading your templates into a database, pulling them out on every page
load and running eval() to run the code isn't the most efficient way to
do it.
Then running eval() inside a loop on that code isn't efficient either.

I think eval() is used this way by some people because they don't know
how to write files using php propely. So instead they just put it in a
database. You also completely miss out on getting the benefits of one of
the different php caching products.
For me a database is for storing data - not php code.
Vbulletin as an example of complete overuse of eval().
--- End Message ---
--- Begin Message ---
Hey,
I tend to agree with you. But what is the most effiecent way of using php
code in template files then? I am not going to move my templates to a
dbase.. thats for sure.
Regards,
Kunal Jhunjhunwala
----- Original Message -----
From: "Michael Waples" <[EMAIL PROTECTED]>
To: "Kunal Jhunjhunwala" <[EMAIL PROTECTED]>
Cc: "php-list" <[EMAIL PROTECTED]>
Sent: Sunday, January 20, 2002 5:51 PM
Subject: Re: eval()


> Kunal Jhunjhunwala wrote:
> >
> > Hey
> > Does anybody know if its wise to use eval() ? I know Vbulletin uses it..
but
> > there is something about it I just cant digest.. it seems to be a very
> > powerfull function which can be very easily exploited... anyone else
have
> > any thoughts?
> > Regards,
> > Kunal
>
>  Loading your templates into a database, pulling them out on every page
> load and running eval() to run the code isn't the most efficient way to
> do it.
> Then running eval() inside a loop on that code isn't efficient either.
>
> I think eval() is used this way by some people because they don't know
> how to write files using php propely. So instead they just put it in a
> database. You also completely miss out on getting the benefits of one of
> the different php caching products.
> For me a database is for storing data - not php code.
> Vbulletin as an example of complete overuse of eval().
>
>

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* On 20-01-02 at 13:26 
* Kunal Jhunjhunwala said....

> Hey,
> I tend to agree with you. But what is the most effiecent way of using php
> code in template files then? I am not going to move my templates to a
> dbase.. thats for sure.

The point of templates is to seperate code from presentation and
content. Your template should only contain html/js, and your code should
be in the script that calls the template. Why not databases? That way
you achieve a proper 3 tier structure that's easy to maintain.

- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8SrjEHpvrrTa6L5oRAoXnAJ9mq+aZx44O3suRenE035hxFPXscgCgncwt
tsmQSf7IkpJ4V9gCqtfepFU=
=RBPj
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Kunal Jhunjhunwala wrote:
> 
> Hey,
> I tend to agree with you. But what is the most effiecent way of using php
> code in template files then? I am not going to move my templates to a
> dbase.. thats for sure.
> Regards,
> Kunal Jhunjhunwala

well for looping through the results of a sql query where you'd want to
print out some html -
to do that you could -
a include a file inside a loop
b run eval on some code from a database
c run a function

I find c to be the most efficient
eg

function thread($sql_arra0
{
        echo 'name - '. $sql_array['name'] .';
}

then inside of loop

thread($sql_array);

works a lot quicker than the other two methods.

I don't see how you can avoid putting php code in templates because you
need to put $var in there some way so you can print out the variable. So
if it's in a database it needs some eval() done on it.
I really can't see the point in querying a database to pull out template
data. Templates usually don't change very often at all and querying a
database to pull out unchanged template data is waste of cpu and memory
resources.


 
> 
> > Kunal Jhunjhunwala wrote:
> > >
> > > Hey
> > > Does anybody know if its wise to use eval() ? I know Vbulletin uses it..
> but
> > > there is something about it I just cant digest.. it seems to be a very
> > > powerfull function which can be very easily exploited... anyone else
> have
> > > any thoughts?
> > > Regards,
> > > Kunal
> >
> >  Loading your templates into a database, pulling them out on every page
> > load and running eval() to run the code isn't the most efficient way to
> > do it.
> > Then running eval() inside a loop on that code isn't efficient either.
> >
> > I think eval() is used this way by some people because they don't know
> > how to write files using php propely. So instead they just put it in a
> > database. You also completely miss out on getting the benefits of one of
> > the different php caching products.
> > For me a database is for storing data - not php code.
> > Vbulletin as an example of complete overuse of eval().
> >
> >
--- End Message ---
--- Begin Message ---
> I don't see how you can avoid putting php code in templates because you
> need to put $var in there some way so you can print out the variable. So
> if it's in a database it needs some eval() done on it.

You could html comment lines?? I tried this.. but it would only consider the
first and the last match of the ereg.. not the in-between ones :(

> I really can't see the point in querying a database to pull out template
> data. Templates usually don't change very often at all and querying a
> database to pull out unchanged template data is waste of cpu and memory
> resources.

Agreed.

Regards,
Kunal Jhunjhunwala
----- Original Message -----
From: "Michael Waples" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 20, 2002 6:39 PM
Subject: [PHP] Re: eval()


> Kunal Jhunjhunwala wrote:
> >
> > Hey,
> > I tend to agree with you. But what is the most effiecent way of using
php
> > code in template files then? I am not going to move my templates to a
> > dbase.. thats for sure.
> > Regards,
> > Kunal Jhunjhunwala
>
> well for looping through the results of a sql query where you'd want to
> print out some html -
> to do that you could -
> a include a file inside a loop
> b run eval on some code from a database
> c run a function
>
> I find c to be the most efficient
> eg
>
> function thread($sql_arra0
> {
> echo 'name - '. $sql_array['name'] .';
> }
>
> then inside of loop
>
> thread($sql_array);
>
> works a lot quicker than the other two methods.
>
> I don't see how you can avoid putting php code in templates because you
> need to put $var in there some way so you can print out the variable. So
> if it's in a database it needs some eval() done on it.
> I really can't see the point in querying a database to pull out template
> data. Templates usually don't change very often at all and querying a
> database to pull out unchanged template data is waste of cpu and memory
> resources.
>
>
>
> >
> > > Kunal Jhunjhunwala wrote:
> > > >
> > > > Hey
> > > > Does anybody know if its wise to use eval() ? I know Vbulletin uses
it..
> > but
> > > > there is something about it I just cant digest.. it seems to be a
very
> > > > powerfull function which can be very easily exploited... anyone else
> > have
> > > > any thoughts?
> > > > Regards,
> > > > Kunal
> > >
> > >  Loading your templates into a database, pulling them out on every
page
> > > load and running eval() to run the code isn't the most efficient way
to
> > > do it.
> > > Then running eval() inside a loop on that code isn't efficient either.
> > >
> > > I think eval() is used this way by some people because they don't know
> > > how to write files using php propely. So instead they just put it in a
> > > database. You also completely miss out on getting the benefits of one
of
> > > the different php caching products.
> > > For me a database is for storing data - not php code.
> > > Vbulletin as an example of complete overuse of eval().
> > >
> > >
>
> --
> 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]
>
>
>

--- End Message ---
--- Begin Message ---
Hi everybody,
I've finally been able to read the e-mails sent by the little script I was
using.

The problem was the address where the script was trying to send the e-mail.
Instead of a *normal* e-mail (i.e. [EMAIL PROTECTED]) like was written in
the book I wrote my *local* address (mitch@localhost) and it worked :-)
I got the e-mail both in the terminal and using the application "Mail" where
I configured an UNIX account.

I am still not able to let the script send e-mails to normal e-mail
addresses, but I think I will now install "postfix" which, as I read, should
be easier to use and configure than "sendmail".

Thanks to you all for the tips and resources you gave me.

Bye,
Michael


--- End Message ---
--- Begin Message ---
I would like to checkout some xml and xsl files from cvs and transform them
using php script. The second part seems easy, but how can I checkout cvs
module from php script. I tried system("cvs -d /home/cvs checkout myModule")
but there was no result. There was no error either. I am shure it is quite
easy. Please, give me a hint.

Regards,

Janez


--- End Message ---
--- Begin Message ---
Good morning everyone,

I'm trying to adapt existing php code that uses a while loop to scan content
for a url pattern, take the matches and add link tags (<a>) around them so
the url with be made into "hot links. Simple enough right? Nevertheless, I
seem to be having trouble with urls that have question marks in them.

Here is the existing code that works - except with question marks:

********************

$content = "http://www.globalhealth.org/text.php3?id=151
adjfladjfajdfkladfjl;kadjf
jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj";

$pattern = "http://([\/~_\.0-9A-Za-z#&=-]+)";

while(ereg($pattern, $content, $match)){
        $http_old = $match[0];  
        $http = "dubdubdub" . $match[1] . $match[2];
        $url = "<A HREF=\"javascript:externalURL('$http')\";>$http</A>"; 
        $content = ereg_replace($http_old, $url, $content);     
        };

$content = ereg_replace("dubdubdub", "http://";, $content);

print $content;

******************

Here's the same code with the question mark in the pattern variable.  When I
add the question mark and test the page, my browsers just "hang". Escaping
the question mark doesn't seem to help (and I also read that escapes aren't
necessary between square brackets]:

$content = "http://www.globalhealth.org/text.php3?id=151
adjfladjfajdfkladfjl;kadjf
jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj";

$pattern = "http://([\/~_\.0-9A-Za-z#&=?-]+)";

while(ereg($pattern, $content, $match)){
        $http_old = $match[0];  
        $http = "dubdubdub" . $match[1] . $match[2];
        $url = "<A HREF=\"javascript:externalURL('$http')\";>$http</A>"; 
        $content = ereg_replace($http_old, $url, $content);     
        };

$content = ereg_replace("dubdubdub", "http://";, $content);

print $content;


*************************

In an attempt to find the problem, I did a test with the following code and
received the result I want - which leads me to believe the problem is
possibly with the while loop or the ereg_replace??

$content = "http://www.globalhealth.org/text.php3?id=151
adjfladjfajdfkladfjl;kadjf
jlkadjflkajdflkj jadklfjalkdjfl;df jalkdfj;ldafj";

$pattern = "http://([/~_.0-9A-Za-z#&=?-]+)";

ereg($pattern, $content, $match);

print "<A HREF=\"javascript:externalURL('$match[0]')\";>$match[0]</A>";

******************

I'm completely confused. I have a feeling there is any easy answer and if I
wasn't so frustrated I'd be embarrassed to say that I've spent hours on
this...

Thanks in advance for your help, Shawna
--- End Message ---
--- Begin Message ---
Hi to the list, i´m new...
well.. i do a Flash SendMail with variables and HTML format.....
it works.. but i insert variables in the HTML Message code.. and it don´t
works...
i don´t know why
the code is..

<?php
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mensaje1 = '
<html>
<head>
 <title>Birthday Reminders for August</title>
</head>
<body>
<p align="left"><font face="Arial, Helvetica, sans-serif"
size="2"><b><i>Sugerencias
  y Comentarios mandado desde la p&aacute;gina de
Tel&eacute;n</i></b></font></p>
<table width="60%" border="1" cellspacing="0" cellpadding="0"
bordercolor="#003333">
  <tr>
    <td width="30%"><font face="Verdana, Arial, Helvetica, sans-serif"
size="2">Nombre:</font></td>
    <td width="70%">name</td>
  </tr>
  <tr>
    <td width="30%"><font face="Verdana, Arial, Helvetica, sans-serif"
size="2">Asunto:</font></td>
    <td width="70%"><?php echo $subject; ?></td>
  </tr>
  <tr>
    <td width="30%"><font face="Verdana, Arial, Helvetica, sans-serif"
size="2">e-mail</font>:</td>
    <td width="70%"><?php echo $from; ?></td>
  </tr>
  <tr>
    <td width="30%"><font face="Verdana, Arial, Helvetica, sans-serif"
size="2">Comentario/Sugerencia</font></td>
    <td width="70%"><?php echo $message; ?></td>
  </tr>
</table>
</body>
</html>
';
?>
<?php
mail("[EMAIL PROTECTED]", "Sugerencias y Consultas", "$mensaje1",
$headers, "From: PHPMailer\nReply-To: $from\nX-Mailer: PHP/" .
phpversion());
?>


The variables don´t work..
Thx if u can answer
P.D.: in normal format mail, the variables work..

--- End Message ---
--- Begin Message ---
hi. im new. i installed a login script on my site and after a few days, it 
stopped working. i reinstalled it and it still refused to work after a dew 
days. can anyone send me a good login script preferably with no MySql? im 
very busy atm with all my school stuff.

Thanks
aron

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

--- End Message ---
--- Begin Message ---
Malte,

Thanks a lot. I was going through the File Upload
Functions in the manual and i think that's what they
were talking about too.

Now there's just one thing. I can run the upload
scripts and get the image for display too. But like i
mentioned, this is for a PenPal system, a database
based PenPal sysem. 
Basically there has to be some connection between the
record entry by the user and the image. Which also be
required when this record is displayed, for the
corresponding image to be displayed. How migh that
work?

Thanks again,
T. Edison jr.

--- Malte Fucks <[EMAIL PROTECTED]> wrote:
> I think the PHP image functions aren't what this guy
> needs...
> 
> First thing : File Uploads
> You have to make a form, including an <input
> type="file" name="yourfile">
> tag, which refers to a php script like...
> 
> <?
> if($file)
> {
>    if(@copy($yourfile,"./$yourfile_name"))
>    {
>        echo "$yourfile_name was uploaded
> succesfully";
>    }
>     else echo "ERROR - UPLOAD ABORTED";
> }
> ?>
> 
> $yourfile_size includes the size of the file in
> bytes, use an if-statement
> to check if the picture-size fits your needs...
> $yourfile_type includes... guess what... the file
> type..
> this should solve the upload problem...
> 
> To control the size of an image is a matter of your
> HTML... do something
> like
> <img src="yourimage" width="40px" height="40px">.
> Its even possible to
> insert height and width-values in percent...
> 
> 
> 
> 
> -- 
> 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]
> 


=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
*******************************************

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
--- End Message ---
--- Begin Message ---
On Monday 21 January 2002 01:26, Thomas Edison Jr. wrote:
> Malte,
>
> Thanks a lot. I was going through the File Upload
> Functions in the manual and i think that's what they
> were talking about too.
>
> Now there's just one thing. I can run the upload
> scripts and get the image for display too. But like i
> mentioned, this is for a PenPal system, a database
> based PenPal sysem.

> Basically there has to be some connection between the
> record entry by the user and the image. Which also be
> required when this record is displayed, for the
> corresponding image to be displayed. How migh that
> work?

The best thing to do would be to store the filename (& path if necessary) of 
the image in the corresponding record of the database.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Mandrell: "You know what I think?"
Doctor:   "Ah, ah that's a catch question. With a brain your size you
          don't think, right?"
                -- Dr. Who
*/
--- End Message ---
--- Begin Message ---
ooh... i dont know if i understood you correctly..but if i did, you simply
have to insert the location of the file in the users tupel like..

UserID    Name    Bla    Bla    picture
001         John       ...      ...      ./images/john.jpg

preferably i would only store the location when the user did upload an image
with an update query, so when fetching the information from your database,
you can check for empty location values... if you're working with mysql it
would be like...

while($my_array = mysql_fetch_array($result))
{
    echo "Stuff about the User";
    if($my_array[location])
    {
        echo "<img src=\"$my_array[location]\" width=\"100\"
height=\"100\">";
    } else echo "<img src=\"standard.jpg\">
}

but as i said, i dont know if i really understood your question.. (im
german, you know *g*)


----- Original Message -----
From: "Thomas Edison Jr." <[EMAIL PROTECTED]>
To: "Malte Fucks" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, January 20, 2002 6:26 PM
Subject: Re: [PHP] Upload & View Image : Database Thingy!!!!


> Malte,
>
> Thanks a lot. I was going through the File Upload
> Functions in the manual and i think that's what they
> were talking about too.
>
> Now there's just one thing. I can run the upload
> scripts and get the image for display too. But like i
> mentioned, this is for a PenPal system, a database
> based PenPal sysem.
> Basically there has to be some connection between the
> record entry by the user and the image. Which also be
> required when this record is displayed, for the
> corresponding image to be displayed. How migh that
> work?
>
> Thanks again,
> T. Edison jr.
>
> --- Malte Fucks <[EMAIL PROTECTED]> wrote:
> > I think the PHP image functions aren't what this guy
> > needs...
> >
> > First thing : File Uploads
> > You have to make a form, including an <input
> > type="file" name="yourfile">
> > tag, which refers to a php script like...
> >
> > <?
> > if($file)
> > {
> >    if(@copy($yourfile,"./$yourfile_name"))
> >    {
> >        echo "$yourfile_name was uploaded
> > succesfully";
> >    }
> >     else echo "ERROR - UPLOAD ABORTED";
> > }
> > ?>
> >
> > $yourfile_size includes the size of the file in
> > bytes, use an if-statement
> > to check if the picture-size fits your needs...
> > $yourfile_type includes... guess what... the file
> > type..
> > this should solve the upload problem...
> >
> > To control the size of an image is a matter of your
> > HTML... do something
> > like
> > <img src="yourimage" width="40px" height="40px">.
> > Its even possible to
> > insert height and width-values in percent...
> >
> >
> >
> >
> > --
> > 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]
> >
>
>
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : [EMAIL PROTECTED]
> Tel : 91-4546512/4522124
> *******************************************
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
>
> --
> 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]
>

--- End Message ---
--- Begin Message ---
I'm trying to get gnupg (OpenPGP) working on my system, which is Solaris 2.6
on Sparc, with PHP 4.0.6 and Apache/Stronghold.

I have the program compiled, as it works at the command line.  Here's what
works at the command line:
/usr/local/bin/gpg --encrypt -ao /usr/local/www/htdocs/777/crypted -r
'<[EMAIL PROTECTED]>'
/usr/local/etc/www/htdocs/777/plain_text_mesage.txt

If I type the above at the command line, when logged in as the user Apache
and PHP is running as (nobody), it encrypts the contents of the file
/usr/local/etc/www/htdocs/777/plain_text_mesage.txt and writes it to the
file /usr/local/www/htdocs/777/crypted, which is what I want.  (The
directory /usr/local/www/htdocs/777/ is "chmod 777", and PHP can write a
file in that directory.)

I've tried everything I can think of, but it looks like a command from PHP
is not working like it is at the command line.

I've tried:

system("/usr/local/bin/gpg --encrypt -ao
/usr/local/www/htdocs/777/crypted -r '<[EMAIL PROTECTED]>'
/usr/local/etc/www/htdocs/777/plain_text_mesage.txt");

passthru("/usr/local/bin/gpg --encrypt -ao
/usr/local/www/htdocs/777/crypted -r '<[EMAIL PROTECTED]>'
/usr/local/etc/www/htdocs/777/plain_text_mesage.txt");

exec("/usr/local/bin/gpg --encrypt -ao /usr/local/www/htdocs/777/crypted -r
'<[EMAIL PROTECTED]>'
/usr/local/etc/www/htdocs/777/plain_text_mesage.txt");

$command= `(/usr/local/bin/gpg --encrypt -ao
/usr/local/www/htdocs/777/crypted -r '<[EMAIL PROTECTED]>'
/usr/local/etc/www/htdocs/777/plain_text_mesage.txt`;

(Each of the above 4 lines of code probably word wrapped in this email, and
the last line contains backtics, not single quotes.)

So, I'm stumped.  I was following the basics of the article at:
http://hotwired.lycos.com/webmonkey/00/20/index3a.html?tw=programming

Thanks,

Peter Janett

New Media One Web Services
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New Upgrades Are Now Live!!!
Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1
Sun Solaris (UNIX) accounts - PHP 4.0.6, mod_perl/1.25,
Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PostgreSQL coming soon!

http://www.newmediaone.net
[EMAIL PROTECTED]
(303)828-9882




--- End Message ---
--- Begin Message ---
Hi,

how can i get the number of rows reuturned by this query?

$sql = "select date from statistik where shooter='$shooter_login' group by
date";

I want to add a page function and limit the returned rows on each page - but
i can´t get the total number of rows.

Regards
# Daniel Alsén    | www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #

--- End Message ---
--- Begin Message ---
On Monday 21 January 2002 01:45, Daniel Alsén wrote:
> Hi,
>
> how can i get the number of rows reuturned by this query?
>
> $sql = "select date from statistik where shooter='$shooter_login' group by
> date";
>
> I want to add a page function and limit the returned rows on each page -
> but i can´t get the total number of rows.

Check out the relevant chapter in the manual for the db that you're using. 
Some dbs have a function returning the number of rows. 

If you're using MySQL then mysql_num_rows() is what you want.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
If a man has talent and cannot use it, he has failed.
                -- Thomas Wolfe
*/
--- End Message ---
--- Begin Message ---
Thanks. I knew that - really. Meltdown upstairs :)

- D

> -----Ursprungligt meddelande-----
> Frċn: Jason Wong [mailto:[EMAIL PROTECTED]]
> Skickat: den 20 januari 2002 18:53
> Till: Daniel Alsén; PHP List
> Ämne: Re: [PHP] Number of rows reurned?
>
>
> On Monday 21 January 2002 01:45, Daniel Alsén wrote:
> > Hi,
> >
> > how can i get the number of rows reuturned by this query?
> >
> > $sql = "select date from statistik where
> shooter='$shooter_login' group by
> > date";
> >
> > I want to add a page function and limit the returned rows on each page -
> > but i can´t get the total number of rows.
>
> Check out the relevant chapter in the manual for the db that
> you're using.
> Some dbs have a function returning the number of rows.
>
> If you're using MySQL then mysql_num_rows() is what you want.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>
> /*
> If a man has talent and cannot use it, he has failed.
>               -- Thomas Wolfe
> */
>
> --
> 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]
>

--- End Message ---
--- Begin Message ---
Hi,

i know i have this answered before. But i can´t find that mail in the
archive.

How do i print an array to see both the structure and the data within?
("test" => "value", "test2" => "value2")...

# Daniel Alsén    | www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #

--- End Message ---
--- Begin Message ---

Hi!

You can find the PHP !manual! at http://www.php.net/manual

Try searching for open , opendir, readdir .. or whatever other function
you're looking for. 

If that doesn't give you an answer straight away, you could go back to the
manual index and find the appropriate category, like Filesystem functions.

About question 3, I think it depends on what you want, but it's possible to
get the access time of a file; also see chapter Filesystem functions.

Also search the manual for preg (if you didn't figure yet) to see how to
use perl style regular expressions.

bvr.

On Sun, 20 Jan 2002 04:39:52 -0500 (EST), Juni Adi wrote:

>On Sun, 20 Jan 2002, Juni Adi wrote:
>
>Hi folks,
>After meessing up with installation stuffs, now
>it's time for PHP code:
>
>1. How to tell PHP to open a file like Perl do
>through:
>
>  open (FILE, $file);
>
>2. Same question, this time to open/read a
>directory:
>
>  opendir (DIR, $dir);
>
>and 
>
>  readdir DIR;
>
>3. Do PHP have a file test like -A $file in Perl?






--- End Message ---
--- Begin Message ---
Hi,

i am fiddling with a script and need to change a while-loop from running on
mysql_fetch_array to a "normal" array?

ie - i have:
while($myrow=mysql_fetch_array($result)) { etc...

But i want the loop to run with an array i created earlier ($anotherarray =
[key1] => value1, [key2] => value2).

How would i do that? Does the loop behave the same way - running until the
array is out of data?

Thanks!
# Daniel Alsén    | www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #

--- End Message ---
--- Begin Message ---
try out first before u post...

what does work is..

mail(implode(false,file("blah.txt")));

"Kyle Smith" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Is it possible to use include inside the mail function?
eg

mail(include("blah.txt")) ???


-lk6-
http://www.StupeedStudios.f2s.com
Home of the burning lego man!

ICQ: 115852509
MSN: [EMAIL PROTECTED]
AIM: legokiller666





--- End Message ---
--- Begin Message ---
Hey List-

Banging my head again the wall with this one. One of our developers was 
trying to get some session stuff to work and he couldn't and asked me to look 
into it.

I have a script that contains the following (the sessions.php href reference 
is the same script accept it calls this one):

_____________________________
session_start();

if (!isset($HTTP_SESSION_VARS[count])) {
    $HTTP_SESSION_VARS[count] = 0;
}
else {
    $HTTP_SESSION_VARS[count]++;
}
//Print the counter

echo "Counter is now: $HTTP_SESSION_VARS[count];\n<br>\n";
echo "Let's go to another <a href=\"sessions.php\">page</a>...<br><br>";
_______________________________

On my box at home running PHP 4.0.6 it works great.

On the work server running PHP 4.0.6 it doesn't work. Just keeps setting 
count to 0.

The work box is running Apache 1.3.20 with the following compile options:

 './configure' '--with-apxs' '--with-config-file-path=/etc/php' 
'--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2' 
'--with-pspell' '--enable-ftp' '--enable-gd' '--with-imap' '--with-mcrypt' 
'--with-mhash' '--with-mysql=/usr/local/mysql'

The home box is running Apache 1.3.22 with the following compile options:

 './configure' '--with-apxs' '--with-config-file-path=/etc/php' 
'--with-openssl=/usr/local/openssl' '--with-zlib' '--with-bz2' 
'--with-mysql=/usr/local/mysql' '--with-mcrypt' '--with-mhash' 
'--disable-xml' '--enable-ftp' '--with-gettext' '--with-pspell' 
'--enable-inline-optimization'

The only major difference that I could find in the php.ini file is that at 
home I have register globals off and at work they are on? 

Even with register globals on, you can still use the $HTTP_*_VARS, right?

The sessionID cookie is getting put into my browser, I checked so the 
"session" is starting correctly, just not retaining the variable.

Any ideas anyone?


Thanks list.

Henrik
-- 

Henrik Hudson
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Is it posible to get values from javascript to PHP? Without having to post 
the variables..

Thanks //Mċrten

_________________________________________________________________
Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se

--- End Message ---
--- Begin Message ---
In a word... No.

Well...

No.


Mċrten Andersson wrote:

> Is it posible to get values from javascript to PHP? Without having to 
> post the variables..
> 
> Thanks //Mċrten
> 
> _________________________________________________________________
> Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se
> 
> 



-- 
Sliante,
Richard S. Crawford

mailto:[EMAIL PROTECTED] 
        http://www.mossroot.com
AIM:  Buffalo2K   ICQ: 11646404  Yahoo!: rscrawford
MSN:  [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is 
invisible to the eye."  --Antoine de Saint Exupery

"Push the button, Max!"


--- End Message ---
--- Begin Message ---


I am really baffled by this problem.  I have tried so many things to get
this working but to no avail.  Here is the
actual code:

function verify_user($username, $password){
 $conn = mysql_connect($db_host, $db_user, $db_pass) or
   die("Error while connecting to Database System.");
 $select_db = mysql_select_db($db_name) or
   die("Error could not select the database");
 $query = "SELECT FROM users WHERE username='$username'";
 $result = mysql_query($query) or
  die("Unable to get query");
 $rows = mysql_fetch_array($result);
  $password = md5($password);
   if($rows["password"] == $password){
    print "You have been verified as $username.<br>";
    print "Registering your session.<br>";
   }
   else{
   print "Error: Bad username or password.<br>";
   print "Please go <a href=\"/?page=admin&step=1\">back</a>";
   }


}

Anyways the problem is I cannot get it to even get to the database.  It
works when I try to connect in the actual code before I call this function.
Like for example in index.php

 $conn = mysql_connect($db_host, $db_user, $db_pass) or
   die("Error while connecting to Database System.");
 $select_db = mysql_select_db($db_name) or
   die("Error could not select the database");
verify_user($username, $pass);

But when I do it that way it won't let me run a query right.  I am so
baffled.  Any input would be appreciated.  Thanks.


-------------------------------------------------------------
Tj Corley
[EMAIL PROTECTED]
The Planet


--- End Message ---
--- Begin Message ---
Tj,


> I am really baffled by this problem.  I have tried so many things to get
> this working but to no avail.  Here is the
> actual code:
> 
> function verify_user($username, $password){
>  $conn = mysql_connect($db_host, $db_user, $db_pass) or
...
> Anyways the problem is I cannot get it to even get to the database.  It
> works when I try to connect in the actual code before I call this function.
...
> But when I do it that way it won't let me run a query right.  I am so
> baffled.  Any input would be appreciated.  Thanks.


Remember the idea of the "scope" of a variable? (if not, please RTFM)
Where do the values of $db_host, $db_user, etc come from?
They are not in the argument list for verify_user().

Regards,
=dn


--- End Message ---
--- Begin Message ---
they are in the same script outside the function.

all the admin functions reside in a admin_func.php
with the $db_host, etc, etc variables assigned before it.

----- Original Message -----
From: "DL Neil" <[EMAIL PROTECTED]>
To: "Tj Corley" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, January 20, 2002 4:56 PM
Subject: Re: [PHP] Confusing Problem


> Tj,
>
>
> > I am really baffled by this problem.  I have tried so many things to get
> > this working but to no avail.  Here is the
> > actual code:
> >
> > function verify_user($username, $password){
> >  $conn = mysql_connect($db_host, $db_user, $db_pass) or
> ...
> > Anyways the problem is I cannot get it to even get to the database.  It
> > works when I try to connect in the actual code before I call this
function.
> ...
> > But when I do it that way it won't let me run a query right.  I am so
> > baffled.  Any input would be appreciated.  Thanks.
>
>
> Remember the idea of the "scope" of a variable? (if not, please RTFM)
> Where do the values of $db_host, $db_user, etc come from?
> They are not in the argument list for verify_user().
>
> Regards,
> =dn
>
>

--- End Message ---
--- Begin Message ---
Just as DL Neil implied, your variables are outside the scope of the
function. set them global within your function.

See: http://www.php.net/manual/en/language.variables.scope.php


----- Original Message -----
From: "Tj Corley" <[EMAIL PROTECTED]>
To: "DL Neil" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, January 20, 2002 3:08 PM
Subject: Re: [PHP] Confusing Problem


> they are in the same script outside the function.
>
> all the admin functions reside in a admin_func.php
> with the $db_host, etc, etc variables assigned before it.
>
> ----- Original Message -----
> From: "DL Neil" <[EMAIL PROTECTED]>
> To: "Tj Corley" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Sunday, January 20, 2002 4:56 PM
> Subject: Re: [PHP] Confusing Problem
>
>
> > Tj,
> >
> >
> > > I am really baffled by this problem.  I have tried so many things to
get
> > > this working but to no avail.  Here is the
> > > actual code:
> > >
> > > function verify_user($username, $password){
> > >  $conn = mysql_connect($db_host, $db_user, $db_pass) or
> > ...
> > > Anyways the problem is I cannot get it to even get to the database.
It
> > > works when I try to connect in the actual code before I call this
> function.
> > ...
> > > But when I do it that way it won't let me run a query right.  I am so
> > > baffled.  Any input would be appreciated.  Thanks.
> >
> >
> > Remember the idea of the "scope" of a variable? (if not, please RTFM)
> > Where do the values of $db_host, $db_user, etc come from?
> > They are not in the argument list for verify_user().
> >
> > Regards,
> > =dn
> >
> >
>
>
> --
> 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]
>
>
>


--- End Message ---
--- Begin Message ---
I am trying to basically copy data from one database to another and am
wondering if it is possible to have more than one database open at a time.
So for example, I want to do something like this but am wondering if there
is a better way:

$dbcon = mysql_connect($db_server, $db_user, $db_passwd);  //Make source
connection
mysql_select_db($db_name);
//Select source db
$source_result = mysql_query("SELECT * FROM users");         //Select all
info from users table
while ($row_cat = mysql_fetch_array($result)){
//Loop through and insert into new db
     //Insert into new database
}

So where I have "Insert into new database" this is where I want to take some
of the information from the source and insert into the new database (which
uses a different user name and password as well).

Any help would be greatly appreciated :)

Jeff


--- End Message ---
--- Begin Message ---
It;'s entirely possible. Most database-related functions can take an 
optional link identifier parameter. You didn't use it, and in that case, 
database operations default to the last opened database connection. You 
can however do something like:

$dblink1=mysql_connect($server1,$user1,$password1);
$dblink2=mysql_connect($server2,$user2,$password2);

mysql_select_db($database_1,$dblink1); //for link 1
mysql_select_db($dblink2,$dblink2); //for link 2

$result1=mysql_query("SELECT * from whatever",$dblink1);

while ($row=mysql_fetch_array($result1)){
        $query2="insert into secondtable values ". 
$row["id"].",".$row["whatever"];
        $result2=mysql_query($query2,$dblink2); //insert on database 2
}


--- End Message ---
--- Begin Message ---

Dear List member,

Plesae forgive me for asking and OT question.  Can you please recommend an edit 
program, (Freely downloadable).

Thanks,

Erisen


Mehmet Erisen
http://www.erisen.com


---------------------------------
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail.
--- End Message ---
--- Begin Message ---

Hi,

If Call-time pass-by-reference has deprecated
so long ago, why are the instructions on how
to do it still in the manual?
http://www.php.net/manual/en/html/functions.arguments.html#functions.arguments.by-reference

At least it should point out that it has been
deprecated.

Bruce


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx

--- End Message ---

Reply via email to