Re: [PHP] error messaages - $DOXPath Wrong

2008-12-05 Thread Maciek Sokolewicz

ddg2sailor wrote:

Hi

Here are the error messages:

Warning: move_uploaded_file(C: mpp\htdocs\dox/th_dsc_076.jpg)
[function.move-uploaded-file]: failed to open stream: Invalid argument in
C:\xampp\htdocs\dox.php on line 40

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move
'C:\xampp\tmp\php2F.tmp' to 'C: mpp\htdocs\dox/th_dsc_076.jpg' in
C:\xampp\htdocs\dox.php on line 40

Warning: Cannot modify header information - headers already sent by (output
started at C:\xampp\htdocs\dox.php:40) in
C:\xampp\htdocs\include\bittorrent.php on line 478

Il make this as painless as possiable I know the third error can be
caused by a dangling white space.. this time it isnt.

This happens when a user uploads a 'dox file. Now we can download them all
we want.
The file Uploads to the right dir : 'C:\xampp\tmp\php2F.tmp' 
But when It tries to copy.. it tries to copy from this dir: C:

mpp\htdocs\dox/th_dsc_076.jpg
And tries to copy to this dir : 'C: mpp\htdocs\dox/th_dsc_076.jpg' 


the correct dirs are c:\xampp\tmp and c:\xampp\dox

//code that kicked my butt

?
require include/bittorrent.php;

dbconn(false);

loggedinorreturn();

if (get_user_class()  UC_USER)
stderr(Error , Permission denied.);

