php-general Digest 26 Feb 2007 14:22:22 -0000 Issue 4647

2007-02-26 Thread php-general-digest-help

php-general Digest 26 Feb 2007 14:22:22 - Issue 4647

Topics (messages 249425 through 249449):

Re: how to display images stored in DB
249425 by: Kevin Waterson
249426 by: Kevin Waterson

Re: remote file time -small issue
249427 by: Richard Lynch

encoding php codes
249428 by: Danial Rahmanzadeh

OCI8 under WINDOWS
249429 by: Miguel J.
249438 by: Fahad Pervaiz
249444 by: Vincent DUPONT

Re: Combining sound files
249430 by: clive
249432 by: Colin Guthrie
249434 by: tedd
249435 by: tedd
249437 by: clive
249446 by: Colin Guthrie

Re: how to retrieve pictures from postgreSQL DB
249431 by: Colin Guthrie

array issues
249433 by: Steven Macintyre

Re: [PHP-DB] NOT NULL query
249436 by: Steven Macintyre
249439 by: Németh Zoltán

$_SERVER['PHP_SELF'] in a included file
249440 by: clive
249441 by: Vincent DUPONT
249442 by: Stut
249447 by: clive
249449 by: Vincent DUPONT

PHP4 and PHP5
249443 by: Martin Marques
249445 by: Steven Macintyre
249448 by: Fahad Pervaiz

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---
This one time, at band camp, zerof [EMAIL PROTECTED] wrote:

 It is not a good practice to store pictures in DataBases, use links, 
 instead of.

Rubbish, where are your benchmarks?

kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.
---End Message---
---BeginMessage---
This one time, at band camp, Alain Roger [EMAIL PROTECTED] wrote:

 Hi,
 
 i stored all my pictures in my PostgreSQL DB as bytea type.
 Now i would like to know how can i display them in my PHP pages ?

Here is a little tutorial on the subject, it uses MySQL and PDO but
you simply need to change the connection string to PDO to pgsql.
http://phpro.org/tutorials/Storing-Images-in-MySQL-with-PHP.html

enjoy
Kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.
---End Message---
---BeginMessage---
You can always add a header to your own PHP scripts if you want to
maintain that info -- but be aware that you really need to be careful
to change it if you expect browsers to get the LATEST version of your
data.

http://php.net/header

You will find, however, that MANY script-driven websites (PHP, ASP,
Perl/cgi, JSP, whatever) are simply not going to provide a
Last-Modified header, and you're going to have to do something
reasonable for your needs in that case.

