php-general Digest 8 Mar 2005 04:52:22 -0000 Issue 3325

2005-03-07 Thread php-general-digest-help

php-general Digest 8 Mar 2005 04:52:22 - Issue 3325

Topics (messages 210172 through 210202):

Re: Improving a MySQL Search
210172 by: Jay Blanchard

GET vs POST (was: Preventing data from being reposted?)
210173 by: Christophe Chisogne

using javascript within php
210174 by: Ross Hulford
210175 by: John Nichel
210176 by: Jay Blanchard

Re: A general question
210177 by: zzapper
210178 by: Stephen Johnson
210181 by: zzapper

'Open Base' with PHP
210179 by: François-Xavier LACROIX

Open Base with PHP
210180 by: François-Xavier LACROIX

Sessions
210182 by: db
210186 by: Jason Barnett
210191 by: db

Re: FTP functions
210183 by: Tim Boring

Re: mac os x - not getting headers already sent error
210184 by: Jonathan Haddad

Re: Problem with ftp_get and ftp_put over SSL--SOLVED
210185 by: Tim Boring

ftp upload via web form - problem getting the file name correct
210187 by: Steve Turnbull

call anchor from php
210188 by: Ross Hulford
210190 by: Chris W. Parker
210193 by: Chris W. Parker

Using switch() to process a set of forms
210189 by: Greg Dotts
210192 by: kjohnson.zootweb.com
210198 by: Greg Dotts

Re: Open source portal systems???
210194 by: Alan Fullmer

Re: Randomize an array?
210195 by: Rick Fletcher
210199 by: Brian Dunning

get image from browser url.
210196 by: buck Wheat
210201 by: Jochem Maas

Re: SOLVED: Re: [PHP] Document root, preferred way to find it???
210197 by: Tom Rogers

Newbie Question re substr
210200 by: Jackson Linux
210202 by: Zareef Ahmed

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
[snip]
Further to my email last week, I've now indexed all the fields that get
searched
on (i.e. sql statement is similar to select x, y from table where
x='blah' - x
is the indexed field).

Is that the correct field to index?
[/snip]

Yes, have you tried an EXPLAIN on your SELECT?

[snip]
Sorry for it being so long, but that's the table!
[/snip]

Have you considered the MySQL mailing list?

[snip]
Currently there are 1.5 million (1,500,00) records, and searching the
table for
the last 10 records is taking up to 40 seconds.
e.g. select unixtime, type, subtype, src, dst, msg, pri from syslog
where
type='ips' ORDER BY unixtime DESC LIMIT 10
Does anyone have any suggestions for improving the search?
[/snip]

Bigger, faster hardwarereally, what are you running this on? I have
some tables nearing the 500,000,000 (half a billion) records mark
running on multi-processor servers that do searches in under a minute. 
---End Message---
---BeginMessage---
Richard Lynch a écrit :
POST versus GET is an aesthetic choice, not Security, not Performance.
Of course, I agree it's not really a 'security' choice.
But another think you can think of can be found in the HTTP/1.1 spec
(rfc 2616) in the 'Safe Methods' section [1]. To summarize:
- GET (and HEAD) should only retreive things, with no side effect
- POST (and others) means taking action (with side effects)
It's 'sould', not 'must' or 'must not'. Anyway, I think its worth
a few seconds to think about it.
Christophe
From [1] :

9.1.1 Safe Methods
   Implementors should be aware that the software represents the user in
   their interactions over the Internet, and should be careful to allow
   the user to be aware of any actions they might take which may have an
   unexpected significance to themselves or others.
   In particular, the convention has been established that the GET and
   HEAD methods SHOULD NOT have the significance of taking an action
   other than retrieval. These methods ought to be considered safe.
   This allows user agents to represent other methods, such as POST, PUT
   and DELETE, in a special way, so that the user is made aware of the
   fact that a possibly unsafe action is being requested.
   Naturally, it is not possible to ensure that the server does not
   generate side-effects as a result of performing a GET request; in
   fact, some dynamic resources consider that a feature. The important
   distinction here is that the user did not request the side-effects,
   so therefore cannot be held accountable for them.

[1] 9.1.1 Safe Methods (pg 51)
ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt
---End Message---
---BeginMessage---
I want to set focus on a text area with javascript if the entry by the user 
is not what I want.

This is what i have so far.
?php

