Re: [PHP] mac os x - not getting headers already sent error

2005-03-07 Thread Jonathan Haddad
The problem is more of my own output sticking around (echo $query) and 
the test server still going to the next page, despite the echoed text.

I'm not sure how to use output buffering to fix this..
Jon
On Mar 7, 2005, at 2:01 AM, Burhan Khalid wrote:
Jonathan Haddad wrote:
I do all my development on mac os x.  sometimes, to debut a script, i 
output the query to the page.  quite often the page sends headers to 
go to another page.  When i do this, i comment out the header() 
function and read the results.  When i'm done i remove the comment
Sometimes I've forgotten to take out the debugging output.  Now, on 
my server here, the page redirects and loads fine.  But in the live 
environment, it craps out and people are left staring at a blank 
page.
This means that on the live server, error_reporting is at such a level 
that the Warning that is generated by php -- the Cannot modify header 
information output started at  line isn't displayed, and since 
there is output to the client, the header() call fails, which is why 
you are left with a white screen.

You can use output buffering to avoid such a problem; there is also 
the header_sent() function.

HTH
--
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] mac os x - not getting headers already sent error

2005-03-06 Thread Jonathan Haddad
I do all my development on mac os x.  sometimes, to debut a script, i 
output the query to the page.  quite often the page sends headers to go 
to another page.  When i do this, i comment out the header() function 
and read the results.  When i'm done i remove the comment

Sometimes I've forgotten to take out the debugging output.  Now, on my 
server here, the page redirects and loads fine.  But in the live 
environment, it craps out and people are left staring at a blank page.

The test server is the same computer i'm developing on.
Anyone know why this happens, and how i can fix it?
Jon Haddad
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP on Windows

2004-10-20 Thread Jonathan Haddad
So I'm setting up a website that needs to run on a windows server.  
There are file uploads.  What do I need to do to make the directory 
writable?  I'm sure it's very obvious but when the time comes to do it 
it has to happen immediately.

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


Re: [PHP] imagejpeg() problem

2004-09-27 Thread Jonathan Haddad
Mike wrote:
the resizing part goes well; I don't really know what the imageinterlace 
function does, but I used it in desperation. Why: the output image's quality 
is visibly inferior to the source's. And I want the image to look good. The 
source is a jpeg (dinamic). As you probably have noticed, I set the quality 
parameter to 100, but uselessly.
What i'd like to know is whether php can output some quality jpegs, and if 
so, then how?
Thanks a lot! 
 

use imagecopyresampled instead of imagecopyresized for much better results.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] thumbnail of webpage

2004-09-20 Thread Jonathan Haddad

Stefan Holmes wrote:
-Original Message-
From: raditha dissanayake [mailto:[EMAIL PROTECTED]
Sent: 18 September 2004 03:22
To: Michael Mao
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] thumbnail of webpage
Michael Mao wrote:
   

Is there a way to capture a snapshot of a html page and save it as a
jpg  using php?
 

This is something that's very very hard to do with PHP but can be easily
done with Java.
   

I would guess the easiest way would be to find some external program that
retrieves the page and then renders to an image file.  I don't offhand the
names of any utils that do this, but I'm sure there must be at least /one/
available!
 

if you're feeling extremely ambitiious, how about taking the gecko 
source and rendering the result to a PDF or JPG file instead of the 
screen?  come on guys get with it.

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


Re: [PHP] trying to do too much with functions?

2004-09-02 Thread Jonathan Haddad
John Holmes elegantly wrote:
From: Justin French [EMAIL PROTECTED]
I have a few functions with way too many parameters in them, or 
functions which have a non-obvious order of parameters which I 
constantly have to refer to as I'm working.  Since I'm using PHP as 
my templating language (none smarty here!) as well as the programming 
language.  So I've been looking for some alternatives...

My main objectives:
  1.  have all parameters optional
  2.  have a mixed order for the paramaters
Other languages seem to do this well (Ruby, or perhaps RubyOnRails 
seems good at it), but in PHP I can only see a few options... I'm 
hoping someone might offer a few more ideas.

? $params = array('a'='123','b'='456'); echo doStuff($params); ?
?=doStuff(array('a'='123','b'='456'))?
?=doStuff('a=123','b=456')?
?=doStuff('a','123','b','456'); ?
?=doStuff(a='123' b='456')?
So, is that it?  Have I thought of all possible options?

Have you looked at the Function Handling Functions?
http://www.php.net/manual/en/ref.funchand.php
An array is probably your best bet, though, since you want to have 
mixed orders. The only way you'd be able to identify what parameter is 
which is by using the keys of the array, then.

---John  Holmes...
OR, if you really wanted to get crazy, you could do it like objective-C.
function blah()
{
   // contents
}
call the function like so
$classobject-function(firstname:jim, lastname:steve );
within the function, you could call func_get_args, then map your 
variables to an array using list($var, $val) = explode( :, $arg[x] )