Be very careful -- The pros writing actual browsers like Netscape,
Mozilla and IE (well, okay, maybe pro is to strong in one of
those... ended up getting bit several times by not really thinking
through what happens with Last-Modified and various wrinkles,
including caching and daylight savings time changes.

I'm sure there are other issues...

Nothing seems so simple, but turns out to be so complex, as Time.

After years of programming, I'm now just plain amazed that humans can
even make any sense at all of the current system of date/time in
use.

I know for damn sure the computers won't ever be able to get it right.

On Fri, February 23, 2007 6:10 pm, SJAMHO DBMS wrote:
 Thanks Richard,


 I was afraid that there would be no other way... By the way: root
 documents
 (like http://sjamho.com/index.php) also do not have this
 date_last_modified... seems to be ebcause of the headers issue..


 Thanks again :-) Regards, Jos

 On 2/24/07, Richard Lynch [EMAIL PROTECTED] wrote:

 On Thu, February 22, 2007 2:34 am, SJAMHO DBMS wrote:
  I have a problem with the attached file.
  Run it or see it here: http://www.sjamho.com/update/remote.php
 
  The issue is: the timestamps are shown for every file in a
  subdirectory, but
  never for a file in the root of a domain.
  Can anyone tell me why?

 Yes.

 The URLs in question don't provide a Last-modified: header.

 localhost junk # wget --server-response
 http://www.pitpass.com/forum/viewforum.php | head -n 40
 --15:10:58--  http://www.pitpass.com/forum/viewforum.php
= `viewforum.php'
 Resolving www.pitpass.com... 64.62.155.120
 Connecting to www.pitpass.com|64.62.155.120|:80... connected.
 HTTP request sent, awaiting response...
   HTTP/1.1 200 OK
   Date: Fri, 23 Feb 2007 21:11:52 GMT
   Server: Apache/1.3.34 (Unix) PHP/4.4.2
   X-Powered-By: PHP/4.4.2
   Set-Cookie:

 forum_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bi%3A-1%3B%7D;
 expires=Sat, 23 Feb 2008 21:11:52 GMT; path=/forum/;
 domain=pitpass.com
   Set-Cookie: forum_sid=f5caf540f60eb89ce67a0672d7bffef7;
 path=/forum/; domain=pitpass.com
   

[PHP] OCI8 under WINDOWS

2007-02-26 Thread Miguel J.
Hi, I am trying to use oci8.dll under PHP 5.2 and Apache 2 under Windows
XP... The system variables are all configured (TNS_ADMIN, SQLPATH,
LD_LIBRARY_PATH, etc...). I use ORACLE Instant Client and sqlplus works
OK ... PHP-CLI loads the extension without any problem but I cannot get
it load under APACHE (with the help of phpinfo()) ... Any idea why it
won't load?

-- 
Miguel J. Jiménez
Área de Internet/XSL/PHP
[EMAIL PROTECTED]



ISOTROL
Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.
Parque Tecnológico Cartuja '93, 41092 Sevilla.
Teléfono: 955 036 800 - Fax: 955 036 849
http://www.isotrol.com

La dicotonomía entre desarrollo económico y sostenibilidad es falsa. Si
nos quedamos sin planeta no habrá economía que valga
(Al Gore, Ex-Vicepresidente de EE.UU.)

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



[PHP] Re: Combining sound files

2007-02-26 Thread Colin Guthrie
clive wrote:
 However, I can't do the same with .WAV files. Does anyone know a way
 to combine .WAV files similar to the way shown above?
 
 Can you not convert the wav files to mp3's then combine them?

While I'm sure you could do this technically, the principle is wrong for
so many reasons tho' for small sound clips these are somewhat mitigated.

I still think sox is the way to go tho' :p

Col

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



Re: [PHP] Combining sound files

2007-02-26 Thread clive
However, I can't do the same with .WAV files. Does anyone know a way to 
combine .WAV files similar to the way shown above?


Can you not convert the wav files to mp3's then combine them?


--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



Re: [PHP] Re: how to retrieve pictures from postgreSQL DB

2007-02-26 Thread Colin Guthrie
Alain Roger wrote:
 Sorry Colin,
 
 but what do you mean by adding some cache related headers ?
 What is the idea behind that ?

Well, PHP is a dynamic language and as such it tells web browsers
(Firefox, Safari etc.) DO NOT CACHE THIS PAGE, I MAY GENERATE IT
DIFFERENTLY NEXT TIME!!!.

So that means that when a browser downloads a page, and then the user
goes back to that page later (e.g. by hitting back etc.) then the user
will have to ask the server and it will supply an updated version of the
page.

The same thing applies for images, but due to the sizes involved this
may be very ugly for users and result in quite slow
performance/rendering of your pages, not to mention increased bandwidth etc.

So you'll almost certainly want some URL rewriting to get neat URLs and
you'll definitely want to put some header() calls with cache control
headers.

Just search for cache control headers and you'll find out more.


Something like:

header('Expires: '.gmdate('D, d M Y H:i:s', time()+CACHE_TIME).' GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $last_mod . ' GMT');
header('Cache-Control: max-age='.CACHE_TIME.', public');


But you'll also want to check to see if the header If-Modified-Since
is used such that you can return a very simple header in response.

e.g.

  $headers = apache_request_headers();
  if (isset($headers['If-Modified-Since']))
  {
$if_modified_since = preg_replace('/;.*$/', '',
$headers['If-Modified-Since']);
if ('' != $if_modified_since)
{
  if (time() - strtotime($if_modified_since)  CACHE_TIME)
  {
header('HTTP/1.1 304 Not Modified');
exit;
  }
}
  }

The above prevents you having to supply any data as the browser is just
asking you if you've got a newer version than the one it has, and quite
often you can reply say, nah, your one is fine!

HTHs

Col

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



[PHP] array issues

2007-02-26 Thread Steven Macintyre
Hi all,

I am working on a project for someone and with the brief I received before -
I created a record per action with the following information;

Artist[tab]artist[tab]artist[tab] etc as a entry for artists 

Then I have the same for titles etc ...

What I have been doing is creating the array's and combining them ... with
artist as a key and song as a value...

Now ... they are requesting that I have the an additional 3 fields ... how
would I now accomplish this?

Bear in mind its php 4 and I am using a combine_array generic from the
www.php.net site in lieu of array_combine.

I have paste a sample record below;

INSERT INTO ` votes_records` (`id`, `date`, `who`, `title`, `description`,
`image`, `email`, `artists`, `titles`, `votes`, `weeks`, `twoweekpos`,
`oneweekpos`, `debut`) VALUES 
(22, '2007-02-26 12:29:15', 1, 'Test Again', '', '', '', 'Artist 1Artist
2', 'Song 1Song 2', '1', '51', '20', '10',
'2005/02/092005/02/09');

The net effect that I need to get - is take that information and display it
per item so people can vote.

S

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



Re: [PHP] Combining sound files

2007-02-26 Thread tedd

At 11:39 AM +0200 2/26/07, clive wrote:
However, I can't do the same with .WAV files. Does anyone know a 
way to combine .WAV files similar to the way shown above?


Can you not convert the wav files to mp3's then combine them?


--
Regards,

Clive.


Clive:

That's a good point, then all I would have to do is to change the 
resultant mp3 file to a wav file. However, I'm not aware of how to do 
that using php. I would hope it's as easy as changing a jpg to a gif 
file, but I have never done a mp3 to a wav conversion before. I'll 
investigate that.


Thanks,

tedd

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

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



[PHP] Re: Combining sound files

2007-02-26 Thread tedd

clive wrote:

 However, I can't do the same with .WAV files. Does anyone know a way
 to combine .WAV files similar to the way shown above?


 Can you not convert the wav files to mp3's then combine them?


While I'm sure you could do this technically, the principle is wrong for
so many reasons tho' for small sound clips these are somewhat mitigated.

I still think sox is the way to go tho' :p

Col


Col:

I'll investigate what you suggest.

It was by accident that I found one could combine mp3 files in such a 
manner. I combined many more than just two. Somehow, the redundant 
headers in the resultant file are not noticeably detrimental to the 
overall assembled sound. Go figure.


Thanks,

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

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



[PHP] RE: [PHP-DB] NOT NULL query

2007-02-26 Thread Steven Macintyre
SELECT * FROM table WHERE field_3 IS NOT NULL

 -Original Message-
 From: Ron Piggott [mailto:[EMAIL PROTECTED]
 Sent: 26 February 2007 02:56 PM
 To: PHP DB
 Subject: [PHP-DB] NOT NULL query
 
 Is it possible to do a SELECT query where field_3 isn't null?  What
 would the syntax look like?  Ron

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



Re: [PHP] Combining sound files

2007-02-26 Thread clive
That's a good point, then all I would have to do is to change the 
resultant mp3 file to a wav file. However, I'm not aware of how to do 
that using php. I would hope it's as easy as changing a jpg to a gif 
file, but I have never done a mp3 to a wav conversion before. I'll 
investigate that.


you could look at lame? and you will have to call it from php using 
exec() or shell_exec()


--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



Re: [PHP] RE: [PHP-DB] NOT NULL query

2007-02-26 Thread Németh Zoltán
SELECT * FROM table WHERE NOT ISNULL(field_3)

(in MySQL)

greets
Zoltán Németh

2007. 02. 26, hétfő keltezéssel 15.21-kor Steven Macintyre ezt írta:
 SELECT * FROM table WHERE field_3 IS NOT NULL
 
  -Original Message-
  From: Ron Piggott [mailto:[EMAIL PROTECTED]
  Sent: 26 February 2007 02:56 PM
  To: PHP DB
  Subject: [PHP-DB] NOT NULL query
  
  Is it possible to do a SELECT query where field_3 isn't null?  What
  would the syntax look like?  Ron
 

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



[PHP] $_SERVER['PHP_SELF'] in a included file

2007-02-26 Thread clive
A project that I work on has a index.php that includes other files 
depending on certain requirements.


so index.php includes a.php;

in a.php if you echo $_SERVER['PHP_SELF'] it echos index.php and I 
understand why it does this.


But, I want echo the file name of a.php from a.php and I dont want to 
add a $filename='a.php'; at the top of a.php, although I have thought of 
using subversion and a find and replace to insert $filename=$Id$; at 
the top of all the files.


Does anyone know know of another way I can get a included files filename?

Sorry if I have posted this question in the past, its been a while since 
I last thought of this problem.


Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



RE: [PHP] $_SERVER['PHP_SELF'] in a included file

2007-02-26 Thread Vincent DUPONT

hello,
try with the system constant __FILE__
print(__FILE__);
inside a.php should always return a.php, even though this is included into 
index.php.





Vincent Dupont
Principal Consultant OpenSource Competence Center
Ausy Belgium
http://www.ausy.be



-Original Message-
From: clive [mailto:[EMAIL PROTECTED]
Sent: Mon 2/26/2007 14:44
To: PHP General List
Subject: [PHP] $_SERVER['PHP_SELF'] in a included file
 
A project that I work on has a index.php that includes other files 
depending on certain requirements.

so index.php includes a.php;

in a.php if you echo $_SERVER['PHP_SELF'] it echos index.php and I 
understand why it does this.

But, I want echo the file name of a.php from a.php and I dont want to 
add a $filename='a.php'; at the top of a.php, although I have thought of 
using subversion and a find and replace to insert $filename=$Id$; at 
the top of all the files.

Does anyone know know of another way I can get a included files filename?

Sorry if I have posted this question in the past, its been a while since 
I last thought of this problem.

Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}

-- 
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] $_SERVER['PHP_SELF'] in a included file

2007-02-26 Thread Stut

clive wrote:
A project that I work on has a index.php that includes other files 
depending on certain requirements.


so index.php includes a.php;

in a.php if you echo $_SERVER['PHP_SELF'] it echos index.php and I 
understand why it does this.


But, I want echo the file name of a.php from a.php and I dont want to 
add a $filename='a.php'; at the top of a.php, although I have thought of 
using subversion and a find and replace to insert $filename=$Id$; at 
the top of all the files.


Does anyone know know of another way I can get a included files filename?

Sorry if I have posted this question in the past, its been a while since 
I last thought of this problem.


__FILE__ will give you the path and filename of the current file.

-Stut

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



[PHP] PHP4 and PHP5

2007-02-26 Thread Martin Marques
Is it posible to run apache with PHP4 and PHP5 on different virtual 
domains?


--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' ||
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
-
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Re: OCI8 under WINDOWS

2007-02-26 Thread Vincent DUPONT


hello

is this not a problem of user rights?
With IIS under XP, the user is always something as IUSR_xxx, so , the c:\oracle 
folder must be granted execute grants to IUSR_xx

try to figure out under what user Apache is executed (see the Taskt Manager to 
check the user running the Apache process)
and change the windows security on the oci client directories to allow execute 
grants to that user on all files.





Vincent Dupont
Principal Consultant OpenSource Competence Center
Ausy Belgium
http://www.ausy.be



-Original Message-
From: Fahad Pervaiz [mailto:[EMAIL PROTECTED]
Sent: Mon 2/26/2007 14:41
To: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: [PHP] Re: OCI8 under WINDOWS
 
#ORIGINAL##
Hi, I am trying to use oci8.dll under PHP 5.2 and Apache 2 under Windows
XP... The system variables are all configured (TNS_ADMIN, SQLPATH,
LD_LIBRARY_PATH, etc...). I use ORACLE Instant Client and sqlplus works
OK ... PHP-CLI loads the extension without any problem but I cannot get
it load under APACHE (with the help of phpinfo()) ... Any idea why it
won't load?
END ORINGINAL###

Uninstall oracle instant client
Restart your windows machine

Download complete oracle client from oracle website
http://www.oracle.com/technology/software/index.html

Restart your windows machine

Every oci8 should work fine now. If not you can try installing Zend
Core for Oracle.


-- 
Regards
Fahad Pervaiz
www.ecommerce-xperts.com
(Shopping Cart Applications, Framework
for Multilingual Web Sites, Web Designs)

-- 
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] PHP4 and PHP5

2007-02-26 Thread Steven Macintyre
This tutorial shows how to install and configure Apache2 with PHP5 and PHP4
enabled at the same time. Because it is not possible to run both PHP5 and
PHP4 as Apache modules, we must run one of them as CGI, the other one as
Apache module.

http://www.howtoforge.com/apache2_with_php5_and_php4

That’s via a google search ... never done it myself!

S

 -Original Message-
 From: Martin Marques [mailto:[EMAIL PROTECTED]
 Sent: 26 February 2007 03:50 PM
 To: php-general@lists.php.net
 Subject: [PHP] PHP4 and PHP5
 
 Is it posible to run apache with PHP4 and PHP5 on different virtual
 domains?
 
 --
   21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37,
 0.18
 -
 Lic. Martín Marqués |   SELECT 'mmarques' ||
 Centro de Telemática|   '@' || 'unl.edu.ar';
 Universidad Nacional|   DBA, Programador,
  del Litoral |   Administrador
 -

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



[PHP] Re: Combining sound files

2007-02-26 Thread Colin Guthrie
tedd wrote:
 I'll investigate what you suggest.

I definitely think it's the right way to go. sox can also convert from
mp3 to wav etc. as per Clive's suggestions too, so if you can use lame
from the command line via PHP, there is no reason not to just use sox
instead.

 It was by accident that I found one could combine mp3 files in such a
 manner. I combined many more than just two. Somehow, the redundant
 headers in the resultant file are not noticeably detrimental to the
 overall assembled sound. Go figure.

This is a result of the frame based approach to the file format.

As a nifty trick I've told to people before you can take several MPEG
video files that have been split from a single recorded source, such
that they are all the same resolution/bit rate etc. Put all the files
one by one into a .zip file (e.g. via winzip etc,) with zero
compression. Take the resultant .zip file and rename it to .mpeg and
play it as usual et viola, uninterrupted video!!! Same applies to mp3
hence how your trick works. The players will just skip past the
inappropriate frames quite happily (tho' like i say, it may be more
problematic WRT differing bit-rates/channels etc.).

Col

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



[PHP] Re: PHP4 and PHP5

2007-02-26 Thread Fahad Pervaiz

 ORIGINAL 
Is it posible to run apache with PHP4 and PHP5 on different virtual
domains?
 END ORIGINAL ###

No! Its not possible. To set php environment in virtual hosts.
You can have both php5 and php4 at the same time but you can not
configure two php version with one apache.

Yes you can run two apache (Diff ports) and with one you can configure
php5 and with the other you can configure php4


--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com
(Shopping Cart Applications, Framework
for Multilingual Web Sites, Web Designs)

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



Re: [PHP] $_SERVER['PHP_SELF'] in a included file

2007-02-26 Thread Stut

clive wrote:

Thanks Vincent,Stut and Olaf. Thats __file___ is exactly what I needed :)

now for another brain teaser for your collective brains, How does a 
function know what file it was called from.


a.php includes functions.php

in a.php we call function test(); which is declared in functions.php

Is there anyway for test(); to  echo called from a.php with out 
passing 'a.php' or ___FILE___ as a parameter to the function?


Im busy googling now for a answer.


Note that the following function has not been extensively tested, and 
should be treated as such. I wrote this function a long time ago to get 
the calling function from a common error routine. You should be able to 
modify this to get what you want...


function GetCaller($offset = 0)
{
  $trace = debug_backtrace();
  $retval = '';
  if (is_array($trace))
  {
foreach ($trace as $call)
{
  if ($offset  0)
  {
$offset--;
  }
  else
  {
if (strlen($retval) == 0)
{
  $retval = str_replace($GLOBALS['rootdir'], '',
$call['file']).':'.$call['line'].' ';
}
elseif (isset($call['function']))
{
  return $retval.(isset($call['class'])
  ?
 $call['class'].'::'
  :
 '').$call['function'];
}
  }
}
  }

  if (strlen($retval) == 0)
return 'unknown';

  return $retval.'unknown function';
}

Hope it helps.

-Stut

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



Re: [PHP] $_SERVER['PHP_SELF'] in a included file

2007-02-26 Thread Jochem Maas
Vincent DUPONT wrote:
 hi
 
 I'm afraid this is not available by default.
 You can try to parse the debug_backtrace() (see 
 http://be2.php.net/manual/en/function.debug-backtrace.php) 
 but this is probably too complex for online processing.

unless you are doing something *very* exotic (which almost by definition
means your skills are beyond the point whereby this list could probably help 
you)
there should be *no* reason for a function to ever need to know who/what/where 
it was
called from/by ... of course in the process of developing something like 
debug_backtrace()
can be very handy for helping to figure out what is going on!

that said if a function seems to need to know who called it (or anything like 
that)
then you probably have a bad smell in your design .. consider that a function 
does
something according to it's input, and that the output of a function should be 
predictable [given
a particular set of input parameters) then the caller, it's environment/start 
and/or the
execution path should have no baring on the function's result - if they did 
then the function's
result could no longer be considered predictable (unless your going to memorize 
every execution-path/state
in your application now and in the future!).

having said all that there are probably some exceptions to the rule - although 
I can't think
of any right now.

 
 if there are some native functions, please tell me !!

there are none - although I did read a thread on the internals mailing list that
mentioned something along these lines in the form of a request ... unlikely 
that it
will be included.

 
 
 Vincent Dupont
 Principal Consultant OpenSource Competence Center
 Ausy Belgium
 http://www.ausy.be
 
 
 
 -Original Message-
 From: clive [mailto:[EMAIL PROTECTED]
 Sent: Mon 2/26/2007 15:15
 To: clive
 Cc: PHP General List
 Subject: Re: [PHP] $_SERVER['PHP_SELF'] in a included file
  
 Thanks Vincent,Stut and Olaf. Thats __file___ is exactly what I needed :)
 
 now for another brain teaser for your collective brains, How does a 
 function know what file it was called from.
 
 a.php includes functions.php
 
 in a.php we call function test(); which is declared in functions.php
 
 Is there anyway for test(); to  echo called from a.php with out 
 passing 'a.php' or ___FILE___ as a parameter to the function?
 
 Im busy googling now for a answer.
 

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



Re: [PHP] PHP4 and PHP5

2007-02-26 Thread Jochem Maas
Steven Macintyre wrote:
 This tutorial shows how to install and configure Apache2 with PHP5 and PHP4
 enabled at the same time. Because it is not possible to run both PHP5 and
 PHP4 as Apache modules, we must run one of them as CGI, the other one as
 Apache module.

alternatively run 2 apaches and use the ProxyPass directive to make the second
apache 'available' via the first (meaning you don't have to mess around with
alternative ports when it comes to actually visiting/using the sites that run
on the second apache.

search the list archives for 'Rasmus' and 'ProxyPass'  and you should find
the info needed to setup a 'php4-php5-proxypass'** configuration.

**that's an arbitrary name I just made up - seemed as good as anything else :-)

 
 http://www.howtoforge.com/apache2_with_php5_and_php4
 
 That’s via a google search ... never done it myself!
 
 S
 
 -Original Message-
 From: Martin Marques [mailto:[EMAIL PROTECTED]
 Sent: 26 February 2007 03:50 PM
 To: php-general@lists.php.net
 Subject: [PHP] PHP4 and PHP5

 Is it posible to run apache with PHP4 and PHP5 on different virtual
 domains?

 --
   21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37,
 0.18
 -
 Lic. Martín Marqués |   SELECT 'mmarques' ||
 Centro de Telemática|   '@' || 'unl.edu.ar';
 Universidad Nacional|   DBA, Programador,
  del Litoral |   Administrador
 -
 

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



[PHP] audio CAPTCHA - was Combining sound files

2007-02-26 Thread tedd

Hi gang:

Thanks for all the advice regarding combining sound files. I shall 
look into all of it.


In the meantime, I am trying a different solution and would 
appreciate your review of the technique:


http://www.sperling.com/a/c/

The point of this experiment is to speak the numbers required for a 
CAPTCHA protection scheme.


I've had a few blind users report that this works for them, but 
considering all the different platforms and talents on this list, I 
thought that I would ask Does this work (i.e., speak the numbers) 
for you? The numbers to be spoken are printed on the top of this 
page for your notice.


If you would be so kind, please review, provide me your platform type 
and success.


Thanks.

tedd

PS: What does this have to do with php? Well... a good deal of the 
code is php and a mix of a bunch of other stuff (we don't live in a 
vacuum) -- so please permit me this indulgence.


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

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



Re: [PHP] GET doesn't work as POST

2007-02-26 Thread Jim Lucas

Otto Wyss wrote:

On the page

http://www.orpatec.ch/turniere/5erfussball/index.php?page=bvallist.phpkind=regions 



I have a form with method=post and action=?PHP $_SERVER['PHP_SELF']; 
?. While it works fine this way, as soon as I change the form to 
method=get it looses the parameter kind when I change e.g. the 
second parameter from -Alle- to Gültig. Has anybody an idea why it 
works with POST but not with GET?


form action=?PHP $_SERVER['PHP_SELF']; ? method=get
try actually using echo or print to output the variable contents to the 
browser.  If you look at your source. you will notice there is no value 
set for action



...
 select name=state onchange=this.form.submit()

O. Wyss




--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



Re: [PHP] audio CAPTCHA - was Combining sound files

2007-02-26 Thread benifactor

tried, and failed.  got this error:

Notice: Undefined variable: captcha in 
/home/httpd/vhosts/sperling.com/httpdocs/a/c/index.php on line 29


and no captcha was displayed.
- Original Message - 
From: tedd [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Monday, February 26, 2007 8:04 AM
Subject: [PHP] audio CAPTCHA - was Combining sound files



Hi gang:

Thanks for all the advice regarding combining sound files. I shall look 
into all of it.


In the meantime, I am trying a different solution and would appreciate 
your review of the technique:


http://www.sperling.com/a/c/

The point of this experiment is to speak the numbers required for a 
CAPTCHA protection scheme.


I've had a few blind users report that this works for them, but 
considering all the different platforms and talents on this list, I 
thought that I would ask Does this work (i.e., speak the numbers) for 
you? The numbers to be spoken are printed on the top of this page for 
your notice.


If you would be so kind, please review, provide me your platform type and 
success.


Thanks.

tedd

PS: What does this have to do with php? Well... a good deal of the code is 
php and a mix of a bunch of other stuff (we don't live in a vacuum) -- so 
please permit me this indulgence.


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

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



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



Re: [PHP] audio CAPTCHA - was Combining sound files

2007-02-26 Thread Németh Zoltán
I got the same notice on the top of the page.
besides that, when clicking the speak captcha button nothing happens

greets
Zoltán Németh

2007. 02. 26, hétfő keltezéssel 08.12-kor benifactor ezt írta:
 tried, and failed.  got this error:
 
 Notice: Undefined variable: captcha in 
 /home/httpd/vhosts/sperling.com/httpdocs/a/c/index.php on line 29
 
 and no captcha was displayed.
 - Original Message - 
 From: tedd [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Monday, February 26, 2007 8:04 AM
 Subject: [PHP] audio CAPTCHA - was Combining sound files
 
 
  Hi gang:
 
  Thanks for all the advice regarding combining sound files. I shall look 
  into all of it.
 
  In the meantime, I am trying a different solution and would appreciate 
  your review of the technique:
 
  http://www.sperling.com/a/c/
 
  The point of this experiment is to speak the numbers required for a 
  CAPTCHA protection scheme.
 
  I've had a few blind users report that this works for them, but 
  considering all the different platforms and talents on this list, I 
  thought that I would ask Does this work (i.e., speak the numbers) for 
  you? The numbers to be spoken are printed on the top of this page for 
  your notice.
 
  If you would be so kind, please review, provide me your platform type and 
  success.
 
  Thanks.
 
  tedd
 
  PS: What does this have to do with php? Well... a good deal of the code is 
  php and a mix of a bunch of other stuff (we don't live in a vacuum) -- so 
  please permit me this indulgence.
 
  -- 
  ---
  http://sperling.com  http://ancientstones.com  http://earthstones.com
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 

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



Re: [PHP] audio CAPTCHA - was Combining sound files

2007-02-26 Thread benifactor
yea, same for me... but maybe the variable needs to be defined for anything 
to happen, as we are probably supposed to press that before we speak tha 
captcha..


- Original Message - 
From: Németh Zoltán [EMAIL PROTECTED]

To: benifactor [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, February 26, 2007 8:18 AM
Subject: Re: [PHP] audio CAPTCHA - was Combining sound files


I got the same notice on the top of the page.
besides that, when clicking the speak captcha button nothing happens

greets
Zoltán Németh

2007. 02. 26, hétfő keltezéssel 08.12-kor benifactor ezt írta:

tried, and failed.  got this error:

Notice: Undefined variable: captcha in
/home/httpd/vhosts/sperling.com/httpdocs/a/c/index.php on line 29

and no captcha was displayed.
- Original Message - 
From: tedd [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Monday, February 26, 2007 8:04 AM
Subject: [PHP] audio CAPTCHA - was Combining sound files


 Hi gang:

 Thanks for all the advice regarding combining sound files. I shall look
 into all of it.

 In the meantime, I am trying a different solution and would appreciate
 your review of the technique:

 http://www.sperling.com/a/c/

 The point of this experiment is to speak the numbers required for a
 CAPTCHA protection scheme.

 I've had a few blind users report that this works for them, but
 considering all the different platforms and talents on this list, I
 thought that I would ask Does this work (i.e., speak the numbers) for
 you? The numbers to be spoken are printed on the top of this page for
 your notice.

 If you would be so kind, please review, provide me your platform type 
 and

 success.

 Thanks.

 tedd

 PS: What does this have to do with php? Well... a good deal of the code 
 is
 php and a mix of a bunch of other stuff (we don't live in a vacuum) --  
 so

 please permit me this indulgence.

 -- 
 ---

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

 -- 
 PHP General Mailing List (http://www.php.net/)

 To unsubscribe, visit: http://www.php.net/unsub.php




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



[PHP] Multiple Submit

2007-02-26 Thread Dan Shirah

Hello all,

I have a page that has multiple submits on it.  One submit is within my
javascriptfor form checking, the other submit is a button used to populate
all customer information if an order ID is entered.

Problem:  I cannot get the two to coincide at the same time.  They both use
the submit function to send the data to the same page instead of their
unique individual pages.

Code:  Below are the code snipets.


?php echo ?xml version=\1.0\ encoding=\iso-8859-1\?.; ?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
HEAD
script language=JavaScript
!--

function closeThis() {
if (window.confirm(Are you sure you want to cancel the payment request?))

 this.window.close();
}

*function checkForm() {*

// ** START **
 if (inputForm.cc_phone_number.value == ) {
   alert( Please enter a phone number. );
   inputForm.cc_phone_number.focus();
   return;
 }

  if (inputForm.receipt.value == ) {
   alert( Please select whether or not a receipt was requested. );
   inputForm.phone_number.focus();
   return;
 }

 if (inputForm.cc_first_name.value == ) {
   alert( Please enter a first name. );
   inputForm.cc_first_name.focus();
   return;
 }

 if (inputForm.cc_last_name.value == ) {
   alert( Please enter a last name. );
   inputForm.cc_last_name.focus();
   return;
 }

 if (!(document.inputForm.cc_comments.value ==)) {
 if (document.inputForm.cc_comments.value.length  250)
 {
   alert(The Comments must be less than 250 characters.\nIt is currently 
+ document.inputForm.window_name.value.length +  characters.);
  document.inputForm.window_name.focus();
  return;
 }
}
* document.inputForm.submit();*
}

//--
/script
LINK rel=stylesheet type=text/css href=../../CSS/background.css
/head
body
*form name=inputForm action=save.php method=post
enctype=multipart/form-data*
table align=center border=0 cellpadding=0 cellspacing=0
width=680
tr
   td height=13 align=center class=tblheadstrongCredit Card
Information/strong/td
/tr

*// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*

table align=center border=0 cellpadding=0 cellspacing=0
width=680
tr
*This is the other submit that I need to go a page other than the one
specified in the form*
*td width=62a href=DeferredPayment3.phpinput type=submit
name=retrieve value=Retrieve/a/td*
 td width=8/td
/tr
/table
br /
br /
table align=center border=0 cellpadding=0 cellspacing=0
width=680
tr
*Call to the javascript checkForm function*
*td width=64 align=lefta href=javascript:checkForm()
title=SaveSave/a/td
* td width=616 align=lefta href=javascript:closeThis()
title=CloseClose/a/td
/tr
/table
/form
/body
/html


Re: [PHP] audio CAPTCHA - was Combining sound files

2007-02-26 Thread benifactor
   i was just trying again, and entered 406 via keyboard and pressed 
submit, and it said i was successful, then i pressed back on my browser and 
no longer had the error. it displayed the captcha at the top of the page 
where the error was. 


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



Re: [PHP] Multiple Submit

2007-02-26 Thread Németh Zoltán
2007. 02. 26, hétfő keltezéssel 11.23-kor Dan Shirah ezt írta:
 Hello all,
 
 I have a page that has multiple submits on it.  One submit is within my
 javascriptfor form checking, the other submit is a button used to populate
 all customer information if an order ID is entered.
 
 Problem:  I cannot get the two to coincide at the same time.  They both use
 the submit function to send the data to the same page instead of their
 unique individual pages.
 
 Code:  Below are the code snipets.
 
 
 ?php echo ?xml version=\1.0\ encoding=\iso-8859-1\?.; ?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 HEAD
 script language=JavaScript
 !--
 
 function closeThis() {
  if (window.confirm(Are you sure you want to cancel the payment request?))
 
   this.window.close();
 }
 
 *function checkForm() {*
 
  // ** START **
   if (inputForm.cc_phone_number.value == ) {
 alert( Please enter a phone number. );
 inputForm.cc_phone_number.focus();
 return;
   }
 
if (inputForm.receipt.value == ) {
 alert( Please select whether or not a receipt was requested. );
 inputForm.phone_number.focus();
 return;
   }
 
   if (inputForm.cc_first_name.value == ) {
 alert( Please enter a first name. );
 inputForm.cc_first_name.focus();
 return;
   }
 
   if (inputForm.cc_last_name.value == ) {
 alert( Please enter a last name. );
 inputForm.cc_last_name.focus();
 return;
   }
 
   if (!(document.inputForm.cc_comments.value ==)) {
   if (document.inputForm.cc_comments.value.length  250)
   {
 alert(The Comments must be less than 250 characters.\nIt is currently 
 + document.inputForm.window_name.value.length +  characters.);
document.inputForm.window_name.focus();
return;
   }
  }
 * document.inputForm.submit();*
 }
 
 //--
 /script
 LINK rel=stylesheet type=text/css href=../../CSS/background.css
 /head
 body
 *form name=inputForm action=save.php method=post
 enctype=multipart/form-data*
 table align=center border=0 cellpadding=0 cellspacing=0
 width=680
  tr
 td height=13 align=center class=tblheadstrongCredit Card
 Information/strong/td
  /tr
 
 *// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*
 
 table align=center border=0 cellpadding=0 cellspacing=0
 width=680
 tr
 *This is the other submit that I need to go a page other than the one
 specified in the form*
 *td width=62a href=DeferredPayment3.phpinput type=submit
 name=retrieve value=Retrieve/a/td*
   td width=8/td

AFAIK an input within an a tag will not work ever
why don't you do it the way you do the other submit button? (with
javascript submit();)

greets
Zoltán Németh

 /tr
 /table
 br /
 br /
 table align=center border=0 cellpadding=0 cellspacing=0
 width=680
  tr
 *Call to the javascript checkForm function*
  *td width=64 align=lefta href=javascript:checkForm()
 title=SaveSave/a/td
 * td width=616 align=lefta href=javascript:closeThis()
 title=CloseClose/a/td
  /tr
 /table
 /form
 /body
 /html

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



Re: [PHP] audio CAPTCHA - was Combining sound files

2007-02-26 Thread Németh Zoltán
2007. 02. 26, hétfő keltezéssel 08.26-kor benifactor ezt írta:
 i was just trying again, and entered 406 via keyboard and pressed 
 submit, and it said i was successful, then i pressed back on my browser and 
 no longer had the error. it displayed the captcha at the top of the page 
 where the error was. 
 

yeah, if you enter anything (even incorrect), the captcha gets displayed
instead of the error message.

but the speak captcha button still does nothing

greets
Zoltán Németh

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



Re: [PHP] getting authentication information from apache

2007-02-26 Thread Ryan

Tried that ($PHP_AUTH_USER) and it is also empty.

On 2/24/07, dave [EMAIL PROTECTED] wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

try echo $PHP_AUTH_USER;

Ryan wrote:
 Richard,

 I looked at phpinfo() as you said, same thing...

 _SERVER[REMOTE_USER]no value

 You may be right, this may not be available, but I don't want to keep
 throwing a login screen in front of users for no apparent reason.

 Thanks,
 Ryan




 On 2/23/07, Richard Lynch [EMAIL PROTECTED] wrote:
 On Wed, February 21, 2007 1:01 pm, Ryan wrote:
  I'm new to php and I have am running php on apache. I already have
  ldap
  authentication set up in apache would rather not create a separate
  system
  for php. What would be ideal would be to get the current authenticated
  user
  from the apache environment. At this point I'm grabbing at straws, but
  so
  far I've tried
 
  $ret = apache_getenv(LDAP_USER);
  echo $ret;
  echo $_SERVER['REMOTE_USER'];
  echo $_SERVER['PHP_AUTH_DIGEST'];
  $ret = apache_getenv('PHP_AUTH_DIGEST');
 
  None of these work. Has anyone done this??

 If the answer you are seeking isn't available in:
 ?php phpinfo();?
 run on the page where you are trying to do this, then you probably
 can't get the answer you want.

 Running http://php.net/ldap to re-connect and re-authenticate will
 probably be fairly cheap, since LDAP is supposed to be pretty dang
 fast in the first place, and whatever caching is going on for the LDAP
 or OS calls behind LDAP virtually guarantees that the data you want is
 in RAM.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF4AgsGPhC6XW20oARAmruAJ9zpCz5q6mN6rwlRHkyXgtox9ZvWACgnrXa
TFy3y3YOWfFPaFctYAFbDFo=
=6tjM
-END PGP SIGNATURE-



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



[PHP] Re: Uploading into website directory for Php files

2007-02-26 Thread Edward Vermillion

On Feb 26, 2007, at 11:22 AM, [EMAIL PROTECTED] wrote:

Thanks alot for your response.. your information really was a help.  
but now knowing that I an use a folder in my root DIR..  how do I  
let PHP know where to look?  For example  the location lets say of  
my include fold is www.example.com/files/include   how do I  
tell PHP to search that DIR?  Thank you soo much! honestly!


I believe there is a way to either add paths or change the  
include_path directive in your php script, you'll have to look in the  
manual:


http://us3.php.net/manual/en/ini.php

I'm not too sure about it because I don't rely on the include_path  
directive to locate my included files. I always give an absolute path  
when I call them, just so I know for sure what I'm getting. To use  
your example:


?php
include '/files/include/foo.php';

// Do something with foo...
?   

instead of:

?php
include 'foo.php';

// Do something with foo...
?

there *could* be another 'foo.php' in the path that gets grabbed  
before the one you want.



Or you can set a constant to the includes directory:

?php

define('INCLUDE_DIR', '/files/include');

include INCLUDE_DIR.'foo.php';

// Do something with foo...
?

By setting a constant to the directory, if you change the location of  
the directory, then you only need to 	change the script in one spot  
instead of hunting for all the include calls. Of course if you're  
working with someone else's code and *they* are relying on  
include_path being set correctly then you're pretty much stuck with  
that, unless you want to rewrite their code.


Ed

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



Re: [PHP] Multiple Submit

2007-02-26 Thread tedd

At 11:23 AM -0500 2/26/07, Dan Shirah wrote:

Hello all,

I have a page that has multiple submits on it.  One submit is within my
javascriptfor form checking, the other submit is a button used to populate
all customer information if an order ID is entered.

Problem:  I cannot get the two to coincide at the same time.  They both use
the submit function to send the data to the same page instead of their
unique individual pages.


Nothing wrong with putting two forms on the same page and each with 
their own action and submit button.


You can always add an attribute value (value=1) with each submit 
button so that you can determine later which page to redirect your 
attention.


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

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



Re: [PHP] Multiple Submit

2007-02-26 Thread Dan Shirah

When I click on save at the bottom, I want it to check my form and submit
all the values.  When I click on the Retrieve button I want it to submit
my order number to another page, and also carry over the $_POST value of any
field that may have had info entered into it.

However, since I have a form within a form, it is giving me problems.


On 2/26/07, tedd [EMAIL PROTECTED] wrote:


At 11:23 AM -0500 2/26/07, Dan Shirah wrote:
Hello all,

I have a page that has multiple submits on it.  One submit is within my
javascriptfor form checking, the other submit is a button used to
populate
all customer information if an order ID is entered.

Problem:  I cannot get the two to coincide at the same time.  They both
use
the submit function to send the data to the same page instead of their
unique individual pages.

Nothing wrong with putting two forms on the same page and each with
their own action and submit button.

You can always add an attribute value (value=1) with each submit
button so that you can determine later which page to redirect your
attention.

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



Re: [PHP] Multiple Submit

2007-02-26 Thread David Giragosian

I always use :

onClick=\this.form.action='SomeOtherPage.php'; \

inside the button tag.

Seems to work just fine.

David

On 2/26/07, Dan Shirah [EMAIL PROTECTED] wrote:


When I click on save at the bottom, I want it to check my form and
submit
all the values.  When I click on the Retrieve button I want it to submit
my order number to another page, and also carry over the $_POST value of
any
field that may have had info entered into it.

However, since I have a form within a form, it is giving me problems.


On 2/26/07, tedd [EMAIL PROTECTED] wrote:

 At 11:23 AM -0500 2/26/07, Dan Shirah wrote:
 Hello all,
 
 I have a page that has multiple submits on it.  One submit is within my
 javascriptfor form checking, the other submit is a button used to
 populate
 all customer information if an order ID is entered.
 
 Problem:  I cannot get the two to coincide at the same time.  They both
 use
 the submit function to send the data to the same page instead of their
 unique individual pages.

 Nothing wrong with putting two forms on the same page and each with
 their own action and submit button.

 You can always add an attribute value (value=1) with each submit
 button so that you can determine later which page to redirect your
 attention.

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




Re: [PHP] Multiple Submit

2007-02-26 Thread Jim Lucas

Dan Shirah wrote:

Hello all,

I have a page that has multiple submits on it.  One submit is within my
javascriptfor form checking, the other submit is a button used to populate
all customer information if an order ID is entered.

Problem:  I cannot get the two to coincide at the same time.  They both use
the submit function to send the data to the same page instead of their
unique individual pages.

Code:  Below are the code snipets.


?php echo ?xml version=\1.0\ encoding=\iso-8859-1\?.; ?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
HEAD
script language=JavaScript
!--

function closeThis() {
if (window.confirm(Are you sure you want to cancel the payment request?))

 this.window.close();
}

*function checkForm() {*

// ** START **
 if (inputForm.cc_phone_number.value == ) {
   alert( Please enter a phone number. );
   inputForm.cc_phone_number.focus();
   return;
 }

  if (inputForm.receipt.value == ) {
   alert( Please select whether or not a receipt was requested. );
   inputForm.phone_number.focus();
   return;
 }

 if (inputForm.cc_first_name.value == ) {
   alert( Please enter a first name. );
   inputForm.cc_first_name.focus();
   return;
 }

 if (inputForm.cc_last_name.value == ) {
   alert( Please enter a last name. );
   inputForm.cc_last_name.focus();
   return;
 }

 if (!(document.inputForm.cc_comments.value ==)) {
 if (document.inputForm.cc_comments.value.length  250)
 {
   alert(The Comments must be less than 250 characters.\nIt is currently 
+ document.inputForm.window_name.value.length +  characters.);
  document.inputForm.window_name.focus();
  return;
 }
}
* document.inputForm.submit();*
}

//--
/script
LINK rel=stylesheet type=text/css href=../../CSS/background.css
/head
body
*form name=inputForm action=save.php method=post
enctype=multipart/form-data*
table align=center border=0 cellpadding=0 cellspacing=0
width=680
tr
   td height=13 align=center class=tblheadstrongCredit Card
Information/strong/td
/tr

*// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*

table align=center border=0 cellpadding=0 cellspacing=0
width=680
tr
*This is the other submit that I need to go a page other than the one
specified in the form*
*td width=62a href=DeferredPayment3.phpinput type=submit
name=retrieve value=Retrieve/a/td*
 td width=8/td
/tr
/table
br /
br /
table align=center border=0 cellpadding=0 cellspacing=0
width=680
tr
*Call to the javascript checkForm function*
*td width=64 align=lefta href=javascript:checkForm()
title=SaveSave/a/td
* td width=616 align=lefta href=javascript:closeThis()
title=CloseClose/a/td
/tr
/table
/form
/body
/html

I see a few things now that are wrong with this.  I thought they were 
comments but now that you have explained that it was a nested for, it 
make a little more sense.  You cannot nest forms.


if you want to have the for submitted to a different location, then you 
have to use one form, with function that modify the action value and 
change it to the correct url and then submit the form.


Try this:

form action=original.php method=get onsubmit=return false; 
input type=submit
onclick=  alert(Original:+this.form.action);
this.form.action = 'new.php';
alert(New:+this.form.action);  /
/form



--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



Re: [PHP] Re: Uploading into website directory for Php files

2007-02-26 Thread Edward Vermillion


On Feb 26, 2007, at 12:06 PM, Edward Vermillion wrote:



Or you can set a constant to the includes directory:

?php

define('INCLUDE_DIR', '/files/include');

include INCLUDE_DIR.'foo.php';



Ooopps... should be define('INCLUDE_DIR', '/files/include/');

forgot the last '/'... 


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



Re: [PHP] read file local not remote

2007-02-26 Thread Joker7
In news: [EMAIL PROTECTED],
Martin Zvarík  said:
 Difference: You don't call file as http://www.myweb.com/ but instead
 you use the path like c:\some.txt or ../some.txt etc.

 PHP 5
 =
 echo file_get_contents(some.txt);

Works a treat

Cheers
Chris








-- 
Cheap As Chips Broadband http://yeah.kick-butt.co.uk
Superb hosting  domain name deals http://host.kick-butt.co.uk 

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



Re: [PHP] Multiple Submit

2007-02-26 Thread Jim Lucas

Dan Shirah wrote:

Okay, I partially figured it out!  YAY!

I only needed to have one form object.

*form name=inputForm action= method=post
enctype=multipart/form-data*

Instead of putting an action in the form, leave it blankand then 
specify

the forms action based on which button is clicked.

*input type=submit name=retrieve value=Retrieve onclick=
this.form.action='CSPayment3.php'; /*

And this will $_POST all your entered values as it should.

Now all I have to figure out is how to have:

*a href=javascript:checkForm() title=SaveSave/a*

Run through all my form checks and then $_POST to my save.php page.



On 2/26/07, Jim Lucas [EMAIL PROTECTED] wrote:


Dan Shirah wrote:
 Hello all,

 I have a page that has multiple submits on it.  One submit is within my
 javascriptfor form checking, the other submit is a button used to
populate
 all customer information if an order ID is entered.

 Problem:  I cannot get the two to coincide at the same time.  They both
use
 the submit function to send the data to the same page instead of their
 unique individual pages.

 Code:  Below are the code snipets.


 ?php echo ?xml version=\1.0\ encoding=\iso-8859-1\?.; ?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 HEAD
 script language=JavaScript
 !--

 function closeThis() {
 if (window.confirm(Are you sure you want to cancel the payment
request?))

  this.window.close();
 }

 *function checkForm() {*

 // ** START **
  if (inputForm.cc_phone_number.value == ) {
alert( Please enter a phone number. );
inputForm.cc_phone_number.focus();
return;
  }

   if (inputForm.receipt.value == ) {
alert( Please select whether or not a receipt was requested. );
inputForm.phone_number.focus();
return;
  }

  if (inputForm.cc_first_name.value == ) {
alert( Please enter a first name. );
inputForm.cc_first_name.focus();
return;
  }

  if (inputForm.cc_last_name.value == ) {
alert( Please enter a last name. );
inputForm.cc_last_name.focus();
return;
  }

  if (!(document.inputForm.cc_comments.value ==)) {
  if (document.inputForm.cc_comments.value.length  250)
  {
alert(The Comments must be less than 250 characters.\nIt is
currently 
 + document.inputForm.window_name.value.length +  characters.);
   document.inputForm.window_name.focus();
   return;
  }
 }
 * document.inputForm.submit();*
 }

 //--
 /script
 LINK rel=stylesheet type=text/css href=../../CSS/background.css
 /head
 body
 *form name=inputForm action=save.php method=post
 enctype=multipart/form-data*
 table align=center border=0 cellpadding=0 cellspacing=0
 width=680
 tr
td height=13 align=center class=tblheadstrongCredit Card
 Information/strong/td
 /tr

 *// LOTS OF FORM DATA REMOVED FOR EMAIL LENGTH*

 table align=center border=0 cellpadding=0 cellspacing=0
 width=680
 tr
 *This is the other submit that I need to go a page other than the one
 specified in the form*
 *td width=62a href=DeferredPayment3.phpinput type=submit
 name=retrieve value=Retrieve/a/td*
  td width=8/td
 /tr
 /table
 br /
 br /
 table align=center border=0 cellpadding=0 cellspacing=0
 width=680
 tr
 *Call to the javascript checkForm function*
 *td width=64 align=lefta href=javascript:checkForm()
 title=SaveSave/a/td
 * td width=616 align=lefta href=javascript:closeThis()
 title=CloseClose/a/td
 /tr
 /table
 /form
 /body
 /html

I see a few things now that are wrong with this.  I thought they were
comments but now that you have explained that it was a nested for, it
make a little more sense.  You cannot nest forms.

if you want to have the for submitted to a different location, then you
have to use one form, with function that modify the action value and
change it to the correct url and then submit the form.

Try this:

form action=original.php method=get onsubmit=return false; 
input type=submit
   onclick=   alert(Original:+this.form.action);
   this.form.action = 'new.php';
   alert(New:+this.form.action);  /
/form



--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.

- Rush








Change this line:
a href=javascript:checkForm() title=SaveSave/a*
to this
input type=button value=Save /

and then in the form ... tag add: onsubmit=checkForm();

I would also run through your checkForm() function and make sure that it 
is returning true or false always.



--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



[PHP] Array question

2007-02-26 Thread Gerry D

I have a question on how to retrieve the value that corresponds to a
key in an array.

$fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry');

$key = array_search($c, $fruit);
if ( $key === FALSE )
$n = $c;
else
{
$n = $fruit[$key];  // how to get the value???
}

the array_search works ok, but how do I get the value?

all I get back is 'a' or 'b', not 'apple' or 'banana'...

TIA

Gerry

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