if (isset($submitted){

if(empty($name)) {

[PHP] pspell replace

2005-03-07 Thread Noodles
Hi,
After much messing around I've got a custom dictionary working properly, 
but I can't seem to find the format for a custom replace file 
(custom.repl in examples on php.net).

Can anyone point me in the right direction or give me an example file?
Thanks
Nick
P.S.
In case anyone is wondering the format for a custom dictionary is:
personal_ws-1.1 en 5024
myword
myotherword
...
en being the language you're writing a custom dictionary for and 5024 
being the number of words in the dictionary

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


[PHP] Re: Download with header() - file corrupted

2005-03-07 Thread Werner Jäger
I solved the problem with inserting this line at the beginning:
ob_end_clean();
all works fine..
I am using php 4 with IIS6 / WinServer 2003
thanks
Werner Jäger wrote:
I try to download a file wit follow code:
   $len = filesize($file);
   $filename = basename($file);
   header(Pragma: public);
   header(Expires: 0);
   header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
   header(Cache-Control: public);
   header(Content-Description: File Transfer);
   header(Content-Type: $ctype);
   $header=Content-Disposition: attachment; filename=.$filename.;;
   header($header );
   header(Content-Transfer-Encoding: binary);
   header(Content-Length: .$len);
   readfile($file);
   exit;
All works pretty well, the filename is correct, the Content Type and the 
file size.
When I try to open the downloaded file I see nothing.
The source file on the web server works great.

I played with Content-Transfer-Encoding and tried all values from the RFC
Any ideas?
thank you
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: pspell replace

2005-03-07 Thread Noodles
Nevermind I found it myself
Format should be:
personal_repl-1.1 en 0
misspelling replacement

Noodles wrote:
Hi,
After much messing around I've got a custom dictionary working properly, 
but I can't seem to find the format for a custom replace file 
(custom.repl in examples on php.net).

Can anyone point me in the right direction or give me an example file?
Thanks
Nick
P.S.
In case anyone is wondering the format for a custom dictionary is:
personal_ws-1.1 en 5024
myword
myotherword
...
en being the language you're writing a custom dictionary for and 5024 
being the number of words in the dictionary
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] testing

2005-03-07 Thread Greg
Just testing guys :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Inline Frame and php

2005-03-07 Thread f00l
Hi,
Would I be right in assuming that the top frame has the search button but 
when searching, the results appear on a new window? or the main window?

Greg

Todd Cary [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 My client insists on using inline Frames that uses my php pages.  As an 
 example, this is on one page:

 IFRAME target=_top frameborder=0 
 SRC=search.php?search_text=?echo($search_text);? WIDTH=592 HEIGHT=282
 /IFRAME

 This works well with the control being given to search.php.  What I do 
 not understand is that within search.php, I have a statement that is 
 suppose to pass control to anther page.  The line is

 header(location: http://192.168.0.23/mypath/mypage.php;);

 Rather than going to the page, it opens mypage.php in the inline frame.

 Is there a way to leave the inline frame?

 [Excuse my nomenclature e.g. control, leave]

 Todd 

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



[PHP] Timeouts during large uploads, very slow queries etc

2005-03-07 Thread zzapper
I am running a simple Upload script in PHP using a HTML Form with a File 
field.  The user can browse their computer and upload a file.  It works great, 
except for large files, where the browser will timeout.  The timeout appears 
to happen after about 5 minutes.  Any ideas on how to get around this?

I dont think this is just a PHP problem.
I 've had it with 2 other scripting languages.

AFAIK the client browser timesout rather than the upload application. ie the 
client's browser thinks
nothings going on and timesout.

I did read of a nasty fix, where you have a simple frameset where the app is in 
the main Frame and
there's a tiny invisible  frame where a piece of javaScript periodically 
refreshes or write's a
character to the frame to fool your browser.

Has ANYONE got any experience/views on this

zzapper (vim, cygwin, wiki  zsh)
-- 

vim -c :%s%s*%CyrnfrTfcbafbeROenzSZbbyranne%|:%s)[R-T]) )Ig|:norm G1VGg?

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips

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



[PHP] Shoutbox without sql dbase

2005-03-07 Thread f00l
Hi all,
I was wondering if anyone has come across (or even using) a shoutbox that 
doesnt require an sql dbase. While it isnt hard to access one id prefer to 
write everything to a file (wanting to learn how to write, append etc files)
I tried one but for some reason the script processing turned into some 
random java script about symwindow openning etc   -has anyone heard of this 
or know what it means?

Thanks all

Greg 

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



Re: [PHP] Semi-OT: Anti-password trading/sharing solutions

2005-03-07 Thread f00l
Come here to get help, not abuse
for what its worth:
sql dbase with fields
usernamepassiptime
if duplicate username/passowrd then check that IPs match and dont do 
anything
if IPs  match then kick both users off / disable username/password

go figure the code out yourself
here is the idea which is the most you have got out of anyone

Dan [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Richard Lynch wrote:
 Dan Trainor wrote:

 I'm not quite sure why you chose the PHP community as a recipient --  
 There
 are quite a few Apache modules out there.

 And Modules such as mod_auth_mysql and mod_auth_ldap (?) and, really, any
 old mod_auth_XYZ module would be a closer match for what you want, I
 think.

 I know absolutely nothing about how ProxyPass, iProtect, and PureMember
 work, however, so perhaps there is something about them that just screams
 use PHP to do this  [I doubt it though]

 It seems to me, however, that you're still a bit off-target on
 PHP-General, as your target audience is not those who use PHP, but those
 who wrote it and maintain it, particularly the Apache Module part of it.

 I believe, in fact, that the Apache Module part of it boils down to the
 code Rasmus Lerdorf wrote ages and ages ago, and that mostly Rasmus (I
 think) has maintained since then.

 Perhaps with Apache 2, somebody else stepped up to write/maintain that
 code, and I'm under-informed.

 Or maybe Rasmus hasn't touched that code in ages, and somebody else is
 doing it now.  Apologies to those individuals who I've slighted by not
 naming them at this time.

 At any rate, you're trying to get in contact with a handful of people by
 sending email to thousands.  Bad Idea #1.

 NOTE: Contacting Rasmus directly and offering him $$$ to do this would
 maybe not be a Bad Idea.  Asking him to do it for free would be really
 stupid.

 Next, let's look at your proposal:

 You want something that Member Sites need, to avoid the theft/sharing of
 username/passwords.

 So, in particular, only for-pay Member Sites need this, mostly, as 
 there's
 not much point in stealing/sharing a username/password if you can just 
 get
 one for free.

 So, basically, it's a for-profit motivator that drives this request.

 Yet nowhere do I see an offer of recompense for the developers who write
 this software for you.  Bad Idea #2.

 I highly recommend you figure out what it would be worth to you and some
 of your colleagues/friends to have an OpenSource solution to rival the
 current proprietary technologies.

 Take up a collection or form a very loose consortium with some of your
 colleagues to fund the project.

 Then write up a specification for what you want done, and make an offer 
 to
 PAY somebody and fund the resources needed to get the project from its
 current state (gleam in your eye) to a usable state.

 You could and probably should still make it OpenSource -- Perhaps with
 Funded by:  attributions on all source code and materials to plug your
 consortium and its members -- and then when it's at the stage of
 usefulness that you need, you will probably find that some people are
 willing to maintain it for little or no money at all.

 Right now, though, you've got a lot of people seeing:

 I want you to work for me for free so I can save thousands of dollars
 every month

 That ain't gonna happen, dude.

 People wrote PHP and Apache and other OpenSource software because THEY
 needed it for THEIR own use, and were willing to give it to you for FREE
 because they knew that giving away 10,000 free copies would get them one
 (1) more Developer to help build/improve the software.

 They did *NOT* do it because they wanted you to be able to run your
 company on free software.

 Which is not to say that they *MIND* that you can do that -- Only that
 they're not going to just up and code something just because *YOU* happen
 to need it to run your company more efficiently.

 You've got zero incentive for the Developer here -- They don't need the
 Module you want, and you're not paying them.  [shrug]



 Go ahead and look at my first email.  For some reason you didn't get the 
 idea that I was looking for solutions.  Ideas.  I wasn't looking for 
 anything solid.

 The reason why I wrote to the PHP community was to get some ideas. Aside 
 from the two people who have sent me hatemail today, the PHP comunity is 
 very intelligent, very clever, and might have worked on something like 
 this in the past.  That's the information that I was after.

 Rasmus?  Waht's he got to do with anything?  Sure, I value and credit the 
 work he's put into PHP, but I really think that using his name in this 
 context has no point.

 Who asked anyone to write any software for me?  Again, let's focus on the 
 primary purpose of this email - to gather information so that I can do 
 some further investigation.

 You know, you're right.  It's stupid for me to think that Open Source 
 software is used in for-profit situations.  PHP, Apache, MySQL, 

[PHP] [ignore] testing connection

2005-03-07 Thread Greg
ignore please, just testing connection :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] FTP functions

2005-03-07 Thread Vaibhav Sibal
Hi
I checked ou the ftp functions of PHP, what I wanted to ask was that
if I connect to a remote server and issue and ftp_fget() command the
file will be downloaded to the server running the PHP code and Apache
webserver or the client machine from which we are calling it ? In the
sense for example I have a client machine running on windows XP, I
launch the mozilla firefox browser in that and call for the
ftp_code.php on my server (http://server). The ftp_code.php contains a
code which connects to a remote ftp server and then using the
ftp_fget() function downloads a file from the remote server. Now where
will this file be downloaded ?

Though I have an inkling that since PHP is a server side scripting
language, the file will be downloaded to the server only... But i
still wanted to confirm

Please confirm

Thanks in advance

Vaibhav Sibal

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



[PHP] A more ecconomical way with control statements??

2005-03-07 Thread Ross Hulford
if (empty($samosa)){
// do nothing

}

else {

setcookie(cookie[samosa], $samosa);

}


if (empty($pakora)){
// do nothing

}

else {

setcookie(cookie[pakora], $pakora);

}


It goes on like this for the whole menu I am looking for a more effiecient 
way to do this. The inputs are text boxes taking values from 0-9.

Thanks



Ross 

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



[PHP] fsockopen and session_start

2005-03-07 Thread Pedro Garre
*This message was transferred with a trial version of CommuniGate(tm) Pro*

Hi,

I am using fsockopen to simulate a POST to another page (test_post.php) within 
the same server.

Data sent to the socket is:
  POST $uri HTTP/1.1\r\n.
  Host: $host\n. User-Agent: mandapost\r\n.
  Cookie: .session_name().=. session_id().\r\n.
  Content-Type: application/x-www-form-urlencoded\r\n.
  Content-Length: $contentlength\r\n.
  Connection: close\r\n\r\n.
  $my_post_variables\r\n;

$_SESSION is used to hold some variables.

test_post.php is:
?php
session_start();
echo User.$_SESSION[user];
...


The problem is that session_start creates a new session instead of using the 
session_id indicated in the cookie.

A user comment in the online PHP manual says:
Just for info, session_start() blocks if another PHP using the same session 
is still running in background. It seems it's waiting the other PHP to 
finish... and sometimes it can be a problem. Create 2 different sessions by 
setting 2 different names : session_name() solve the problem.

The above comment seems correct and PHP hangs until some time-out or something 
occurs. The previous session is not started anyway.
I tried to change the name with use session_name, to change the ID with 
session_regenerate_id, also some tests with session_id, ...
I also tried to send data to the sockect using PHPSESSID and $_COOKIE instead 
of session_name and session_id.

This is my current code:
?php
$previous_name = session_name(MASIVO);
//sessionid($previous_name);

session_start();
//session_regenerate_id();

echo ##.$previous_name.##.$_COOKIE[$previous_name].##; // (1)
echo User.$_SESSION[user];

(1) It is correct: ##PHPSESSID##09a169b69eccbf2dd49407c5d4cc84aa##

And this is what the socket returns:
HTTP/1.1 200 OK Date: Mon, 07 Mar 2005 13:43:51 GMT Server: Apache/1.3.28 
(Unix) PHP/4.3.3 mod_ssl/2.8.15 OpenSSL/0.9.7c X-Powered-By: PHP/4.3.3 
Set-Cookie: MASIVO=79241c1fb5309b6487f689eb30c65caa; path=/ Expires: Thu, 19 
Nov 1981 08:52:00 GMT Cache-Control: private, max-age=10800, pre-check=10800 
Last-Modified: Mon, 7 Mar 2005 13:38:57 GMT Connection: close 
Transfer-Encoding: chunked Content-Type: text/html c7 
##PHPSESSID##09a169b69eccbf2dd49407c5d4cc84aa##
Notice: Undefined index: user in ... etzetera

I am running out of ideas. Could anyboy help ?

Thanks,

Pedro.

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



RE: [PHP] A more ecconomical way with control statements??

2005-03-07 Thread Stanislav Kuhn

in the form:
...
input type=text name=cookie_vars[samosa]
input type=text name=cookie_vars[pakora]
...

in the script
...
foreach($_REQUEST['cookie_vars'] $var_name as $var_val)
  if (!empty($var))
setcookie(cookie[$var_name], $var_val);
...

Stan

-Original Message-
From: Ross Hulford [mailto:[EMAIL PROTECTED]
Sent: 07 March 2005 12:59
To: php-general@lists.php.net
Subject: [PHP] A more ecconomical way with control statements??


if (empty($samosa)){
// do nothing

}

else {

setcookie(cookie[samosa], $samosa);

}


if (empty($pakora)){
// do nothing

}

else {

setcookie(cookie[pakora], $pakora);

}


It goes on like this for the whole menu I am looking for a more effiecient 
way to do this. The inputs are text boxes taking values from 0-9.

Thanks



Ross 

-- 
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] Pear DB class not PHP5 strict compatible?

2005-03-07 Thread Richard Davey
Hi,

   Having heard good things about the PEAR DB package I wanted to try
   it out on a new project. I'm using PHP 5.0.3, ran the go-pear and
   installed the latest version but upon including it in my script it
   brings up rafts of errors such as:

Strict Standards: Assigning the return value of new by reference is deprecated 
in D:\dev\php-5.0.3\PEAR\DB.php on line 470

   I run PHP with E_ALL | E_STRICT because it's the best way for me to
   catch all errors and keep my code sensible - do the Pear packages
   not also work in this environment or am I just out of luck re: the
   DB package itself?

   It included and worked fine when I switched to PHP 4, but that
   isn't an option for this project.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



[PHP] Re: Pear DB class not PHP5 strict compatible?

2005-03-07 Thread M. Sokolewicz
Richard Davey wrote:
Hi,
   Having heard good things about the PEAR DB package I wanted to try
   it out on a new project. I'm using PHP 5.0.3, ran the go-pear and
   installed the latest version but upon including it in my script it
   brings up rafts of errors such as:
Strict Standards: Assigning the return value of new by reference is deprecated 
in D:\dev\php-5.0.3\PEAR\DB.php on line 470
   I run PHP with E_ALL | E_STRICT because it's the best way for me to
   catch all errors and keep my code sensible - do the Pear packages
   not also work in this environment or am I just out of luck re: the
   DB package itself?
   It included and worked fine when I switched to PHP 4, but that
   isn't an option for this project.
Best regards,
Richard Davey
PEAR uses a lot of (IMHO ugly) hacks to circumvent bugs in (very) early 
php versions. Back when PHP 4 was released there was a bug with 
assigning objects to variables, at a certain point people found out that 
by using $a = new class; circumvented that bug, and didn't pose any 
real problem in later versions, so PEAR uses that still. As of PHP 
5.0.0, this is considered bad behaviour, but since PEAR should be usable 
for old versions of PHP aswell, it still keeps this syntax.

I personally find most PEAR packages extremely bloated, and badly coded, 
but that's just a personal opinion. However, you can edit the package 
yourself and replace the = new to = new :)

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


RE: [PHP] Timeouts during large uploads, very slow queries etc

2005-03-07 Thread Chris Rose
 I am running a simple Upload script in PHP using a HTML Form with a
File
 field.  The user can browse their computer and upload a file.  It
works
 great, except for large files, where the browser will timeout.  The
 timeout appears to happen after about 5 minutes.  Any ideas on how to
get
 around this?
 
 I dont think this is just a PHP problem.
 I 've had it with 2 other scripting languages.
 
 AFAIK the client browser timesout rather than the upload application.
ie
 the client's browser thinks
 nothings going on and timesout.
 
 I did read of a nasty fix, where you have a simple frameset where the
app
 is in the main Frame and
 there's a tiny invisible  frame where a piece of javaScript
periodically
 refreshes or write's a
 character to the frame to fool your browser.
 
 Has ANYONE got any experience/views on this
 
 zzapper (vim, cygwin, wiki  zsh)

http://sourceforge.net/projects/megaupload/

Maybe this will help? I've been looking for a PHP replacement of
something as graceful as ASPUpload and this is the closest I can find.

Thanks.
 
Kind Regards,
Chris Rose

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



Re: [PHP] Pop-up message

2005-03-07 Thread f00l
not knowing much about php myself but you could ask phpBB  about their 
private msgs. i cant recall whther it is a mod that pops the window up on 
receiving a msg or whether the user is online (probably configurable). But 
as far as direction, that is where i would be heading :)
Greg