if ($_SERVER[REQUEST_METHOD] == POST)
{

$file = $_FILES['file'];

if (!$file || $file[size] == 0 || $file[name] == )
stderr(Error, Nothing received! The selected file may have been too
large. );

if (file_exists($DOXPATH/$file[name]))
stderr(Error, A file with the name .htmlspecialchars($file['name']).
already exists! );

$title = trim($_POST[title]);
if ($title == )
{
$title = substr($file[name], 0, strrpos($file[name], .));
if (!$title)
$title = $file[name];
}

$r = mysql_query(SELECT id FROM dox WHERE title= . sqlesc($title)) or
sqlesc();
if (mysql_num_rows($r)  0)
stderr(Error, A file with the title , .htmlspecialchars($title).
already exists!);

$url = $_POST[url];

if ($url != )
if (substr($url, 0, 7) != http://;  substr($url, 0, 6) != ftp://;)
stderr(Error, The URL ,  . htmlspecialchars($url) .  does not seem to
be valid.);

if (!move_uploaded_file($file[tmp_name], $DOXPATH/$file[name]))
stderr(Error, Failed to move uploaded file. You should contact an
administrator about this error.);

 [SNIP]



Sorry its so long But this thing has me beat. I was trying to cross it
with this line from another piece of code that does it fact know the right
dir with no luck:

//working code

$file = $DOXPATH/$arr[filename];

//end

Maybe its apples and oranges


Ok, first of all, stop pasting entire pages of code in here when they 
have absolutely nothing to do with the problem. An error on line x 
almost *NEVER* has anything to do with *anything* on page  41. So, 
just... don't.


Next: Unable to move
'C:\xampp\tmp\php2F.tmp' to 'C: mpp\htdocs\dox/th_dsc_076.jpg' actually 
tells you what's going wrong:
1. It can't move the file from an existing place to a place with a path 
that is invalid. C: mpp\ is an invalid path on windows. Of course you 
didn't include the definition of $DOXPath for us, but I bet it looks like:

$DOXPath = C:\xampp\htdocs\dox;
Now, you're using double quotes here (for no good reason), which means 
it interprets all escape sequences. What do we do? In the PHP docs 
lookup escape sequences: 
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double


Note that:
\x[0-9A-Fa-f]{1,2}  	 the sequence of characters matching the regular 
expression is a character in hexadecimal notation
You have an expression which is basically the same as: 
'C:'.\xa.'ampp\htdocs\dox'; where the first and last part work as you 
intended, but the second one gets replaced by the char with ordinal 10 
(which is a space. A in hexadecimal notation is 10 in decimal).


Fix your definition of it (ie. use SINGLE quotes, or double escape it to 
look like \\xa so the interpreter won't see it as a special escape 
sequence anymore.


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



Re: [PHP] Will not report errors what can I do

2008-12-05 Thread Ashley Sheridan
On Fri, 2008-12-05 at 00:00 -0500, Robert Cummings wrote:
 On Fri, 2008-12-05 at 17:44 +1300, German Geek wrote:
  On Fri, Dec 5, 2008 at 4:26 PM, Robert Cummings [EMAIL PROTECTED]
  wrote:
  On Thu, 2008-12-04 at 15:07 -0800, Jim Lucas wrote:
   Terion Miller wrote:
Hey everyone I am still fighting the same problem that my
  script isn't
working and its not reporting errors, when you click to
  view the work
order it doesn't do anything, I have all kinds of error
  reporting turned on
but nothing, do I have them syntax wrong?
   
?php
include(inc/dbconn_open.php);
error_reporting(E_ALL);
 ini_set('display_errors', '1');
  
   This is boolean, it should be ini_set('display_errors', 1);
  
  
  Isn't 1 an integer and true a boolean? ;)
  
  Anyways, what I noticed is that error reporting is enabled
  after an
  include. Maybe the system is failing during the include.
  1 and true can usually be used interchangeably in most programming
  languages because true is stored as something bigger than (or
  different to) 0 and false as 0. But it's clearer for the programmer to
  use true and false because it's clearer as what its semantics are.
  Important for computer science: The difference between syntax and
  semantics...
 
 PHP does type juggling... '1' is coerced to true just as well as 1.
 
 Cheers,
 Rob.
 
 -- 
 http://www.interjinn.com
 Application and Templating Framework for PHP
 
 
Not always the case though, hence the need for the === and !== 


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Will not report errors what can I do

2008-12-05 Thread Robert Cummings
On Fri, 2008-12-05 at 08:15 +, Ashley Sheridan wrote:
 On Fri, 2008-12-05 at 00:00 -0500, Robert Cummings wrote:
  On Fri, 2008-12-05 at 17:44 +1300, German Geek wrote:
   On Fri, Dec 5, 2008 at 4:26 PM, Robert Cummings [EMAIL PROTECTED]
   wrote:
   On Thu, 2008-12-04 at 15:07 -0800, Jim Lucas wrote:
Terion Miller wrote:
 Hey everyone I am still fighting the same problem that my
   script isn't
 working and its not reporting errors, when you click to
   view the work
 order it doesn't do anything, I have all kinds of error
   reporting turned on
 but nothing, do I have them syntax wrong?

 ?php
 include(inc/dbconn_open.php);
 error_reporting(E_ALL);
  ini_set('display_errors', '1');
   
This is boolean, it should be ini_set('display_errors', 1);
   
   
   Isn't 1 an integer and true a boolean? ;)
   
   Anyways, what I noticed is that error reporting is enabled
   after an
   include. Maybe the system is failing during the include.
   1 and true can usually be used interchangeably in most programming
   languages because true is stored as something bigger than (or
   different to) 0 and false as 0. But it's clearer for the programmer to
   use true and false because it's clearer as what its semantics are.
   Important for computer science: The difference between syntax and
   semantics...
  
  PHP does type juggling... '1' is coerced to true just as well as 1.
  
  Cheers,
  Rob.
  
  -- 
  http://www.interjinn.com
  Application and Templating Framework for PHP
  
  
 Not always the case though, hence the need for the === and !== 

No, PHP will happily coerce as needed... the === and !== operators are
for when you want to distinguish the type-- if you want to distinguish
the type, then you probably aren't relying on automatic type conversion.
The comment was that a boolean should be used instead of '1', but then
an integer was provided instead of a boolean. As such, an automatic
conversion still happens with the same outcome. I would imagine though,
that since this function works with the ini type data, it would mirror
what one would expect from the php.ini itself... namely, it probably
handles string values appropriately.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] IE8 and HTML5

2008-12-05 Thread Per Jessen
Benjamin Hawkes-Lewis wrote:

 Everyone has their favorite unstandardized feature they'd love IE to
 support. (Personally I'd be delighted by -ms-border-radius and
 content:uri() support.)

Nope, I don't have a single one.


/Per Jessen, Zürich


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



Re: [PHP] PHP - Jasper Report Integeration

2008-12-05 Thread Johny John
Hi Chris,
Sorry few days back also I posted the same request. But it did not shown up
in my mailing list. That's why I posted it again thinking that my previous
email did not reach. Sorry for the trouble.



On Fri, Dec 5, 2008 at 11:52 AM, Chris [EMAIL PROTECTED] wrote:

 Johny John wrote:

 Dear All,

 Do any one know how to integrate PHP with Jasper Reports. I tried it..but
 its says Unable to create Java Virtual Machine 
 Please refer this link for more details.
 http://jagadmaya.com/integration-phpjasperreports.html


 asking the same things multiple times will not help you get an answer..

 maybe ask the author for help?

 --
 Postgresql  php tutorials
 http://www.designmagick.com/




-- 
Regards,
Johny
www.phpshore.com


Re: [PHP] IE8 and HTML5

2008-12-05 Thread Richard Heyes
Hi,

a client reported problems with a web app
 written by me with IE8.

Why on earth would you support a beta browser?

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

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



[PHP] Comments in excel

2008-12-05 Thread Erfan Shirazi

Hi,
I use the excel spreadsheet writer to export some info to an excel file. 
When I insert some note with writeNote(), the note/comment works well in 
open office, but if I open it with ms excel 2003, the note/comment can 
not show all, just a few lines of the note/comment instead of the whole 
content.


Does anyone know how to show the note/comment completely in ms excel 
2003 when I put mouse over it, instead of just show a couple of lines? 
It can show the complete note/comment in open office.


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



RE: [PHP] Help with IF ELSE

2008-12-05 Thread David Stoltz
I turned on error reporting (ALL) as you suggested. Nothing is being
sent to the browserstill doesn't work if the recordset isn't empty.

I'm wondering, is there any other way to do a redirect in PHP?

Thanks


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Richard Heyes
Sent: Thursday, December 04, 2008 3:17 PM
To: David Stoltz
Cc: php-general@lists.php.net
Subject: Re: [PHP] Help with IF ELSE

 I'm new to PHP - I'm trying to figure out what is wrong with a simple
IF
 ELSE block I have...if the recordset $rs is empty (login fails), the
1st
 part of the block works, and redirects the user to default.php - but
if
 the login works, and $rs is not empty, the 2nd else part does not
 work, and does not redirect to menu.php - I just get  a blank white
 screen on the login.php page (where this code is)

You could try setting error_reporting() to full before you do
anything, it may help, and it's always prudent to use it that way:

?php
error_reporting(E_ALL);
?

Additionally, redirects fail when you've sent output to the browser,
even if its just whitespace. Your code looks OK, but check for it. The
error reporting thang may help you with that.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

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



Re: [PHP] Help with IF ELSE

2008-12-05 Thread HostWare Kft.
You should check if php.ini has display_error off. This can prevent all 
error message to be shown.


SanTa

- Original Message - 
From: David Stoltz [EMAIL PROTECTED]

To: Richard Heyes [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, December 05, 2008 12:42 PM
Subject: RE: [PHP] Help with IF ELSE


I turned on error reporting (ALL) as you suggested. Nothing is being
sent to the browserstill doesn't work if the recordset isn't empty.

I'm wondering, is there any other way to do a redirect in PHP?

Thanks


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Richard Heyes
Sent: Thursday, December 04, 2008 3:17 PM
To: David Stoltz
Cc: php-general@lists.php.net
Subject: Re: [PHP] Help with IF ELSE


I'm new to PHP - I'm trying to figure out what is wrong with a simple

IF

ELSE block I have...if the recordset $rs is empty (login fails), the

1st

part of the block works, and redirects the user to default.php - but

if

the login works, and $rs is not empty, the 2nd else part does not
work, and does not redirect to menu.php - I just get  a blank white
screen on the login.php page (where this code is)


You could try setting error_reporting() to full before you do
anything, it may help, and it's always prudent to use it that way:

?php
   error_reporting(E_ALL);
?

Additionally, redirects fail when you've sent output to the browser,
even if its just whitespace. Your code looks OK, but check for it. The
error reporting thang may help you with that.

--
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

--
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] Help with IF ELSE

2008-12-05 Thread David Stoltz
The problem turned out to be, since I'm using the MCRYPT function to encrypt 
the password, once in a while the encrypted password will have a bad character:

ßt¦?rDþž’Q…ß±–

For example, the above has ’

This stops the PHP processing cold when executing the query to insert that 
string - no errors at all - just stops processing - and I do have 
display_errors turned on.

So then, how does one store this type of string? I can't do a string 
replacebut there must be a way...

If anyone has come across this, please let me know...

Thanks!

-Original Message-
From: Sándor Tamás (HostWare Kft.) [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 05, 2008 6:59 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Help with IF ELSE

You should check if php.ini has display_error off. This can prevent all 
error message to be shown.

SanTa

- Original Message - 
From: David Stoltz [EMAIL PROTECTED]
To: Richard Heyes [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, December 05, 2008 12:42 PM
Subject: RE: [PHP] Help with IF ELSE


I turned on error reporting (ALL) as you suggested. Nothing is being
sent to the browserstill doesn't work if the recordset isn't empty.

I'm wondering, is there any other way to do a redirect in PHP?

Thanks


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Richard Heyes
Sent: Thursday, December 04, 2008 3:17 PM
To: David Stoltz
Cc: php-general@lists.php.net
Subject: Re: [PHP] Help with IF ELSE

 I'm new to PHP - I'm trying to figure out what is wrong with a simple
IF
 ELSE block I have...if the recordset $rs is empty (login fails), the
1st
 part of the block works, and redirects the user to default.php - but
if
 the login works, and $rs is not empty, the 2nd else part does not
 work, and does not redirect to menu.php - I just get  a blank white
 screen on the login.php page (where this code is)

You could try setting error_reporting() to full before you do
anything, it may help, and it's always prudent to use it that way:

?php
error_reporting(E_ALL);
?

Additionally, redirects fail when you've sent output to the browser,
even if its just whitespace. Your code looks OK, but check for it. The
error reporting thang may help you with that.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

-- 
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] Help with IF ELSE

2008-12-05 Thread HostWare Kft.

For your original problem:

If you're unsure if you've sent something to the browser BEFORE the 
header(), you should check it with header_sent(). This function returns true 
if something has been sent to the browser.


SanTa

- Original Message - 
From: David Stoltz [EMAIL PROTECTED]

To: Richard Heyes [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, December 05, 2008 12:42 PM
Subject: RE: [PHP] Help with IF ELSE


I turned on error reporting (ALL) as you suggested. Nothing is being
sent to the browserstill doesn't work if the recordset isn't empty.

I'm wondering, is there any other way to do a redirect in PHP?

Thanks


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Richard Heyes
Sent: Thursday, December 04, 2008 3:17 PM
To: David Stoltz
Cc: php-general@lists.php.net
Subject: Re: [PHP] Help with IF ELSE


I'm new to PHP - I'm trying to figure out what is wrong with a simple

IF

ELSE block I have...if the recordset $rs is empty (login fails), the

1st

part of the block works, and redirects the user to default.php - but

if

the login works, and $rs is not empty, the 2nd else part does not
work, and does not redirect to menu.php - I just get  a blank white
screen on the login.php page (where this code is)


You could try setting error_reporting() to full before you do
anything, it may help, and it's always prudent to use it that way:

?php
   error_reporting(E_ALL);
?

Additionally, redirects fail when you've sent output to the browser,
even if its just whitespace. Your code looks OK, but check for it. The
error reporting thang may help you with that.

--
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

--
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] Help with IF ELSE

2008-12-05 Thread HostWare Kft.
The solution is addslashes(). This function adds a backslash before special 
characters in a string.


http://php.net/manual/en/function.addslashes.php

SanTa

- Original Message - 
From: David Stoltz [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Friday, December 05, 2008 1:19 PM
Subject: RE: [PHP] Help with IF ELSE


The problem turned out to be, since I'm using the MCRYPT function to 
encrypt the password, once in a while the encrypted password will have a 
bad character:


ßt¦?rDþž’Q…ß±–

For example, the above has ’

This stops the PHP processing cold when executing the query to insert that 
string - no errors at all - just stops processing - and I do have 
display_errors turned on.


So then, how does one store this type of string? I can't do a string 
replacebut there must be a way...


If anyone has come across this, please let me know...

Thanks!

-Original Message-
From: Sándor Tamás (HostWare Kft.) [mailto:[EMAIL PROTECTED]
Sent: Friday, December 05, 2008 6:59 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Help with IF ELSE

You should check if php.ini has display_error off. This can prevent all
error message to be shown.

SanTa

- Original Message - 
From: David Stoltz [EMAIL PROTECTED]

To: Richard Heyes [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, December 05, 2008 12:42 PM
Subject: RE: [PHP] Help with IF ELSE


I turned on error reporting (ALL) as you suggested. Nothing is being
sent to the browserstill doesn't work if the recordset isn't empty.

I'm wondering, is there any other way to do a redirect in PHP?

Thanks


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Richard Heyes
Sent: Thursday, December 04, 2008 3:17 PM
To: David Stoltz
Cc: php-general@lists.php.net
Subject: Re: [PHP] Help with IF ELSE


I'm new to PHP - I'm trying to figure out what is wrong with a simple

IF

ELSE block I have...if the recordset $rs is empty (login fails), the

1st

part of the block works, and redirects the user to default.php - but

if

the login works, and $rs is not empty, the 2nd else part does not
work, and does not redirect to menu.php - I just get  a blank white
screen on the login.php page (where this code is)


You could try setting error_reporting() to full before you do
anything, it may help, and it's always prudent to use it that way:

?php
   error_reporting(E_ALL);
?

Additionally, redirects fail when you've sent output to the browser,
even if its just whitespace. Your code looks OK, but check for it. The
error reporting thang may help you with that.

--
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 29th)

--
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



RE: [PHP] Help with IF ELSE

2008-12-05 Thread David Stoltz
WOO HOO - addslashes baby!

Thank you!

-Original Message-
From: Sándor Tamás (HostWare Kft.) [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 05, 2008 7:26 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Help with IF ELSE

The solution is addslashes(). This function adds a backslash before special 
characters in a string.

http://php.net/manual/en/function.addslashes.php

SanTa

- Original Message - 
From: David Stoltz [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Friday, December 05, 2008 1:19 PM
Subject: RE: [PHP] Help with IF ELSE


 The problem turned out to be, since I'm using the MCRYPT function to 
 encrypt the password, once in a while the encrypted password will have a 
 bad character:

 ßt¦?rDþž’Q…ß±–

 For example, the above has ’

 This stops the PHP processing cold when executing the query to insert that 
 string - no errors at all - just stops processing - and I do have 
 display_errors turned on.

 So then, how does one store this type of string? I can't do a string 
 replacebut there must be a way...

 If anyone has come across this, please let me know...

 Thanks!

 -Original Message-
 From: Sándor Tamás (HostWare Kft.) [mailto:[EMAIL PROTECTED]
 Sent: Friday, December 05, 2008 6:59 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Help with IF ELSE

 You should check if php.ini has display_error off. This can prevent all
 error message to be shown.

 SanTa

 - Original Message - 
 From: David Stoltz [EMAIL PROTECTED]
 To: Richard Heyes [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Friday, December 05, 2008 12:42 PM
 Subject: RE: [PHP] Help with IF ELSE


 I turned on error reporting (ALL) as you suggested. Nothing is being
 sent to the browserstill doesn't work if the recordset isn't empty.

 I'm wondering, is there any other way to do a redirect in PHP?

 Thanks


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
 Of Richard Heyes
 Sent: Thursday, December 04, 2008 3:17 PM
 To: David Stoltz
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Help with IF ELSE

 I'm new to PHP - I'm trying to figure out what is wrong with a simple
 IF
 ELSE block I have...if the recordset $rs is empty (login fails), the
 1st
 part of the block works, and redirects the user to default.php - but
 if
 the login works, and $rs is not empty, the 2nd else part does not
 work, and does not redirect to menu.php - I just get  a blank white
 screen on the login.php page (where this code is)

 You could try setting error_reporting() to full before you do
 anything, it may help, and it's always prudent to use it that way:

 ?php
error_reporting(E_ALL);
 ?

 Additionally, redirects fail when you've sent output to the browser,
 even if its just whitespace. Your code looks OK, but check for it. The
 error reporting thang may help you with that.

 -- 
 Richard Heyes

 HTML5 Graphing for FF, Chrome, Opera and Safari:
 http://www.rgraph.org (Updated November 29th)

 -- 
 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



Re: [PHP] syntax error (stumped)

2008-12-05 Thread Daniel Brown
On Fri, Dec 5, 2008 at 1:31 AM, ddg2sailor [EMAIL PROTECTED] wrote:

 Its begining to look like this code was written for a newer sql
[snip!]

Negative.  It's either a custom function or was written
incorrectly in the first place.  There's never been a native PHP
function `do_mysql_query`, nor was there an `sqlerr` function.
Instead:

?php
mysql_query($sql) or die(mysql_error());
?

 would do the trick.

 Thats all she wrote... instead of do_mysql_query , mysql_query instead.
 Thanks for all your help.. I do however have another issue.. but thats
 another thread.

Good deal.  Glad it's working.

-- 
/Daniel P. Brown
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
50% Off Hosting! http://www.pilotpig.net/specials.php

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



Re: [PHP] Will not report errors what can I do

2008-12-05 Thread tedd

At 3:07 PM -0800 12/4/08, Jim Lucas wrote:

Terion Miller wrote:

 

 $query = SELECT ViewAllWorkOrders FROM admin WHERE AdminID='$AdminID';
 $result = mysql_query ($query);


Not the best solution, but add this to the above line...

$result = mysql_query ($query) or die(mysql_error());


Agreed.

I go even a bit further, like so:

$result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__));

//  to show dB errors  ==

function report($query, $line, $file)
   {
   echo($query . 'br' .$line . 'br/' . $file . 'br/' . mysql_error());
   }

This does two things: 1) It tells where the error took place 
(line/file); 2) and it provides a single place in my entire project 
to turn-off dB error reporting -- all I have to do is comment out a 
single line.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] Help with IF ELSE

2008-12-05 Thread tedd

At 7:19 AM -0500 12/5/08, David Stoltz wrote:
The problem turned out to be, since I'm using the MCRYPT function to 
encrypt the password, once in a while the encrypted password will 
have a bad character:

--snip--


So then, how does one store this type of string? I can't do a string 
replacebut there must be a way...


I use md5() -- it works great for passwords and I don't have that 
type of problem.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] IE8 and HTML5

2008-12-05 Thread Andrew Ballard
On Fri, Dec 5, 2008 at 5:03 AM, Richard Heyes [EMAIL PROTECTED] wrote:
 Hi,

a client reported problems with a web app
 written by me with IE8.

 Why on earth would you support a beta browser?

 --
 Richard Heyes


Agreed. Test your site in the beta if you have time so you can
anticipate (and hopefully plan fixes for) issues that will need
attention when the official version is released, but supporting a beta
often causes you to chase problems that MAY be resolved in the
official release. Or, in some cases, the final release could have a
whole different batch of problems than the beta. :-)

Andrew

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



Re: [PHP] How to fetch .DOC or .DOCX file in php

2008-12-05 Thread tedd

At 10:59 AM -0800 12/4/08, Jim Lucas wrote:

Ah, not true about the MS requirement.  If all you want is the clear/clean
text (without any formatting), then I can do it with php on any platform.

If this is what is needed, here is the code to do it.

?php

-snip- code

?

Hope this helps.
--
Jim Lucas



Jim:

Most excellent code!

I was considering a way for clients to post directly from MS word 
into a form requiring text-only. No matter how many times I tell them 
text only they keep cut-pasting directly from a formatted Word 
document and wondering Where did those characters come from?


Thanks,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] How to fetch .DOC or .DOCX file in php

2008-12-05 Thread tedd

At 6:39 PM -0600 12/4/08, Shawn McKenzie wrote:

Jim Lucas wrote:

  Hope this helps.


 I am working on a set of php classes that will be able to read the 
text with the formatting included and convert it to a standard 
document format.

 The standard format that it will end up in has yet


has yet...  what?

Are you O.K. Jim?  Did you die while writing this?



If he did, at least we got the code.  :-)

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] How to fetch .DOC or .DOCX file in php

2008-12-05 Thread tedd

At 7:35 PM -0800 12/4/08, Jim Lucas wrote:
A question to all then.  How would you like to see the text, with 
formating, stored?


