[PHP] Re: Error - when trying to connect to postgresql

2003-07-21 Thread Peter Torraca
When I try to connect to postresql with my php script below I got hhis eror:
I can insert into the table from psql.  Please help
Thanks,

---
Warning: pg_exec() query failed: ERROR: invention: permission denied 
in /home/pptun/public_html/invention.php on line 9
---

$conn = pg_connect("dbname=pptun port=5432");

My first guess is that your problem comes from the fact that 
pg_connect is missing at least a username and password.

From http://us4.php.net/pg_connect :

$dbconn3 = pg_connect ("host=sheep port=5432 dbname=mary user=lamb 
password=foo");
//connect to a database named "mary" on the host "sheep" with a 
username and password

Good luck

peter
--
Peter Torraca
[EMAIL PROTECTED]
<><
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mail From option in PHP.ini

2003-07-21 Thread Peter Torraca
On 07/18/2003 12:00 PM, Brian S. Drexler wrote:
 Ok, I want to specify who the mail is coming from by using the sendmail_path
 option in the PHP.ini.  I've added the [EMAIL PROTECTED] to it, but I want
 to be able to dynmaically change [EMAIL PROTECTED] to [EMAIL PROTECTED] or
 whatever else.  Anyone have any ideas how I can do this?  I'm pulling the
 e-mail I'd like to change it to from a MySQL database but can I rewrite the
 php.ini file on the fly or am I stuck.  Any help is greatly appreciated.
Why not just add the From: header to the fourth mail() param? 
Something like this:

$email = "[EMAIL PROTECTED]";
$admin_email = "[EMAIL PROTECTED]";
$body = "blah blah blah";
$mail = mail($email, "Information you requested", $body, "From: $admin_email");

I've found that this sets the headers the way most clients expect to 
see them.  We use it a lot to tidy up emails set from "reset your 
password" functions and the like.  It should be trivial to set the 
From: header based on a db result or whatever.

There is a much expanded version of this solution regarding sending 
emails with attachments through mail() on in the online php manual, 
check out "kieran dot huggins at rogers dot com"'s comments and some 
others on the http://us4.php.net/mail page (it's a 06-Nov-2002 
comment).

I'm coming in a bit late to this conversation -- hopefully I'm not 
too far off base with this reply.  If I am, sorry!

peter

--
Peter Torraca
Webmaster, Math Department
Purdue Univ., Math 813
765-494-9998
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] safe_mode problem

2003-09-24 Thread Peter Torraca
I can't seem to get safe_mode working the way I need it  to.  I'm 
trying to allow users to include PEAR from their local webspace 
without disabling safe_mode.  The docs tell me to simply use the 
safe_mode_include_dir directive, but php does not seem to be using 
it.  Here's my config, set up in httpd.conf:


AllowOverride FileInfo Indexes AuthConfig Limit
Options MultiViews +Indexes -FollowSymLinks +SymLinksIfOwnerMatch 
+ExecCGI +IncludesNoExec

Order allow,deny
Allow from all


Order deny,allow
Deny from all

php_admin_flag safe_mode On
php_value include_path ".:/pkgs/php-4.2.3/share/pear"
php_admin_value safe_mode_exec_dir "/pkgs/www/cgi-bin/"
php_admin_value safe_mode_include_dir ".:/pkgs/php-4.2.3/share/pear"
php_admin_value doc_root "."
php_admin_value user_dir WWW
php_admin_flag engine On
php_value max_execution_time 90


Currently, this setup throws "SAFE MODE Restriction in effect" errors 
when I try to include /pkgs/php-4.2.3/share/pear.  Includes work when 
I turn safe_mode off.  Anyone see what I'm doing wrong or what I 
should be doing differently?

Peter

--
Peter Torraca
Webmaster, Math Department
Purdue Univ., Math 813
765-494-9998
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] mktime trouble

2003-10-20 Thread Peter Torraca
I'm taking a postgres timestamp from the database to something I can 
parse with PHP (i.e., a unix timestamp.  Thing is, the date function 
isn't giving me the result I expect.  Check this out:

print date ("m/d/y h:m:s A", mktime(16, 30, 0, 10, 10, 2003));

gives the output: 10/10/03 04:10:00 AM

Where did the 4:10 come from?  It should be 4:*30*.  To make things 
stranger, when I change the month field in mktime to 9, like so:

print date ("m/d/y h:m:s A", mktime(16, 30, 0, 9, 10, 2003));

I get the output: 09/10/03 04:09:00 AM

It works the same way if I feed date a Unix timestamp, so I'm sure 
this is a date problem.  (using mktime in my example here is just 
clearer than playing with unix timestamps).

date() and mktime() are usually simple enough, but something is going 
wrong.  Perhaps it is a dumb mistake on my part, but I'm not seeing 
it

peter

--
Peter Torraca
Webmaster, Math Department
Purdue Univ., Math 813
765-494-9998
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] smart table construction from array

2001-08-14 Thread Peter Torraca

Hello All --

I have a csv file that I need to parse into a table.  Getting the
file open and into stuffed into an array is not really a problem, but
I want PHP to adapt the table structure to the data on the fly.  For
example, some data (from the hgitner.com stamp buying list):

26,used,3¢ Washington Dull Red type II,$1.00 ,-,-
"Fine + OG Hinged 232-40, 285-90, 294-99, 323-7 wanted. Call or ship!",
534A,single,"2¢ Washington, type VI (imperf, offset)",$20.00 ,$12.00 ,$6.00
534B,single,"2¢ Washington, type Va (imperf, offset)",Needed Urgently!,,


I can easily get line 1 and 3 can easily into:

263¢ Washington Dull Red type
II$1.00--

but line 2 and 4 are my problem.  I want PHP to take line 2 and see
that there is only one cell of data in the  and four blanks in the
array and thus create:

Fine + OG Hinged 232-40, 285-90, 294-99, 323-7 wanted.
Call or ship!

PHP should see that line 4 ends in two blanks and thus should output:

34Bsingle 2¢ Washington, type Va (imperf,
offset) Needed Urgently!"

but I'm having some real trouble figuring out the logic/control
structures to do this.  If there is a class out there that does this,
I'd be happy to hear of it.  But I suspect my inexperience is the
real problem: I'm really hoping that someone can explain the logic of
how this might be done.

thanks in advance.

peter

--
Peter Torraca
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]