Richard Lynch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Lester Caine wrote:
 At the risk of being shouted at because *I* know it's not a PHP problem!

 Actually, it's a client problem :-)

 I have a page that is being refreshed every 30 seconds or so, and
 displays a list of 'tickets' waiting to be dealt with on a list from a
 database query. No problems there, but a couple of sites now want me to
 add a pop-up warning when a ticket is added that has a staff ID matching
 the logged in user.

 Your first task is to convince the client what an incredibly stupid idea
 this is.

 And that it won't work with all the popup blockers.

 And if it did work, it would just annoy the [bleep] out of their users.

 I know I'm preaching to the choir, here, but I have to go on record with
 this statement.

 I can drive a sounder in the target browser, but need kicking in the

 A sounder?  You mean like make my browser make noise?  ICK!!!

 right direction for a method of adding a pop-up window. Ideally it needs
 to be browser agnostic, which is where the problem comes given the
 pop-up blockers and other 'toys' that are being added to the browser end
 of things.

 You're not going to defeat the popup blockers in the long run.

 You are better off using clean simple code in an onLoad in your body tag
 to open the new window.  Something like:
 body onLoad=window.open(URL);
 where the URL loads in that user's recently added items.

 Either the users will accept the popup and whitelist it in their popup
 blocker, or they won't.

 And if a lot of them don't accept it, as they shouldn't, that tells you
 right there what a dumb idea this was. :-)

 But running around to find code to defeat the popup blockers will be a
 total waste of time -- and you'll end up with something so hacked and so
 un-maintainable that you'll have to fix it every six months, even if the
 popup blockers don't find workarounds to block your workarounds that popup
 the windows that they don't want popped up.

 So can anybody point me in the right direction for a CURRENT method of
 achieving this, many of the bits I've found so far are somewhat
 antiquated, and fail in one way or another :(

 Perhaps it would be better to segregate the tickets into those associated
 with the User logged in, and those that are not.

 Or to at least sort them that way, regardless of their other sorting 
 options.

 For that matter, don't even *BOTHER* to show me items that aren't mine,
 unless I specifically ask for them.

 Build a system that detects tickets that sit un-assigned for too long, and
 randomly assigns them, or, better yet, assigns them based on factors such
 as:
 Ticket features (IE, interface tickets to interface team members)
 Productivity (IE, don't assign as many tickets to your slow team members
 as your fast ones)
 User Status (IE, if I'm on vacation, don't assign me anything)
 .
 .
 .

 That way, no tickets is left sitting there too long but nobody has to
 deal with tickets that aren't assigned to them.

 Just an idea.

 In general, though, I only mean:

 Come back at the client with more than just That's a dumb idea (which it
 is)

 Come back with a Here's a MUCH better way to do this proposal.

 That's a dumb idea just gets you more headaches.

 A solution for a better solution makes you look real smart. :-)

 Yes, this may turn out to be a waste of your time, because the client is
 REALLY dead set on these popups, and you'll end up being miserable about
 them not taking your proposal as well...  Time to start looking for a new
 client. :-v

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

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



Re: [PHP] SOLVED: Re: [PHP] Document root, preferred way to find it???

2005-03-07 Thread Leif Gregory
Hello Tom,

Sunday, March 6, 2005, 11:20:04 PM, you wrote:
T I do this for security as I have things in include that I don't
T want to be avaiable directly to the browser Also you don't need a
T path for include files you can just do:

Don't necessarily disagree with you there other than if you place the
includes outside the web accessible folders how do you address the
managers of virtual hosts for the ability to modify, delete or add to
their particular include file? Additionally, how do you address
the naming convention of the include file.

i.e.
Site 'A' is using config.php
Site 'B' is using config.inc.php
Site 'C' wants to use config.php



T include('somefile.php');
T and it will be found regardless of where the script is located.

That's true enough..

BTW, good to see another TheBat! user here.

Thanks again.



-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



[PHP] A general question

2005-03-07 Thread Vaibhav Sibal
How can I click on a link which is linked to a JPG file and instead of
displaying it in the browser save it somewhere on the local machine or
open in a different software ?

Please help very urgent

Thanks
vaibhav

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



[PHP] Problem with Tabs and Newlines

2005-03-07 Thread Phusion
I'm having problems with a function I created to display filesystems.
The problem is that I can't get tabs (\t)  or newlines (\n) to work.

  function filesystems () {
$df = `df -kP`;
$mounts = preg_split('/\n/', $df);
$row = Filesystem\t . Size\n;
for ($i = 1, $max = sizeof($mounts); $i  $max; $i++) {
  $row .= $mounts[$i];
  $row .= \n;
}
$result = $row;
echo $result;
  }

...

table border=1 cellspacing=0 cellpadding=0 width=600 align=center
  tr
td width=600? filesystems();  ?/td
  /tr
/table

I just put filesystem and size on the first line to test the \t for
creating a tab. The \t and \n don't seem to work. What am I doing
wrong here? Thanks for any help you can give me.

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



SV: [PHP] A general question

2005-03-07 Thread Kim Madsen
Fra: Vaibhav Sibal [mailto:[EMAIL PROTECTED] 
Sendt: 7. marts 2005 15:26
Til: php-general@lists.php.net
Emne: [PHP] A general question

 How can I click on a link which is linked to a JPG file and instead of
 displaying it in the browser save it somewhere on the local machine or
 open in a different software ?

http://dk.php.net/manual/en/function.header.php

 Please help very urgent

:-)

-- 
Sincerly 
Kim Madsen

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



RE: [PHP] Problem with Tabs and Newlines

2005-03-07 Thread Jay Blanchard
[snip]
I just put filesystem and size on the first line to test the \t for
creating a tab. The \t and \n don't seem to work. What am I doing
wrong here? Thanks for any help you can give me.
[/snip]


/t and /n do not work for HTML output. If you view the source of your
HTML output you will see that the tabs and newlines are used properly.
You will have to substitute an HTML equivalent.

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



RE: [PHP] Problem with Tabs and Newlines

2005-03-07 Thread trlists
On 7 Mar 2005 Jay Blanchard wrote:

 /t and /n do not work for HTML output. If you view the source of your
 HTML output you will see that the tabs and newlines are used properly.
 You will have to substitute an HTML equivalent.

The HTML equivalent would likely be tables -- but if he uses pre then 
the tabs and newlines should work.