All suggestions welcome!

--
Jim Lucas



Jim:

What's wrong with .txt?

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Help with IF ELSE

2008-12-05 Thread Andrew Ballard
 - Original Message - From: David Stoltz [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Friday, December 05, 2008 1:19 PM
 Subject: RE: [PHP] Help with IF ELSE


 The problem turned out to be, since I'm using the MCRYPT function to
 encrypt the password, once in a while the encrypted password will have a bad
 character:

 ßt¦?rDþž' Q…ß±–

 For example, the above has '

 This stops the PHP processing cold when executing the query to insert that
 string - no errors at all - just stops processing - and I do have
 display_errors turned on.

 So then, how does one store this type of string? I can't do a string
 replacebut there must be a way...

 If anyone has come across this, please let me know...

 Thanks!

On Fri, Dec 5, 2008 at 7:25 AM, Sándor Tamás (HostWare Kft. )
[EMAIL PROTECTED] wrote:
 The solution is addslashes(). This function adds a backslash before special
 characters in a string.

 http://php.net/manual/en/function.addslashes.php

 SanTa


No, the solution would be mysql_real_escape_string(), or equivalent if
using another database engine. However, in this case since you are
encrypting the value (and since many encryptions return binary data)
you could either hexdec() or base64encode() the value as well.

Andrew


Re: [PHP] Help with IF ELSE

2008-12-05 Thread Andrew Ballard
On Fri, Dec 5, 2008 at 6:42 AM, David Stoltz [EMAIL PROTECTED] wrote:
 I turned on error reporting (ALL) as you suggested. Nothing is being
 sent to the browserstill doesn't work if the recordset isn't empty.

 I'm wondering, is there any other way to do a redirect in PHP?

 Thanks


That is how you do redirects in PHP. I believe you've got several
solutions to your actual problem by now (I like tedd's with either md5
or sha1), but since you asked...

There is a note in the documentation for header() that says HTTP/1.1
requires absolute URIs instead of relative ones as those in your
example.

You can also pass the response code in the third parameter (in which
case you can use the 303 SEE OTHER code that was intended for the
typical redirect rather than the 302 FOUND that most sites use), but
it isn' t necessary since PHP automatically sets a 302 on a Location:
header when the parameter is empty.

http://www.php.net/header

Andrew

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



Re: [PHP] Help with IF ELSE

2008-12-05 Thread HostWare Kft.
In fact, if I have to redirect, and I am not sure about headers are sent or 
not, I usually do:


print('SCRIPTwindow.location=somewhere.php/SCRIPT');

That way I can always do the redirection.

SanTa

- Original Message - 
From: Andrew Ballard [EMAIL PROTECTED]

To: David Stoltz [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, December 05, 2008 3:52 PM
Subject: Re: [PHP] Help with IF ELSE



On Fri, Dec 5, 2008 at 6:42 AM, David Stoltz [EMAIL PROTECTED] wrote:

I turned on error reporting (ALL) as you suggested. Nothing is being
sent to the browserstill doesn't work if the recordset isn't empty.

I'm wondering, is there any other way to do a redirect in PHP?

Thanks



That is how you do redirects in PHP. I believe you've got several
solutions to your actual problem by now (I like tedd's with either md5
or sha1), but since you asked...

There is a note in the documentation for header() that says HTTP/1.1
requires absolute URIs instead of relative ones as those in your
example.

You can also pass the response code in the third parameter (in which
case you can use the 303 SEE OTHER code that was intended for the
typical redirect rather than the 302 FOUND that most sites use), but
it isn' t necessary since PHP automatically sets a 302 on a Location:
header when the parameter is empty.

http://www.php.net/header

Andrew

--
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] How to fetch .DOC or .DOCX file in php

2008-12-05 Thread Andrew Ballard
On Thu, Dec 4, 2008 at 10:35 PM, Jim Lucas [EMAIL PROTECTED] wrote:
 I was going to say that I haven't yet decided on what the final output format 
 is going to be.  Probably either rtf or OpenXML.

 How about I ask for suggestions on what would be the best format to store the 
 final copy.

 I figured that this tool would mainly be used for .doc to web conversion, but 
 I guess it could be used to also convert to other document formats too.

 But, I would like to have the ability to at least store the formating inline 
 with the text.  So, either some form of xml.  Be it (x)HTML or plain XML
 or even OpenXML.

 A question to all then.  How would you like to see the text, with formating, 
 stored?

 All suggestions welcome!

 --
 Jim Lucas


It's an excellent start. It pulled in some additional control
characters in some of the documents I tried, and some documents had
extra stuff at the end of the document. It was still text, but it
looked like the text from the page header/footer definitions. It would
be cool to see this polished and released. I just wish there was
something this basic that worked this well on PDF files! :-)

Andrew

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



RE: [PHP] Help with IF ELSE

2008-12-05 Thread ceo

Please do NOT use addslashes.



Replace it with this:

http://php.net/mysql_real_escape_string



It is CRUCIAL if your database might maybe ever consider going international 
and having charset other than ISO-8856-1 or Latin1



[or the MySQL default of Monty's native language, which is very very very close 
to Latin1, but not quite]



Even if you know you'll never ever need a different charset, it's just best 
practice to use the DB-supplied escape function, rather than Rasmus' quick 
(and very needed) nineteen-ninety-mumble hack.



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



RE: [PHP] Help with IF ELSE

2008-12-05 Thread Chrome


 -Original Message-
 From: Sándor Tamás (HostWare Kft.) [mailto:[EMAIL PROTECTED]
 Sent: 05 December 2008 14:58
 To: php-general@lists.php.net
 Subject: Re: [PHP] Help with IF ELSE
 
 In fact, if I have to redirect, and I am not sure about headers are
 sent or
 not, I usually do:
 
 print('SCRIPTwindow.location=somewhere.php/SCRIPT');
 
 That way I can always do the redirection.

I always use this little function for redirects

function redirect($url) { // redirect the page
   if (headers_sent()) { // perform JS redirect
  echo 'script type=text/javascript language=javascript';
  echo \n!-- \n\tdocument.location.href=' . $url . '; \n// 
--\n/script\n;
  echo 'a href=' . $url . 'Continue to your page/a';
   } else { // normal redirect
  header('location: ' . $url);
  die();
   }
}

This just outputs a JS call to a redirect if headers have already been sent and 
provides a link if the user has disabled JS (some do)

Also it should be XHTML compliant

Dan

 SanTa
 
 - Original Message -
 From: Andrew Ballard [EMAIL PROTECTED]
 To: David Stoltz [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Friday, December 05, 2008 3:52 PM
 Subject: Re: [PHP] Help with IF ELSE
 
 
  On Fri, Dec 5, 2008 at 6:42 AM, David Stoltz [EMAIL PROTECTED] wrote:
  I turned on error reporting (ALL) as you suggested. Nothing is being
  sent to the browserstill doesn't work if the recordset isn't
 empty.
 
  I'm wondering, is there any other way to do a redirect in PHP?
 
  Thanks
 
 
  That is how you do redirects in PHP. I believe you've got several
  solutions to your actual problem by now (I like tedd's with either
 md5
  or sha1), but since you asked...
 
  There is a note in the documentation for header() that says HTTP/1.1
  requires absolute URIs instead of relative ones as those in your
  example.
 
  You can also pass the response code in the third parameter (in which
  case you can use the 303 SEE OTHER code that was intended for the
  typical redirect rather than the 302 FOUND that most sites use), but
  it isn' t necessary since PHP automatically sets a 302 on a Location:
  header when the parameter is empty.
 
  http://www.php.net/header
 
  Andrew
 
  --
  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



Re: [PHP] Will not report errors what can I do

2008-12-05 Thread ceo

 $result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__));

 

 //  to show dB errors  ==

 

 function report($query, $line, $file)

 {

echo($query . 'br' .$line . 'br/' . $file . 'br/' . 

 mysql_error());

}

 

 This does two things: 1) It tells where the error took place

 (line/file); 2) and it provides a single place in my entire project to

 turn-off dB error reporting -- all I have to do is comment out a single

 line.



I did this, briefly, but got tired of typing __LINE__, __FILE__ so much.



define('ERROR_VERBOSE', 0);

function error_handler($level, $messsage, $file, $line, $context){

  error_log($file:$line - $message);

  if (ERROR_VERBOSE){

foreach($context as $k=$v){

  error_log($k: $v);

}

  }

  switch($level){

case E_USER_ERROR:

case E_USER_WARNING:

case E_USER_NOTICE:

case E_WARNING:

case E_NOTICE:

   //do nothing

break;

case E_ERROR:

  exit;

break;

default:

  error_log(PHP Devs invented a new error level:?  . $level);

break;

  }

}

set_error_handler('error_handler');

$f = mysql_query($sql) or trigger_error(mysqli_error($connection));



This generalizes it to not be just about DB errors, but ANY php error.



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



Re: [PHP] Will not report errors what can I do

2008-12-05 Thread tedd

At 3:19 PM + 12/5/08, [EMAIL PROTECTED] wrote:

  $result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__));


 //  to show dB errors  ==

 function report($query, $line, $file)
 {
echo($query . 'br' .$line . 'br/' . $file . 'br/' .
 mysql_error());
}

 This does two things: 1) It tells where the error took place
 (line/file); 2) and it provides a single place in my entire project to
 turn-off dB error reporting -- all I have to do is comment out a single
 line.


I did this, briefly, but got tired of typing __LINE__, __FILE__ so much.



That's what I call common code -- I type it once and after that it's 
all cut/paste.


I have entire libraries of routines that I've used before -- I just 
cut/paste them into the new stuff as needed. Even many of the 
variable names remain the same so it becomes more a job of assembly 
more than typing.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Help with IF ELSE

2008-12-05 Thread Bastien Koert
On Fri, Dec 5, 2008 at 9:17 AM, tedd [EMAIL PROTECTED] wrote:

 At 7:19 AM -0500 12/5/08, David Stoltz wrote:

 The problem turned out to be, since I'm using the MCRYPT function to
 encrypt the password, once in a while the encrypted password will have a bad
 character:

 --snip--


 So then, how does one store this type of string? I can't do a string
 replacebut there must be a way...


 I use md5() -- it works great for passwords and I don't have that type of
 problem.

 Cheers,

 tedd

 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

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


One option is to base64encode it before sticking it in the db and then doing
a base64decode upon retreival.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] How to fetch .DOC or .DOCX file in php

2008-12-05 Thread Jim Lucas
Andrew Ballard wrote:
 On Thu, Dec 4, 2008 at 10:35 PM, Jim Lucas [EMAIL PROTECTED] wrote:
 I was going to say that I haven't yet decided on what the final output 
 format is going to be.  Probably either rtf or OpenXML.

 How about I ask for suggestions on what would be the best format to store 
 the final copy.

 I figured that this tool would mainly be used for .doc to web conversion, 
 but I guess it could be used to also convert to other document formats too.

 But, I would like to have the ability to at least store the formating inline 
 with the text.  So, either some form of xml.  Be it (x)HTML or plain XML
 or even OpenXML.

 A question to all then.  How would you like to see the text, with formating, 
 stored?

 All suggestions welcome!

 --
 Jim Lucas

 
 It's an excellent start. It pulled in some additional control
 characters in some of the documents I tried, and some documents had
 extra stuff at the end of the document. It was still text, but it
 looked like the text from the page header/footer definitions. It would
 be cool to see this polished and released. I just wish there was
 something this basic that worked this well on PDF files! :-)
 
 Andrew
 

Ah, a part that I hadn't yet thought about checking to see if they would have 
been included.  Like I said, this is just the starting spot.

I will continue hacking at this thing.  Hopefully something good will come of 
it... :)

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] How to fetch .DOC or .DOCX file in php