of course, if you had a : (colon) in either string that exact solution 
wouldn't work.  but that's not the point of this lesson. 

i should note that I've considered doing this before and I didn't.  Now 
i just use default values of NULL.

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


Re: [PHP] unlink() rmdir() ... Problems.

2004-08-23 Thread Jonathan Haddad
PHP probably does not have permission to change those files.  chmod 777 
and it should work.

However now those files are writable by anyone.  If you're on a shared 
server there could be problems later.

Jon
PHP Junkie wrote:
Ave,
I do not really know what the problem is because I don't get an error, and
in fact my scripts execute fine... Except that, niether is the directory
deleted, nor is the file deleted. Only corresponding database entries are
deleted which I specify in my SQL code.
There are 2 different functions in 2 separate places in my File Manager.
1 function deletes the User including his Folder
The other deletes a particular file.
The code I'm using to delete the User  his Folder is:
?php
if($delete_user) {
$db = mysql_connect(localhost,usr,pwd);
mysql_select_db(mydb,$db);
$sql = DELETE FROM user where login = '$user';
$result = mysql_query($sql) or die(There is a problem.);
$sql2 = DELETE FROM file where login = '$user';
$result2 = mysql_query($sql2) or die(There is a problem.);
rmdir (imsafm/$user);
echo brbismallUser $user deleted./small/i/bbr;
}
?
The name of Folder of a user is the same as his Login.
Anyhow... The above code doesn¹t generate any error, and in fact does delete
the database entries from the table... But it doesn¹t remove the user¹s
directory. Why is that?
Similarly, this is the code for deleting the file:
?php
$db = mysql_connect(localhost,usr,pwd);
mysql_select_db(mydb,$db);
$sql = DELETE FROM file where ID = '$ID';
$result = mysql_query($sql) or DIE(Cannot Do!);
unlink($P/$F);
echo centerFile Deleted/center;
?
Again, no error... The entries in the table get deleted.. But file remains
in the directory.
Any suggestions?

 

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


Re: [PHP] How do I open Save As Dialog Box?

2004-08-23 Thread Jonathan Haddad
In Safari it'll download the file and then open it. 

Jon
PHP Junkie wrote:
Ave,
IT WORKS!!
There wasn't one bit of a problem..
I'll just paste the code here again for anyone who might be looking for it.
I guess I was very close to it but just doing one thing wrong... I wasn't
specifying the Basename directive.
?php
$file = $P/$F;
header(Content-Description: File Transfer);
header(Content-Type: application/force-download);
header(Content-Disposition: attachment; filename=.basename($file));
@readfile($file);
? 

Although this doesn't work on MAC... It works on Windows .. In Mac it still
opens up the file in it's supported software. But it's not an issue for me.
Thanks a ton guys...

On 8/23/04 10:51 AM, John Holmes [EMAIL PROTECTED] wrote:
 

From: PHP Junkie [EMAIL PROTECTED]
   

I have created a File Manager Application for my company which has a place
where authorized users can download the stored files. The files are of
various MIME Types.. Mainly PDF, TXT  DOC.
What I want to do is basically... When the user clicks on the Download
Button... The Save As Dialog Box should appear...
What is happening right now is that the file opens in it's related
software
(Word, Acrobat, Notepad etcetera). I don't want the file to open in it's
native software.
I know I need to use the
header (Content-type: application/octet-stream);
But I don't know how.
 

Read the first comment here: http://us4.php.net/readfile
---John Holmes... 
   

 

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


Re: [PHP] unlink() rmdir() ... Problems.

2004-08-23 Thread Jonathan Haddad
the chmod 666 sets the exisiting files to be edited by the server.  
anything that's uploaded by the server is owned by it, and thusly can be 
edited.

as a side note, you'd have to chmod 777 the directory to be edited if 
you want uploads to work.

PHP Junkie wrote:
Ave,
Well here's my situation...
You see the File Manager allows users to Upload files ... Once a user
uploads the file... It resides in a particular folder on my server. Users
will be constantly uploading, downloading, deleting files. I can't possibly
CHMOD 777 all the time...
My question is... If I select the nobody group for the base folder where
the files are stored  created... Will all the directories  files which are
created later by the users using the website therein have the permissions to
be deleted, if I set the permissions to read  write on that base folder?
Thanks.

On 8/23/04 12:48 PM, Jay Blanchard [EMAIL PROTECTED]
wrote:
 

[snip]
How do I find out which user/group my web server is running as?
I'm running an Apache Web Server on my Power MAC G5 (Mac OS X) machine.
I can change the user/group permissions... But which user/group does the
web
server use?
[/snip]
For security reasons Apache typically runs as nobody
   

 

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


Re: [PHP] Template Question