For the original poster -- in other words, near the start:

$row = preFilesystem\t . Size\n;

and near the end:

$row .= /pre\n

If you don't mind the monospaced font then that should work -- though 
you are at the mercy of whatever the browser uses for tab spacing.

--
Tom

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



[PHP] Re: Timeouts during large uploads, very slow queries etc

2005-03-07 Thread zzapper
On Mon, 7 Mar 2005 13:54:07 -,  wrote:


 
 zzapper (vim, cygwin, wiki  zsh)

http://sourceforge.net/projects/megaupload/

Maybe this will help? I've been looking for a PHP replacement of
something as graceful as ASPUpload and this is the closest I can find.

Chris,
Supercool, but I would also be interested in other solutions. May be I can also 
use the progress
meter part for sending bulk emails

zzapper (vim, cygwin, wiki  zsh)
-- 

vim -c :%s%s*%CyrnfrTfcbafbeROenzSZbbyranne%|:%s)[R-T]) )Ig|:norm G1VGg?

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips

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



[PHP] Randomize an array?

2005-03-07 Thread Brian Dunning
I have a Magpie RSS feed in an array, and I want to output it in random 
order. What's the best (fastest) way to do this?

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


[PHP] Re: Randomize an array?

2005-03-07 Thread M. Sokolewicz
Brian Dunning wrote:
I have a Magpie RSS feed in an array, and I want to output it in random 
order. What's the best (fastest) way to do this?

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


Re: [PHP] Re: Randomize an array?

2005-03-07 Thread Brian Dunning
On Mar 7, 2005, at 7:40 AM, M. Sokolewicz wrote:
array_rand()
But that's likely to give me the same element more than once. I want to 
output the entire array but in a random order, like a shuffled deck of 
cards.

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


RE: [PHP] Re: Randomize an array?

2005-03-07 Thread Jay Blanchard
[snip]
 array_rand()

But that's likely to give me the same element more than once. I want to 
output the entire array but in a random order, like a shuffled deck of 
cards.
[/snip]

Wow,. http://www.php.net/shuffle

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



[PHP] Re: Weird WMV/Media Player behaviour (Loading media file twice)

2005-03-07 Thread Jared Williams
 Does anyone have any idea why this is happening and how I can avoid
 this double request?

Try checking the UserAgent for each request.
http://support.microsoft.com/default.aspx?scid=kb;en-us;293792

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



RE: [PHP] Improving a MySQL Search

2005-03-07 Thread James Nunnerley
Further to my email last week, I've now indexed all the fields that get searched
on (i.e. sql statement is similar to select x, y from table where x='blah' - x
is the indexed field).

Is that the correct field to index?

My table structure is now as follows:
CREATE TABLE `syslog` (
  `ID` int(100) NOT NULL auto_increment,  `unixtime` int(20) NOT NULL default
'0',  `date` date default NULL,  `time` time default NULL,  `device_id`
varchar(255) default NULL,  `log_id` varchar(255) default NULL,  `type`
varchar(255) default NULL,  `subtype` varchar(255) default NULL,  `pri`
varchar(255) default NULL,  `SN` varchar(255) default NULL,  `duration`
varchar(255) default NULL,  `policyid` varchar(255) default NULL,  `proto`
varchar(255) default NULL,  `service` varchar(255) default NULL,  `status`
varchar(255) default NULL,  `src` varchar(255) default NULL,  `srcname`
varchar(255) default NULL,  `dst` varchar(255) default NULL,  `dstname`
varchar(255) default NULL,  `src_int` varchar(255) default NULL,  `dst_int`
varchar(255) default NULL,  `sent` varchar(255) default NULL,  `rcvd`
varchar(255) default NULL,  `sent_pkt` varchar(255) default NULL,  `rcvd_pkt`
varchar(255) default NULL,  `src_port` varchar(255) default NULL,  `dst_port`
varchar(255) default NULL,  `vpn` varchar(255) default NULL,  `tran_ip`
varchar(255) default NULL,  `tran_port` varchar(255) default NULL,  `user`
varchar(255) NOT NULL default '',  `ui` varchar(255) NOT NULL default '', 
`action` varchar(255) NOT NULL default '',  `reason` varchar(255) NOT NULL
default '',  `msg` varchar(255) NOT NULL default '',  `vd` varchar(255) NOT
NULL default '',  `hostname` varchar(255) NOT NULL default '',  `module`
varchar(255) NOT NULL default '',  `submodule` varchar(255) NOT NULL default
'',  `virdb` varchar(255) NOT NULL default '',  `idsdb` varchar(255) NOT NULL
default '',  `libav` varchar(255) NOT NULL default '',  `aven` varchar(255) NOT
NULL default '',  `imap` varchar(255) NOT NULL default '',  `smtp` varchar(255)
NOT NULL default '',  `pop3` varchar(255) NOT NULL default '',  `http`
varchar(255) NOT NULL default '',  `ftp` varchar(255) NOT NULL default '', 
`fcni` varchar(255) NOT NULL default '',  `fdni` varchar(255) NOT NULL default
'',  `idsmn` varchar(255) NOT NULL default '',  `idssn` varchar(255) NOT NULL
default '',  `rbldb` varchar(255) NOT NULL default '',  `seq` varchar(255) NOT
NULL default '',  `old_sintf` varchar(255) NOT NULL default '',  `old_dintf`
varchar(255) NOT NULL default '',  `old_saddr` varchar(255) NOT NULL default
'',  `old_daddr` varchar(255) NOT NULL default '',  `old_schd` varchar(255) NOT
NULL default '',  `old_svr` varchar(255) NOT NULL default '',  `old_act`
varchar(255) NOT NULL default '',  `old_nat` varchar(255) NOT NULL default '', 
`old_log` varchar(255) NOT NULL default '',  `new_sintf` varchar(255) NOT NULL
default '',  `new_dintf` varchar(255) NOT NULL default '',  `new_saddr`
varchar(255) NOT NULL default '',  `new_daddr` varchar(255) NOT NULL default
'',  `new_schd` varchar(255) NOT NULL default '',  `new_svr` varchar(255) NOT
NULL default '',  `new_act` varchar(255) NOT NULL default '',  `new_nat`
varchar(255) NOT NULL default '',  `new_log` varchar(255) NOT NULL default '', 
`sport` varchar(255) NOT NULL default '',  `dport` varchar(255) NOT NULL default
'',  `cat` varchar(255) NOT NULL default '',  `cat_desc` varchar(255) NOT NULL
default '',  `url` varchar(255) NOT NULL default '',  `from` varchar(255) NOT
NULL default '',  `to` varchar(255) NOT NULL default '',  `file` varchar(255)
NOT NULL default '',  `virus` varchar(255) NOT NULL default '',  `intf`
varchar(255) NOT NULL default '',  `attack_id` varchar(255) NOT NULL default
'',  `dir_disp` varchar(255) NOT NULL default '',  `tran_disp` varchar(255) NOT
NULL default '',  `name` varchar(255) NOT NULL default '',  `local` varchar(255)
NOT NULL default '',  `remote` varchar(255) NOT NULL default '',  `assigned`
varchar(255) NOT NULL default '',  `stat` varchar(255) NOT NULL default '', 
`loc_ip` varchar(255) NOT NULL default '',  `loc_port` varchar(255) NOT NULL
default '',  `rem_ip` varchar(255) NOT NULL default '',  `rem_port`
varchar(255) NOT NULL default '',  `out_if` varchar(255) NOT NULL default '', 
`vpn_tunnel` varchar(255) NOT NULL default '',  `init` varchar(255) NOT NULL
default '',  `mode` varchar(255) NOT NULL default '',  `stage` varchar(255) NOT
NULL default '',  `dir` varchar(255) NOT NULL default '',  `spi` varchar(255)
NOT NULL default '',  `old_status` varchar(255) NOT NULL default '', 
`new_status` varchar(255) NOT NULL default '',  `passwd` varchar(255) NOT NULL
default '',  `sintf` varchar(255) NOT NULL default '',  `dintf` varchar(255)
NOT NULL default '',  `saddr` varchar(255) NOT NULL default '',  `daddr`
varchar(255) NOT NULL default '',  `schd` varchar(255) NOT NULL default '', 
`svr` varchar(255) NOT NULL default '',  `act` varchar(255) NOT NULL default
'',  `nat` varchar(255) NOT NULL default '',  `log` varchar(255) NOT 

RE: [PHP] Improving a MySQL Search

2005-03-07 Thread Jay Blanchard
[snip]
Further to my email last week, I've now indexed all the fields that get
searched
on (i.e. sql statement is similar to select x, y from table where
x='blah' - x
is the indexed field).

Is that the correct field to index?
[/snip]

Yes, have you tried an EXPLAIN on your SELECT?

[snip]
Sorry for it being so long, but that's the table!
[/snip]

Have you considered the MySQL mailing list?

[snip]
Currently there are 1.5 million (1,500,00) records, and searching the
table for
the last 10 records is taking up to 40 seconds.
e.g. select unixtime, type, subtype, src, dst, msg, pri from syslog
where
type='ips' ORDER BY unixtime DESC LIMIT 10
Does anyone have any suggestions for improving the search?
[/snip]

Bigger, faster hardwarereally, what are you running this on? I have
some tables nearing the 500,000,000 (half a billion) records mark
running on multi-processor servers that do searches in under a minute. 

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



[PHP] GET vs POST (was: Preventing data from being reposted?)

2005-03-07 Thread Christophe Chisogne
Richard Lynch a écrit :
POST versus GET is an aesthetic choice, not Security, not Performance.
Of course, I agree it's not really a 'security' choice.
But another think you can think of can be found in the HTTP/1.1 spec
(rfc 2616) in the 'Safe Methods' section [1]. To summarize:
- GET (and HEAD) should only retreive things, with no side effect
- POST (and others) means taking action (with side effects)
It's 'sould', not 'must' or 'must not'. Anyway, I think its worth
a few seconds to think about it.
Christophe
From [1] :

9.1.1 Safe Methods
   Implementors should be aware that the software represents the user in
   their interactions over the Internet, and should be careful to allow
   the user to be aware of any actions they might take which may have an
   unexpected significance to themselves or others.
   In particular, the convention has been established that the GET and
   HEAD methods SHOULD NOT have the significance of taking an action
   other than retrieval. These methods ought to be considered safe.
   This allows user agents to represent other methods, such as POST, PUT
   and DELETE, in a special way, so that the user is made aware of the
   fact that a possibly unsafe action is being requested.
   Naturally, it is not possible to ensure that the server does not
   generate side-effects as a result of performing a GET request; in
   fact, some dynamic resources consider that a feature. The important
   distinction here is that the user did not request the side-effects,
   so therefore cannot be held accountable for them.

[1] 9.1.1 Safe Methods (pg 51)
ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] using javascript within php