2008-12-05 Thread Eric Butera
On Thu, Dec 4, 2008 at 10:35 PM, Jim Lucas [EMAIL PROTECTED] wrote:
 Shawn McKenzie wrote:
 Jim Lucas wrote:
 Boyd, Todd M. wrote:
 -Original Message-
 From: Jagdeep Singh [mailto:[EMAIL PROTECTED]
 Sent: Thursday, December 04, 2008 8:39 AM
 To: php-general@lists.php.net
 Subject: [PHP] How to fetch .DOC or .DOCX file in php
 Importance: Low

 Hi !

 I want to fetch text from .doc / .docx file and save it into database
 file.
 But when  I tried to fetch text with fopen/fgets etc ... It gave me
 special
 characters with text.

 (With .txt files everything is fine)
 Only problem is with doc/docx files.
 I dont know whow to remove SPECIAL CHARACTERS from this text ...
 A.) This has been handled on this list several times. Please search the
 archives before posting a question.
 B.) Did you even TRY to Google for this? In the first 5 matches for php
 open ms word I found this:

 http://www.developertutorials.com/blog/php/extracting-text-from-word-doc
 uments-via-php-and-com-81/

 You will need an MS Windows machine for this solution to work. If you're
 using *nix... well... good luck.


 // Todd

 Ah, not true about the MS requirement.  If all you want is the clear/clean
 text (without any formatting), then I can do it with php on any platform.

 If this is what is needed, here is the code to do it.

 ?php

 $filename = './12345.doc';
 if ( file_exists($filename) ) {

  if ( ($fh = fopen($filename, 'r')) !== false ) {

  $headers = fread($fh, 0xA00);

  # 1 = (ord(n)*1) ; Document has from 0 to 255 characters
  $n1 = ( ord($headers[0x21C]) - 1 );

  # 1 = ((ord(n)-8)*256) ; Document has from 256 to 63743 
 characters
  $n2 =   ( ( ord($headers[0x21D]) - 8 ) * 256 );

  # 1 = ((ord(n)*256)*256) ; Document has from 63744 to 16775423 
 characters
  $n3 =   ( ( ord($headers[0x21E]) * 256 ) * 256 );

  # (((ord(n)*256)*256)*256) ; Document has from 16775424 to 
 4294965504 characters
  $n4 = ( ( ( ord($headers[0x21F]) * 256 ) * 256 ) * 256 );

  # Total length of text in the document
  $textLength = ($n1 + $n2 + $n3 + $n4);

  $extracted_plaintext = fread($fh, $textLength);

  # if you want the plain text with no formatting, do this
  echo $extracted_plaintext;

  # if you want to see your paragraphs in a web page, do this
  echo nl2br($extracted_plaintext);

  }

 }

 ?

 Hope this helps.

 I am working on a set of php classes that will be able to read the text 
 with the formatting included and convert it to a standard document format.
 The standard format that it will end up in has yet

   has yet...  what?

 Are you O.K. Jim?  Did you die while writing this?


 Sorry, still kickin'

 I was going to say that I haven't yet decided on what the final output format 
 is going to be.  Probably either rtf or OpenXML.

 How about I ask for suggestions on what would be the best format to store the 
 final copy.

 I figured that this tool would mainly be used for .doc to web conversion, but 
 I guess it could be used to also convert to other document formats too.

 But, I would like to have the ability to at least store the formating inline 
 with the text.  So, either some form of xml.  Be it (x)HTML or plain XML
 or even OpenXML.

 A question to all then.  How would you like to see the text, with formating, 
 stored?

 All suggestions welcome!

 --
 Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

 Twelfth Night, Act II, Scene V
by William Shakespeare

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



Is there a way to make it so that additional output renderers could be
created?  I'd lean towards xml though, since that can be parsed fairly
easily.

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



RE: [PHP] error messaages - $DOXPath Wrong

2008-12-05 Thread Boyd, Todd M.
 -Original Message-
 From: Maciek Sokolewicz [mailto:[EMAIL PROTECTED]
 Sent: Friday, December 05, 2008 2:07 AM
 To: php-general@lists.php.net; [EMAIL PROTECTED]
 Subject: Re: [PHP] error messaages - $DOXPath Wrong
 
 ddg2sailor wrote:
  Hi
 
  Here are the error messages:
 
  Warning: move_uploaded_file(C: mpp\htdocs\dox/th_dsc_076.jpg)
  [function.move-uploaded-file]: failed to open stream: Invalid
 argument in
  C:\xampp\htdocs\dox.php on line 40
 
  Warning: move_uploaded_file() [function.move-uploaded-file]: Unable
 to move
  'C:\xampp\tmp\php2F.tmp' to 'C: mpp\htdocs\dox/th_dsc_076.jpg' in
  C:\xampp\htdocs\dox.php on line 40
 
  Warning: Cannot modify header information - headers already sent by
 (output
  started at C:\xampp\htdocs\dox.php:40) in
  C:\xampp\htdocs\include\bittorrent.php on line 478
 
  Il make this as painless as possiable I know the third error can
 be
  caused by a dangling white space.. this time it isnt.
 
  This happens when a user uploads a 'dox file. Now we can download
 them all
  we want.
  The file Uploads to the right dir : 'C:\xampp\tmp\php2F.tmp'
  But when It tries to copy.. it tries to copy from this dir: C:
  mpp\htdocs\dox/th_dsc_076.jpg
  And tries to copy to this dir : 'C: mpp\htdocs\dox/th_dsc_076.jpg'
 
  the correct dirs are c:\xampp\tmp and c:\xampp\dox
 
  //code that kicked my butt
 
  ?
  require include/bittorrent.php;
 
  dbconn(false);
 
  loggedinorreturn();
 
  if (get_user_class()  UC_USER)
  stderr(Error , Permission denied.);
 
  if ($_SERVER[REQUEST_METHOD] == POST)
  {
 
  $file = $_FILES['file'];
 
  if (!$file || $file[size] == 0 || $file[name] == )
  stderr(Error, Nothing received! The selected file may have been
 too
  large. );
 
  if (file_exists($DOXPATH/$file[name]))
  stderr(Error, A file with the name
 .htmlspecialchars($file['name']).
  already exists! );
 
  $title = trim($_POST[title]);
  if ($title == )
  {
  $title = substr($file[name], 0, strrpos($file[name], .));
  if (!$title)
  $title = $file[name];
  }
 
  $r = mysql_query(SELECT id FROM dox WHERE title= . sqlesc($title))
 or
  sqlesc();
  if (mysql_num_rows($r)  0)
  stderr(Error, A file with the title ,
 .htmlspecialchars($title).
  already exists!);
 
  $url = $_POST[url];
 
  if ($url != )
  if (substr($url, 0, 7) != http://;  substr($url, 0, 6) !=
 ftp://;)
  stderr(Error, The URL ,  . htmlspecialchars($url) .  does not
 seem to
  be valid.);
 
  if (!move_uploaded_file($file[tmp_name], $DOXPATH/$file[name]))
  stderr(Error, Failed to move uploaded file. You should contact an
  administrator about this error.);
   [SNIP]
 
 
  Sorry its so long But this thing has me beat. I was trying to
 cross it
  with this line from another piece of code that does it fact know the
 right
  dir with no luck:
 
  //working code
 
  $file = $DOXPATH/$arr[filename];
 
  //end
 
  Maybe its apples and oranges
 
 Ok, first of all, stop pasting entire pages of code in here when they
 have absolutely nothing to do with the problem. An error on line x
 almost *NEVER* has anything to do with *anything* on page  41. So,
 just... don't.
 
 Next: Unable to move
 'C:\xampp\tmp\php2F.tmp' to 'C: mpp\htdocs\dox/th_dsc_076.jpg'
 actually
 tells you what's going wrong:
 1. It can't move the file from an existing place to a place with a
path
 that is invalid. C: mpp\ is an invalid path on windows. Of course
you
 didn't include the definition of $DOXPath for us, but I bet it looks
 like:
 $DOXPath = C:\xampp\htdocs\dox;
 Now, you're using double quotes here (for no good reason), which means
 it interprets all escape sequences. What do we do? In the PHP docs
 lookup escape sequences:

http://www.php.net/manual/en/language.types.string.php#language.types.s
 tring.syntax.double
 
 Note that:
 \x[0-9A-Fa-f]{1,2} the sequence of characters matching the
 regular
 expression is a character in hexadecimal notation
 You have an expression which is basically the same as:
 'C:'.\xa.'ampp\htdocs\dox'; where the first and last part work as
you
 intended, but the second one gets replaced by the char with ordinal 10
 (which is a space. A in hexadecimal notation is 10 in decimal).
 
 Fix your definition of it (ie. use SINGLE quotes, or double escape it
 to
 look like \\xa so the interpreter won't see it as a special escape
 sequence anymore.

Lots of good points there. I think it's also worth mentioning that
mixing back slashes in file paths with forward slashes is a terrible,
terrible idea. Pick one and stick with it. To be honest, I'm not even
sure Windows-branded PHP is capable of dissecting a local file system
address when it uses forward slashes.

So.. yes, the \xa is being turned into hexadecimal garbage... but if you
continue to have errors after replacing it with \\xa (and doubling up
all of the other back slashes in your paths), try:

C:\\xampp\\htdocs\\dox\\th_dsc_076.jpg

Instead of

C:\\xampp\\htdocs\\dox/th_dsc_076.jpg

HTH,


// Todd

--
PHP General Mailing List 

[PHP] How to fetch .DOC or .DOCX file in php

2008-12-05 Thread Boyd, Todd M.
 -Original Message-
 From: Andrew Ballard [mailto:[EMAIL PROTECTED]
 Sent: Friday, December 05, 2008 9:11 AM
 To: Jim Lucas
 Cc: Shawn McKenzie; php-general@lists.php.net
 Subject: Re: [PHP] How to fetch .DOC or .DOCX file in php
 
 On Thu, Dec 4, 2008 at 10:35 PM, Jim Lucas [EMAIL PROTECTED] wrote:
  I was going to say that I haven't yet decided on what the final
 output format is going to be.  Probably either rtf or OpenXML.
 
  How about I ask for suggestions on what would be the best format to
 store the final copy.
 
  I figured that this tool would mainly be used for .doc to web
 conversion, but I guess it could be used to also convert to other
 document formats too.
 
  But, I would like to have the ability to at least store the formating
 inline with the text.  So, either some form of xml.  Be it (x)HTML or
 plain XML
  or even OpenXML.
 
  A question to all then.  How would you like to see the text, with
 formating, stored?
 
 It's an excellent start. It pulled in some additional control
 characters in some of the documents I tried, and some documents had
 extra stuff at the end of the document. It was still text, but it
 looked like the text from the page header/footer definitions. It would
 be cool to see this polished and released. I just wish there was
 something this basic that worked this well on PDF files! :-)

Andrew,

There's something to be said about inter-language operability. I've become 
enamored with the iText package for manipulating, creating, and extracting PDF 
documents and associated info/bookmarks/tags/etc. There was, for a time, an 
OpenSource PDF editor built with JPedal/iText that looked like it would soon 
compete with Acrobat for PDF fillable forms; but the author has little time to 
play with it.

Anyway, you can setup a Java program (yes, iText is Java) to extract the text 
from the fields--or entire document--and spit it out however you format it 
(text, XML, whatev).

iText - http://www.lowagie.com/iText/ 
PHP/Java bridge - http://php-java-bridge.sourceforge.net/pjb/

HTH,


// Todd


[PHP] Downloading file from local network machine

2008-12-05 Thread Mayer, Jonathan
Hiya everyone,

 

I  would like to present users to our internal intranet with a link to
download a file from a folder on a different machine on our local
network (such as \\computername\folder\file)

 

The file may be an HTML file, in which case the page should show in the
browser, or a file which requires saving to the user's local machine,
and which may be very big.

 

In IE, I could do something simple like 

 

a href='file://computername/folder/file.html'click here/a

 

But Firefox doesn't like doing this, for security reasons I think. I was
wondering whether there was a PHP solution. I have looked into fopen()
and fread() but not sure if this will help me.

 

I would like to hide all the working behind a form button so as to also
mask the download location, but that should be easy enough to do once I
get the basics working.

 

Any ideas?

 

Thanks,

Jon.



Re: [PHP] Downloading file from local network machine

2008-12-05 Thread Wolf
!-- SNIP -- 
 I  would like to present users to our internal intranet with a link to
 download a file from a folder on a different machine on our local
 network (such as \\computername\folder\file)
!-- SNIP -- 

Map the drive to the server so that it is accessible as /folder/file on the 
website.

Voila, no more problem.

HTH,
Wolf

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



RE: [PHP] Downloading file from local network machine

2008-12-05 Thread Mayer, Jonathan
Thanks Wolf :)

Yup, I had considered that, although there could be up to 8 different servers 
so that's 8 seperately mapped drives. 

If that's the simplest/neatest way, I'll do that, although I did wonder whether 
there was some other clever another way around it.

-Original Message-
From: Wolf [mailto:[EMAIL PROTECTED] 
Sent: 05 December 2008 17:29
To: Mayer, Jonathan; php-general@lists.php.net
Subject: Re: [PHP] Downloading file from local network machine

!-- SNIP -- 
 I  would like to present users to our internal intranet with a link to
 download a file from a folder on a different machine on our local
 network (such as \\computername\folder\file)
!-- SNIP -- 

Map the drive to the server so that it is accessible as /folder/file on the 
website.

Voila, no more problem.

HTH,
Wolf




Re: [PHP] Will not report errors what can I do

2008-12-05 Thread Robert Cummings
On Fri, 2008-12-05 at 10:40 -0500, tedd wrote:
 At 3:19 PM + 12/5/08, [EMAIL PROTECTED] wrote:
$result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__));
 
   //  to show dB errors  ==
 
   function report($query, $line, $file)
   {
  echo($query . 'br' .$line . 'br/' . $file . 'br/' .
   mysql_error());
  }
 
   This does two things: 1) It tells where the error took place
   (line/file); 2) and it provides a single place in my entire project to
   turn-off dB error reporting -- all I have to do is comment out a single
   line.
 
 I did this, briefly, but got tired of typing __LINE__, __FILE__ so much.
 
 
 That's what I call common code -- I type it once and after that it's 
 all cut/paste.
 
 I have entire libraries of routines that I've used before -- I just 
 cut/paste them into the new stuff as needed. Even many of the 
 variable names remain the same so it becomes more a job of assembly 
 more than typing.

