[PHP] writing Excel files through PHP

2004-01-10 Thread Binay

Hi all,

I m generating an Excel file though PHP by sending the appropriate header and then 
using HTML TD tags to write data in different cells. Below is my code snippet.

It has got 1 problems:

1. Image doesn't come/showup in Excel sheet.

?php

header(Content-type: application/vnd.ms-excel);
header(Content-disposition: attachment; filename=pareto_combined.xls);
?

tr colspan=8
td height=50 img src='../../../extra/images/log.jpg'/td 
td align=rightimg src='../../../extra/images/mickey_sup.jpg'/td 
/tr 

?php
$dateF=$_REQUEST['dateF']; 

$dateT=$_REQUEST['dateT'];

$agentID=$_REQUEST['agentID'];
tr
td class='graybg'?php echo $agentID/td
td class='graybg'?php echo $dateF/td
td class='graybg'?php echo $dateT/td
/tr

?

now after saving the Excel file it displays all alphanumeric data correctly but images 
do not show up. i think Img tag is not supported by Excel application. 

So my question is how can i display the images in Excel using PHP? plz help me out 

Thanks in advance

Binay 




[PHP] Rand() problem

2004-01-10 Thread nefar
After moving my PHP files to a new hard drive and a new windows
installation, my rand function gets stuck and only gives you one number over
and over.  It worked a few times then got stuck.  I tried using IIS 5.1 (I
was using Xitami) and it gave me the same results.  It even gets stuck on
the same number as the other webserver. I tried installing on a different
machine.  Same result.  Can anyone help?

Thanks

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



Re: [PHP] Rand() problem

2004-01-10 Thread Richard Davey
Hello nefar,

Friday, January 9, 2004, 6:05:34 AM, you wrote:

n After moving my PHP files to a new hard drive and a new windows
n installation, my rand function gets stuck and only gives you one number over
n and over.  It worked a few times then got stuck.  I tried using IIS 5.1 (I
n was using Xitami) and it gave me the same results.  It even gets stuck on
n the same number as the other webserver. I tried installing on a different
n machine.  Same result.  Can anyone help?

Which version of PHP are you using? If it's earlier than 4.2.0 you
need to see the rand() function first, or it will return the same
numbers each time. Use srand() to do this.

Also, are you passing in values to the rand() function? (your min and
max values) - on Windows there is a limit on the max value of 32,768.

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



php-general Digest 10 Jan 2004 10:26:23 -0000 Issue 2522

2004-01-10 Thread php-general-digest-help

php-general Digest 10 Jan 2004 10:26:23 - Issue 2522

Topics (messages 174179 through 174196):

Re: Display syslog file?
174179 by: Steve Edberg

Re: XML/HTML encoding?
174180 by: memoimyself.yahoo.com.br

Hiding files away from /public_html/
174181 by: Philip J. Newman
174183 by: Ralph Guzman

Re: Buffalo'ed, stumped, confused...
174182 by: Ralph Guzman

Re: post vars not by form
174184 by: Ralph Guzman

Re: Not working?
174185 by: Ralph Guzman

Re: Sorting data into columns vertically
174186 by: Ralph Guzman
174187 by: Ralph Guzman
174188 by: Ralph Guzman

Re: limit mysql connections
174189 by: John W. Holmes

[Newbie Guide] For the benefit of new members
174190 by: Ma Siva Kumar

Total NewB Q
174191 by: Russell Shaw

Odd strtotime behavior
174192 by: Chris W
174193 by: hitek

writing Excel files through PHP
174194 by: Binay

Rand() problem
174195 by: nefar
174196 by: Richard Davey

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]


--
---BeginMessage---
I don't know if the same syntax is available on Linux, but on Solaris 
I can use the 'tail -f' command to watch lines being appended to a 
file from the commandline.. You might be able to do something via

	passthru(tail -f $PathToSyslog);

in a frame on your page...although there might be socket_blocking or 
page flush() issues to experiment with -

	steve

At 8:28 AM -0600 1/9/04, Carlton L. Whitmore wrote:
I didn't make my last request very clear. I used lastlog as an example,
but what I really want to do is open a syslog file (text file), that is
coming in from a VPN box.
I'd like to have it displayed live so I can scan it during the day.
What is the best way to do this? Someone had suggested using cron, but
I'm very new to Linux and PHP so I would need some help with that.
Any help is appreciated,
Carlton.


--
++
| Steve Edberg  [EMAIL PROTECTED] |
| University of California, Davis  (530)754-9127 |
| Programming/Database/SysAdmin   http://pgfsun.ucdavis.edu/ |
++
| [EMAIL PROTECTED]: 1001 Work units on 23 oct 2002  |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens...  |
++
---End Message---
---BeginMessage---
Hello Vincent,

On 9 Jan 2004 at 16:23, Vincent Jansen wrote:

 After xslt I end up with a html document with a souce that looks
 something like
 
   ?xml version=1.0 encoding=UTF-8 standalone=yes?
   !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
   http://www.w3.org/TR/REC-html40/loose.dtd;
   html
   head
   titledotted e (ë) works/title
   /head
   body
   Etc.
 
 This is what I want
 But my browser displays dotted e () works
 
 Because I don't want yes or no: Please tell me what (maybe obvious
 thing) I'm doing wrong

I don't think you're doing anything wrong, except perhaps for using an outdated 
browser. 
The ë (e-umlaut, which you called a dotted e) displays just fine in both IE 6 and 
Netscape 7.1 on my computer.