2005-03-07 Thread Ross Hulford
I want to set focus on a text area with javascript if the entry by the user 
is not what I want.

This is what i have so far.
?php

if (isset($submitted){

if(empty($name)) {
$fname_error =  *Please Enter your firstname or initial;
//the code to set focus to the textbox should go here
}

}

?

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



Re: [PHP] using javascript within php

2005-03-07 Thread John Nichel
Ross Hulford wrote:
snip
PHP == Server Side
HTML/JavaScript == Client Side
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] using javascript within php

2005-03-07 Thread Jay Blanchard
[snip]
I want to set focus on a text area with javascript if the entry by the
user 
is not what I want.

if (isset($submitted){

if(empty($name)) {
$fname_error =  *Please Enter your firstname or initial;
//the code to set focus to the textbox should go here
}
[/snip]

if(empty($name)) {
$fname_error =  *Please Enter your firstname or initial;
//the code to set focus to the textbox should go here
echo window.document.YOURFORMNAME.name.focus();;
}

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



[PHP] Re: A general question

2005-03-07 Thread zzapper
On Mon, 7 Mar 2005 19:55:37 +0530,  wrote:

How can I click on a link which is linked to a JPG file and instead of
displaying it in the browser save it somewhere on the local machine or
open in a different software ?

Please help very urgent

Thanks
vaibhav

a href=/img/some.jpgSome/a

zzapper (vim, cygwin, wiki  zsh)
-- 

vim -c :%s%s*%CyrnfrTfcbafbeROenzSZbbyranne%|:%s)[R-T]) )Ig|:norm G1VGg?

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips

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



Re: [PHP] Re: A general question

2005-03-07 Thread Stephen Johnson
You have to trick the browser into thinking that the jpg file is something
other then a jpg.  This is sketchy and does not always work.

Something like this maybe
 $len = filesize($file_path);
 header(Content-Type: application/force-download);
 header(Content-Type: application/octet-stream);
 header(Content-Disposition: attachment; filename=$file);
 header(Content-Title: $file_path);
 header(Content-Length: $len);
 readfile($file_path);

$fh=fopen($file_path,'rt');
 @fclose($fh);

HTH

?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?

 From: zzapper [EMAIL PROTECTED]
 Date: Mon, 07 Mar 2005 17:19:30 +
 To: php-general@lists.php.net
 Subject: [PHP] Re: A general question
 
 
 How can I click on a link which is linked to a JPG file and instead of
 displaying it in the browser save it somewhere on the local machine or
 open in a different software ?
 
 Please help very urgent
 
 Thanks
 vaibhav

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



[PHP] 'Open Base' with PHP

2005-03-07 Thread François-Xavier LACROIX
hello,
I am totally new to this list,
I just want to know if someone have ever use a driver ODBC to access a 
database 'Open Base' with PHP.

I know where to buy an ODBC dll on 
http://www.actualtechnologies.com/Product_OpenBase.php
but I don't know if it could really work...

look forward to hearing your suggestions...
fx
--
François-Xavier LACROIX - http://www.clever-age.com
Clever Age - conseil en architecture technique
Tél: +33 1 53 34 66 10  Fax: +33 1 53 34 65 20
Clever Age lance son blog de veille permanente
  http://www.clever-age.com/veille/weblog/ 

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


[PHP] Open Base with PHP

2005-03-07 Thread François-Xavier LACROIX
hello,
I am totally new to this list,
I just want to know if someone have ever use a driver ODBC to access a 
database 'Open Base' with PHP.

I know where to buy an ODBC dll on 
http://www.actualtechnologies.com/Product_OpenBase.php
but I don't know if it could really work...

look forward to hearing your suggestions...
fx
--
François-Xavier LACROIX - http://www.clever-age.com
Clever Age - conseil en architecture technique
Tél: +33 1 53 34 66 10  Fax: +33 1 53 34 65 20
Clever Age lance son blog de veille permanente
  http://www.clever-age.com/veille/weblog/ 

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


[PHP] Re: A general question

2005-03-07 Thread zzapper
On Mon, 07 Mar 2005 09:32:56 -0800,  wrote:

Regards my previous post in this thread,

Sorry for not reading the OP correctly!!

zzapper

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



[PHP] Sessions

2005-03-07 Thread db
Hi all

I'm writing a C++ CGI lib and I want to support php(5) sessions. Is there some 
API I should use or can I just create/delete/read/write the sess_ files 
in /tmp?

br
db

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



Re: [PHP] FTP functions

2005-03-07 Thread Tim Boring
Hello!