I have to say... for what he's trying to achieve, I cheat and extract
the file and line number via debug_backtrace(). Indeed, it is annoying
to type the same thing over and over :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Will not report errors what can I do

2008-12-05 Thread Terion Miller
On Fri, Dec 5, 2008 at 12:08 PM, Robert Cummings [EMAIL PROTECTED]wrote:

 On Fri, 2008-12-05 at 10:40 -0500, tedd wrote:
  At 3:19 PM + 12/5/08, [EMAIL PROTECTED] wrote:
 $result = mysql_query($query) or die(report($query,__LINE__
 ,__FILE__));
  
//  to show dB errors  ==
  
function report($query, $line, $file)
{
   echo($query . 'br' .$line . 'br/' . $file . 'br/' .
mysql_error());
   }
  
This does two things: 1) It tells where the error took place
(line/file); 2) and it provides a single place in my entire project
 to
turn-off dB error reporting -- all I have to do is comment out a
 single
line.
  
  I did this, briefly, but got tired of typing __LINE__, __FILE__ so much.
 
 
  That's what I call common code -- I type it once and after that it's
  all cut/paste.
 
  I have entire libraries of routines that I've used before -- I just
  cut/paste them into the new stuff as needed. Even many of the
  variable names remain the same so it becomes more a job of assembly
  more than typing.

 I have to say... for what he's trying to achieve, I cheat and extract
 the file and line number via debug_backtrace(). Indeed, it is annoying
 to type the same thing over and over :)

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP


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

 Thanks to everyone you really helped and I got that page error showing and
fixed and whew...on to my next problems! I am starting a new discussion
thread because I want to see what people think between using Javascript form
validation or php form validation on php pagesstay tuned and much
thanks!  Terion


[PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Terion Miller
I have a huge form to validate and wonder which is better javascript
validation or php, the page is a php page, I actually put js validation on
it but then it stopped working (stopped inserting into the db) not sure if
that had anything to do with it
What does everyone prefer?

Terion who is actually finally learning stuff to her surprise!!


Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Stut

On 5 Dec 2008, at 18:28, Terion Miller wrote:

I have a huge form to validate and wonder which is better javascript
validation or php, the page is a php page, I actually put js  
validation on
it but then it stopped working (stopped inserting into the db) not  
sure if

that had anything to do with it
What does everyone prefer?


Both. Always PHP, optionally with JS to cut down on pointless HTTP  
requests.


Never ever trust anything coming from the client, even if you have JS  
checking it first. The client may not have JS support either due to  
the user turning it off or just because it doesn't. Your control over  
the data starts when your server-side script is executed, not before.


-Stut

--
http://stut.net/

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



Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Andrew Ballard
On Fri, Dec 5, 2008 at 1:28 PM, Terion Miller [EMAIL PROTECTED] wrote:
 I have a huge form to validate and wonder which is better javascript
 validation or php, the page is a php page, I actually put js validation on
 it but then it stopped working (stopped inserting into the db) not sure if
 that had anything to do with it
 What does everyone prefer?

 Terion who is actually finally learning stuff to her surprise!!


No question here. Javascript validation is a nicety, and can catch a
lot of errors without wasting server time or bandwidth, but
server-side validation is a MUST, no questions asked. If the client
has javascript disabled, or someone uses wget, curl, etc. to send
data, it still needs to be validated!

Andrew

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



Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Wolf
 Terion Miller [EMAIL PROTECTED] wrote: 
 I have a huge form to validate and wonder which is better javascript
 validation or php, the page is a php page, I actually put js validation on
 it but then it stopped working (stopped inserting into the db) not sure if
 that had anything to do with it
 What does everyone prefer?
 
 Terion who is actually finally learning stuff to her surprise!!

Never trust users to give you the data you expect.

Javascript/Ajax is a nicety but even when adding more things it can be broken.  
Always double-check and validate everything on the server side.

Wolf

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



Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Yeti
Java Script should always be an option, unless you write the
validation for yourself or people you personally know only.

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



Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Ashley Sheridan
On Fri, 2008-12-05 at 12:08 -0800, Yeti wrote:
 Java Script should always be an option, unless you write the
 validation for yourself or people you personally know only.
 
JavaScript is client-side, ergo untrusted. Javascript can be nice as an
addition, but only that.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Bastien Koert
On Fri, Dec 5, 2008 at 3:18 PM, Ashley Sheridan [EMAIL PROTECTED]wrote:

 On Fri, 2008-12-05 at 12:08 -0800, Yeti wrote:
  Java Script should always be an option, unless you write the
  validation for yourself or people you personally know only.
 
 JavaScript is client-side, ergo untrusted. Javascript can be nice as an
 addition, but only that.


 Ash
 www.ashleysheridan.co.uk


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


Never trust the user, always validate on the server


-- 

Bastien

Cat, the other other white meat


RE: [PHP] Downloading file from local network machine

2008-12-05 Thread Ashley Sheridan
On Fri, 2008-12-05 at 17:32 +, Mayer, Jonathan wrote:
 Thanks Wolf :)
 
 Yup, I had considered that, although there could be up to 8 different servers 
 so that's 8 seperately mapped drives. 
 
 If that's the simplest/neatest way, I'll do that, although I did wonder 
 whether there was some other clever another way around it.
 
 -Original Message-
 From: Wolf [mailto:[EMAIL PROTECTED] 
 Sent: 05 December 2008 17:29
 To: Mayer, Jonathan; php-general@lists.php.net
 Subject: Re: [PHP] Downloading file from local network machine
 
 !-- SNIP -- 
  I  would like to present users to our internal intranet with a link to
  download a file from a folder on a different machine on our local
  network (such as \\computername\folder\file)
 !-- SNIP -- 
 
 Map the drive to the server so that it is accessible as /folder/file on the 
 website.
 
 Voila, no more problem.
 
 HTH,
 Wolf
 
 
I don't have the code to hand right now, but I can try and post it
later. You were on the right track with fread() et al. Basically, set
the correct headers for a download (application/octet-stream I believe)
and print out the results of the fread(). Don't forget the binary flag
on fread() if you are opening binary files, and it should create a file
that auto-downloads. There are extra headers to set the default filename
of the download, but I forget these at the moment. A Google should give
you what you need though. This way, the file can even be delivered to
someone outside of your network should you wish, without you needing to
put the file in a web-accessible directory.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Ashley Sheridan
On Fri, 2008-12-05 at 15:16 -0500, Bastien Koert wrote:
 On Fri, Dec 5, 2008 at 3:18 PM, Ashley Sheridan [EMAIL PROTECTED]wrote:
 
  On Fri, 2008-12-05 at 12:08 -0800, Yeti wrote:
   Java Script should always be an option, unless you write the
   validation for yourself or people you personally know only.
  
  JavaScript is client-side, ergo untrusted. Javascript can be nice as an
  addition, but only that.
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 Never trust the user, always validate on the server
 

Or, never trust the user, the user is stupid ;)


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Yeti
Nuclear power plants got the MCA [1]
Developers got the MCA [2]

[1] maximum credible accident
[2] maximum credible addlebrained

Both of them are what nobody likes to think of, but they can (and do?) happen.

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



[PHP] PEAR Help

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi All,

I installed PEAR fine.

How I need to install OLE and Spreadsheet_Excel_Writer and I dont see  
how


pear install .

fails every time with channel errors and not found errors.

I have downloaded the .tgz files, but I dont know where to put the  
contents.


Any thoughts?

-Jason




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



Re: [PHP] PEAR Help

2008-12-05 Thread ceo

I found the PEAR tarballs to be corrupt a day or two ago...



The PEAR bug report captcha continually rejected my correct answers to simple 
math questions. :-(



I snagged a re-packaged version from:

http://pizzaseo.com/



ymmv



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



[PHP] Job opportunity in Denver, CO - Jr. PHP developer needed

2008-12-05 Thread Nick Gasparro
Hello Group  Seasons Greetings,

I have an immediate opportunity available for a Jr. PHP developer with the 
following skill set.  Please contact me directly if you are interested.

The perfect candidate will possess the following skills:
* Serious OO design background
* PHP5 (this will be your primary language, though you can learn it on the 
job )
* Strong database design skills (MySql experience preferred)
* Love of open source development and standards-based development
* Expert understanding of JavaScript, XHTML, and the DOM
* Strong communication skills and able to multi-task and project manage 
well --

Nick Gasparro
Managing Partner, REMY Corp.
Denver, CO 80202
303-539-0448 Direct
303-547-7469 Cell
[EMAIL PROTECTED]mailto:[EMAIL PROTECTED]
www.remycorp.comhttp://www.remycorp.com/

Click 
herehttp://www.linkedin.com/inviteFromProfile?firstName=Nickfrom=profilelastName=Gasparrokey=5604666
 to invite me on linkedin



Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Clancy
On Fri, 05 Dec 2008 20:24:07 +, [EMAIL PROTECTED] (Ashley
Sheridan) wrote:

On Fri, 2008-12-05 at 15:16 -0500, Bastien Koert wrote:
 On Fri, Dec 5, 2008 at 3:18 PM, Ashley Sheridan [EMAIL PROTECTED]wrote:
 
  On Fri, 2008-12-05 at 12:08 -0800, Yeti wrote:
   Java Script should always be an option, unless you write the
   validation for yourself or people you personally know only.
  
  JavaScript is client-side, ergo untrusted. Javascript can be nice as an
  addition, but only that.
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 Never trust the user, always validate on the server
 

Or, never trust the user, the user is stupid ;)

Or, worse, malicious!

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



[PHP] SQL syntax?

2008-12-05 Thread Terion Miller
Hi I am having problems (yep me again) with my sql, I have looked and tried
different things (ASC, DESC, etc) but it same error:
Here is the error:
 You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'ORDER BY
StartDate DESC' at line 2 --and the actual line the code is on
is line 21 not 2 so that is weird...and I had a comma between DESC and the
field but nothing

Code:
   $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
%e, %Y %l:%i %p') AS Start_Date,
DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
$sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
Impressions AS Ad_Impressions, ;
$sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
$sql .= ORDER BY StartDate DESC;

could it be the AS,  I copied that from another code--- I am trying to
make a report from the tableHere is my full script:

?php
include(../inc/dbconn_open.php);

if (empty($_SESSION['AdminLogin']) OR $_SESSION['AdminLogin']  'OK' ){
header (Location: LogOut.php);
}

$query = SELECT WorkOrderID, Advertiser, AccountNum, Impressions,
AdSize, StartDate, EndDate, CPM,  OnlineDate FROM workorderform;
$result = mysql_query ($query) or die(mysql_error());
$row = mysql_fetch_object ($result);
if ($row-UserReport == NO) {
header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
not have access to that page.);
}



$sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
%e, %Y %l:%i %p') AS Start_Date,
DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
$sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
Impressions AS Ad_Impressions, ;
$sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
$sql .= ORDER BY StartDate DESC;


$export = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_object ($result);
$fields = mysql_num_fields($export);