Make sure your browser is configured to use Western European (ISO-8859-1) encoding, 
because even latest-generation browsers have poor support for UTF-8. To change your 
browser's encoding settings, do:

In IE 6: View  Encoding

In Netscape: View  Character Coding

Any other browser: figure it out yourself ;-)

Take care,

Erik
---End Message---
---BeginMessage---
Hi, just wanted to pick someones brain.

I want to store some images outside the /public_html/ how ever my isp has decided that 
i'm not aloud
to write files in that area.  Would the next best solution that wold be as secure to 
maybe put them
in a folder with a .htaccess file in it?

---
Philip J. Newman
Master Developer
PhilipNZ.com [NZ] Ltd.
[EMAIL PROTECTED]
---End Message---
---BeginMessage---
Put them in a folder with .htaccess:

RewriteEngine onRewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/.*$ [NC]
ReWriteRule .*\.(gif|jpg)$  -   [N,F,L]



-Original Message-
From: Philip J. Newman [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 3:42 PM
To: 'Php-general'
Subject: [PHP] Hiding files away from /public_html/

Hi, just wanted to pick someones brain.

I want to store some images outside the /public_html/ how ever my isp has
decided that i'm not aloud
to write files in that area.  

Re: [PHP] Fw: Intermitent problems retreiving PDF's from a MySQL database.

2004-01-10 Thread Stuart
Donald Tyler wrote:
I thought that maybe the PDF had been corrupted somehow, but the problem
miraculously fixed itself so I didnt have a change to check that out.
Now I got a call from one of my users complaining of the exact same problem,
which once again miraculously fixed itself after reloading internet
explorer.
There are no error messages in the apache log or the mysql log.

Does anyone have any idea what is going on?!?
This is most likely an issue with the client-side (i.e. the Acrobat IE 
plugin) and not PHP given that restarting IE (i.e. restarting the 
plugin) solves it.

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


Re: [PHP] picturing webpage

2004-01-10 Thread Stuart
Mike Brum wrote:
It could be similar to how you can build a PDF. They could just take your
HTML and then use that to build a .JPG. I'm sure it's a very *expensive*
process (server  CPU -wise) though.
There's an addon for LiveStats (www.mediahouse.com) that does this so it 
can display thumbs of pages on your site in its reports. It runs on 
Windows and appears to load the page in and embedded IE instance then 
takes a screenshot.

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


Re: [PHP] writing Excel files through PHP

2004-01-10 Thread Marek Kilimajer
Use full uri. But the user needs to be online while viewing the xls file.

Other option is to create web archive. It's a mime encoded file, save an 
excel file with an embeded image and you will see what it is.

Binay wrote:
Hi all,

I m generating an Excel file though PHP by sending the appropriate header and then using HTML TD tags to write data in different cells. Below is my code snippet.

It has got 1 problems:

1. Image doesn't come/showup in Excel sheet.

?php

header(Content-type: application/vnd.ms-excel);
header(Content-disposition: attachment; filename=pareto_combined.xls);
?
tr colspan=8
td height=50 img src='../../../extra/images/log.jpg'/td 
td align=rightimg src='../../../extra/images/mickey_sup.jpg'/td 
/tr 

?php
$dateF=$_REQUEST['dateF']; 

$dateT=$_REQUEST['dateT'];

$agentID=$_REQUEST['agentID'];
tr
td class='graybg'?php echo $agentID/td
td class='graybg'?php echo $dateF/td
td class='graybg'?php echo $dateT/td
/tr
?

now after saving the Excel file it displays all alphanumeric data correctly but images do not show up. i think Img tag is not supported by Excel application. 

So my question is how can i display the images in Excel using PHP? plz help me out 

Thanks in advance

Binay 



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


[PHP] Re: Hiding files away from /public_html/

2004-01-10 Thread memoimyself
Hi Philip,

On 10 Jan 2004 at 12:42, Philip J. Newman wrote:

 I want to store some images outside the /public_html/ how ever my isp
 has decided that i'm not aloud to write files in that area.  Would the
 next best solution that wold be as secure to maybe put them in a folder
 with a .htaccess file in it? 

You could use an htaccess file, but: (a) the Apache web server must be configured to 
allow htaccess to over-ride authentication settings (which, from what you've told us, 
is 
something you'll have no control over); (b) you'd need to upload an htpasswd file 
containing username and passwords pairs to the webserver, but wouldn't be able to 
save it to an off-web directory; and (c) the htaccess file would prevent your own 
scripts 
from accessing the image files, which would mean that the user viewing a page with a 
protected image would need to type a username and password in order for the image to 
be displayed. Doesn't sound like the best solution to me.

Do you have access to a database? One solution would be to store all images on a 
database and have the image files generated dinamically via PHP. That would imply in 
some overhead, but it would be fairly secure. If you like the idea, let me know and 
I'll tell 
you how I've implemented it in the past.

Another much more complicated solution would be to rename your image files with a 
PHP extension (thus protecting their contents) and create a script to read these 
files, 
extract their contents and create temporary PNG/JPG/GIF files on the fly.

Good luck,

Erik

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



[PHP] Mail function problem

2004-01-10 Thread Rolf Berkenbosch
Hi All,
 
I have a big problem with the mail function in PHP.
I have installed PHP 4.3.3. But no email where send
With the mail function. If I run this script as root. There
Is no problem..
 
What do I need to change??
 
Thanks,
 
Rolf


[PHP] FW: Re: need help please

2004-01-10 Thread haydar Moussalem



From: Gabor Hojtsy [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: haydar [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: need help please
Date: Sat, 10 Jan 2004 15:39:45 +0100 (CET)
Please ask support questions at [EMAIL PROTECTED] I would
suggest you read the manual page of header() and headers_sent() before
you ask there though.
Regards,
Gabor Hojtsy

 hello
 i have this probleme
 i include a connection file to the db
 then i update i record and finaly i want to redirect it to another
page using header function but i have the following error
 Warning: Cannot modify header information - headers already sent by
(output started
 my code is :
 ?php require_once('../Connections/vb_conn.php');?
 ?php ob_start(); ?
 ?php global $gifname;
 $gifname=rand(1,1000);
 $gifname=$gifname..gif;
 global $jpgname;
 $jpgname=rand(1000,1);
 $jpgname=$jpgname..jpg;
 if(is_uploaded_file($pic))
   {   global $myvar;
  $myvar = $HTTP_POST_FILES['pic']['name'];
  $cd = getcwd();
  $wd = $cd./pics;
  chdir($wd);
  if([EMAIL PROTECTED]('.'))
{ if($HTTP_POST_FILES['pic']['type']==image/gif)
   {
   if(file_exists($GLOBALS['myvar']))
 {
 rename($GLOBALS['myvar'],$GLOBALS['gifname']);
 }
   copy($HTTP_POST_FILES['pic']['tmp_name'],$dir);
   if(file_exists(Resource id #1))   {
   rename(Resource id #1,$GLOBALS['myvar']);
 }
   elseif(file_exists(Resource id #2))   {
   rename(Resource id #2,$GLOBALS['myvar']);
 }
 elseif(file_exists(Resource id #3))   {
   rename(Resource id #3,$GLOBALS['myvar']);
 }
 elseif(file_exists(Resource id #4))   {
   rename(Resource id #4,$GLOBALS['myvar']);
 }
 }
   if($HTTP_POST_FILES['pic']['type']==image/jpeg)
   {
   if(file_exists($GLOBALS['myvar']))
 {
 rename($GLOBALS['myvar'],$GLOBALS['jpgname']);
 }
   copy($HTTP_POST_FILES['pic']['tmp_name'],$dir);
   if(file_exists(Resource id #1))   {
   rename(Resource id #1,$GLOBALS['myvar']);
 }
   elseif(file_exists(Resource id #2))   {
   rename(Resource id #2,$GLOBALS['myvar']);
 }
 elseif(file_exists(Resource id #3))   {
   rename(Resource id #3,$GLOBALS['myvar']);
 }
 elseif(file_exists(Resource id #4))   {
   rename(Resource id #4,$GLOBALS['myvar']);
 }
   closedir($dir);}
 }
 }
 function GetSQLValueString($theValue, $theType, $theDefinedValue = ,
$theNotDefinedValue = )
 {
   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) :
$theValue;
   switch ($theType) {
 case text:
   $theValue = ($theValue != ) ? ' . $theValue . ' : NULL;
   break;
 case long:
 case int:
   $theValue = ($theValue != ) ? intval($theValue) : NULL;
   break;
 case double:
   $theValue = ($theValue != ) ? ' . doubleval($theValue) . '
: NULL;
   break;
 case date:
   $theValue = ($theValue != ) ? ' . $theValue . ' : NULL;
   break;
 case defined:
   $theValue = ($theValue != ) ? $theDefinedValue :
$theNotDefinedValue;
   break;
   }
   return $theValue;
 }
 $editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
 if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
   $editFormAction .= ? . $HTTP_SERVER_VARS['QUERY_STRING'];
 }
 if ((isset($HTTP_POST_VARS[MM_insert])) 
($HTTP_POST_VARS[MM_insert] == form1)) {
   $insertSQL = sprintf(INSERT INTO iss_pages (iss_id, pg_name,
pg_alt, pg_order, pg_display) VALUES (%s, %s, %s, %s, %s),
GetSQLValueString($HTTP_POST_VARS['page_id'],
int),
GetSQLValueString($GLOBALS['myvar'], text),
GetSQLValueString($HTTP_POST_VARS['image_alt'],
text),

GetSQLValueString($HTTP_POST_VARS['image_order'], int),

GetSQLValueString($HTTP_POST_VARS['display'],text));
   mysql_select_db($database_vb_conn, $vb_conn);
   $Result1 = mysql_query($insertSQL, $vb_conn) or die(mysql_error());
   if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
 $insertGoTo .= (strpos($insertGoTo, '?')) ?  : ?;
 $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];  }
   if (isset($HTTP_POST_VARS['another']))
  { $nb= $HTTP_POST_VARS['page_id'];
 $insertGoTo = ins_pages.php?inb=$nb; }
 else { $insertGoTo = issues_menu.php;}



**
   header(sprintf(Location: %s, $insertGoTo));
*here is the error
   exit();}
   ob_get_contents() ;

**
 ?
 ?  ob_end_flush(); ?
 ?php  echo -.br; ?
 html
 head
 titleUploading/title body link=#FF vlink=#FF
alink=#FFbr
 meta http-equiv=Content-Type content=text/html;
charset=utf-8/head
 link rel=stylesheet href=../cp.css
 body
 /body
 /html





[PHP] Re: Mail function problem

2004-01-10 Thread Jonas
Rolf Berkenbosch wrote:
 Hi All,
  
 I have a big problem with the mail function in PHP.
 I have installed PHP 4.3.3. But no email where send
 With the mail function. If I run this script as root. There
 Is no problem..
  
 What do I need to change??
  
 Thanks,
  
 Rolf

hm I think the webserver or the user who is running the PHP Script has no 
access/execute rights for the Mailserver..

Greetings, Veers
and sry for my bad english...

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



[PHP] Re: Odd strtotime behavior

2004-01-10 Thread Jonas
Chris W wrote:

 The following code doesn't do what I expect and I was wondering if
 someone could tell me why and how to make it do what I want.
 
 $NowT = strtotime(January 9 2004);
 $EventT = strtotime(June 1 2004);
 print ($EventT - $NowT)/86400;
 
 I get 143.95833
 
 Why don't I get 144?
 
 Chris W
Hi Chris,
try this:
 $NowT = strtotime(January 9 2004);
 $EventT = strtotime(June 1 2004);
 print (round($EventT - $NowT)/86400);

greetings, Jonas

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



[PHP] Re: writing Excel files through PHP

2004-01-10 Thread Greg Beaver
Hi,

You might also consider using Spreadsheet_Excel_Writer

http://pear.php.net/package/Spreadsheet_Excel_Writer

Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org
Binay wrote:
Hi all,

I m generating an Excel file though PHP by sending the appropriate header and then using HTML TD tags to write data in different cells. Below is my code snippet.

It has got 1 problems:

1. Image doesn't come/showup in Excel sheet.

?php

header(Content-type: application/vnd.ms-excel);
header(Content-disposition: attachment; filename=pareto_combined.xls);
?
tr colspan=8
td height=50 img src='../../../extra/images/log.jpg'/td 
td align=rightimg src='../../../extra/images/mickey_sup.jpg'/td 
/tr 

?php
$dateF=$_REQUEST['dateF']; 

$dateT=$_REQUEST['dateT'];

$agentID=$_REQUEST['agentID'];
tr
td class='graybg'?php echo $agentID/td
td class='graybg'?php echo $dateF/td
td class='graybg'?php echo $dateT/td
/tr
?

now after saving the Excel file it displays all alphanumeric data correctly but images do not show up. i think Img tag is not supported by Excel application. 

So my question is how can i display the images in Excel using PHP? plz help me out 

Thanks in advance

Binay 



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


[PHP] Headers and sessions in php .cgi

2004-01-10 Thread Børge Strand

Hi there,

I have a problem setting my headers right with php running as .cgi. I
have to specify a Content-type for the cgi file to work. But how
should I do both that and start a session?

I have a few options:

#! /usr/local/bin/php
?php
session_start();
print 'Content-type: text/html' . \n\n;

This way $_SESSION['count'] stays unset even though I say
$_SESSION['count'] = 1; in my program.

To swap the two lines won't work because I heard \n\n terminates the
header portion. Anyway, here goes:

#! /usr/local/bin/php
?php
print 'Content-type: text/html' . \n\n;
session_start();

Now I get Warning: session_start(): Cannot send session cookie -
headers already sent by... line 3 and then Warning: session_start():
Cannot send session cache limiter - headers already sent

I have tried replacing print 'Content-type: text/html' . \n\n; by
print 'Content-type: text/html' . \n; (one \n instead of two) with
exactly the same result. With no \n at all I only get Warning:
session_start(): Cannot send session cache limiter - headers already
sent.

The next thing I try is to replace print 'Content-type: text/html' and
the \n's by sending the same text in header(). This variety gives me a
500 Internal Server Error independant on the number of \n's.

Anyway, here's all my code. No matter what I do it always prints Your
visit number 1. $_SESSION['count'] doesn't get increased at all!


#! /usr/local/bin/php
?php
print 'Content-type: text/html' . \n\n;
session_start();
print 'html' . \n;
print 'body' . \n;

if (!isset($_SESSION['count']))
{
$_SESSION['count'] = 1;
}
else
{
$_SESSION['count']++;
}

print 'Your visit number ' . $_SESSION['count'] . \n;
print '/body' . \n;
print '/html' . \n;
?


I hope you can help me out getting my headers straight.


Regards, 

Børge

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



[PHP] Calling cgi post form from within php

2004-01-10 Thread Thomas Andersen
Hi,

does anyone know how to call a cgi script and pass along a post-form from
within php?

Thanks,
Thomas

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



Re: [PHP] Calling cgi post form from within php

2004-01-10 Thread David Otton
On Sat, 10 Jan 2004 13:46:19 -0500, you wrote:

does anyone know how to call a cgi script and pass along a post-form from
within php?

http://pear.php.net/package/HTTP_Request

There are others, of course. But this will let you make a POST request.

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



[PHP] Re: Calling cgi post form from within php

2004-01-10 Thread Thomas Andersen
a little extra info.  This is a remote script located on another server.  I
will then get a return value for error checking purposes.

Thomas

Thomas Andersen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 does anyone know how to call a cgi script and pass along a post-form from
 within php?

 Thanks,
 Thomas

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



Re: [PHP] Headers and sessions in php .cgi

2004-01-10 Thread David Otton
On Sat, 10 Jan 2004 17:44:18 +0100 (MET), you wrote:

I have a problem setting my headers right with php running as .cgi. I
have to specify a Content-type for the cgi file to work. But how
should I do both that and start a session?

I have a few options:

#! /usr/local/bin/php
?php
session_start();
print 'Content-type: text/html' . \n\n;

This way $_SESSION['count'] stays unset even though I say
$_SESSION['count'] = 1; in my program.

To swap the two lines won't work because I heard \n\n terminates the
header portion. Anyway, here goes:

Stupid question: Have you tried

header ('Content-type: text/html');

I'm pretty sure it will work.

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



Re: [PHP] Headers and sessions in php .cgi

2004-01-10 Thread Chris Shiflett
--- Børge Strand [EMAIL PROTECTED] wrote:
 I have a problem setting my headers right with php running as
 .cgi. I have to specify a Content-type for the cgi file to work.
 But how should I do both that and start a session?

Try using header() instead of print to set Content-Type.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



Re: [PHP] Calling cgi post form from within php

2004-01-10 Thread Chris Shiflett
--- Thomas Andersen [EMAIL PROTECTED] wrote:
 does anyone know how to call a cgi script and pass along a
 post-form from within php?

You can use cURL (if you compiled with the cURL extension), any one of the
HTTP* PEAR classes (see http://pear.php.net/), or do it manually:

http://shiflett.org/hacks/php/http_post

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



Re: [PHP] Headers and sessions in php .cgi

2004-01-10 Thread Børge Strand

 I have a problem setting my headers right with php running as .cgi. I
 have to specify a Content-type for the cgi file to work. But how
 should I do both that and start a session?
 
 I have a few options:
 
 #! /usr/local/bin/php
 ?php
 session_start();
 print 'Content-type: text/html' . \n\n;
 
 This way $_SESSION['count'] stays unset even though I say
 $_SESSION['count'] = 1; in my program.
 
 To swap the two lines won't work because I heard \n\n terminates the
 header portion. Anyway, here goes:
 
 Stupid question: Have you tried

Well, there's one thing I have found out here and that is that there's
no such thing as a stupid question. I've tried searching for
Content-type and session_start without getting any wiser :-(

 header ('Content-type: text/html');
 
 I'm pretty sure it will work.

Tried it, didn't word I'm afraid. The text inside doesn't contain
anything that's treated differently by  and '. 


--
Børge

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



Re: [PHP] Headers and sessions in php .cgi

2004-01-10 Thread Børge Strand

  I have a problem setting my headers right with php running as
  .cgi. I have to specify a Content-type for the cgi file to work.
  But how should I do both that and start a session?
 
 Try using header() instead of print to set Content-Type.
 
 Hope that helps.

Thanks Chris. I tried that (see original post). Then I get a 500 error
in my browser and bad header in error_log.

Guess I'll have to take session_start() apart and see what it does.
This all worked in 4.2, though, where I used .cgi files without a
die-hard need for Content-type.

As I said in a previous post, everything works when I run my program
as a .php file without Content-type. So I guess there's a conflict
between the Content-type header and those inserted by session_start()
in 4.3.4.

Thanks for any help, I'm on a bad deadline and my ISP changed PHP
version without telling!

-- 
Børge

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



[PHP] http authentication through PHP

2004-01-10 Thread Scott Taylor


What is the easiest way to access a page that is protected by HTTP basic 
authentication through PHP? In other words, I have a PHP page that will 
get the username and  password off a database and will then login 
through HTTP authentication to access a second page (say an HTML page).

Best regards,

Scott Taylor

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


[PHP] Re: Calling cgi post form from within php

2004-01-10 Thread Manuel Lemos
Hello,

On 01/10/2004 04:46 PM, Thomas Andersen wrote:
does anyone know how to call a cgi script and pass along a post-form from
within php?
You may want to try this class. It comes with an example to post a form 
to a remote server, exactly as you ask:

http://www.phpclasses.org/httpclient

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: http authentication through PHP

2004-01-10 Thread Manuel Lemos
Hello,

On 01/10/2004 06:01 PM, Scott Taylor wrote:
What is the easiest way to access a page that is protected by HTTP basic 
authentication through PHP? In other words, I have a PHP page that will 
get the username and  password off a database and will then login 
through HTTP authentication to access a second page (say an HTML page).
You may want to try this class that comes with an example to do exactly 
what you ask:

http://www.phpclasses.org/httpclient

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Mail function problem

2004-01-10 Thread Manuel Lemos
Hello,

On 01/10/2004 11:36 AM, Rolf Berkenbosch wrote:
I have a big problem with the mail function in PHP.
I have installed PHP 4.3.3. But no email where send
With the mail function. If I run this script as root. There
Is no problem..
 
What do I need to change??
Which platform as you using, Windows ou Linux/Unix? Did you configure 
PHP to send messages properly?

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Turck mmcache is dead

2004-01-10 Thread Manuel Lemos
Hello,

On 01/08/2004 09:36 AM, [EMAIL PROTECTED] wrote:
http://sourceforge.net/forum/message.php?msg_id=2361065
Not exactly as you may also read there. The control is being passed to 
other developers interested in carrying on the development while the 
original author is unable to do it himself.

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Headers and sessions in php .cgi

2004-01-10 Thread Justin Patrin
BøRge Strand wrote:
Hi there,

I have a problem setting my headers right with php running as .cgi. I
have to specify a Content-type for the cgi file to work. But how
should I do both that and start a session?
I have a few options:

#! /usr/local/bin/php
?php
session_start();
print 'Content-type: text/html' . \n\n;
This way $_SESSION['count'] stays unset even though I say
$_SESSION['count'] = 1; in my program.
To swap the two lines won't work because I heard \n\n terminates the
header portion. Anyway, here goes:
#! /usr/local/bin/php
?php
print 'Content-type: text/html' . \n\n;
session_start();
Now I get Warning: session_start(): Cannot send session cookie -
headers already sent by... line 3 and then Warning: session_start():
Cannot send session cache limiter - headers already sent
I have tried replacing print 'Content-type: text/html' . \n\n; by
print 'Content-type: text/html' . \n; (one \n instead of two) with
exactly the same result. With no \n at all I only get Warning:
session_start(): Cannot send session cache limiter - headers already
sent.
The next thing I try is to replace print 'Content-type: text/html' and
the \n's by sending the same text in header(). This variety gives me a
500 Internal Server Error independant on the number of \n's.
Anyway, here's all my code. No matter what I do it always prints Your
visit number 1. $_SESSION['count'] doesn't get increased at all!

#! /usr/local/bin/php
?php
print 'Content-type: text/html' . \n\n;
session_start();
print 'html' . \n;
print 'body' . \n;
if (!isset($_SESSION['count']))
{
$_SESSION['count'] = 1;
}
else
{
$_SESSION['count']++;
}
print 'Your visit number ' . $_SESSION['count'] . \n;
print '/body' . \n;
print '/html' . \n;
?

I hope you can help me out getting my headers straight.

Regards, 

Børge
You should be using header as such:

header('Content-type: text/html');

You don't need and should not include the newlines. The reason that 
other things aren't set is that two newlines ends headers (includeing 
cookies and such) which breaks sessions.

If you simply use header() all of this is dealt with for you as it 
should be. Just make sure that you don't print or echo anything before 
using it (or starting a session).

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


Re: [PHP] http authentication through PHP

2004-01-10 Thread Chris Shiflett
--- Scott Taylor [EMAIL PROTECTED] wrote:
 What is the easiest way to access a page that is protected by HTTP
 basic authentication through PHP?

You should be able to indicate the username and password in the URL:

http://username:[EMAIL PROTECTED]/path/to/script.php

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



[PHP] PHP/MySQL tutor wanted

2004-01-10 Thread bFreeburg
I've a project to do, and have chosen PHP/MySQL as the tool.   I'd like to
hire a tutor for assistance.

It's an ecommerce app, where you sell something out of a database and send a
few emails.  Not rocket science.  I'd like to have something usable in 3-4
months at the most.

I'd like phone and email support, preferably from someone close to my time
zone.  I'm in Seattle, so PST or MST is preferred.  You don't have to be
available 24/7.  I f you've got a day job, evening phone calls work.

I've tried to teach myself, but am having trouble figuring what part to
learn first and I need a solid result, not a first-project pile of spagetti
code.

Send me an email (not a list response). Put PHP Tutor in the subject, and
tell me a website where I could look at something you've done.  Rate's
negotiable, but I'm thinking I should be able to get some decent help for
$20 hr.  I'll post back to the list when I've found someone.

Thanks,
Bill Freeburg
[EMAIL PROTECTED]

p.s. I'm an experienced Foxpro programmer, but have not yet achieved 'guru'
status on internet applications.

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



[PHP] Exception number: c0000005 (access violation

2004-01-10 Thread Gunter Sammet
I have 4.3.5-dev (Build Dec-22-2003) installed on a W2K Dell Inspiron 7500
and I am getting an error which I don't get with 4.1.1 and 4.3.4. Would like
to learn how to debug things like that. Here is a dump of Dr. Watson:

Application exception occurred:
App:  (pid=2228)
When: 1/10/2004 @ 14:51:33.711
Exception number: c005 (access violation)

* System Information *
Computer Name: DELL
User Name: Administrator
Number of Processors: 1
Processor Type: x86 Family 6 Model 8 Stepping 3
Windows 2000 Version: 5.0
Current Build: 2195
Service Pack: 4
Current Type: Uniprocessor Free
Registered Organization: SammySolutions.com ltd.
Registered Owner: Gunter Sammet

* Task List *
   0 Idle.exe
   8 System.exe
 148 smss.exe
 172 csrss.exe
 168 winlogon.exe
 220 services.exe
 232 lsass.exe
 384 svchost.exe
 436 svchost.exe
 488 spoolsv.exe
 512 ati2plab.exe
 536 ibserver.exe
 580 APACHE.exe
 708 regsvc.exe
 728 MSTask.exe
 732 APACHE.exe
 968 snmp.exe
1028 stisvc.exe
1060 vsmon.exe
1112 WinMgmt.exe
1136 svchost.exe
1164 svchost.exe
 120 Explorer.exe
1460 jusched.exe
1448 interserver.exe
1440 Atiptaxx.exe
1420 EM_EXEC.exe
1392 zapro.exe
 640 internat.exe
1512 AirPlus.exe
1520 trillian.exe
1760 mysqld-nt.exe
1796 PostCastServer..exe
1820 gcdnssrv.exe
1860 OUTLOOK.exe
 996 IEXPLORE.exe
1916 IEXPLORE.exe
1980 IEXPLORE.exe
2020 IEXPLORE.exe
2060 IEXPLORE.exe
2100 IEXPLORE.exe
2184 PHPEdit.exe
2200 DBGLIS~1.exe
2168 IEXPLORE.exe
2280 IEXPLORE.exe
2192 IEXPLORE.exe
1084 APACHE.exe
1020 APACHE.exe
2228 php.exe
1532 drwtsn32.exe
   0 _Total.exe

(0040 - 0040D000)
(77F8 - 77FFB000)
(1000 - 1015)
(7C4E - 7C599000)
(77E1 - 77E75000)
(77F4 - 77F7C000)
(7505 - 75058000)
(7503 - 75044000)
(7800 - 78045000)
(7C2D - 7C332000)
(77D3 - 77D9E000)
(7502 - 75028000)
(77A5 - 77B3C000)
(779B - 77A4B000)
(1F7C - 1F7F4000)
(76B3 - 76B6E000)
(6318 - 631E5000)
(7171 - 71794000)
(782F - 78538000)
(00CC - 00CD6000)
(6E42 - 6E426000)
(75E6 - 75E7A000)
(782C - 782CC000)
(7798 - 779A4000)
(7734 - 77353000)
(7752 - 77525000)
(7732 - 77337000)
(7515 - 7515F000)
(7517 - 751BF000)
(7C34 - 7C34F000)
(751C - 751C6000)
(7795 - 7797A000)
(773B - 773DF000)
(7738 - 773A3000)
(7783 - 7783E000)
(7788 - 7790E000)
(7C0F - 7C152000)
(774E - 77513000)
(774C - 774D1000)
(7753 - 77552000)
(7736 - 77379000)
(777E - 777E8000)
(777F - 777F5000)
(74FD - 74FEE000)
(7501 - 75017000)

State Dump for Thread Id 0x738

eax=0001 ebx=0005 ecx=0098 edx=00794010 esi=0012fd18
edi=00ce
eip=77fcc2e2 esp=0012fb0c ebp=0012fca4 iopl=0 nv up ei pl zr na po
nc
cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=
efl=0246


function: RtlAllocateHeap
77fcc2ca 51   pushecx
77fcc2cb 51   pushecx
77fcc2cc 81ec7401 sub esp,0x174
77fcc2d2 53   pushebx
77fcc2d3 56   pushesi
77fcc2d4 57   pushedi
77fcc2d5 8b7d08   mov edi,[ebp+0x8]
ss:00bd9b8a=
77fcc2d8 897da4   mov [ebp+0xa4],edi
ss:00bd9b8a=
77fcc2db 8065b800 and byte ptr [ebp+0xb8],0x0
ss:00bd9b8a=??
77fcc2df 8b450c   mov eax,[ebp+0xc]
ss:00bd9b8a=
FAULT -77fcc2e2 0b4710   or  eax,[edi+0x10]
ds:01789ee6=
77fcc2e5 89450c   mov [ebp+0xc],eax
ss:00bd9b8a=
77fcc2e8 a9600f037d   testeax,0x7d030f60
77fcc2ed 0f856aee jne _eFSQRT+0xe93 (77fcb15d)
77fcc2f3 817d100080
ss:00bd9b8a=
  cmp dword ptr [ebp+0x10],0x8000
77fcc2fa 0f835dee jnb _eFSQRT+0xe93 (77fcb15d)
77fcc300 837d1000 cmp   dword ptr [ebp+0x10],0x0
ss:00bd9b8a=
77fcc304 0f8424f8 je  RtlSizeHeap+0x228 (77fcbb2e)
77fcc30a 8b4510   mov eax,[ebp+0x10]
ss:00bd9b8a=
77fcc30d 83c00f   add eax,0xf
77fcc310 24f8 and al,0xf8
77fcc312 8945e0   mov [ebp+0xe0],eax
ss:00bd9b8a=

* Stack Back Trace *

FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
0012FCA4 100C03A2 00CE 0001 0098 0080 ntdll!RtlAllocateHeap
0081      !emalloc

* Raw Stack Dump *
0012fb0c  b8 3e 79 00 18 fd 12 00 - 05 00 00 00 80 7d 13 00
.y..}..
0012fb1c  00 00 00 00 c8 fb 12 00 - d7 c8 fc 77 00 00 13 00
...w
0012fb2c  c0 c9 fc 77 08 06 13 00 - 25 c9 fc 77 8c 7d 13 00
...w%..w.}..
0012fb3c  e8 b6 b2 77 00 00 00 00 - ce 47 f8 77 28 b3 b2 77
...w.G.w(..w

Re: [PHP] Exception number: c0000005 (access violation

2004-01-10 Thread Peter Vertes




Usually under Windows when you get a Memory Access Violation its a good indication that your power supply or RAM is on its way out. Is this happening to all apps or only PHP ?
 Unfortunately I don't know how to debug using a Dr. Watson dump but I do know of a free memory testing utility called MemTest86 (http://www.memtest86.com/). Sorry if I wasn't too much of a help.

-Pete

On Sat, 2004-01-10 at 17:06, Gunter Sammet wrote:

I have 4.3.5-dev (Build Dec-22-2003) installed on a W2K Dell Inspiron 7500
and I am getting an error which I don't get with 4.1.1 and 4.3.4. Would like
to learn how to debug things like that. Here is a dump of Dr. Watson:

Application exception occurred:
App:  (pid=2228)
When: 1/10/2004 @ 14:51:33.711
Exception number: c005 (access violation)

* System Information *
Computer Name: DELL
User Name: Administrator
Number of Processors: 1
Processor Type: x86 Family 6 Model 8 Stepping 3
Windows 2000 Version: 5.0
Current Build: 2195
Service Pack: 4
Current Type: Uniprocessor Free
Registered Organization: SammySolutions.com ltd.
Registered Owner: Gunter Sammet

* Task List *
   0 Idle.exe
   8 System.exe
 148 smss.exe
 172 csrss.exe
 168 winlogon.exe
 220 services.exe
 232 lsass.exe
 384 svchost.exe
 436 svchost.exe
 488 spoolsv.exe
 512 ati2plab.exe
 536 ibserver.exe
 580 APACHE.exe
 708 regsvc.exe
 728 MSTask.exe
 732 APACHE.exe
 968 snmp.exe
1028 stisvc.exe
1060 vsmon.exe
1112 WinMgmt.exe
1136 svchost.exe
1164 svchost.exe
 120 Explorer.exe
1460 jusched.exe
1448 interserver.exe
1440 Atiptaxx.exe
1420 EM_EXEC.exe
1392 zapro.exe
 640 internat.exe
1512 AirPlus.exe
1520 trillian.exe
1760 mysqld-nt.exe
1796 PostCastServer..exe
1820 gcdnssrv.exe
1860 OUTLOOK.exe
 996 IEXPLORE.exe
1916 IEXPLORE.exe
1980 IEXPLORE.exe
2020 IEXPLORE.exe
2060 IEXPLORE.exe
2100 IEXPLORE.exe
2184 PHPEdit.exe
2200 DBGLIS~1.exe
2168 IEXPLORE.exe
2280 IEXPLORE.exe
2192 IEXPLORE.exe
1084 APACHE.exe
1020 APACHE.exe
2228 php.exe
1532 drwtsn32.exe
   0 _Total.exe

(0040 - 0040D000)
(77F8 - 77FFB000)
(1000 - 1015)
(7C4E - 7C599000)
(77E1 - 77E75000)
(77F4 - 77F7C000)
(7505 - 75058000)
(7503 - 75044000)
(7800 - 78045000)
(7C2D - 7C332000)
(77D3 - 77D9E000)
(7502 - 75028000)
(77A5 - 77B3C000)
(779B - 77A4B000)
(1F7C - 1F7F4000)
(76B3 - 76B6E000)
(6318 - 631E5000)
(7171 - 71794000)
(782F - 78538000)
(00CC - 00CD6000)
(6E42 - 6E426000)
(75E6 - 75E7A000)
(782C - 782CC000)
(7798 - 779A4000)
(7734 - 77353000)
(7752 - 77525000)
(7732 - 77337000)
(7515 - 7515F000)
(7517 - 751BF000)
(7C34 - 7C34F000)
(751C - 751C6000)
(7795 - 7797A000)
(773B - 773DF000)
(7738 - 773A3000)
(7783 - 7783E000)
(7788 - 7790E000)
(7C0F - 7C152000)
(774E - 77513000)
(774C - 774D1000)
(7753 - 77552000)
(7736 - 77379000)
(777E - 777E8000)
(777F - 777F5000)
(74FD - 74FEE000)
(7501 - 75017000)

State Dump for Thread Id 0x738

eax=0001 ebx=0005 ecx=0098 edx=00794010 esi=0012fd18
edi=00ce
eip=77fcc2e2 esp=0012fb0c ebp=0012fca4 iopl=0 nv up ei pl zr na po
nc
cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=
efl=0246


function: RtlAllocateHeap
77fcc2ca 51   pushecx
77fcc2cb 51   pushecx
77fcc2cc 81ec7401 sub esp,0x174
77fcc2d2 53   pushebx
77fcc2d3 56   pushesi
77fcc2d4 57   pushedi
77fcc2d5 8b7d08   mov edi,[ebp+0x8]
ss:00bd9b8a=
77fcc2d8 897da4   mov [ebp+0xa4],edi
ss:00bd9b8a=
77fcc2db 8065b800 and byte ptr [ebp+0xb8],0x0
ss:00bd9b8a=??
77fcc2df 8b450c   mov eax,[ebp+0xc]
ss:00bd9b8a=
FAULT -77fcc2e2 0b4710   or  eax,[edi+0x10]
ds:01789ee6=
77fcc2e5 89450c   mov [ebp+0xc],eax
ss:00bd9b8a=
77fcc2e8 a9600f037d   testeax,0x7d030f60
77fcc2ed 0f856aee jne _eFSQRT+0xe93 (77fcb15d)
77fcc2f3 817d100080
ss:00bd9b8a=
  cmp dword ptr [ebp+0x10],0x8000
77fcc2fa 0f835dee jnb _eFSQRT+0xe93 (77fcb15d)
77fcc300 837d1000 cmp   dword ptr [ebp+0x10],0x0
ss:00bd9b8a=
77fcc304 0f8424f8 je  RtlSizeHeap+0x228 (77fcbb2e)
77fcc30a 8b4510   mov eax,[ebp+0x10]
ss:00bd9b8a=
77fcc30d 83c00f   add eax,0xf
77fcc310 24f8 and al,0xf8
77fcc312 8945e0   mov [ebp+0xe0],eax
ss:00bd9b8a=

* Stack Back Trace *

FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
0012FCA4 100C03A2 00CE 0001 

[PHP] Re: jpeg Uploader issue

2004-01-10 Thread Manuel Vázquez Acosta
Could you give us details on: how the uploads is being made: HTTP, or FTP;
tests you have made, etc.

Manu.

Mike R [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 I am having an issue where a user with a MAC can't see jpegs uploaded to a
 web site I built.  They are getting some sort of corrupt file indicator.
 All PC users are fine from what I gather.

 I saw only one reference to this on the web in a forum, and it lead to no
 particular answer; just a few people talking about how they were all
having
 the issue.

 Anyone ever seen anything like this?

 Thanks,

 -Mike

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