On Mon, 2005-03-07 at 18:20 +0530, Vaibhav Sibal wrote:
 Hi
 I checked ou the ftp functions of PHP, what I wanted to ask was that
 if I connect to a remote server and issue and ftp_fget() command the
 file will be downloaded to the server running the PHP code and Apache
 webserver or the client machine from which we are calling it ? In the
 sense for example I have a client machine running on windows XP, I
 launch the mozilla firefox browser in that and call for the
 ftp_code.php on my server (http://server). The ftp_code.php contains a
 code which connects to a remote ftp server and then using the
 ftp_fget() function downloads a file from the remote server. Now where
 will this file be downloaded ?

The short answer is it would download it to the server, not the client
on which Firefox is running.  But if you were wanting to transfer the
file to the client, I'd think you could do something creative like this:

1. Have your script download the file from the remote server.
2. Once the file has been downloaded, display a new page to the browser
with a link to the file.
3. Then the user can click the link to retrieve/open the file.

Now this may not be the best solution, it just happens to be what I
could think of off the top of my head.  There may be better ways to
accomplish the same thing.

Hope that helps!

Tim

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



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


Re: [PHP] Problem with ftp_get and ftp_put over SSL--SOLVED

2005-03-07 Thread Tim Boring
On Wed, 2005-02-23 at 15:58 -0500, Tim Boring wrote:
 Hi, Richard!
 
 On Wed, 2005-02-23 at 08:45 -0800, Richard Lynch wrote:
  Maybe try the active/passive thing...
 
  Often-times, the client/server will/won't allow one or the other, based on
  their idea of what's safe/fast.
 
 Yes, I tried that, too.  Sorry, I didn't mention that in my original
 post.  I appreciate the suggestion!

It was in fact the active/passive thing!  Being a newbie to phpunit2, I
didn't realize that each test creates a new object; thus, although I had
a test to test the passive function, the passive connection to the ftp
server got destroyed with the object at the end of that test.  So, I had
to modify my test code to set the active connection to passive within
each test.  

Tim

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



[PHP] Re: Sessions

2005-03-07 Thread Jason Barnett
Db wrote:
 Hi all
 
 I'm writing a C++ CGI lib and I want to support php(5) sessions. Is there 
 some 
 API I should use or can I just create/delete/read/write the sess_ files 
 in /tmp?

You are probably best off searching the PHP source for
session_set_save_handler.  It will be something like
PHP_FUNCTION('session_set_save_handler', ... )

-- 
Teach a man to fish...

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


signature.asc
Description: OpenPGP digital signature


[PHP] ftp upload via web form - problem getting the file name correct

2005-03-07 Thread Steve Turnbull
Hi

I have tried creating a script which will allow our core staff to upload
files to our FTP server.

I don't have a problem with the uploading of a local file to our FTP server
with the correct authentication etc, the problem I am having, is that the
file which gets uploaded always has the filename of 'www.ourdomain.net'
which is the destination web server name.

I have a form, which has a file 'browse' element. PHP stores the local file
in /tmp/ as with a temporary file name (I can see this with
$_FILES['$file']['tmp_name']), but I don't know why it gets converted to
'www.ourdomain.net' in the final stages?

My code (rough, but you get the idea);

Thanks for any help
Steve

?php

$ftp_server = 'OUR FTP SERVER';
$un = $_REQUEST['ftp_un'];
$pw = $_REQUEST['ftp_pw'];
$tmp_file   = $_FILES['ftp_f']['tmp_name'];
$file   = $_FILES['ftp_f']['name'];
?

html
head
titleFTP Interface/title
/head

body

div id=topHeader
h1FTP Interface/h1/td
/div

?php

if (is_null($file)) {
?

div
You need a username  password to upload files to the FTP area.br /br /

form enctype=multipart/form-data action=?php echo $_SERVER
['PHP_SELF'] ? method=post

div
spanUsername: /span
span style=position:absolute; left:150px;input type=text
name=ftp_un //span
/div

div
spanPassword: /span
span style=position:absolute; left:150px;input type=password
name=ftp_pw //span
/div

div
spanBrowse for file: /span
input type=hidden name=MAX_FILE_SIZE value=10 /
span style=position:absolute; left:150px;input type=file
name=ftp_f //span
/div

div
input type=submit value=Upload File Now /
/div

/form
/div

?php
}
else {



$c = ftp_connect($ftp_server, 21)   or die(Can't connect);


if (!ftp_login($c, $un, $pw)){
echo 'Login details incorrect, please try again...';
} else {
if (ftp_put($c, $ftp_server, $tmp_file, FTP_ASCII)){
ftp_rename($c, OUR FTP SERVER, $file) or die(ftp rename didn't
work);
echo 'your file has transfered successfully!';
} else {
echo 'There was a problem, please retry...';
}
}


ftp_close($c);

}

?

body

/html

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



[PHP] call anchor from php

2005-03-07 Thread Ross Hulford
Is it possible to call a named anchor from within a php script?? I need my 
page to go to the point in the page where the form is and bypass all the 
rubbish.

Thanks y'all 

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



[PHP] Using switch() to process a set of forms

2005-03-07 Thread Greg Dotts
Hi All,
I'm new to PHP, but have read my Beginning PHP 5 and MySQL manual and 
have searched the net for a solution to my (presumably simple) problem.

I have a series of HTML forms that need to be processed.  I am tring to 
build a process.php file which will evaluate the FORM variable and 
select the proper code from a SWITCH statement.  I have processed these 
forms using a different construct with IF ELSE statments, but it's 
getting messy and SWITCH looked like a good solution.  The problem is 
that it doesn't work - isn't that always the problem!  I can't find 
anything but simple examples of SWITCH usage on the net.  Would someone 
be good enough to evaluate this script?  Much thanks!!

Below is the process.php script and the form tags go something like this:
FORM action=process.php method=post name=form value=addcontact
   Some fields go here...
/FORM
FORM action=process.php method=post name=form value=addletter
   More fields go here...
/FORM
?php
//Include database access info
include(setup.php);
//Connect to the database server
@mysql_connect($dbhost, $dbuser, $dbpass)or die(mysql_error());
@mysql_select_db ($db) or die(mysql_error());
//-- Begin Main Script --
$x = $_POST['form'];
//Evaluate which form we are receiving and process the results
switch ($x) {
case addcontact:
//Get the form variables
$cgroup = $_POST['cgroup'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$phone = $_POST['phone'];
$email = $_POST['email'];
//Insert form data into the database
$query = INSERT INTO contacts SET cgroup='$cgroup', fname='$fname', 
lname='$lname', address='$address', city='$city', state='$state', 
zipcode='$zipcode', phone='$phone', email='$email';
$result = mysql_query($query) or die (mysql_error());
break;

case addletter:
//Get the form variables
$lgroup = $_POST['lgroup'];
$lname = $_POST['lname'];
$content = $_POST['lcontent'];
//Insert form data into the database
$query = INSERT INTO letters SET lgroup='$lgroup', lname='$lname', 
lcontent='$lcontent';
$result = mysql_query($query) or die (mysql_error());
break;
}
mysql_close();
?
//END SCRIPT

--
Best regards,
Greg Dotts
If quitters never win, and winners never quit,
what fool came up with, Quit while you're ahead?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] call anchor from php

2005-03-07 Thread Chris W. Parker
Ross Hulford mailto:[EMAIL PROTECTED]
on Monday, March 07, 2005 2:48 PM said:

 Is it possible to call a named anchor from within a php script?? I
 need my page to go to the point in the page where the form is and
 bypass all the rubbish.

Since that is a client-side issue and PHP is server-side the best you
could do is to redirect to the page putting the anchor in the URL.
Whether or not the browser will actually pay attention to your anchor
and move the page is another story.


Chris.

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



Re: [PHP] Re: Sessions

2005-03-07 Thread db
On Monday 07 March 2005 21:36, Jason Barnett wrote:
 You are probably best off searching the PHP source for
 session_set_save_handler.  It will be something like
 PHP_FUNCTION('session_set_save_handler', ... )

Found it and some other functions in php-5.0.3/ext/session/session.c
I could however not find any documentation of the code, so I think I'll have 
to contact Sascha and/or Andrei.

Thanks for the reply!

br
db

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



Re: [PHP] Using switch() to process a set of forms

2005-03-07 Thread kjohnson
I think the problem is that the name and value attributes of the form 
tag aren't posted with the rest of the data, i.e., $_POST['form'] isn't 
defined.

You will need to code the form identifier a different way, e.g., either a 
hidden field, or, unique name and value attributes in a submit button.

Kirk


Greg Dotts [EMAIL PROTECTED] wrote on 03/07/2005 03:47:55 PM:

 Hi All,
 
 I'm new to PHP, but have read my Beginning PHP 5 and MySQL manual and 
 have searched the net for a solution to my (presumably simple) problem.
 
 I have a series of HTML forms that need to be processed.  I am tring to 
 build a process.php file which will evaluate the FORM variable and 
 select the proper code from a SWITCH statement.  I have processed these 
 forms using a different construct with IF ELSE statments, but it's 
 getting messy and SWITCH looked like a good solution.  The problem is 
 that it doesn't work - isn't that always the problem!  I can't find 
 anything but simple examples of SWITCH usage on the net.  Would someone 
 be good enough to evaluate this script?  Much thanks!!
 
 Below is the process.php script and the form tags go something like 
this:
 
 FORM action=process.php method=post name=form value=addcontact
 Some fields go here...
 /FORM
 
 FORM action=process.php method=post name=form value=addletter
 More fields go here...
 /FORM
 
 ?php
 //Include database access info
 include(setup.php);
 //Connect to the database server
 @mysql_connect($dbhost, $dbuser, $dbpass)or die(mysql_error());
 @mysql_select_db ($db) or die(mysql_error());
 
 //-- Begin Main Script --
 $x = $_POST['form'];
 //Evaluate which form we are receiving and process the results
 switch ($x) {
 case addcontact:
 //Get the form variables
 $cgroup = $_POST['cgroup'];
 $fname = $_POST['fname'];
 $lname = $_POST['lname'];
 $address = $_POST['address'];
 $city = $_POST['city'];
 $state = $_POST['state'];
 $zipcode = $_POST['zipcode'];
 $phone = $_POST['phone'];
 $email = $_POST['email'];
 //Insert form data into the database
 $query = INSERT INTO contacts SET cgroup='$cgroup', fname='$fname', 
 lname='$lname', address='$address', city='$city', state='$state', 
 zipcode='$zipcode', phone='$phone', email='$email';
 $result = mysql_query($query) or die (mysql_error());
 break;
 
 case addletter:
 //Get the form variables
 $lgroup = $_POST['lgroup'];
 $lname = $_POST['lname'];
 $content = $_POST['lcontent'];
 //Insert form data into the database
 $query = INSERT INTO letters SET lgroup='$lgroup', lname='$lname', 
 lcontent='$lcontent';
 $result = mysql_query($query) or die (mysql_error());
 break;
 }
 mysql_close();
 ?
 //END SCRIPT
 
 
 -- 
 Best regards,
 Greg Dotts
 
 If quitters never win, and winners never quit,
 what fool came up with, Quit while you're ahead?
 
 -- 
 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



FW: [PHP] call anchor from php

2005-03-07 Thread Chris W. Parker
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
on Monday, March 07, 2005 3:09 PM said:

Ross,

Please don't send emails off list unless there is a specific reason to
do so. In this case, there's not.

Now on to your issue.

 What I want to do is something like this although this doesn't work

What about it is not working?



Chris.

p.s. Read this! If you read this and apply the principles found therein
you can get questions answered much more quickly.
http://www.catb.org/~esr/faqs/smart-questions.html

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



re: [PHP] Open source portal systems???

2005-03-07 Thread Alan Fullmer



I must concur.   PHP nuke has never even been the slightest resource hog
on any of my machines.   



 http://www.xnote.com/
Alan Fullmer
Owner / Administrator   
[EMAIL PROTECTED]   





-Original Message-
From: Warren Vail [mailto:[EMAIL PROTECTED]
Sent: Friday, February 25, 2005 3:26 PM
To: Kostyantyn Shakhov; php-general@lists.php.net
Subject: RE: [PHP] Open source portal systems???

Where did you hear that PHP Nuke required a powerful server?  I personally
implemented PHP Nuke on a Windoz box (one strike there), that ran on a 166
mmx box (a big second strike), and benchmarked it handling 90 concurrent
users, with no noticeable delays.  If I were you, I'd dig deeper into what
you heard and you may find that someone had another agenda in mind when
they passed along that info.  It's unfortunate, but there are lots of
people in the IT field that distort results to justify an already
conceived opinion.

go figure,
Warren Vail

 -Original Message-
 From: Kostyantyn Shakhov [mailto:[EMAIL PROTECTED]
 Sent: Friday, February 25, 2005 9:34 AM
 To: php-general@lists.php.net
 Subject: [PHP] Open source portal systems???


 I've got an order for the media portal. Thus, I'm looking for an open
 source portal systems. First that comes to my mind is PHP-Nuke, but I
 heared that it requires a powerful server and i'll have just a
 middle-level one. So, could someone knows another PHP-based open
 source portal systems? Thank you in advance.

 --
 Best regards,
  Kostyantyn  mailto:[EMAIL PROTECTED]


 --
 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] Re: Randomize an array?

2005-03-07 Thread Rick Fletcher
Brian Dunning wrote:
On Mar 7, 2005, at 7:40 AM, M. Sokolewicz wrote:
array_rand()

But that's likely to give me the same element more than once. I want to 
output the entire array but in a random order, like a shuffled deck of 
cards.
like a shuffled deck of cards?
http://www.php.net/shuffle
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] get image from browser url.

2005-03-07 Thread buck Wheat
Hello all,

I am writing a script that uses curl to access a
webpage that is password protected and uses cookies. 
The webpage displays a graph on my browser and I would
like to capture and save that graph to a file.

This is the url I am using in curlopt_url :

http://10.10.10.22:8080/NetPerfMon/ViewChart.asp?Chart=AVGRTLOSSNetObject=N:4Period=TodaySampleSize=30MReBuild=TRUEFontSize=MediumWidth=640Height=0;)

If I cut and paste this to my browser the graph gets
displayed but when I use my sript this is the ouput of
the curl_exec:

img
src=/NetPerfMon/Chart.asp?Chart=AVGRTLOSSNetObject=N:4Period=TodaySampleSize=30MReBuild=TRUEFontSize=MediumWidth=640Height=0
border=0

Which is not what I want, I actually want to grab and
save the image that I see on my browser. 

Can this be done and can someone help me out ?

Thanks,

--
buck



---
Emanuele Buttice




__ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

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



Re[2]: [PHP] SOLVED: Re: [PHP] Document root, preferred way to find it???

2005-03-07 Thread Tom Rogers
Hi,

Tuesday, March 8, 2005, 12:03:54 AM, you wrote:
LG Hello Tom,

LG Sunday, March 6, 2005, 11:20:04 PM, you wrote:
T I do this for security as I have things in include that I don't
T want to be avaiable directly to the browser Also you don't need a
T path for include files you can just do:

LG Don't necessarily disagree with you there other than if you place the
LG includes outside the web accessible folders how do you address the
LG managers of virtual hosts for the ability to modify, delete or add to
LG their particular include file? Additionally, how do you address
LG the naming convention of the include file.

LG i.e.
LG Site 'A' is using config.php
LG Site 'B' is using config.inc.php
LG Site 'C' wants to use config.php



T include('somefile.php');
T and it will be found regardless of where the script is located.

LG That's true enough..

LG BTW, good to see another TheBat! user here.

LG Thanks again.

I only do stuff for my own server which actually creates a couple
 of server variables called:

 SERVER[DOMAIN_ROOT] and SERVER[PHPINCDIR] which have the same
 values as the script we just cobbled together for each virtual
 domain.
 I don't suffer from the problem of lack of access to the
 include directory, So all my domains follow this layout:

/usr/local/apache/domains/domain1.com //root and chroot for ftp
 access
/usr/local/apache/domains/domain1.com/www web document root

/usr/local/apache/domains/domain1.com/include for all include files

If a hosting provider locks you in to the document root it's time to
change provider :)
As for naming convention I use .inc and stop apache from serving .inc
files.

-- 
regards,
Tom

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



Re: [PHP] Using switch() to process a set of forms

2005-03-07 Thread Greg Dotts
Sure enough Kirk!  That was it.  Seems strange that you can set a 
name/value pair on the form tag, but they aren't used.  Guess they 
were just kidding ;-)

Greg

Greg Dotts wrote:
Sure enough Kirk!  That was it.  Seems strange that you can set a 
name/value pair on the form tag, but they aren't used.  Guess they 
were just kidding ;-)