$header = ;
$value = ;
$data = ;

for ($i = 0; $i  $fields; $i++) {
$header .= mysql_field_name($export, $i) . \t;
}

while($row2 = mysql_fetch_row($export)) {
$line = '';
foreach($row2 as $value)
{
if ((!isset($value)) OR ($value == )) {
$value = \t;
} else {
$value = str_replace('', '', $value);
$value = '' . $value . '' . \t;
}
$line .= $value;
}
$data .= trim($line).\n;
}
$data = str_replace(\r,,$data);

if ($data == ) {
$data = \n(0) Records Found!\n;
}

header(Content-type: application/x-msdownload);
header(Content-Disposition: attachment; filename=AdDates_Report.xls);
header(Pragma: no-cache);
header(Expires: 0);
print $header\n$data;


?


Re: [PHP] SQL syntax?

2008-12-05 Thread Allan Arguelles


 $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
 %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
 $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
 Impressions AS Ad_Impressions, ;
 $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
 $sql .= ORDER BY StartDate DESC;
   

You forgot the tables, plus you have an extra comma after CPM_Rate.



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



Re: [PHP] Downloading file from local network machine

2008-12-05 Thread Bastien Koert
On Fri, Dec 5, 2008 at 3:22 PM, Ashley Sheridan [EMAIL PROTECTED]wrote:

 On Fri, 2008-12-05 at 17:32 +, Mayer, Jonathan wrote:
  Thanks Wolf :)
 
  Yup, I had considered that, although there could be up to 8 different
 servers so that's 8 seperately mapped drives.
 
  If that's the simplest/neatest way, I'll do that, although I did wonder
 whether there was some other clever another way around it.
 
  -Original Message-
  From: Wolf [mailto:[EMAIL PROTECTED]
  Sent: 05 December 2008 17:29
  To: Mayer, Jonathan; php-general@lists.php.net
  Subject: Re: [PHP] Downloading file from local network machine
 
  !-- SNIP --
   I  would like to present users to our internal intranet with a link to
   download a file from a folder on a different machine on our local
   network (such as \\computername\folder\file)
  !-- SNIP --
 
  Map the drive to the server so that it is accessible as /folder/file on
 the website.
 
  Voila, no more problem.
 
  HTH,
  Wolf
 
 
 I don't have the code to hand right now, but I can try and post it
 later. You were on the right track with fread() et al. Basically, set
 the correct headers for a download (application/octet-stream I believe)
 and print out the results of the fread(). Don't forget the binary flag
 on fread() if you are opening binary files, and it should create a file
 that auto-downloads. There are extra headers to set the default filename
 of the download, but I forget these at the moment. A Google should give
 you what you need though. This way, the file can even be delivered to
 someone outside of your network should you wish, without you needing to
 put the file in a web-accessible directory.


 Ash
 www.ashleysheridan.co.uk


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


function force_download($file)
{
$dir  = ../log/exports/;
if ((isset($file))(file_exists($dir.$file))) {
   header(Content-type: application/force-download);
   header('Content-Disposition: inline; filename=' . $dir.$file . '');

   header(Content-Transfer-Encoding: Binary);
   header(Content-length: .filesize($dir.$file));
   header('Content-Type: application/octet-stream');
   header('Content-Disposition: attachment; filename=' . $file . '');
   readfile($dir$file);
} else {
   echo No file selected;
} //end if

}//end function


-- 

Bastien

Cat, the other other white meat


Re: [PHP] SQL syntax?

2008-12-05 Thread Terion Miller
On Fri, Dec 5, 2008 at 3:57 PM, Allan Arguelles [EMAIL PROTECTED]wrote:


 
  $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate,
 '%b.
  %e, %Y %l:%i %p') AS Start_Date,
  DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
  $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
  Impressions AS Ad_Impressions, ;
  $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
  $sql .= ORDER BY StartDate DESC;
 

 You forgot the tables, plus you have an extra comma after CPM_Rate.

 well I changed it to:

  $sql = SELECT workorderform.WorkOrderID AS Work_Order_ID,
 DATE_FORMAT(workorderform.StartDate, '%b. %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(workorderform.EndDate, '%b. %e, %Y %l:%i %p') AS End_Date,
 ;
 $sql .= workorderform.Advertiser AS
 Advertiser_Name,workorderform.AccountNum AS Account_Number,
 workorderform.Impressions AS Ad_Impressions, ;
 $sql .= workorderform.AdSize AS Ad_Size,  workorderform.CPM AS
 CPM_Rate ;
 $sql .= ORDER BY StartDate DESC;

 and got the same error




[PHP] File Uploads Help!!!

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi All,

I am uploading a file and it says it worked, but I dont see it in the  
directory


Here is my code so far:

$allowed_ext = array('csv','xls');
$ext = end(explode('.',$_FILES['uploadedfile']['name']));
$ran2 = rand()..;
$target = tempUploads/;
$target = $target . $ran2.$ext;

if($_FILES['uploadedfile']['size']  200){
$message = 'File over 2MB';
echo $message;
exit;
}

if($message == NULL  !in_array($ext,$allowed_ext)){
$message = 'File extension not allowed'.' extension is:'.$ext;
echo $message;
exit;
}

if($message == NULL) {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], 
$target))
{
$message = Uploaded The File.;
echo $message;

// upload was successful, now lets work with it
include '_functions.inc'; // Utility Functions

			include '_fileHeaders.inc'; // CSV File Headers that we expect, in  
the proper order


include '_fileParse.inc'; // CSV File Parsing
}
else
{
$message = Sorry, there was a problem uploading your 
file.;
echo $message;
}
}

How can I verify it is there? I ftp in and I dont see it.

-Jason


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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Jason Todd Slack-Moehrle

Here is the output I am printing:

'tempUploads/1425182872.xlsUploaded The File.'

What is the issue?

-Jason


On Dec 5, 2008, at 2:11 PM, Jason Todd Slack-Moehrle wrote:


Hi All,

I am uploading a file and it says it worked, but I dont see it in  
the directory


Here is my code so far:

$allowed_ext = array('csv','xls');
$ext = end(explode('.',$_FILES['uploadedfile']['name']));
$ran2 = rand()..;
$target = tempUploads/;
$target = $target . $ran2.$ext;

if($_FILES['uploadedfile']['size']  200){
$message = 'File over 2MB';
echo $message;
exit;
}

if($message == NULL  !in_array($ext,$allowed_ext)){
$message = 'File extension not allowed'.' extension is:'.$ext;
echo $message;
exit;
}

if($message == NULL) {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], 
$target))
{
$message = Uploaded The File.;
echo $message;

// upload was successful, now lets work with it
include '_functions.inc'; // Utility Functions

			include '_fileHeaders.inc'; // CSV File Headers that we expect,  
in the proper order


include '_fileParse.inc'; // CSV File Parsing
}
else
{
$message = Sorry, there was a problem uploading your 
file.;
echo $message;
}
}

How can I verify it is there? I ftp in and I dont see it.

-Jason


--
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] SQL syntax?

2008-12-05 Thread Allan Arguelles
Umm.. I meant you need to put

$sql .= FROM workorderform ;

between these:

$sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
$sql .= ORDER BY StartDate DESC;


:)


Terion Miller wrote:
 On Fri, Dec 5, 2008 at 3:57 PM, Allan Arguelles [EMAIL PROTECTED]wrote:

   
 $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate,
   
 '%b.
 
 %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
 $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
 Impressions AS Ad_Impressions, ;
 $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
 $sql .= ORDER BY StartDate DESC;

   
 You forgot the tables, plus you have an extra comma after CPM_Rate.

 well I changed it to:

  $sql = SELECT workorderform.WorkOrderID AS Work_Order_ID,
 DATE_FORMAT(workorderform.StartDate, '%b. %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(workorderform.EndDate, '%b. %e, %Y %l:%i %p') AS End_Date,
 ;
 $sql .= workorderform.Advertiser AS
 Advertiser_Name,workorderform.AccountNum AS Account_Number,
 workorderform.Impressions AS Ad_Impressions, ;
 $sql .= workorderform.AdSize AS Ad_Size,  workorderform.CPM AS
 CPM_Rate ;
 $sql .= ORDER BY StartDate DESC;

 and got the same error


 

   


Re: [PHP] SQL syntax?

2008-12-05 Thread Terion Miller
ah...I also though it was because I didn't have a statement like where
adsize = adsize or something but I tried that and got the same error I have
been getting ...

You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'FROM
workorderform, WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC' at
line 2

and why does it keep saying line 2...
here is the snippet as it is now:

 $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
%e, %Y %l:%i %p') AS Start_Date,
DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
$sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
Impressions AS Ad_Impressions, ;
$sql .= AdSize AS Ad_Size, CPM AS CPM_Rate, ;
$sql.= FROM workorderform, ;
$sql .=  WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC;


On Fri, Dec 5, 2008 at 4:14 PM, Allan Arguelles [EMAIL PROTECTED]wrote:

  Umm.. I meant you need to put

 $sql .= FROM workorderform ;

 between these:

 $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
 $sql .= ORDER BY StartDate DESC;


 :)


 Terion Miller wrote:

 On Fri, Dec 5, 2008 at 3:57 PM, Allan Arguelles [EMAIL PROTECTED] [EMAIL 
 PROTECTED]wrote:



  $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate,


  '%b.


  %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
 $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
 Impressions AS Ad_Impressions, ;
 $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
 $sql .= ORDER BY StartDate DESC;



  You forgot the tables, plus you have an extra comma after CPM_Rate.

 well I changed it to:

  $sql = SELECT workorderform.WorkOrderID AS Work_Order_ID,
 DATE_FORMAT(workorderform.StartDate, '%b. %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(workorderform.EndDate, '%b. %e, %Y %l:%i %p') AS End_Date,
 ;
 $sql .= workorderform.Advertiser AS
 Advertiser_Name,workorderform.AccountNum AS Account_Number,
 workorderform.Impressions AS Ad_Impressions, ;
 $sql .= workorderform.AdSize AS Ad_Size,  workorderform.CPM AS
 CPM_Rate ;
 $sql .= ORDER BY StartDate DESC;

 and got the same error







Re: [PHP] SQL syntax?

2008-12-05 Thread Allan Arguelles
Try this:

 $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
%e, %Y %l:%i %p') AS Start_Date,
DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
$sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
Impressions AS Ad_Impressions, ;
$sql .= AdSize AS Ad_Size, CPM AS CPM_Rate ;
$sql.= FROM workorderform ;
$sql .=  WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC;


I just removed extra commas from CPM_Rate and workorderform


Terion Miller wrote:
 ah...I also though it was because I didn't have a statement like where
 adsize = adsize or something but I tried that and got the same error I have
 been getting ...

 You have an error in your SQL syntax; check the manual that corresponds to
 your MySQL server version for the right syntax to use near 'FROM
 workorderform, WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC' at
 line 2

 and why does it keep saying line 2...
 here is the snippet as it is now:

  $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
 %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
 $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
 Impressions AS Ad_Impressions, ;
 $sql .= AdSize AS Ad_Size, CPM AS CPM_Rate, ;
 $sql.= FROM workorderform, ;
 $sql .=  WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC;


 On Fri, Dec 5, 2008 at 4:14 PM, Allan Arguelles [EMAIL PROTECTED]wrote:

   
  Umm.. I meant you need to put

 $sql .= FROM workorderform ;

 between these:

 $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
 $sql .= ORDER BY StartDate DESC;


 :)


 Terion Miller wrote:

 On Fri, Dec 5, 2008 at 3:57 PM, Allan Arguelles [EMAIL PROTECTED] [EMAIL 
 PROTECTED]wrote:



  $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate,


  '%b.


  %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
 $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
 Impressions AS Ad_Impressions, ;
 $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
 $sql .= ORDER BY StartDate DESC;



  You forgot the tables, plus you have an extra comma after CPM_Rate.

 well I changed it to:

  $sql = SELECT workorderform.WorkOrderID AS Work_Order_ID,
 DATE_FORMAT(workorderform.StartDate, '%b. %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(workorderform.EndDate, '%b. %e, %Y %l:%i %p') AS End_Date,
 ;
 $sql .= workorderform.Advertiser AS
 Advertiser_Name,workorderform.AccountNum AS Account_Number,
 workorderform.Impressions AS Ad_Impressions, ;
 $sql .= workorderform.AdSize AS Ad_Size,  workorderform.CPM AS
 CPM_Rate ;
 $sql .= ORDER BY StartDate DESC;

 and got the same error





 

   


Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Eric Butera
On Fri, Dec 5, 2008 at 5:13 PM, Jason Todd Slack-Moehrle
[EMAIL PROTECTED] wrote:
 Here is the output I am printing:

 'tempUploads/1425182872.xlsUploaded The File.'

 What is the issue?

 -Jason


 On Dec 5, 2008, at 2:11 PM, Jason Todd Slack-Moehrle wrote:

 Hi All,

 I am uploading a file and it says it worked, but I dont see it in the
 directory

 Here is my code so far:

$allowed_ext = array('csv','xls');
$ext = end(explode('.',$_FILES['uploadedfile']['name']));
$ran2 = rand()..;
$target = tempUploads/;
$target = $target . $ran2.$ext;

if($_FILES['uploadedfile']['size']  200){
$message = 'File over 2MB';
echo $message;
exit;
}

if($message == NULL  !in_array($ext,$allowed_ext)){
$message = 'File extension not allowed'.' extension
 is:'.$ext;
echo $message;
exit;
}

if($message == NULL) {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],
 $target))
{
$message = Uploaded The File.;
echo $message;

// upload was successful, now lets work with it
include '_functions.inc'; // Utility Functions

include '_fileHeaders.inc'; // CSV File Headers
 that we expect, in the proper order

include '_fileParse.inc'; // CSV File Parsing
}
else
{
$message = Sorry, there was a problem uploading
 your file.;
echo $message;
}
}

 How can I verify it is there? I ftp in and I dont see it.

 -Jason


 --
 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



