[PHP] FW: [NEWBIE GUIDE] For the benefit of new members

2005-02-11 Thread Jay Blanchard
=
Please feel free to add more points and send to the list. 
=

1. If you have any queries/problems about PHP try
http://www.php.net/manual/en first. You can download a copy and use it
offline also. 

Please also try http://www.php.net/manual/faq.php for answers to
frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching for php YOUR QUERY may
fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the mailing list discussion at
http://phparch.com/mailinglists. Many of the common topics are discussed
repeatedly, and you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed question in the list is
Best PHP editor. Everyone has his/her favourite editor. You can get
all the opinions by going through the list archives. If you want a
chosen list try this link :
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want find out what extensions are
available to 
you?

Just put the following code into a file with a .php extension and access
it through your 
webserver:

?php
phpinfo();
? 

If PHP is installed you will see a page with a lot of information on it.
If PHP is not installed (or not working correctly) your browser will try
to download the file.
(contributed by Teren and reworded by Chris W Parker)

5. If you are stuck with a script and do not understand what is wrong,
instead of posting 
the whole script, try doing some research yourself. One useful trick is
to print the variable/sql query using print or echo command and check
whether you get what you expected. 

After diagnosing the problem, send the details of your efforts
(following steps 1, 2  3) and ask for help.

6. PHP is a server side scripting language. Whatever processing PHP does
takes place BEFORE the output reaches the client. Therefore, it is not
possible to access users' computer related information (OS, screen size
etc) using PHP. Nor can you modify any the user side settings. You need 
to go for JavaScript and ask the question in a JavaScript list.

On the other hand, you can access the information that is SENT by the
user's browser when a client requests a page from your server. You can
find details about browser, OS etc as reported by 
this request. 
(contributed by Wouter van Vliet and reworded by Chris W Parker.)

7. Provide a clear descriptive subject line. Avoid general subjects like
Help!!, A Question etc. Especially avoid blank subjects. 

8. When you want to start a new topic, open a new mail composer and
enter the mailing list address php-general@lists.php.net instead of
replying to an existing thread and replacing the subject and body with
your message.

9. It's always a good idea to post back to the list once you've solved
your problem. People usually add [SOLVED] to the subject line of their
email when posting solutions. By posting your solution you're helping
the next person with the same question. 
[contribued by Chris W Parker]

10. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

11. Do not send your email to the list with attachments. If you don't
have a place to upload your code, try the many pastebin websites (such
as www.pastebin.com). 
(contributed by Burhan Khalid)

Following these guidelines will ensure that you get effective responses
from the list members. Otherwise, your questions might not be answered.

===
Hope you have a good time programming with PHP.
===

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



[PHP] Adding Business Days

2005-02-11 Thread Ben C
I am trying to add 5 business/week days to today's date.  Does anyone
know a good way of how to do it?

Thanks,

Ben

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



[PHP] How do you read one of these parameters?

2005-02-11 Thread Brian Dunning
I see URLs formatted like this:
  http://tinyurl.com/xyz
How do you read that xyz, since there's no /?x= preceding it? Is it 
not a get parameter?

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


[PHP] Limit iterations on a foreach loop?

2005-02-11 Thread Brian Dunning
I'm using an RSS feed that has WAY too much content, I only want the 
first 10. I'm outputting the array with a foreach loop: is there a way 
to limit it to only go through the first 10?

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


RE: [PHP] Adding Business Days

2005-02-11 Thread Mikey
Lookup the manual in the date and time section, more specifically:

http://uk.php.net/mktime

If the date is then on a weekend, you can add whatever days you need.

HTH,