Greg
[EMAIL PROTECTED] wrote:
I think the problem is that the name and value attributes of the 
form tag aren't posted with the rest of the data, i.e., 
$_POST['form'] isn't defined.

You will need to code the form identifier a different way, e.g., 
either a hidden field, or, unique name and value attributes in a 
submit button.

Kirk
Greg Dotts [EMAIL PROTECTED] wrote on 03/07/2005 03:47:55 PM:
 

Hi All,
I'm new to PHP, but have read my Beginning PHP 5 and MySQL manual 
and have searched the net for a solution to my (presumably simple) 
problem.

I have a series of HTML forms that need to be processed.  I am tring 
to build a process.php file which will evaluate the FORM variable 
and select the proper code from a SWITCH statement.  I have 
processed these forms using a different construct with IF ELSE 
statments, but it's getting messy and SWITCH looked like a good 
solution.  The problem is that it doesn't work - isn't that always 
the problem!  I can't find anything but simple examples of SWITCH 
usage on the net.  Would someone be good enough to evaluate this 
script?  Much thanks!!

Below is the process.php script and the form tags go something 
like   
this:
 

FORM action=process.php method=post name=form 
value=addcontact
   Some fields go here...
/FORM

FORM action=process.php method=post name=form value=addletter
   More fields go here...
/FORM
?php
//Include database access info
include(setup.php);
//Connect to the database server
@mysql_connect($dbhost, $dbuser, $dbpass)or die(mysql_error());
@mysql_select_db ($db) or die(mysql_error());
//-- Begin Main Script --
$x = $_POST['form'];
//Evaluate which form we are receiving and process the results
switch ($x) {
case addcontact:
//Get the form variables
$cgroup = $_POST['cgroup'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$phone = $_POST['phone'];
$email = $_POST['email'];
//Insert form data into the database
$query = INSERT INTO contacts SET cgroup='$cgroup', fname='$fname', 
lname='$lname', address='$address', city='$city', state='$state', 
zipcode='$zipcode', phone='$phone', email='$email';
$result = mysql_query($query) or die (mysql_error());
break;

case addletter:
//Get the form variables
$lgroup = $_POST['lgroup'];
$lname = $_POST['lname'];
$content = $_POST['lcontent'];
//Insert form data into the database
$query = INSERT INTO letters SET lgroup='$lgroup', lname='$lname', 
lcontent='$lcontent';
$result = mysql_query($query) or die (mysql_error());
break;
}
mysql_close();
?
//END SCRIPT

--
Best regards,
Greg Dotts
If quitters never win, and winners never quit,
what fool came up with, Quit while you're ahead?
--
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] Re: Randomize an array?

2005-03-07 Thread Brian Dunning
http://www.php.net/shuffle
Boy do I feel stupid. Thanks!!  :)
I always RTFM and STFW before posting - but somehow did not search the 
PHP site for the word shuffle. 
 

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


[PHP] Newbie Question re substr

2005-03-07 Thread Jackson Linux
Hi,
I'm really new and getting lots of help but need some assistance.
I'm running a script which gets specific articles from a database if 
they're entered in the URL after the ? . For instance if someone asks 
for

www.foo.com/index.htm?a=1234
then the script would look for an database entry with the id of 1234 
and display it in the page.

If there's no number specified (www.foo.com/index.htm) or if the number 
given is to an article which doesn't exist, it gets the titles of all 
the articles available and prints them as links to the proper article 
number.

I'd also like it to grab the first 200 characters of text from the 
$content field of the entry.

With help I have the title link part and I suspect I'm close but I keep 
messing up the syntax

The code is:
snip
if (!empty($where)) {
echo 
 ul;
 $article = mysql_fetch_assoc($result);
} else {
while ($article = mysql_fetch_assoc($result)) {
 $table_of_contents[] = 
lia href='{$_SERVER['PHP_SELF']}?a={$article['article_id']}' 
title='{$article['title']}'{$article['title']}/abr /
$article['content'] = substr($article['content'], 0 200);/li;
}
}

echo 
 /ul;
/snip
Can anyone help ?
Thanks in advance!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] get image from browser url.

2005-03-07 Thread Jochem Maas
buck Wheat wrote:
Hello all,
I am writing a script that uses curl to access a
webpage that is password protected and uses cookies. 
The webpage displays a graph on my browser and I would
like to capture and save that graph to a file.

This is the url I am using in curlopt_url :
http://10.10.10.22:8080/NetPerfMon/ViewChart.asp?Chart=AVGRTLOSSNetObject=N:4Period=TodaySampleSize=30MReBuild=TRUEFontSize=MediumWidth=640Height=0;)
If I cut and paste this to my browser the graph gets
displayed but when I use my sript this is the ouput of
the curl_exec:
img
src=/NetPerfMon/Chart.asp?Chart=AVGRTLOSSNetObject=N:4Period=TodaySampleSize=30MReBuild=TRUEFontSize=MediumWidth=640Height=0
border=0
from the output of curl_exec extract the url:
/NetPerfMon/Chart.asp?Chart=AVGRTLOSSNetObject=N:4Period=TodaySampleSize=30MReBuild=TRUEFontSize=MediumWidth=640Height=0
then make another call with curl_exec() using that url
the data you get back should be the image, save it to disk.
...thats basically what you browser would do.
or just use that url iso the url that you are currently
using (the one that outputs a page with (only!?) an img tag in it.)
Which is not what I want, I actually want to grab and
save the image that I see on my browser. 