Read up!

http://us2.php.net/manual/en/function.is-uploaded-file.php
http://us2.php.net/manual/en/features.file-upload.errors.php

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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi Eric,



'tempUploads/1425182872.xlsUploaded The File.'


http://us2.php.net/manual/en/function.is-uploaded-file.php
http://us2.php.net/manual/en/features.file-upload.errors.php


So do I still use move_uploaded_file?

-Jason

Re: [PHP] SQL syntax?

2008-12-05 Thread Terion Miller
Excellent Allan thanks so much, sometimes I think php is causing me
blindness!!
Terion

On Fri, Dec 5, 2008 at 4:26 PM, Allan Arguelles [EMAIL PROTECTED]wrote:

  Try this:

  $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
 %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
 $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
 Impressions AS Ad_Impressions, ;
 $sql .= AdSize AS Ad_Size, CPM AS CPM_Rate ;
 $sql.= FROM workorderform ;
 $sql .=  WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC;


 I just removed extra commas from CPM_Rate and workorderform


 Terion Miller wrote:

 ah...I also though it was because I didn't have a statement like where
 adsize = adsize or something but I tried that and got the same error I have
 been getting ...

 You have an error in your SQL syntax; check the manual that corresponds to
 your MySQL server version for the right syntax to use near 'FROM
 workorderform, WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC' at
 line 2

 and why does it keep saying line 2...
 here is the snippet as it is now:

  $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
 %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
 $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
 Impressions AS Ad_Impressions, ;
 $sql .= AdSize AS Ad_Size, CPM AS CPM_Rate, ;
 $sql.= FROM workorderform, ;
 $sql .=  WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC;


 On Fri, Dec 5, 2008 at 4:14 PM, Allan Arguelles [EMAIL PROTECTED] [EMAIL 
 PROTECTED]wrote:



   Umm.. I meant you need to put

 $sql .= FROM workorderform ;

 between these:

 $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
 $sql .= ORDER BY StartDate DESC;


 :)


 Terion Miller wrote:

 On Fri, Dec 5, 2008 at 3:57 PM, Allan Arguelles [EMAIL PROTECTED] [EMAIL 
 PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]wrote:



  $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate,


  '%b.


  %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
 $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
 Impressions AS Ad_Impressions, ;
 $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
 $sql .= ORDER BY StartDate DESC;



  You forgot the tables, plus you have an extra comma after CPM_Rate.

 well I changed it to:

  $sql = SELECT workorderform.WorkOrderID AS Work_Order_ID,
 DATE_FORMAT(workorderform.StartDate, '%b. %e, %Y %l:%i %p') AS Start_Date,
 DATE_FORMAT(workorderform.EndDate, '%b. %e, %Y %l:%i %p') AS End_Date,
 ;
 $sql .= workorderform.Advertiser AS
 Advertiser_Name,workorderform.AccountNum AS Account_Number,
 workorderform.Impressions AS Ad_Impressions, ;
 $sql .= workorderform.AdSize AS Ad_Size,  workorderform.CPM AS
 CPM_Rate ;
 $sql .= ORDER BY StartDate DESC;

 and got the same error










Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Eric Butera
On Fri, Dec 5, 2008 at 5:40 PM, Jason Todd Slack-Moehrle
[EMAIL PROTECTED] wrote:
 Hi Eric,

 'tempUploads/1425182872.xlsUploaded The File.'

 http://us2.php.net/manual/en/function.is-uploaded-file.php
 http://us2.php.net/manual/en/features.file-upload.errors.php

 So do I still use move_uploaded_file?
 -Jason

Absolutely.  I just didn't see anywhere in your code where you were
checking for an error with the file upload itself or that it did exist
on the server before moving it.

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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi Eric,


So do I still use move_uploaded_file?



Absolutely.  I just didn't see anywhere in your code where you were
checking for an error with the file upload itself or that it did exist
on the server before moving it.


Got it, thanks!!

-Jason

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



[PHP] PHP5 DOM Problem

2008-12-05 Thread Craig Whitmore
Hi there. I don't kno id this is the correct place to post but...

I am using the PHP5 DOM to make up RSS Feeds ..

A Problem I have is I want to make this up for itunes..

?xml version=1.0 encoding=UTF-8?
rss version=2.00 xmlns:itunes=http://www.itunes.com/dtds/podcast-1.0.dtd;


etc.. 

I use..
$p_dom = new DOMDocument('1.0','UTF-8');
$p_rss = $p_dom-createElement('rss');
$p_rss-setAttribute('version', '2.00');
$p_rss-setAttribute('xmlns:itunes','http://www.itunes.com/dtds/podcast-1.0.dtd');
$p_dom-appendChild($p_rss);

which is working for me.. Debian (PHP 5.2.6-2+b1)

but doesn't work on some other people with other versions of php5  ( I don't 
know yet which version they have)

they only get 

?xml version=1.0 encoding=UTF-8?
rss version=2.00

So the name space is missing..

So I looked up http://nz2.php.net/manual/en/domelement.setattribute.php

and it says the correct way is to use createElementNS.. but I have tried and 
tried and I cannot get it to make up what I want it to do.

can someone help?

I also want to make something like

?xml version=1.0 encoding=UTF-8?
rss version=0.91 xmlns:media=http://search.yahoo.com/mrss/; 
xmlns:dcterms=http://purl.org/dc/terms/; 
xmlns:gm=http://www.google.com/schemas/gm/1.1; 
xmlns:av=http://www.searchvideo.com/schemas/av/1.0; 
xmlns:dc=http://purl.org/dc/elements/1.1/;

for mediarss feeds + other types . but I can't seem to be able to use 
CreateElementNS to make this up either


Can someone help??








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



[PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle

OK, making good learning progress today.

I have a string that is: Jason Slack

and I want it broken at the space so i get Jason and then Slack

I am looking at parse_str, but I dont get how to do it with a space.  
The example is using []=.


Then I want to assign like:

$fname = Jason;
$lname = Slack;

Any ideas?

-Jason

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



RE: [PHP] Downloading file from local network machine

2008-12-05 Thread Manuel Lemos
Hello Jonathan,

On Fri, 2008-12-05 at 17:32 +, Mayer, Jonathan wrote:
 Thanks Wolf :)
 
 Yup, I had considered that, although there could be up to 8 different servers 
 so that's 8 seperately mapped drives. 
 
 If that's the simplest/neatest way, I'll do that, although I did wonder 
 whether there was some other clever another way around it.

Actually there is a much better way to achieve that. I just presented it
at a Microsoft Web Development summit that was mostly about PHP. Here
follows the slide presentation. Check slide 5.

http://www.slideshare.net/manuellemos/what-could-microsoft-do-to-make-php-run-better-on-windows-presentation/

It consists add a PHP stream wrapper class that allows you to use fopen
and other PHP file access functions with a file name URL like this:

smb://user:[EMAIL PROTECTED]/path/to/share

The stream warpper class is here:

http://www.phpclasses.org/smb4php

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - 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



Re: [PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle


How might I also parse and address like: SCOTTSDALE, AZ 85254

It has a comma and a space

-Jason

On Dec 5, 2008, at 4:02 PM, Jason Todd Slack-Moehrle wrote:


OK, making good learning progress today.

I have a string that is: Jason Slack

and I want it broken at the space so i get Jason and then Slack

I am looking at parse_str, but I dont get how to do it with a space.  
The example is using []=.


Then I want to assign like:

$fname = Jason;
$lname = Slack;

Any ideas?

-Jason

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





AW: [PHP] Parsing Strings

2008-12-05 Thread Konrad Priemer
Hi,

Jason wrote:
 I have a string that is: Jason Slack
 and I want it broken at the space so i get Jason and then Slack

explode or split can do this.

$array = explode( , Jason Slack);

Array
(
[0] = Jason
[1] = Slack
)

Greetings from Stuttgart

Conny


---
Firma Konrad Priemer
Onlinedienste  Webdesign

Kirchheimer Straße 116, D-70619 Stuttgart
Tel. 0711-50420416, FAX 0711-50420417, VOIP 0711-50888660
eMail: mailto:[EMAIL PROTECTED] - Internet:
http://www.cp-onlinedienste.de
---
Aktuelles Projekt: http://www.tierische-events.de - Veranstaltungen für
(oder mit) Mensch, Hund, Katze und Pferd

 

__ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 3667
(20081205) __

E-Mail wurde geprüft mit ESET NOD32 Antivirus.

http://www.eset.com
 


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



Re: AW: [PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle


Konrad,

On Dec 5, 2008, at 4:22 PM, Konrad Priemer wrote:


$array = explode( , Jason Slack);


Awesome, thanks, yup that does it.

Can you explain how to do an address now into City, State, Zip

Like: cortland, ny 13045

It has a comma and a space!

-Jason


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



AW: AW: [PHP] Parsing Strings

2008-12-05 Thread Konrad Priemer
Hi,

On Sa 06.12.2008 01:30 Jason wrote:

 Can you explain how to do an address now into City, State, Zip
 Like: cortland, ny 13045

Test this:

$string = cortland, ny 13045;
$search = array(, , ,); # if there is no space after the comma, we make
this ;-)
$replace = array( ,  );
$newString = str_replace($search, $replace, $string);
$array = explode( , $newString);

--
Old String: cortland, ny 13045
New String: cortland ny 13045

Array
(
[0] = cortland
[1] = ny
[2] = 13045
)
---

Regards from Stuttgart

Conny


PS: Sorry about my perfect english
 

__ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 3667
(20081205) __

E-Mail wurde gepruft mit ESET NOD32 Antivirus.

http://www.eset.com
 


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



Re: AW: [PHP] Parsing Strings

2008-12-05 Thread Jason Todd Slack-Moehrle

Conny,


Can you explain how to do an address now into City, State, Zip
Like: cortland, ny 13045



$string = cortland, ny 13045;
$search = array(, , ,);
$replace = array( ,  );
$newString = str_replace($search, $replace, $string);
$array = explode( , $newString);


Ah ha! Nice that makes sense, why did I not think of that!

-Jason

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



AW: [PHP] Parsing Strings

2008-12-05 Thread Konrad Priemer
Oups, sorry

 

mistake by copy  paste ;-)

 

On Sa 06.12.2008 01:30 Jason wrote:

 

 Can you explain how to do an address now into City, State, Zip

 Like: cortland, ny 13045

 

 

$string = cortland, ny 13045;

$search = array(, , ,);

$replace = array( ,  );

$newString = str_replace($search, $replace, $string); $array = explode( ,
$newString);

 

 

Regards from Stuttgart

 

Conny

 

 

PS: Sorry about my perfect english



Re: [PHP] Downloading file from local network machine