Mikey

 -Original Message-
 From: Ben C [mailto:[EMAIL PROTECTED] 
 Sent: 11 February 2005 15:38
 To: php-general@lists.php.net
 Subject: [PHP] Adding Business Days
 
 I am trying to add 5 business/week days to today's date.  
 Does anyone know a good way of how to do it?
 
 Thanks,
 
 Ben
 
 --
 PHP General Mailing List (http://www.php.net/) To 
 unsubscribe, visit: http://www.php.net/unsub.php
 
 


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



[PHP] Re: Limit iterations on a foreach loop?

2005-02-11 Thread Greg Beaver
Brian Dunning wrote:
I'm using an RSS feed that has WAY too much content, I only want the 
first 10. I'm outputting the array with a foreach loop: is there a way 
to limit it to only go through the first 10?

Thanks,
- Brian
$i = 1;
foreach ($rsses as $rss) {
if ($i++ = 10) {
break;
}
}
However, why not use for()?
for($i=0;$i10;$i++) {
// do stuff
$rss = next($rsses);
}
reset($rsses);
Greg
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] fsockopen: fetching url

2005-02-11 Thread branimir . topic

I'm using code below to fetch content from the url.
This code was worked properly on two servers I tested but it want worked on
the
designated one,  so after getting error message I figure it out it may
be php.ini settings limitation

The server encountered an internal error or misconfiguration and was
unable to complete your request.
Additionally, a 404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.



So here's the settings I found as possible reason for limitation on code
execution.

disable_functions: readfile, system, passthru, shell_exec, shell_exec,
system, execreadfile, system, passthru, shell_exec, shell_exec, system,
exec

Does anybody hava any tip how to workarround on this?


CODE

function fetchURL( $url ) {
   $url_parsed = parse_url($url);
   $host = isset($url_parsed[host]) ? $url_parsed[host]: ;
   $port = isset($url_parsed[port]) ? $url_parsed[port]: 0;
   if ($port==0)
   $port = 80;
   $path = $url_parsed[path];

   $query = isset($url_parsed[query]) ? $url_parsed[query]: ;

   if ($query != )
   $path .= ? . $query;

   $out = GET $path HTTP/1.0\r\nHost: $host\r\n\r\n;

   $fp = fsockopen($host, $port, $errno, $errstr, 30);

   fwrite($fp, $out);
   $body = false;
   $in = ;
   while (!feof($fp)) {
   $s = fgets($fp, 1024);
   if ( $body )
   $in .= $s;
   if ( $s == \r\n )
   $body = true;
   }

   fclose($fp);

   return $in;
}


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



RE: [PHP] How do you read one of these parameters?

2005-02-11 Thread Mike Johnson
From: Brian Dunning [mailto:[EMAIL PROTECTED] 

 I see URLs formatted like this:
 
http://tinyurl.com/xyz
 
 How do you read that xyz, since there's no /?x= preceding 
 it? Is it not a get parameter?

My best guess is that it's being converted by Apache using mod_rewrite.
For one of my websites, for instance, I have mod_rewrite convert
/op_ed/123 to /op_ed/index.php?id=123. It's more search engine-friendly,
for one, and an easier structure to remember for non-techie folks.

More on mod_rewrite here:

http://httpd.apache.org/docs/misc/FAQ.html#rewrite-more-config

This is Apache-specific, but I'd imagine there are similar methods for
other webservers.


-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smartertravel.com
[EMAIL PROTECTED]   (617) 886-5539

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



Re: [PHP] Limit iterations on a foreach loop?

2005-02-11 Thread Greg Donald
On Thu, 10 Feb 2005 15:58:28 -0800, Brian Dunning
[EMAIL PROTECTED] wrote:
 I'm using an RSS feed that has WAY too much content, I only want the
 first 10. I'm outputting the array with a foreach loop: is there a way
 to limit it to only go through the first 10?

Use a counter variable and break.

php.net/break


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] File upload, suid directory and temporary dir

2005-02-11 Thread Richard Lynch
ADNET Ghislain wrote:
 upload_tmp_dir/www/htdocs/upload  /no value/
   ^^^
  /
 /
*THIS* is the one that matters -+

Somehow, you are OVER-RIDING your php.ini in either .htaccess or your PHP
source to set this upload_tmp_dir to a blank, or an invalid directory
or...

Or, perhaps, your suid bit setting is making PHP nervous, and it's
deciding to not use that directory, so then it reverts to the default when
you do the upload.

So PHP is reading the php.ini, setting the value, then over-riding it
somewhere/somehow locally in an .htaccess or something.

Hope that helps.`

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Upgrade PHP 4.3.4 to PHP 5.0.3 (Windows 2k IIS5), I recieve a Blank Page and Session errors

2005-02-11 Thread Fabian I. Cuesta
The $_SESSION['sitedoc'] was not initialized because I use
$_SERVER[PATH_TRANSLATED] to make the requires for diffrent files. In
these file I initialized this $_SESSION varibales. I already took care for
this ploblem (in PHP5 you have to replace it for ORIG_PATH_TRANSLATED).
But I still have the blank page, with no error or wrnings.
The only thing that look strange is that the session files in sessiondata
are beeing created empty.
Do u know what can it be?
Thanks a lot

Fabian

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Miércoles, 09 de Febrero de 2005 06:01 p.m.
To: Fabian I. Cuesta
Cc: php-general@lists.php.net
Subject: Re: [PHP] Upgrade PHP 4.3.4 to PHP 5.0.3 (Windows 2k  IIS5), I
recieve a Blank Page and Session errors


Fabian I. Cuesta wrote:
 Hi, I'm trying to upgrade the PHP version of my dev enviroment.
 After installing PHP5 I've just recieve a blank page. I activated the
 error
 log of PHP and recieve a couple of errors like this one:

 [09-Feb-2005 13:38:20] PHP Notice: Undefined index: sitedesc in
 c:\Inetpub\wwwroot\Inpae\admin\lib\headerFooter.php on line 40

 All related to $_SESSION, like the values are not set (sitedesc is one of
 the indexes of the variable $_SESSION)

But when you first start a session, a totally NEW session, is
$_SESSION['sitedoc'] initialized?

I assume not.

Your problem code looks something like this:
?php
  session_start();
  if ($_SESSION['sitedoc']){
//whatever;
  }
?

PHP is notifying you that there is NO session index named 'sitedoc' yet,
but you're trying to read it and use the value -- the value that doesn't
exist.

You'll need to get in the habit of writing (and re-writing) code like this:
?php
  session_start();
  if (isset($_SESSION['sitedoc'])  $_SESSION['sitedoc']){
//whatever
  }
?

You may also re-structure your code a bit if 'sitedoc' can take on several
values, so it ends up being more like:
?php
  session_start();
  if (isset($_SESSION['sitedoc'])){
if ($_SESSION['sitedoc'] == 'whatever'){
}
elseif ($_SESSION['sitedocd'] == 'something else'){
}
  }
?

The point is that you shouldn't be reading session variables that were
never set to any value at all in the first place.

Sure, PHP will initialize them to 0 or '' or false, but the point here is
to catch typos where you have:
  if ($_SESSION['sietdoc']){
  }
  else{
  }

If you RARELY expect 'sitedoc' to be a TRUE value, and you don't do a lot
of unit testing, a typo bug like this could go undetected for a long
time.

The PHP Notice warns you about things like this by not notifying you when
you try to read a variable that hasn't been set.

 Notice: C:\Inetpub\wwwroot\Inpae\lib\include.php line 15 - Undefined
 index:
 SCRIPT_NAME
 Notice: C:\Inetpub\wwwroot\Inpae\lib\include.php line 15 - Undefined
 index:
 PATH_TRANSLATED

See above.

 Debug Warning: C:\Inetpub\wwwroot\Inpae\lib\include.php line 3 -
 main(/config.php) [a href='function.main'function.main/a]: failed to
 open stream: No such file or directory
 Compile Error: C:\Inetpub\wwwroot\Inpae\lib\include.php line 3 - main()
 [a
 href='function.require'function.require/a]: Failed opening required
 '/config.php' (include_path='.;c:\php5\pear')

config.php is not in the same directory as your script, nor in the PEAR
library.  It is, probably, in Inpae\lib\ and you need to change your
include_path setting in .htaccess or in the script or somewhere to have
that directory in your include path.

--
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Limit iterations on a foreach loop?

2005-02-11 Thread Alex Hogan
 I'm using an RSS feed that has WAY too much content, I only want the
 first 10. I'm outputting the array with a foreach loop: is there a way
 to limit it to only go through the first 10?

foreach($var as $newvar){
if($count = 10){
// Do something here
}
else{
break;
}
}

alex hogan

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



Re: [PHP] Student Suspended Over PHP use.

2005-02-11 Thread Zareef Ahmed
Hi, 

News is very old it was published  in  june 2000.

zareef ahmed 


On Thu, 10 Feb 2005 07:24:27 -0600, Steve Buehler [EMAIL PROTECTED] wrote:
 Shouldn't have taken your Cat to school with a bag of catnip.  That was
 asking for trouble. :)
 
 Steve
 
 At 08:44 PM 2/9/2005, Dotan Cohen wrote:
 
 Maybe it's not People Hate Perl after all...
 Pot, Heroin, Pussy?!?
 I think I got suspended for at leat two of those on campus grounds at
 some point or another.
 
 Dotan
 
 On Thu, 10 Feb 2005 01:31:43 +1100 (EST), [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
   PHP is bad Mkay.
  
I just ran across this interesting article from awhile back. Pretty
funny
   
http://bbspot.com/News/2000/6/php_suspend.html
http://bbspot.com/News/2000/6/php_suspend.html
   
Topeka, KS - High school sophomore Brett Tyson was suspended today
after teachers learned he may be using PHP.
   
A teacher overheard him say that he was using PHP, and as part of our
Zero-Tolerance policy against drug use, he was immediately suspended.
No questions asked, said Principal Clyde Thurlow.   We're not quite
sure what PHP is, but we suspect it may be a derivative of PCP, or
maybe a new designer drug like GHB.
   
php_logoParents are frightened by the discovery of this new menace in
their children's school, and are demanding the school do something.
We heard that he found out about PHP at school on the internet.  There
may even be a PHP web ring operating on school grounds, said irate
parent Carol Blessing. School is supposed to be teaching our kids how
to read and write.  Not about dangerous drugs like PHP.
   
In response to parental demands the school has reconfigured its
internet WatchDog software to block access to all internet sites
mentioning PHP. Officials say this should prevent any other students
from falling prey like Brett Tyson did.  They have also stepped up
locker searches and brought in drug sniffing dogs.
   
Interviews with students suggested that PHP use is wide spread around
the school, but is particularly concentrated in the geeky nerd
population.  When contacted by BBspot.com, Brett Tyson said, I don't
know what the hell is going on dude, but this suspension gives me more
time for fraggin'.  Yee haw!
   
PHP is a hypertext preprocessor, which sounds very dangerous.  It is
believed that many users started by using Perl and moved on to the more
powerful PHP.  For more information on how to recognize if your child
may be using PHP please visit http://www.php.net http://www.php.net .
   
   
   
   
   
   
   
   
   
   
HTC Disclaimer:  The information contained in this message may be
privileged and confidential and protected from disclosure. If the
reader of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this communication is strictly prohibited.  If you have
received this communication in error, please notify us immediately by
replying to the message and deleting it from your computer.  Thank you.
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



[PHP] Re: imagettftext color problem

2005-02-11 Thread Anni Hienola

And to correct one mistake in the code that was kindly pointed out but is
here just a typo:

 $bg=imagecolorallocate($img, 255, 255, 255);
 $font_color=imageallocatecolor($img, 0, 0, 0);

Should be:
$bg=imagecolorallocate($img, 255, 255, 255);
$font_color=imagecolorallocate($img, 0, 0, 0);

Full error check is on and the colors are correctly indexed as far as I
can tell, but the TTF text stubbornly shows up yellow.

Anni H.

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



Re: [PHP] Creating a varable with a name held in a string

2005-02-11 Thread Ben Edwards
On Thu, 10 Feb 2005 23:08:22 -0500, John Holmes
[EMAIL PROTECTED] wrote:
 Randy Johnson wrote:
  I like to do this:
 
  foreach( $row as $key=$val) {
 
$$key = $row[$key];
 
  }
 
 You're just recreating a slower version of extract()...

extract seems like the ticket, but as I will also be wanting to run
eatch var through a varable think I will use the foreach approch.

Thanks everybody.

From the manual

For each key/value pair it will create a variable in the current symbol table.

What exactly is a simble table?

Ben

 
 --
 
 ---John Holmes...
 
 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
 
 php|architect: The Magazine for PHP Professionals  www.phparch.com
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Ben Edwards - Bristol, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] How do you read one of these parameters?

2005-02-11 Thread Greg Donald
On Thu, 10 Feb 2005 16:28:15 -0800, Brian Dunning
[EMAIL PROTECTED] wrote:
 I see URLs formatted like this:
 
http://tinyurl.com/xyz
 
 How do you read that xyz, since there's no /?x= preceding it? Is it
 not a get parameter?

Apache ModRewrite

RewriteEngine on
RewriteRule ^([A-Za-z].*) index.php?var=$1 [L,qsappend]


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] Limit iterations on a foreach loop?

2005-02-11 Thread Robby Russell
On Thu, 2005-02-10 at 15:58 -0800, Brian Dunning wrote:
 I'm using an RSS feed that has WAY too much content, I only want the 
 first 10. I'm outputting the array with a foreach loop: is there a way 
 to limit it to only go through the first 10?
 
 Thanks,
 
 - Brian
 

Is this data coming from a database? If so, just set a limit at the end
of your query...

example: SELECT * FROM blog ORDER BY id DESC LIMIT 10;

..will return the latest 10 entries.

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
* --- Now hosting Ruby on Rails Apps ---
/

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



Re: [PHP] fsockopen: fetching url

2005-02-11 Thread Richard Lynch
[EMAIL PROTECTED] wrote:

 I'm using code below to fetch content from the url.
 This code was worked properly on two servers I tested but it want worked
 on
 the
 designated one,  so after getting error message I figure it out it may
 be php.ini settings limitation
 
 The server encountered an internal error or misconfiguration and was
 unable to complete your request.
 Additionally, a 404 Not Found error was encountered while trying to use
 an
 ErrorDocument to handle the request.

Do *ANY* PHP scripts work on that server?

?php phpinfo();?

is a good example to try.




 So here's the settings I found as possible reason for limitation on code
 execution.
 
 disable_functions: readfile, system, passthru, shell_exec, shell_exec,
 system, execreadfile, system, passthru, shell_exec, shell_exec, system,
 exec

Are you using any of those functions?...

I don't see them in your code.


 Does anybody hava any tip how to workarround on this?


 CODE
 
 function fetchURL( $url ) {
$url_parsed = parse_url($url);
$host = isset($url_parsed[host]) ? $url_parsed[host]: ;
$port = isset($url_parsed[port]) ? $url_parsed[port]: 0;
if ($port==0)
$port = 80;
$path = $url_parsed[path];

$query = isset($url_parsed[query]) ? $url_parsed[query]: ;

if ($query != )
$path .= ? . $query;

$out = GET $path HTTP/1.0\r\nHost: $host\r\n\r\n;

$fp = fsockopen($host, $port, $errno, $errstr, 30);

fwrite($fp, $out);
$body = false;
$in = ;
while (!feof($fp)) {
$s = fgets($fp, 1024);
if ( $body )
$in .= $s;
if ( $s == \r\n )
$body = true;
}

fclose($fp);

return $in;
 }


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: AW: [PHP] export mysql to csv prob

2005-02-11 Thread Tom
If your mysql server has access (or can have access) to the directory 
where you want to dump the file, you can just use the SELECT INTO 
OUTFILE FIELDS TERMINATED BY ','... syntax as your query, which is very 
fast.

Mirco Blitz wrote:
Hi, 
Probably the Pear Excel_Syltesheet_Writer works for you.
http://pear.php.net/package/Spreadsheet_Excel_Writer

I found out that it is faster with huge data sets on my system.
Greetings
Mirco
-Ursprüngliche Nachricht-
Von: Redmond Militante [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 11. Februar 2005 00:02
An: php-general@lists.php.net
Betreff: [PHP] export mysql to csv prob

hi
i have a script that exports the result of a mysql query to a csv file
suitable for downloading
the code looks like
$result = mysql_query(select * from user,mjp1,mjp2,mjp3,mjp4);
while($row = mysql_fetch_array($result)) { 
$csv_output .= $row[userid] $row[firstname] $row[lastname]\n }

header(Content-type: application/vnd.ms-excel);
header(Content-disposition: csv . date(Y-m-d) . .xls);  print
$csv_output;
this works fine, except that when i expand the line $csv_output
.=$row[userid] $row[firstname] $row[lastname] $row[anotherfield]
$row[anotherfield] ...\n} -to include an increasing number of fields, it
tends to bog down the speed at which the $csv_output file can be printed.
when i have this line output 30+ fields for each row, wait time for output
file generation is almost 4-5 minutes.
is this the most efficient way to do this?  i'd like to be able to generate
the file as quickly as possible.
thanks
redmond
--
Redmond Militante
Software Engineer / Medill School of Journalism FreeBSD 5.2.1-RELEASE-p10
#0: Wed Sep 29 17:17:49 CDT 2004 i386  4:45PM  up  4:01, 3 users, load
averages: 0.00, 0.00, 0.00
 

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


RE: [PHP] FW: [NEWBIE GUIDE] For the benefit of new members

2005-02-11 Thread Chris Ramsay
An addition to point 5 perhaps?

[snip]
 One useful trick is
to print the variable/sql query using print or echo command and check
whether you get what you expected. 
[/snip] 

How about mentioning var_dump() and print_r() also?

rgds

Chris Ramsay

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



Re: [PHP] How do you read one of these parameters?

2005-02-11 Thread Richard Lynch
Brian Dunning wrote:
 I see URLs formatted like this:

http://tinyurl.com/xyz

 How do you read that xyz, since there's no /?x= preceding it? Is it
 not a get parameter?

If you can't do mod_rewrite you can use:
http://tinyurl.com/index.php/xyz
with:

?php echo $_SERVER['PATH_INFO'];?

I use it all the time, especially to pass parameters to dynamic images and
PDFs so that Microsoft Internet Explorer (various versions) can't screw
up.

 BAD: http://example.com/dynamic_pdf.php?record_id=1
GOOD: http://example.com/dynamic_pdf.php/record_id=1/fool_ie.pdf

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] [Fwd: Re: [PHP-WIN] Re: SESSION]

2005-02-11 Thread Jason Barnett
Please send responses to the newsgroup.  I am usually happy to help you
out, but I do need to keep things organized / slightly sane on my end :)
The short answer to your question below: yes you can use Word with PHP
and depending on your needs this might happen on the server or you might
just send a Word document to a browser with the correct mime-type.
Based on what you say in your message what you want to do is read the
file's contents on the server side.  You don't even need to open Word to
do this.  Then when you get the file contents you can send the MIME
header and the content of the file to the browser.  Note that this
doesn't *force* the user to open the file through Adobe etc. but it
gives the browser an idea of what to do with the file and gives the user
that option.
Oh, and be careful which files you decide to make public and be
*especially* careful which files you allow people to edit and put on the
server.  You probably already know that, but it doesn't hurt to be
reminded from time to time :)
 Original Message 
Subject: Re: [PHP-WIN] Re: SESSION
Date: Fri, 11 Feb 2005 11:43:24 +0530
From: Vaibhav Sibal [EMAIL PROTECTED]
Reply-To: Vaibhav Sibal [EMAIL PROTECTED]
To: php php-windows@lists.php.net, Jason Barnett
[EMAIL PROTECTED]
References: [EMAIL PROTECTED]
[EMAIL PROTECTED]
Thanks Jason ! It'll be great if you could also tell me whether I can
launch applications like MS WORD using COM or any other technology.
Basically I want the user sitting on a client machine  to select a
file from a list and press the open button (which I will provide) and
the action linked to the open button should be that of opening the
file in the appropriate software . For eg. The user sitting on the
client side select a file image001.jpg and presses open, and it
automatically gets opened in Adobe photoshop. That kind of thing I am
talking about. The only thing to be taken in mind is that the client
does not have a PHP parser installed and is not running a webserver
either. The file list comes from the server only, which is actually
running  the webserver and the PHP parser also. ! Please provide some
insight on this.
On Thu, 10 Feb 2005 17:36:05 -0500, Jason Barnett
[EMAIL PROTECTED] wrote:
Vaibhav Sibal wrote:
 I wanted to ask, where is the Session information stored ? That is at
 the server or on the client. Because I need to give the
 session.save_path value in the php.ini. I would give it according to
 people's reply of this question. Thank you.

 Vaibhav
session.save_path is located on the server.  Session data is stored on
the server; typically the only thing that gets sent to the user is they
will have a cookie written (wherever the web browser writes its cookies).
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


--
Jason Barnett
Destiny Capital LLC
Phone: 937.832.6900 x1054
Fax: 937.832.1570
GPG Public Key ID: 0x74D2856A
CONFIDENTIALITY NOTICE: The information in this email is confidential
and may be legally privileged. It is intended solely for the addressee.
Access to this email by anyone else is unauthorized. If you are not the
intended recipient, an disclosure, copying, distribution or any action
taken or omitted to be taken in reliance on it is prohibited and may be
unlawful.


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Adding Business Days

2005-02-11 Thread Richard Lynch
Ben C wrote:
 I am trying to add 5 business/week days to today's date.  Does anyone
 know a good way of how to do it?

Untested Code:

?php
  //Start with a time-tick NOW:
  $now = mktime();
  echo Starting on , date('l m/d/Y', $now), br /\n;
  $mdy = date('m/d/Y', $now);
  list($m, $d, $y) = explode($mdy);
  $workdays = 0;
  $then = $now;
  while ($workdays  5){
$then += 60 * 60 * 24; //24 hours, one day
$dow = date('w', $then); //Day Of Week (dow)
if ($dow != 0  $dow != 6){ //0 Sun ; 6 Sat
  $workdays++;
}
  }
  echo $workdays away: , date('l m/d/Y', $then), br /\n;
?


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] quotemeta() question...

2005-02-11 Thread Richard Lynch
Steve Kaufman wrote:
 Why does
   quotemeta(pat:1$WRW)
 return
   pat:1
 instead of
   pat:1\$WRW

 What am I misunderstanding about quotemeta function?

You usually would use quotemeta on data coming from the database, or the
user, or externally, or, errr, basically things you haven't typed in to
PHP, that you need to pass into Regular Expressions.

In those cases, you've already got the $ (and other characters)
successfully embedded in the string, but you want to escape them for
whatever reason.

A better example code would be:
$string =
'period.backslash\\plus+star*question?lbracket[rbracket]carat^lparen(rparen)dollar$';
echo PRE, quotemeta($string), /PRE;


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Creating a varable with a name held in a string

2005-02-11 Thread Richard Lynch
Ben Edwards (lists) wrote:
 I have the following code;_

   $sql = select * from  text where id= '$id' ;

   $row = fetch_row_row( $sql, $db );

You may also wish to consider:
list($img_loc, $text_type, $seq, $rec_type, $section, $code, $repeat,
$description, $text) = fetch_row_row($sql, $db);

This allows you to see more of the code's algorithm (if/else/while)
on-screen.

A good editor should allow you to not wrap this line and clutter up your
screen.  Or just buy a wider monitor :-)

This is a Religious Issue of Programming :-)

PS Using select * is also dangerous as you never know when somebody will
decide to add a new column in the database somewhere -- possibly one with
a *TON* of data that you don't need.  Better to name each field you want.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Creating a varable with a name held in a string

2005-02-11 Thread Jason Barnett
Ben Edwards wrote:
...
What exactly is a simble table?
Ben
The symbol table is the where, deep down inside the guts of the Zend
Engine, your variables are stored.  There are symbol tables for
different scopes (function, class, global)
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] avoiding user using back button-need to re-route

2005-02-11 Thread Angelo Zanetti
ok sorry, I dont get a chance to read the list a lot, can you send me
the subject...

TIA

 Richard Lynch [EMAIL PROTECTED] 02/10/05 9:50 PM 
Angelo Zanetti wrote:
 I have a site, the user goes through a few pages inputting info and
also
 making various selections. On the last page they are shown a success
 page. however if they go back by clicking the back button. they can
re

We kinda just went through this two days ago, which is why folks are
probably ignoring you... :-)

Check the archives linked from:
http://www.php.net/mailing-lists.php 

-- 
Like Music?
http://l-i-e.com/artists.htm 

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Peninsula University of 
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] How do you read one of these parameters?

2005-02-11 Thread M. Sokolewicz
or, you could use a 404-errorHandler, and have it parse the URL that 
caused it couldn't find ;) (that's what I use occasionally)

Richard Lynch wrote:
Brian Dunning wrote:
I see URLs formatted like this:
  http://tinyurl.com/xyz
How do you read that xyz, since there's no /?x= preceding it? Is it
not a get parameter?

If you can't do mod_rewrite you can use:
http://tinyurl.com/index.php/xyz
with:
?php echo $_SERVER['PATH_INFO'];?
I use it all the time, especially to pass parameters to dynamic images and
PDFs so that Microsoft Internet Explorer (various versions) can't screw
up.
 BAD: http://example.com/dynamic_pdf.php?record_id=1
GOOD: http://example.com/dynamic_pdf.php/record_id=1/fool_ie.pdf
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: AW: [PHP] export mysql to csv prob

2005-02-11 Thread Richard Lynch
 i have a script that exports the result of a mysql query to a csv file
 suitable for downloading

 the code looks like
 $result = mysql_query(select * from user,mjp1,mjp2,mjp3,mjp4);
 while($row = mysql_fetch_array($result)) {
  $csv_output .= $row[userid] $row[firstname] $row[lastname]\n }

  header(Content-type: application/vnd.ms-excel);
  header(Content-disposition: csv . date(Y-m-d) . .xls);  print
 $csv_output;

 this works fine, except that when i expand the line $csv_output
 .=$row[userid] $row[firstname] $row[lastname] $row[anotherfield]
 $row[anotherfield] ...\n} -to include an increasing number of fields, it
 tends to bog down the speed at which the $csv_output file can be printed.
 when i have this line output 30+ fields for each row, wait time for output
 file generation is almost 4-5 minutes.

 is this the most efficient way to do this?  i'd like to be able to
 generate
 the file as quickly as possible.

Since you don't really care about the individual fields, and you are just
dumping them all out anyway, this might be faster:

$cvs_output .= implode(',', $row);

And, actually, there's no real reason to build up this HUGE string in PHP.

Just spew as you go:

$result = mysql_query(select * from user,mjp1,mjp2,mjp3,mjp4);

header(Content-type: application/vnd.ms-excel);
header(Content-disposition: csv . date(Y-m-d) . .xls);

while($row = mysql_fetch_array($result)) {
  echo implode(',', $row);
}

Note that if you ever embed a comma in your data, then you will be
generating invalid CSV...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: imagettftext color problem

2005-02-11 Thread Richard Lynch




Anni Hienola wrote:

 And to correct one mistake in the code that was kindly pointed out but is
 here just a typo:

 $bg=imagecolorallocate($img, 255, 255, 255);
 $font_color=imageallocatecolor($img, 0, 0, 0);

 Should be:
 $bg=imagecolorallocate($img, 255, 255, 255);
 $font_color=imagecolorallocate($img, 0, 0, 0);

 Full error check is on and the colors are correctly indexed as far as I
 can tell, but the TTF text stubbornly shows up yellow.

Maybe try switching to the other thing that uses TTF fonts...

You're using, what?, TrueType now?  Try FreeType.

You might have to re-compile to install it, but the code changes should be
pretty quick global search and replace.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Creating a varable with a name held in a string

2005-02-11 Thread Richard Lynch
Ben Edwards wrote:
 From the manual

 For each key/value pair it will create a variable in the current symbol
 table.

 What exactly is a simble table?

Internally, PHP stores variables in an array.

That array is sometimes referred to as a symbol table because each
symbol (variable name) is listed in the table with its value.

var_dump($GLOBALS);

is pretty much the symbol table for all intents and purposes to a PHP
script.

Down in the guts of PHP source, it's probably just a tad bit more
complicated than that :-)

For starters, do a little research on reference counting if you want to
make your head spin a bit.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How do you read one of these parameters?

2005-02-11 Thread trlists
On 11 Feb 2005 Richard Lynch wrote:

 BAD: http://example.com/dynamic_pdf.php?record_id=1
 GOOD: http://example.com/dynamic_pdf.php/record_id=1/fool_ie.pdf

Just curious, how does IE screw up the first one?

--
Tom

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



Re: [PHP] Re: imagettftext color problem

2005-02-11 Thread hitek
You are using imagecreate() with png, which creates an indexed color image.

 $img=imagecreate($width, $height);

Use Imagecreatetruecolor() instead.

 
 From: Anni Hienola [EMAIL PROTECTED]
 Date: 2005/02/11 Fri AM 02:27:03 EST
 To: php-general@lists.php.net
 Subject: [PHP] Re: imagettftext color problem
 
 
 And to correct one mistake in the code that was kindly pointed out but is
 here just a typo:
 
  $bg=imagecolorallocate($img, 255, 255, 255);
  $font_color=imageallocatecolor($img, 0, 0, 0);
 
 Should be:
 $bg=imagecolorallocate($img, 255, 255, 255);
 $font_color=imagecolorallocate($img, 0, 0, 0);
 
 Full error check is on and the colors are correctly indexed as far as I
 can tell, but the TTF text stubbornly shows up yellow.
 
 Anni H.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] Secure system calls -- how

2005-02-11 Thread Niels
Hi,

Jason Wong wrote:

 To put it simply you would have to check *extremely* carefully the user
 input to ensure that it is not malicious, and that it is what it should
 be. I believe your original problem was about writing procmail files.
No, not exactly.

Thank you just the same, you bring up another good point. In the extreme
case, when I want to be really sure of the file, I have to parse it, just
as I parse all other data from the user. Yikes, that's a lot of work! I'm
counting on not doing that, but making sure I escape_cmd or whatever it's
called -- isn't that almost as good?


- Niels

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



Re: [PHP] quotemeta() question...

2005-02-11 Thread Jason Barnett
Richard Lynch wrote:
Steve Kaufman wrote:
Why does
 quotemeta(pat:1$WRW)
return
 pat:1
instead of
 pat:1\$WRW
What am I misunderstanding about quotemeta function?

You usually would use quotemeta on data coming from the database, or the
user, or externally, or, errr, basically things you haven't typed in to
PHP, that you need to pass into Regular Expressions.
In those cases, you've already got the $ (and other characters)
successfully embedded in the string, but you want to escape them for
whatever reason.
A better example code would be:
$string =
'period.backslash\\plus+star*question?lbracket[rbracket]carat^lparen(rparen)dollar$';
echo PRE, quotemeta($string), /PRE;
Interesting aside... with the test string above, I noticed that
backslash\\ only resolved to two backslashes.  I thought there would be
4.  It seems that quotemeta will resolve \ and \\ to \\, \\\ and 
resolve to , etc.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Secure system calls -- how

2005-02-11 Thread Niels
Hi,

Richard Lynch wrote:
 I suspect that people who looked into doing this fall into two categories:
 
 Those who heeded the experts who told them Don't do that and didn't do
 it.
 
 Thoee who ignored the experts, went ahead and did it, and cobbled together
 enough band-aid security measures to be Okay with it, but not something
 they want to publish what they did, because then it would be too easy to
 attack them.
 
 Actually, there's probably a third category:  Those who don't even really
 own their own machines any more because they got root-ed. :-v
 

I know you're trying to cheer me up, but this isn't helping! ;-)

I have this theory that if what you're trying to protect is important
enough, somebody will get through the security barriers eventually. That
goes double for the internet. A good point that I've failed to bring up is
the question How secure do you need it to be?. I think that's an
important consideration.

Your three groups sound quite accurate, but my big problem is that when a
program _has_ to do these things, I'm left in group #2, because I can't
find any tried-and-tested methods. This is not usually the case with PHP,
the community always seems to provide good solutions. I'm left in group #2
until I've become an expert in this myself, several unpaid years into the
future...

Webmin is a common tool, and if their security measures don't hold up, then
we're in big trouble. I believe they're using PAM somehow, I'll look into
that. Until then, it's a sudo scheme.


Thanks again,
Niels

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



Re: [PHP] export mysql to csv prob

2005-02-11 Thread Redmond Militante
hi,

this pear package is working beautifully, but so far i've only managed to 
generate .xls docs.
are there any formatting commands that would allow me to generate just a tab 
delimited text file?

thanks
redmond


[Fri, Feb 11, 2005 at 12:41:42AM +0100]
This one time, at band camp, Mirco Blitz said:

 Hi, 
 Probably the Pear Excel_Syltesheet_Writer works for you.
 http://pear.php.net/package/Spreadsheet_Excel_Writer
 
 I found out that it is faster with huge data sets on my system.
 
 Greetings
 Mirco
 
 -Ursprüngliche Nachricht-
 Von: Redmond Militante [mailto:[EMAIL PROTECTED] 
 Gesendet: Freitag, 11. Februar 2005 00:02
 An: php-general@lists.php.net
 Betreff: [PHP] export mysql to csv prob
 
 hi
 
 i have a script that exports the result of a mysql query to a csv file
 suitable for downloading
 
 the code looks like
 $result = mysql_query(select * from user,mjp1,mjp2,mjp3,mjp4);
 while($row = mysql_fetch_array($result)) { 
  $csv_output .= $row[userid] $row[firstname] $row[lastname]\n }
  
  header(Content-type: application/vnd.ms-excel);
  header(Content-disposition: csv . date(Y-m-d) . .xls);  print
 $csv_output;
 
 this works fine, except that when i expand the line $csv_output
 .=$row[userid] $row[firstname] $row[lastname] $row[anotherfield]
 $row[anotherfield] ...\n} -to include an increasing number of fields, it
 tends to bog down the speed at which the $csv_output file can be printed.
 when i have this line output 30+ fields for each row, wait time for output
 file generation is almost 4-5 minutes.
 
 is this the most efficient way to do this?  i'd like to be able to generate
 the file as quickly as possible.
 
 thanks
 redmond
 
 --
 Redmond Militante
 Software Engineer / Medill School of Journalism FreeBSD 5.2.1-RELEASE-p10
 #0: Wed Sep 29 17:17:49 CDT 2004 i386  4:45PM  up  4:01, 3 users, load
 averages: 0.00, 0.00, 0.00
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
Redmond Militante
Software Engineer / Medill School of Journalism
FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386
 1:00PM  up 1 day, 16 mins, 2 users, load averages: 0.06, 0.06, 0.02


pgpa22Dw99Wua.pgp
Description: PGP signature


Re: [PHP] How do you read one of these parameters?

2005-02-11 Thread Robert Cummings
On Thu, 2005-02-10 at 19:28, Brian Dunning wrote:
 I see URLs formatted like this:
 
http://tinyurl.com/xyz
 
 How do you read that xyz, since there's no /?x= preceding it? Is it 
 not a get parameter?

It means the hosting webserver either does a URL rewrite for the
receiver application, or the receiver application parses the URL itself.
In either case the developer then assigns the value to a variable of
their choice. This is usually a positional approach to URL variables.
Meaning you can't arbitrarily re-arrange the order of the variables.

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

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



[PHP] Checking the Version of mySql and settings on server

2005-02-11 Thread GH
Is it possible to check via php what version of mysql is running and
if it is a 4.1.x or better version to see if it is using the
--old-password switch or not?  I would like to know so that I can code
both ways and just have a conditional statement direct which code is
used...

Thanks

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



Re: [PHP] Checking the Version of mySql and settings on server

2005-02-11 Thread Marek Kilimajer
GH wrote:
Is it possible to check via php what version of mysql is running and
if it is a 4.1.x or better version to see if it is using the
--old-password switch or not?  I would like to know so that I can code
both ways and just have a conditional statement direct which code is
used...
hmm, mysql, that should be in mysql functions. I need to *get* *info* 
about *mysql* *server*. Oh yeah, there's one function like that: 
mysql_get_server_info

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


[PHP] How can I read the output from a local php file [fopen()]?

2005-02-11 Thread Al
I have a script that needs to read the output, not the file itself, from a local 
php file using its absolute address.

Normally I'd simply use $handle= fopen(http://www.whatever.com, 'rb')
However, the webhost [Powweb] just changed their system to use load balancing 
servers.   Now, my script must use the fopen() with a hack as such:

$handle= fopen(http://local.whatever.com, rb)
But, but, it doesn't work when my script is started from a cronjob, only from a 
remote browser.

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


[PHP] Re: How can I read the output from a local php file [fopen()]?

2005-02-11 Thread Jason Barnett
Al wrote:
...
But, but, it doesn't work when my script is started from a cronjob, only
from a remote browser.
Any suggestions?
Thanks.
cURL extension:
http://www.php.net/manual/en/ref.curl.php
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Checking the Version of mySql and settings on server

2005-02-11 Thread GH
However, this does not tell you if they are using the Old or New
Password on the newer version... how can i check that?



On Fri, 11 Feb 2005 21:01:02 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote:
 GH wrote:
  Is it possible to check via php what version of mysql is running and
  if it is a 4.1.x or better version to see if it is using the
  --old-password switch or not?  I would like to know so that I can code
  both ways and just have a conditional statement direct which code is
  used...
 
 hmm, mysql, that should be in mysql functions. I need to *get* *info*
 about *mysql* *server*. Oh yeah, there's one function like that:
 mysql_get_server_info


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



Re: AW: [PHP] export mysql to csv prob

2005-02-11 Thread Redmond Militante
they're on separate machines, this seems the fastest method, but i'm not sure 
if it's possible given my setup

[Fri, Feb 11, 2005 at 09:48:18AM +]
This one time, at band camp, Tom said:

 If your mysql server has access (or can have access) to the directory 
 where you want to dump the file, you can just use the SELECT INTO 
 OUTFILE FIELDS TERMINATED BY ','... syntax as your query, which is very 
 fast.
 
 Mirco Blitz wrote:
 
 Hi, 
 Probably the Pear Excel_Syltesheet_Writer works for you.
 http://pear.php.net/package/Spreadsheet_Excel_Writer
 
 I found out that it is faster with huge data sets on my system.
 
 Greetings
 Mirco
 
 -Ursprüngliche Nachricht-
 Von: Redmond Militante [mailto:[EMAIL PROTECTED] 
 Gesendet: Freitag, 11. Februar 2005 00:02
 An: php-general@lists.php.net
 Betreff: [PHP] export mysql to csv prob
 
 hi
 
 i have a script that exports the result of a mysql query to a csv file
 suitable for downloading
 
 the code looks like
 $result = mysql_query(select * from user,mjp1,mjp2,mjp3,mjp4);
 while($row = mysql_fetch_array($result)) { 
 $csv_output .= $row[userid] $row[firstname] $row[lastname]\n }
 
 header(Content-type: application/vnd.ms-excel);
 header(Content-disposition: csv . date(Y-m-d) . .xls);  print
 $csv_output;
 
 this works fine, except that when i expand the line $csv_output
 .=$row[userid] $row[firstname] $row[lastname] $row[anotherfield]
 $row[anotherfield] ...\n} -to include an increasing number of fields, it
 tends to bog down the speed at which the $csv_output file can be printed.
 when i have this line output 30+ fields for each row, wait time for output
 file generation is almost 4-5 minutes.
 
 is this the most efficient way to do this?  i'd like to be able to generate
 the file as quickly as possible.
 
 thanks
 redmond
 
 --
 Redmond Militante
 Software Engineer / Medill School of Journalism FreeBSD 5.2.1-RELEASE-p10
 #0: Wed Sep 29 17:17:49 CDT 2004 i386  4:45PM  up  4:01, 3 users, load
 averages: 0.00, 0.00, 0.00
 
  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
Redmond Militante
Software Engineer / Medill School of Journalism
FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386
 2:30PM  up 1 day,  1:46, 2 users, load averages: 0.00, 0.00, 0.00


pgp9mlMCLKuFW.pgp
Description: PGP signature


[PHP] Uploading products in database using zip file?

2005-02-11 Thread afan
Hi,
right now in my firm, to upload new products to web site, marketing person
has to, in admin area, upload csv file (then php read content and store
info in DB), and then ftp all images in temp directory. And then, using
other php script, resize images and put them in product_images directory.
Whole process works just fine.

But, I was wondering, if is possible this scenario:
marketing person zip images and csv file together, then in admin area
uload zip file to server, and php then unzip file and do the job.
Actually, instead doing two operations (upload csv file and ftp images) he
has to do just one thing: upload zip file.
???

Or, if somebody has an idea about this whole process?

Thanks!

-afan

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



Re: [PHP] How do you read one of these parameters?

2005-02-11 Thread Blake Schroeder
I may be looking at this problem from the wrong direction but if your
form method is a post you will not see the parameters in the url, if
your form method is a get you will.

examples:
form method=POST action=test.php
input type=HIDDEN name=x value=yes

example url: 
http://www.something.com/test.php
form method=GET action=test.php
input type=HIDDEN name=x value=yes

example url: 
http://www.something.com/test.php?x=yes


Sorry if I am note getting the problem.

-Blake


On Fri, 11 Feb 2005 11:16:17 -0500, Robert Cummings
[EMAIL PROTECTED] wrote:
 On Thu, 2005-02-10 at 19:28, Brian Dunning wrote:
  I see URLs formatted like this:
 
 http://tinyurl.com/xyz
 
  How do you read that xyz, since there's no /?x= preceding it? Is it
  not a get parameter?
 
 It means the hosting webserver either does a URL rewrite for the
 receiver application, or the receiver application parses the URL itself.
 In either case the developer then assigns the value to a variable of
 their choice. This is usually a positional approach to URL variables.
 Meaning you can't arbitrarily re-arrange the order of the variables.
 
 Cheers,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
+-+
 |Blake Schroeder | Owner/Developer | www.lhwd.net|
+---(http://www.lhwd.net)---+

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



Re: [PHP] Uploading products in database using zip file?

2005-02-11 Thread afan
One more thing marketing person use Windows and he will probably use Winzip.
Is this still ok, or it's better to use some other application?



 Hi,
 right now in my firm, to upload new products to web site, marketing person
 has to, in admin area, upload csv file (then php read content and store
 info in DB), and then ftp all images in temp directory. And then, using
 other php script, resize images and put them in product_images directory.
 Whole process works just fine.

 But, I was wondering, if is possible this scenario:
 marketing person zip images and csv file together, then in admin area
 uload zip file to server, and php then unzip file and do the job.
 Actually, instead doing two operations (upload csv file and ftp images) he
 has to do just one thing: upload zip file.
 ???

 Or, if somebody has an idea about this whole process?

 Thanks!

 -afan

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



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



Re: [PHP] Checking the Version of mySql and settings on server

2005-02-11 Thread Marek Kilimajer
GH wrote:
However, this does not tell you if they are using the Old or New
Password on the newer version... how can i check that?

On Fri, 11 Feb 2005 21:01:02 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote:
GH wrote:
Is it possible to check via php what version of mysql is running and
if it is a 4.1.x or better version to see if it is using the
--old-password switch or not?  I would like to know so that I can code
both ways and just have a conditional statement direct which code is
used...
hmm, mysql, that should be in mysql functions. I need to *get* *info*
about *mysql* *server*. Oh yeah, there's one function like that:
mysql_get_server_info

$var = mysql_fetch_assoc(mysql_query('show variables like 
'old_passwords';'));

echo $var['Variable_name']
But you need to be connected first :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Uploading products in database using zip file?

2005-02-11 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
One more thing marketing person use Windows and he will probably use Winzip.
Is this still ok, or it's better to use some other application?
First of all I would suggest using 7zip on Windows.  Its usage is 100%
free (you can of course donate to the project if you feel it is worthy).
 Your sales guy can then create zip's / tgz's / whatever archiving
scheme supported by 7zip.


Hi,
right now in my firm, to upload new products to web site, marketing person
has to, in admin area, upload csv file (then php read content and store
info in DB), and then ftp all images in temp directory. And then, using
other php script, resize images and put them in product_images directory.
Does the other script do all the resizing automagically, or is the sales
guy necessary in this step of the process?
Whole process works just fine.
But, I was wondering, if is possible this scenario:
marketing person zip images and csv file together, then in admin area
uload zip file to server, and php then unzip file and do the job.
Sure... PHP can unzip the archive to a temp directory.  Then you glob
the files in this temp directory and have PHP perform the action(s)
matching that type of file.  Rinse and repeat for images.
Alternatively you can have PHP try checking the contents of each
individual file to guesstimate what type of file it is and handle it
accordingly.  If you go this route it may also be worthwhile to check
the file's contents for possible XSS exploits, or PHP code, or ...
Even if the images are stored in a database / other server this
shouldn't be too tough for PHP to handle.  :)

Actually, instead doing two operations (upload csv file and ftp images) he
has to do just one thing: upload zip file.
???
Or, if somebody has an idea about this whole process?
Thanks!
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] quotemeta() question...

2005-02-11 Thread Jochem Maas
Jason Barnett wrote:
Richard Lynch wrote:
Steve Kaufman wrote:
Why does
 quotemeta(pat:1$WRW)
return
 pat:1
instead of
 pat:1\$WRW
What am I misunderstanding about quotemeta function?

You usually would use quotemeta on data coming from the database, or the
user, or externally, or, errr, basically things you haven't typed in to
PHP, that you need to pass into Regular Expressions.
In those cases, you've already got the $ (and other characters)
successfully embedded in the string, but you want to escape them for
whatever reason.
A better example code would be:
$string =
'period.backslash\\plus+star*question?lbracket[rbracket]carat^lparen(rparen)dollar$'; 

echo PRE, quotemeta($string), /PRE;
Interesting aside... with the test string above, I noticed that
backslash\\ only resolved to two backslashes.  I thought there would be
thats correct...
echo \\; // shows one backslash

4.  It seems that quotemeta will resolve \ and \\ to \\, \\\ and 
resolve to , etc.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins 

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


Re: [PHP] Uploading products in database using zip file?

2005-02-11 Thread afan

Hi,
right now in my firm, to upload new products to web site, marketing
 person
has to, in admin area, upload csv file (then php read content and store
info in DB), and then ftp all images in temp directory. And then, using
other php script, resize images and put them in product_images
 directory.

 Does the other script do all the resizing automagically, or is the sales
 guy necessary in this step of the process?


Yes, script resize images to a big one and a thumbanail, and then delete
original.

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



Re: [PHP] quotemeta() question...

2005-02-11 Thread Jason Barnett
Jochem Maas wrote:
...
A better example code would be:
$string =
'period.backslash\\plus+star*question?lbracket[rbracket]carat^lparen(rparen)dollar$';
echo PRE, quotemeta($string), /PRE;
Interesting aside... with the test string above, I noticed that
backslash\\ only resolved to two backslashes.  I thought there would be

thats correct...
echo \\; // shows one backslash
Well in the example above it was a single quote, not a double quote.
But either way... I would have thought there would be a 1:1 relationship
in the quotemeta translation (either quote all of them, or assume they
are all quoted already).

4.  It seems that quotemeta will resolve \ and \\ to \\, \\\ and 
resolve to , etc.
See above.  I would think (given my own common sense as well as the man
page for quotemeta) that there would be a quote added to each of these.
 But the results don't quite match this...
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: pdf properties

2005-02-11 Thread Stian Berger
On Thu, 10 Feb 2005 12:28:19 -0700, Jason Motes [EMAIL PROTECTED] wrote:
Hello,
Is there anyway to retrieve the properties from a pdf file using php?
When you right click on a pdf file in windows you can see the title of  
the file and you can change this property there also.

I wrote a php page that lists all files in a certain directory.  I want  
to be able show the actual title of the document instead of just the  
file name.

I have searched the manual and google, everything that comes up refers  
to generating pdfs on the fly, not working with an already made pdf.

Thanks in Advance,
Jason Motes

If you study the structure of pdf in a text editor, you'll notice that it  
is quite readable. If you go to the end of a document, prefferably a small  
one, you will see the trailer. Here is al list of all bytepositions of the  
objects the pdf document contains. These objects can be images, text, page  
descriptions, page groups and so on. There can also be a reference to the  
properties of the document wich can contain creator, author, title etc. It  
is easy to read the objects, but to change them can prove rather  
difficult, as you will need to update the trailer informaition with new  
byteposition for all objects that comes after the properties (hard to  
explain), unless you keep the new info the same length.

But as you only need to extract the title you can do this with a simple  
regexp.

while(filelistingstuff) {
$document = file_get_contents($pdf);
 if(preg_match(/\/Title\s\((.*?)\)/i,$document,$match)) {
  $title = $match[1];
 } else {
  $title = $filename;
 }
}
Hope this helps.
--
Stian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Convert a string to ASCII

2005-02-11 Thread Shaun
Hi,

Is it possible to create an ascii representation of a string with php, i had 
a look on the site but with no luck :(

Thanks for your advice 

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


RE: [PHP] Convert a string to ASCII

2005-02-11 Thread Jay Blanchard
[snip]
Is it possible to create an ascii representation of a string with php, i
had 
a look on the site but with no luck :(
[/snip]

You mean like this?

__

^(picture of a string, obvious).j/k

Do you mean the ascii values for a string? Yes it is possible, it only
requires that you use one of the regex or replace functions

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


Re: [PHP] How do you read one of these parameters?

2005-02-11 Thread Chris
[EMAIL PROTECTED] wrote:
On 11 Feb 2005 Richard Lynch wrote:
 

BAD: http://example.com/dynamic_pdf.php?record_id=1
GOOD: http://example.com/dynamic_pdf.php/record_id=1/fool_ie.pdf
   

Just curious, how does IE screw up the first one?
--
Tom
 

IE has unique (read: non-standard) way of determining the Content-Type 
of a request. The BAD example doesn't get read as a PDF by IE, no matter 
what the Content-Type is. I'm not fully versed in this behavior, but I 
do know that IE acts correctly if the URL (not just the text before a ?) 
ends in .pdf AND the Content-Type is text/pdf .

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


[PHP] Re: PHP User Permissions

2005-02-11 Thread Ugo Bellavance
Matthew Walker wrote:
And if you're running apache as root, you shouldn't be allowed to.
Apache should always be run as as nonpriviledged user.
On Fri, 2002-09-13 at 09:04, J Smith wrote:
A running script cannot change its own permissions
If you mean can't change it's user ID and/or group ID, that isn't entirely 
true.

If your script is being run as a privileged user on a UNIX system (usually 
root), you can change the user/group IDs of the process (either effective 
or real) with the POSIX extension. (posix_seteuid(), posix_setuid(), etc.)

I haven't tried it from an Apache process, so I can't say if it will work 
from a web server (doubtful) but it does work for standalone scripts from 
the CGI/CLI.
AFAIK, your CGI is processed by a child process of apache, that should 
run as an unpriviledged user, so it cannot change the U/GID.

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


Re: [PHP] Convert a string to ASCII

2005-02-11 Thread Shaun

Jay Blanchard [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
[snip]
Is it possible to create an ascii representation of a string with php, i
had
a look on the site but with no luck :(
[/snip]

You mean like this?

__

^(picture of a string, obvious).j/k

Do you mean the ascii values for a string? Yes it is possible, it only
requires that you use one of the regex or replace functions

Hi,

Thanks for your reply, yes for each character in the string I need to 
replace it with its ascii representaion 

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


RE: [PHP] Convert a string to ASCII

2005-02-11 Thread Jesse Castro

 -Original Message-
 From: Shaun [mailto:[EMAIL PROTECTED] 
 Sent: Friday, February 11, 2005 4:44 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Convert a string to ASCII
 
 
 
 Jay Blanchard [EMAIL PROTECTED] wrote 
 in message 
 news:[EMAIL PROTECTED]
 [snip]
 Is it possible to create an ascii representation of a string 
 with php, i had a look on the site but with no luck :( [/snip]
 
 You mean like this?
 
 __
 
 ^(picture of a string, obvious).j/k
 
 Do you mean the ascii values for a string? Yes it is 
 possible, it only requires that you use one of the regex or 
 replace functions
 
 Hi,
 
 Thanks for your reply, yes for each character in the string I need to 
 replace it with its ascii representaion 
 
http://us3.php.net/function.ord
HTH,
Jesse R. Castro

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


Re: [PHP] quotemeta() question...

2005-02-11 Thread Jochem Maas
Jason Barnett wrote:
Jochem Maas wrote:
...
A better example code would be:
$string =
'period.backslash\\plus+star*question?lbracket[rbracket]carat^lparen(rparen)dollar$'; 

echo PRE, quotemeta($string), /PRE;
Interesting aside... with the test string above, I noticed that
backslash\\ only resolved to two backslashes.  I thought there would be

thats correct...
echo \\; // shows one backslash
I should have been clearer:
echo \\; // shows one backslash
echo '\\'; // shows one backslash
the backslash is a metachar in both single and double quoted
strings so regardless of the quotes used in order to write a
literal backslash in a string you must 'backslash' it.
you still not with me?:
echo '\'; // does this parse?
so the output of metaquote() is correct.

Well in the example above it was a single quote, not a double quote.
But either way... I would have thought there would be a 1:1 relationship
in the quotemeta translation (either quote all of them, or assume they
are all quoted already).
it quotes them all AFAIT.


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


[PHP] LibMcrypt and Mcrypt and Mhash - OH MY!

2005-02-11 Thread Steven Altsman








Ive beaten my head against the desk repeatedly, RTFMing
until my eyes are sore, the boss is still at my back.. and Im completely
lost. Id love to grok intricacies of compiling C code and setting
environment variables.. but I am dead once February 15th rolls
around and may have to find another job soon.



All Im trying to do is get an OpenBSD 3.6 box with
the following components installed:



MySQL 4.1 (or 5.0.2)

Apache 2

Mcrypt

Mhash

Libmcrypt

PHP

OpenSSL



And thats it. Nothing fancy, just something
that is highly secure and easy to lock down to 2 ports. Ive gotten
a bunch of shell scripts written up for each portion of the install.. most of
them are ./configure prefix=/usr/local/(program name) with the
configuration files in the conf directory for each.



Im currently hung up on Mcrypt. Its a
total monster! Its a key component in so many programs and
libraries, and yet Googling news groups, checking out the main site for
them, and going through the config.log files I cant understand a darn
thing anyone is saying.



Im an intro PHP fella.. I can tie into databases,
loop through if statements, store images, handle usernames and passwords.. but
encryption is something completely alien to me. Ive done ASP
before and installing the packages may not be as
secure/customizable/reliable/intelligent.. it involved double-clicking and
maybe doing something in DOS like adding a -v at the end.



Dont get me wrong, Id kindly RTFM and leave
the vicious cerebral types be, but I dont have that luxury. Surely
someone else out there has experienced something like this before and can
bestow a nugget of wisdom upon me.




 
  
  
  
  
  Steven Altsman
  Webmaster and Program Analyst
  EFast Funding, LLC.
  713.983.4069
  - work
  832.527.3786
  - cell
  [EMAIL PROTECTED]
  
 








Only two things are infinite,
the universe and human stupidity, and I'm not sure about the former.

- Albert Einstein (1879  1955)










Re: [PHP] LibMcrypt and Mcrypt and Mhash - OH MY!

2005-02-11 Thread Jeffery Fernandez
Steven Altsman wrote:
Ive beaten my head against the desk repeatedly, RTFMing until my 
eyes are sore, the boss is still at my back.. and Im completely lost. 
Id love to grok intricacies of compiling C code and setting 
environment variables.. but I am dead once February 15^th rolls around 
and may have to find another job soon.

All Im trying to do is get an OpenBSD 3.6 box with the following 
components installed:

MySQL 4.1 (or 5.0.2)
Apache 2
Mcrypt
Mhash
Libmcrypt
PHP
OpenSSL
And thats it. Nothing fancy, just something that is highly secure and 
easy to lock down to 2 ports. Ive gotten a bunch of shell scripts 
written up for each portion of the install.. most of them are 
./configure prefix=/usr/local/(program name) with the configuration 
files in the conf directory for each.

Im currently hung up on Mcrypt. Its a total monster! Its a key 
component in so many programs and libraries, and yet Googling news 
groups, checking out the main site for them, and going through the 
config.log files I cant understand a darn thing anyone is saying.

Im an intro PHP fella.. I can tie into databases, loop through if 
statements, store images, handle usernames and passwords.. but 
encryption is something completely alien to me. Ive done ASP before 
and installing the packages may not be as 
secure/customizable/reliable/intelligent.. it involved double-clicking 
and maybe doing something in DOS like adding a -v at the end.

Dont get me wrong, Id kindly RTFM and leave the vicious cerebral 
types be, but I dont have that luxury. Surely someone else out there 
has experienced something like this before and can bestow a nugget of 
wisdom upon me.


Steven Altsman
//Webmaster and Program Analyst//
EFast Funding, LLC.
713.983.4069 - work
832.527.3786 - cell
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
/Only two things are infinite, the universe and human stupidity, and 
I'm not sure about the former./

*/- Albert Einstein/** *(1879  1955)
quick answer.. have you tried reading up on the installation method 
ports @ http://www.openbsd.org/ports.html#Use

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


[PHP] Minimalist permissions

2005-02-11 Thread Ugo Bellavance
Hi,
Please forgive me if this specific question has already been 
addressed, but I'm doing tests to figure out what are the minimal 
permissions I can give on my files and folders for a PHP application and 
I just can't find it (even by searching this list).  Feel free to 
redirect me to existing documentation that I woule have missed, if needed.

My config:  Apache2 on RHEL, php-4.3.2-19.  The server runs as 
apache.apache.  I have a test server and a prod servers.  On the test 
server, one developper accesses the files directly in his home (userdir 
activated).  On my production server, the application is located in a 
subfolder of the document root (/var/www/html/) and files are tarred on 
the test server, copied using sftp (to my user account) mv'ed into 
/var/www/html and then untarred.  This server is not shared by external 
users, so it is usually only root that can put content in the DocRoot.

According to my tests, we need read permissions for php files to be 
processed by apache, and we need execute (and read) permissions on 
direcories.For directories in which php uploads (images) or create 
(pdf) files, it needs write permissions on the directory.

I'm curious about the reason why it needs execute permissions on 
directory.  According to the documentation, 'x' on directories allows to 
'search' a direcory.  Isn't 'r' enough?  That allows php to read the 
directory listing...  However, this is not my main concern...

So here it is: If the needed permissions for standard PHP files and 
directories are 'r' on files and 'r-x' on directories, how can I set my 
umask so that files and directories are always created as such?  I 
looked up 'man umask' and it seems to treat files and directories the 
same way.  Maybe that is impossible, but I logged in via FTP to a server 
of a web hosting company, and it implements just this: creates 
directories as rwxr-xr-x and files as rw-r--r--.

Another thing... how should I configure ownership on the files? 
root as owner, apache as group and no permissions for others?

Thanks for taking the time to read such a long post.
Regards,
Ugo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] NOTICE: Attachment Blocked

2005-02-11 Thread postmaster
The following message has been blocked because 
it contained a potential virus in an attachment.

To:  php-general@lists.php.net
From:[EMAIL PROTECTED]
Date:Sat, 12 Feb 2005 08:35:56 +0100
Subject: [PHP] Re: unknown

If this was a legitimate attachment, please contact 
the IT Department for help.

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