Can this be done and can someone help me out ?
Thanks,
--
buck

---
Emanuele Buttice
	
		
__ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

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


Re: [PHP] Newbie Question re substr

2005-03-07 Thread Zareef Ahmed
On Mon, 7 Mar 2005 22:23:19 -0500, Jackson Linux
[EMAIL PROTECTED] wrote:
 Hi,
 I'm really new and getting lots of help but need some assistance.
 
 I'm running a script which gets specific articles from a database if
 they're entered in the URL after the ? . For instance if someone asks
 for
 
 www.foo.com/index.htm?a=1234
 
 then the script would look for an database entry with the id of 1234
 and display it in the page.
 
 If there's no number specified (www.foo.com/index.htm) or if the number
 given is to an article which doesn't exist, it gets the titles of all
 the articles available and prints them as links to the proper article
 number.
 
 I'd also like it to grab the first 200 characters of text from the
 $content field of the entry.
 
 With help I have the title link part and I suspect I'm close but I keep
 messing up the syntax
 
 The code is:
 
 snip
 
 if (!empty($where)) {
 
 echo 
  ul;
   $article = mysql_fetch_assoc($result);
 } else {
 while ($article = mysql_fetch_assoc($result)) {
   $table_of_contents[] = 
 lia href='{$_SERVER['PHP_SELF']}?a={$article['article_id']}'

 title='{$article['title']}'{$article['title']}/abr /
 $article['content'] = substr($article['content'], 0 200);/li;

change these two lines to 

title='{$article['title']}'{$article['title']}/abr /.
substr($article['content'], 0, 200)./li;

zareef ahmed 


 }
 }
 
 echo 
  /ul;
 
 /snip
 
 Can anyone help ?
 
 Thanks in advance!
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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

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



Re: [PHP] Can't figure mail post out

2005-03-07 Thread Zareef Ahmed
On Mon, 7 Mar 2005 10:02:32 +0530, anirudh dutt [EMAIL PROTECTED] wrote:
 On Mon, 7 Mar 2005 08:37:52 +0530, Zareef Ahmed [EMAIL PROTECTED] wrote:
  Hi Robert,
 
   Please take a look at php manual and try to know something about
  $_POST, $_GET etc.
  Your code is full of errors.
 
 
  On Sun, 6 Mar 2005 15:33:30 -0500, Robert [EMAIL PROTECTED] wrote:
$sendto = $row[1];
 echo brRow one output = $sendtobr;
 mail ($_POST['sendto'],'Testing', $body, $headers);
  Again you are sending the mail to same person very time.
 
 no, that part is correct.

Dear Anirudh,
 Yes syntax is correct but receipent field is looking for the value in
$_POST and programe  is intended to  send the emails to users in the
database.


 while ($row = mysql_fetch_array ($result, MYSQL_NUM)) {
 ...
  mail ($_POST['sendto'],'Testing', $body, $headers);
  echo Sent to $row[1]br;} // --*
$row['1'] is correct but it was not used as the reciepent.


zareef ahmed 

  mysql_free_result ($result);
 
 * the values are retrieved and used in the loop, the mail IS going to
 the right person.
 
$headers = MIME-Version: 1.0\r\n;
$headers .= Content-type: text/html; charset=iso-8859-1\r\n;
$headers .= From: ;
  From is not set, value is not here.
 
 this is the part that's causing the problem. u can leave it empty and
 let the system put the admin's email id. don't leave it incomplete
 though.
 
 i agree that there are logical errors regarding the data he's used,
 but that's not why it didn't work.
 
 @Robert: u may want to print/echo all the vars for mail() before using
 it, helps to debug. check all $POST vars too. this is how i generally
 set the headers:
 $headers = From: $fname $from_email\n.Return-Path: $ret.\n;
 
 i use return path so that bounce messages/delivery failures go to another id.
 
 if u want to add the X-Mailer header:
 $headers.= 'X-Mailer: PHP/' . phpversion().\n;
 (note  ^^^ the dot)
 
 if still doesn't work, replace ur \r\n with \n. check manual page for details.
 
 considering that u're possibly mass mailing...
 http://us2.php.net/manual/en/function.mail.php
 [quote]
 Note:  It is worth noting that the mail() function is not suitable
 for larger volumes of email in a loop. This function opens and closes
 an SMTP socket for each email, which is not very efficient.
 
 For the sending of large amounts of email, see the PEAR::Mail, and
 PEAR::Mail_Queue packages.
 [/quote]
 u could also open a pipe to the mail program...
 http://www.devarticles.com/c/a/PHP/Getting-Intimate-With-PHPs-Mail-Function/2/
 
 hth
 
 --
 ]#
 Anirudh Dutt
 
 ...pilot of the storm who leaves no trace
 like thoughts inside a dream
 


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

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



Re: [PHP] Newbie Question re substr

2005-03-07 Thread Jackson Linux
Zareef,
Almost
On 7 Mar 2005, at 23:52, Zareef Ahmed wrote:
From: [EMAIL PROTECTED]
Subject:Re: [PHP] Newbie Question re substr
Date:   7 March 2005 23:52:15 GMT-05:00
To:   [EMAIL PROTECTED]
Cc:   php-general@lists.php.net
Reply-To: [EMAIL PROTECTED]
On Mon, 7 Mar 2005 22:23:19 -0500, Jackson Linux
[EMAIL PROTECTED] wrote:
Hi,
I'm really new and getting lots of help but need some assistance.
I'm running a script which gets specific articles from a database if
they're entered in the URL after the ? . For instance if someone asks
for
www.foo.com/index.htm?a=1234
then the script would look for an database entry with the id of 1234
and display it in the page.
If there's no number specified (www.foo.com/index.htm) or if the number
given is to an article which doesn't exist, it gets the titles of all
the articles available and prints them as links to the proper article
number.
I'd also like it to grab the first 200 characters of text from the
$content field of the entry.
With help I have the title link part and I suspect I'm close but I keep
messing up the syntax
The code is:
snip
if (!empty($where)) {
echo 
 ul;
  $article = mysql_fetch_assoc($result);
} else {
while ($article = mysql_fetch_assoc($result)) {
  $table_of_contents[] = 
lia href='{$_SERVER['PHP_SELF']}?a={$article['article_id']}'

title='{$article['title']}'{$article['title']}/abr /
$article['content'] = substr($article['content'], 0 200);/li;
change these two lines to
title='{$article['title']}'{$article['title']}/abr /.
substr($article['content'], 0, 200)./li;
zareef ahmed

I did that and now it reads this:

if (!empty($where)) {
echo 
 ul;
 $article = mysql_fetch_assoc($result);
} else {
while ($article = mysql_fetch_assoc($result)) {
 $table_of_contents[] = 
lia href='{$_SERVER['PHP_SELF']}?a={$article['article_id']}'
lia href='{$_SERVER['PHP_SELF']}?a={$article['article_id']}'
title='{$article['title']}'{$article['title']}/abr /.
substr($article['content'], 0, 200)./li;
}
}
\
Which doesn't kick back errors but also does not pull any 
$article['content'] - it leaves a line break but no text is being 
inserted from the content row.
?

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


Re: [PHP] fsockopen and session_start

2005-03-07 Thread Jason Wong
On Monday 07 March 2005 22:02, Pedro Garre wrote:

 I am using fsockopen to simulate a POST to another page (test_post.php)
 within the same server.

It's not clear how exactly you're executing your code. I suspect that you 
haven't closed the session before doing your simulated POST. Your order 
of execution should be something like:

  start session
  assign values to session
  close session
  do the simulated POST

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Can't figure mail post out

2005-03-07 Thread anirudh dutt
On Tue, 8 Mar 2005 10:28:32 +0530, Zareef Ahmed [EMAIL PROTECTED] wrote:
 On Mon, 7 Mar 2005 10:02:32 +0530, anirudh dutt [EMAIL PROTECTED] wrote:
  On Mon, 7 Mar 2005 08:37:52 +0530, Zareef Ahmed [EMAIL PROTECTED] wrote:
   Again you are sending the mail to same person very time.
 
  no, that part is correct.
 
 Dear Anirudh,
  Yes syntax is correct but receipent field is looking for the value in
 $_POST and programe  is intended to  send the emails to users in the
 database.

u're right. i didn't c that he used mail ($_POST['sendto'],... and not
mail ($sendto,...

(i was more concerned with the syntax/value errors)

  while ($row = mysql_fetch_array ($result, MYSQL_NUM)) {
  ...
   mail ($_POST['sendto'],'Testing', $body, $headers);
   echo Sent to $row[1]br;} // --*
 $row['1'] is correct but it was not used as the reciepent.

yup.

@Robert: i know u've fixed the problem but...

On Sun, 6 Mar 2005 23:00:55 -0500, Robert [EMAIL PROTECTED] wrote:
 Thanks, I fixed the problem and it's working great.  Didn't need the $_POST
 in the email and needed double quotes around the sender header variable.

u did have double quotes around ur headers.
sender header variable == the ( $headers .= From: ; ) line ? any
program (not logic) changes other than that?

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

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