2008-12-05 Thread Ashley Sheridan
On Fri, 2008-12-05 at 16:59 -0500, Bastien Koert wrote:
 On Fri, Dec 5, 2008 at 3:22 PM, Ashley Sheridan [EMAIL PROTECTED]wrote:
 
  On Fri, 2008-12-05 at 17:32 +, Mayer, Jonathan wrote:
   Thanks Wolf :)
  
   Yup, I had considered that, although there could be up to 8 different
  servers so that's 8 seperately mapped drives.
  
   If that's the simplest/neatest way, I'll do that, although I did wonder
  whether there was some other clever another way around it.
  
   -Original Message-
   From: Wolf [mailto:[EMAIL PROTECTED]
   Sent: 05 December 2008 17:29
   To: Mayer, Jonathan; php-general@lists.php.net
   Subject: Re: [PHP] Downloading file from local network machine
  
   !-- SNIP --
I  would like to present users to our internal intranet with a link to
download a file from a folder on a different machine on our local
network (such as \\computername\folder\file)
   !-- SNIP --
  
   Map the drive to the server so that it is accessible as /folder/file on
  the website.
  
   Voila, no more problem.
  
   HTH,
   Wolf
  
  
  I don't have the code to hand right now, but I can try and post it
  later. You were on the right track with fread() et al. Basically, set
  the correct headers for a download (application/octet-stream I believe)
  and print out the results of the fread(). Don't forget the binary flag
  on fread() if you are opening binary files, and it should create a file
  that auto-downloads. There are extra headers to set the default filename
  of the download, but I forget these at the moment. A Google should give
  you what you need though. This way, the file can even be delivered to
  someone outside of your network should you wish, without you needing to
  put the file in a web-accessible directory.
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 function force_download($file)
 {
 $dir  = ../log/exports/;
 if ((isset($file))(file_exists($dir.$file))) {
header(Content-type: application/force-download);
header('Content-Disposition: inline; filename=' . $dir.$file . '');
 
header(Content-Transfer-Encoding: Binary);
header(Content-length: .filesize($dir.$file));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $file . '');
readfile($dir$file);
 } else {
echo No file selected;
 } //end if
 
 }//end function
 
 
Two Content-type and Content-Disposition types specified here. All sorts
of wrong. It can be done with just the one of each. Get rid of the
force-download and the inline; disposition one. I just completed a
project at work that has to do this, and it works fine on IE, Fx, Opera,
and Safari. 


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Poll of sorts: Javascript Form validation or PHP

2008-12-05 Thread Ashley Sheridan
On Sat, 2008-12-06 at 08:38 +1100, Clancy wrote:
 On Fri, 05 Dec 2008 20:24:07 +, [EMAIL PROTECTED] (Ashley
 Sheridan) wrote:
 
 On Fri, 2008-12-05 at 15:16 -0500, Bastien Koert wrote:
  On Fri, Dec 5, 2008 at 3:18 PM, Ashley Sheridan [EMAIL PROTECTED]wrote:
  
   On Fri, 2008-12-05 at 12:08 -0800, Yeti wrote:
Java Script should always be an option, unless you write the
validation for yourself or people you personally know only.
   
   JavaScript is client-side, ergo untrusted. Javascript can be nice as an
   addition, but only that.
  
  
   Ash
   www.ashleysheridan.co.uk
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  Never trust the user, always validate on the server
  
 
 Or, never trust the user, the user is stupid ;)
 
 Or, worse, malicious!

Never underestimate the power of stupidity! It's trivial enough to test
for the obvious malicious attacks, but idiocy opens up a whole new world
of problems that the sane mind could never comprehend!


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] SQL syntax?

2008-12-05 Thread Ashley Sheridan
On Fri, 2008-12-05 at 16:51 -0600, Terion Miller wrote:
 Excellent Allan thanks so much, sometimes I think php is causing me
 blindness!!
 Terion
 
 On Fri, Dec 5, 2008 at 4:26 PM, Allan Arguelles [EMAIL PROTECTED]wrote:
 
   Try this:
 
   $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
  %e, %Y %l:%i %p') AS Start_Date,
  DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
  $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
  Impressions AS Ad_Impressions, ;
  $sql .= AdSize AS Ad_Size, CPM AS CPM_Rate ;
  $sql.= FROM workorderform ;
  $sql .=  WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC;
 
 
  I just removed extra commas from CPM_Rate and workorderform
 
 
  Terion Miller wrote:
 
  ah...I also though it was because I didn't have a statement like where
  adsize = adsize or something but I tried that and got the same error I have
  been getting ...
 
  You have an error in your SQL syntax; check the manual that corresponds to
  your MySQL server version for the right syntax to use near 'FROM
  workorderform, WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC' at
  line 2
 
  and why does it keep saying line 2...
  here is the snippet as it is now:
 
   $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate, '%b.
  %e, %Y %l:%i %p') AS Start_Date,
  DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
  $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
  Impressions AS Ad_Impressions, ;
  $sql .= AdSize AS Ad_Size, CPM AS CPM_Rate, ;
  $sql.= FROM workorderform, ;
  $sql .=  WHERE WorkOrderID = WorkOrderID ORDER BY StartDate DESC;
 
 
  On Fri, Dec 5, 2008 at 4:14 PM, Allan Arguelles [EMAIL PROTECTED] [EMAIL 
  PROTECTED]wrote:
 
 
 
Umm.. I meant you need to put
 
  $sql .= FROM workorderform ;
 
  between these:
 
  $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
  $sql .= ORDER BY StartDate DESC;
 
 
  :)
 
 
  Terion Miller wrote:
 
  On Fri, Dec 5, 2008 at 3:57 PM, Allan Arguelles [EMAIL PROTECTED] [EMAIL 
  PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]wrote:
 
 
 
   $sql = SELECT WorkOrderID AS Work_Order_ID, DATE_FORMAT(StartDate,
 
 
   '%b.
 
 
   %e, %Y %l:%i %p') AS Start_Date,
  DATE_FORMAT(EndDate, '%b. %e, %Y %l:%i %p') AS End_Date, ;
  $sql .= Advertiser AS Advertiser_Name,AccountNum AS Account_Number,
  Impressions AS Ad_Impressions, ;
  $sql .= AdSize AS Ad_Size,  CPM AS CPM_Rate, ;
  $sql .= ORDER BY StartDate DESC;
 
 
 
   You forgot the tables, plus you have an extra comma after CPM_Rate.
 
  well I changed it to:
 
   $sql = SELECT workorderform.WorkOrderID AS Work_Order_ID,
  DATE_FORMAT(workorderform.StartDate, '%b. %e, %Y %l:%i %p') AS Start_Date,
  DATE_FORMAT(workorderform.EndDate, '%b. %e, %Y %l:%i %p') AS End_Date,
  ;
  $sql .= workorderform.Advertiser AS
  Advertiser_Name,workorderform.AccountNum AS Account_Number,
  workorderform.Impressions AS Ad_Impressions, ;
  $sql .= workorderform.AdSize AS Ad_Size,  workorderform.CPM AS
  CPM_Rate ;
  $sql .= ORDER BY StartDate DESC;
 
  and got the same error
 
 
If I run into troubles with SQL (specifically MySQL) I run the query in
phpMyAdmin, which is so helpful. If you're using another SQL variant
like that god-forsaken M$ SQL, then you have to use the appropriate tool
to interface with the database there. It sure helps remove the SQL
problems from PHP, which was your problem in this case.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Job opportunity in Denver, CO - Jr. PHP developer needed

2008-12-05 Thread Kevin Waterson
This one time, at band camp, Nick Gasparro [EMAIL PROTECTED] wrote:

 The perfect candidate will possess the following skills:
 * Serious OO design background
 * PHP5 (this will be your primary language, though you can learn it on 
 the job )
 * Strong database design skills (MySql experience preferred)
 * Love of open source development and standards-based development
 * Expert understanding of JavaScript, XHTML, and the DOM
 * Strong communication skills and able to multi-task and project manage 
 well --

Hmm, all of this, I thought you wanted a Junior developer...

Kevin

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



Re: [PHP] error messaages - $DOXPath Wrong

2008-12-05 Thread ddg2sailor

First I would like to thank everyone who reponded to this thread. Your all
Great!

I took your advice and made these changes

//Just the relevant lines not in order

$DOXPATH = 'C:\\xampp\\htdocs\\dox\\'

// New DOXPATH 


if (!move_uploaded_file($file['tmp_name'], '$DOXPATH\$file[name]'))

//Fixed line 40 (now 41) ' changed to ' , / change to \ , dont even think I
need that \


//end of code

I sent this code to the sysop of the site and it was in his mail box when he
decided to reformat the system and restore yet another backup. On the bright
side it did cure this issue But the file in question is now a java
script :) , I will never know if this worked cause its no longer used. I
fixxed a few minor error's that I had fixxed before the restore. I had to
check the php files because they were just slightly recoded... It took about
10 mins to fix what I already knew how to fix Now that everything
works... Im not important anymore... Stop talking to me Im trying to do
some work

Well who said life is supposed to be fair?

?
//regards
//Sailor
?


Maciek Sokolewicz-2 wrote:
 
 Fix your definition of it (ie. use SINGLE quotes, or double escape it to 
 look like \\xa so the interpreter won't see it as a special escape 
 sequence anymore.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/error-messaages---%24DOXPath-Wrong-tp20848918p20867173.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



[PHP] Convert .docx /.pdf file to .txt

2008-12-05 Thread Jagdeep Singh
Hi!

I need a function to fetch text from docx file, but it is showing formated
characters in output. I was using fopen, fgets etc function .

I want to fetch text from .docx and save it to .txt file Without special
characters (Microsoft formated characters)

Is there any function or an example??

Thanks

Jagdeep Singh


Re: [PHP] Job opportunity in Denver, CO - Jr. PHP developer needed

2008-12-05 Thread VamVan
telecommute??

On Fri, Dec 5, 2008 at 9:43 PM, Kevin Waterson [EMAIL PROTECTED] wrote:

 This one time, at band camp, Nick Gasparro [EMAIL PROTECTED] wrote:

  The perfect candidate will possess the following skills:
  * Serious OO design background
  * PHP5 (this will be your primary language, though you can learn it
 on the job )
  * Strong database design skills (MySql experience preferred)
  * Love of open source development and standards-based development
  * Expert understanding of JavaScript, XHTML, and the DOM
  * Strong communication skills and able to multi-task and project
 manage well --

 Hmm, all of this, I thought you wanted a Junior developer...

 Kevin

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




Re: [PHP] Job opportunity in Denver, CO - Jr. PHP developer needed

2008-12-05 Thread mike
If you're interested for a telecommuting job I am pretty sure mysql's
position supports it - php and mysql for mysql itself!

http://www.sun.com/corp_emp/search.cgi?keyword=561790jpp=50

(Sorry for stealing the thread)

On Fri, Dec 5, 2008 at 11:22 PM, VamVan [EMAIL PROTECTED] wrote:
 telecommute??

 On Fri, Dec 5, 2008 at 9:43 PM, Kevin Waterson [EMAIL PROTECTED] wrote:

 This one time, at band camp, Nick Gasparro [EMAIL PROTECTED] wrote:

  The perfect candidate will possess the following skills:
  * Serious OO design background
  * PHP5 (this will be your primary language, though you can learn it
 on the job )
  * Strong database design skills (MySql experience preferred)
  * Love of open source development and standards-based development
  * Expert understanding of JavaScript, XHTML, and the DOM
  * Strong communication skills and able to multi-task and project
 manage well --

 Hmm, all of this, I thought you wanted a Junior developer...

 Kevin

 --
 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] How to Insert ?xml-stylesheet .....? into DOMDocument

2008-12-05 Thread Shanon Swafford

I have the following code:

#!/usr/bin/php -q
?PHP
error_reporting(E_ALL);
ini_set('display_errors', '1');
$doc = new DOMDocument();
$doc-formatOutput = true;

$foo = $doc-createElement(foo);
$doc-appendChild($foo);

$bar = $doc-createElement(bar);
$foo-appendChild($bar);

$bazz = $doc-createElement(bazz);
$foo-appendChild($bazz);

echo $doc-saveXML();

?

Which generates:

?xml version=1.0?
foo
  bar/
  bazz/
/foo

Is there a way to make it create the following XML?

?xml version=1.0?
?xml-stylesheet href=xsl_table.xsl type=text/xsl?
foo
  bar/
  bazz/
/foo

I can't seem to find any dom functions to do this.

Thanks in advance,
Shanon



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