2004-08-13 Thread Jonathan Haddad
eval takes a string and evaluates it as PHP, which I also thought would 
work.  But this is a file of mixed PHP and HTML.

I've designed it this way because I work with guys that are dreamweaver 
crazy and want to do all their layout there.

Maybe I should parse the file, and eval() the PHP and echoing the HTML? 
 Or is there a better way?

Jon
On Aug 13, 2004, at 8:09 AM, John Holmes wrote:
Jonathan Hadddad wrote:
if there's any PHP code in the template file, it just gets echoed to
the page.  is there any way to have the code between the ?  ?
evaluated instead of just echoed??  I realize an include would work,
but the goal is to use a single file as the template.
anyone got any suggestions?
eval()
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com


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


Re: [PHP] Re: php tools

2004-08-10 Thread Jonathan Haddad
BBEdit is the tool of the Gods.
Jon
Lester Caine wrote:
Matthew Weier O'Phinney wrote:
So, you basically need a text editor with good syntax highlighting for
X/HTML, PHP, CSS, SQL, and javascript. As I said, I have that in Vim. I
also know EditPlus has that and is either shareware or freeware.
If you're looking for an IDE, can't help you.

Eclipse + phpeclipse
http://www.eclipse.org/
http://sourceforge.net/projects/phpeclipse
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: [Q] How to setup Dreamweaver so that PHP scripts are executed?

2004-08-09 Thread Jonathan Haddad
And if you want to be really extreme, you can edit httpd.conf to use 
virtual hosting and recognize each of the sites you have as individual 
web servers.

Then, edit your hosts file to match the domains.. say I am working on my 
own web site, oldirtyhaddad.com (shameless plug).  I have set up my 
hosts file to recognize oldirtyhaddad and it gets served up locally.  I 
have one of these for each of the 20 sites that I maintain.  I also have 
this set up for phpMyAdmin.  (accessed by typing dbadmin).

Jon
Chris Martin wrote:
Michael T. Peterson wrote:
Hi,
I know this must be really obvious to many of you, but I have been 
unable to
configure DW (using [preferences] or [site-edit]) so that it will 
execute a
php script from a form action=foo.php... tag.  When the submit 
button is
clicked the php file is displayed, rather than executed.

Here's the HTML code of the submit button form:
form action=update_river_measurements.php method=post name=form1
target=mainFrame
 select name=interval_period
  optionSelect interval/option
  option value=22 days/option
  option value=44 days/option
  option value=88 days/option
  option value=3131 days/option
  /select
 input type=submit value=Update Database
/form
When the [Update Database] button is clicked, the file specified by the
action parameter is displayed, rather than executed.
My dev machine is a Windows XP system with Apache, PHP, and MySQL 
installed.
I have confirmed that my Apache-PHP configuration is correctly 
configured.
For example,  PHP correctly executes the script when I pass
update_river_measurements.php to IExplore.exe from the command 
line. Also,
when I upload these local files to my ISP, the PHP also executes 
correctly.

Any suggestions as to how to get DW to execute these files would be
appreciated.
Cheers,
Michael
P.S. Cross-posted to the DreamWeaver news group
I'm not sure that dreamweaver will execute them.
If you've got Apache/PHP setup, just go to 
http://localhost/your_script.php in your browser to test them out, no 
need to use the command line to pass to a browser.

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


Re: [PHP] SQL Join query

2004-08-09 Thread Jonathan Haddad
The only problem there is when you group the LEFT JOIN pictures that 
have a count of 0 return a count of 1.  Unfortunately there's no single 
query that I figured out when I did this same project that would give 
accurate results.

John Holmes wrote:
Mattias Jönsson wrote:
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics, 
pic_comments WHERE pics.category = 1 AND pics.id = 
pic_comments.pic_id GROUP BY pic_comments.pic_id;
[snip]
The problem is that i only get the the pictures that have comments, i 
want even the pictures where there arent no comments and the field 
num_comments should be 0.

Need a LEFT JOIN
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics LEFT 
JOIN pic_comments on pics.id = pic_comments.pic_id WHERE pics.category 
= 1 GROUP BY pic_comments.pic_id

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


Re: [PHP] Usng Session Vaiable in WHERE Statement

2004-07-26 Thread Jonathan Haddad
Remember you can always use curly braces..
SELECT * from MembersData WHERE UserID = '{$_SESSION['logname']}'
works just fine
Jonathan Haddad
Afan Pasalic wrote:
I think he has to keep the single quotes and add double quotes with dots:
$MembersDataQry = SELECT * FROM MembersData WHERE UserID=' 
.$_SESSION['logname']'. ' ;

afan
At 09:24 AM 7/26/2004, Jason Davidson wrote:
hey, just take the single quotes around the word logname out and you
should be ok.
Jason
On Mon, 26 Jul 2004 12:58:28 +0100, Harlequin
[EMAIL PROTECTED] wrote:
 Could someone please help me with my syntax here...?

 $MembersDataQry = SELECT * FROM MembersData
 WHERE UserID='$_SESSION['logname']';

 I get an error on line 2 but can't seem to figure out what I've 
missed.

 The variable echoes fine so I know there's a string in there.

 --
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -

 --
 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] Trouble with sin()

2004-07-22 Thread Jonathan Haddad
as in 20 degrees?
float *sin* ( float arg)
*sin()* returns the sine of the arg parameter. The arg parameter is in 
radians.

RADIANS. 

|sin(deg2rad(20));
|
Jon
Marcus Strube wrote:
Hi,
i'm working with PHP 5.0.0 (Linux) and have some trouble using function sin(). 
In PHPs opinion

sin(20) 

is 

0.912945250728
I have had a look at the bug.php.net, but couldn`t find anything. Is it a bug 
or am I just misunderstanding something??

Marcus
 

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


Re: [PHP] Error when using HTTP Location header

2004-07-21 Thread Jonathan Haddad
I've seen it work with a relative URL, which suprised me, because until 
I had saw that I would have agreed with you.

Jon
Chris Shiflett wrote:
--- Arnout Boks [EMAIL PROTECTED] wrote:
 

header('Location: ' . urlencode('loginForm.php?error=Incorrect
password'));
   

The Location header requires an absolute URL. Also, this is the header you
are sending:
Location: loginForm.php%3Ferror%3DIncorrect+password
I doubt that's the URL you meant. URL encode the value of URL variables,
not the entire URL.
Lastly, I hope you're not blindly displaying $_GET['error'] on your
loginForm.php page, otherwise you have a cross-site scripting
vulnerability.
Hope that helps.
Chris
=
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/
 


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


Re: [PHP] PHP error catching....

2004-07-20 Thread Jonathan Haddad
error_reporting( E_NONE )?
Jon
Scott Fletcher wrote:
Close, but still not quite it.  I can't remember what I did 6 to 8 months
ago.  I do remember that it was written to temporary suppress the php error
while the other part of the php script can be allow to execute before
unsupressing the php error.  I do not meant the @ part..  It was a
function where I can enter the PHP's defined parameter in the function.
Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

* Thus wrote Scott Fletcher:
   

What are those php functions that catch the PHP errors, not display it
 

and
 

do something to it while the user load a webpage.   I don't remember
 

what
 

those are.  :-(
 

It sounds like you're looking for http://php.net/set_error_handler

Curt
--
First, let me assure you that this is not one of those shady pyramid
   

schemes
 

you've been hearing about.  No, sir.  Our model is the trapezoid!
   

 

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


Re: [PHP] textarea/display question...

2004-07-20 Thread Jonathan Haddad
Anything inside that textarea actually get's displayed.  So they will 
actually see that HTML.
I don't know of a way to actually highlight sections within the text 
area, and I don't think there is one.  You could highlight the text 
outside of the textarea though.

Jon
bruce wrote:
hi..
i'm presenting a textarea to the user...
i'd like to be able to display the information within the textarea in a
table format. this would allow me to highlight the material that the user
should modify. however, i can't figure out how to accomplish this...
$foo = 'tabletrtd class='red'blah/td/tr/table';
textarea value='$foo'/textarea
something like the above, but without displaying all the attrib stuff...
any ideas/pointers would be appreciated..
thanks
-bruce
 

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


Re: [PHP] Problem of a beginner with Array

2004-07-20 Thread Jonathan Haddad
You don't have to declare an array size in PHP.First you can do this:
$arr = array();
then
$arr[1] = 50;
$arr[2] = true;
$arr[3] = some value;
or you can loop through
foreach( $i = 0; $i   50 ; $i++ )
   $arr[$i] = false;
I believe you can assign the checkbox names in HTML as grid[] and in php 
the array value will be filled in for you.

Jon
Henri Marc wrote:
Hello,
I'm just starting with PHP and I have a problem. This is certainly very easy for you 
but for me, it's tough.
I want to make a lottery site (just as an exercise), so I made a page with 6 grids of 
50 numbers each (check boxes).
Now, I want to know which numbers have been checked by the player.
I have a :
input name=Grid1 type=checkbox
for the first grid. Grid2 for the grid #2...
I was thinking to get the numbers chosen by the player with $_POST['Grid1[]']
Grid1 being a table but it doesn't work. I thought I wouldn't have to declare an 
array. I have 50 numbers for each grid, I don't want to have to type array followed by 
the 50 numbers. There is not a way to do something like array(1...50).
What is the solution?
Thank you very much (in advance) for your help.
Dave

-
Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
Créez votre Yahoo! Mail
Yahoo! Messenger : dialoguez instantanément avec vos amis - c'est  gratuit !
 

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