Re: [PHP] change PHP include directory

2003-09-14 Thread Tom Rogers
Hi,

Sunday, September 14, 2003, 3:25:57 PM, you wrote:
TT Hi,

TT Normally to change a sites include directory for PHP I'd use a .htaccess 
TT file and the following command:

TT php_value include_path .:/path/to/web/

TT Again normally, I would get the path to the site by doing a simple 
TT phpinfo(); command and find the _ENV[DOCUMENT_ROOT]  line near the end of 
TT the phpinfo(); page.

TT I've just setup an account with a shared hosting provider - I'm not fully 
TT sure if they allow me to use .htaccess or not, I've got a call into tech 
TT support but waiting is boring.  So while I wait - is there a better or more 
TT accurate way of determining the actual path to my site on their 
TT server?  I'm sure it has been written into PHP to specifically not allow 
TT this - just curious.

TT Secondly, if it is proven that my host does not allow .htaccess - is there 
TT another way for me to change the include directory from its default and 
TT into my sites root?

TT This current site isn't all that large, so I could live without changing 
TT the include path - but my next job (which is already committed to this same 
TT host) is fairly large and will be a necessity for the change to occur.

TT Thanks
TT -Tim
You can do this at the top of each page if all else fails

ini_set('include_path','new_include_path:'.ini_get('include_path'));

(Use a ; as the separator if on windows)
This puts your directory first in the search path
-- 
regards,
Tom

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



[PHP] CGI Error, IIS

2003-09-14 Thread nabil
Why this happen with me with IIS
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:

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



Re: [PHP] socket_write eats data - solved

2003-09-14 Thread Thomas Weber
IMAP? We were talking about IRC, the Internet Relay Chat.
In detail, my problems doesn't even refer to IRC directly, as i am
developing a server for a html-based webchat, but the server-structure and
the messages are nearly the same.
Once you realize the basics of socket-multicasting, it is no problem to
maintain hundreds of simultanous TCP-connects via arrays of sockets, also
called descriptor-sets. PHP seems to directly use the underlying C-
libraries, so everything you can imagine is possible.
Anyway, the major drawback of PHP in this case is speed. Currently i can
send about seven messages per second (one send means socket-connect of a
input client, some simple processing of the message and sending it to all
connected listening clients) with a dozen listening clients, but only about
three messages per second with two hundred listening clients. As C-written
IRC-servers sometimes have thousands of connected clients, i can only
imagine that it is PHP which has some not so efficent array- or
resource-handling.

Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

- Original Message - 
From: Raditha Dissanayake [EMAIL PROTECTED]
Cc: PHP-List [EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 7:26 AM
Subject: Re: [PHP] socket_write eats data - solved


 Wouldn't this multiple connections be a problem for php? IMHO one of the
 main draw backs of the PHP IMAP library is the fact that you have to
 open and close and imap connection for each page. That issue is
 multiplied ten fold in this scenario isn't it?


 Thomas Weber wrote:

 No, it's TCP and a very uncomplicated protocol, everything is sent in
clear
 text. Major problem is the socket-multicasting to keep track of all
clients
 simultanly.
 
 - Original Message - 
 From: Raditha Dissanayake [EMAIL PROTECTED]
 To: Thomas Weber [EMAIL PROTECTED]; PHP-List
 [EMAIL PROTECTED]
 Sent: Sunday, September 14, 2003 2:59 AM
 Subject: Re: [PHP] socket_write eats data - solved
 
 
 
 
 Is IRC UDP?
 Thomas Weber wrote:
 
 
 
 Hi,
 
 i've checked a hundred things before posting this question, but i
forgot
 
 
 the
 
 
 most important thing, the buffer.
 The 'eaten' writes were buffered by the network-kernel and sent as
bunch
 
 
 of
 
 
 data. If too much data for the buffer is sent, the write is broken up
and
 completed in the next bunch-of-data.
 My receive-script hasn't diplayed the raw output, but an unserialized
 
 
 array,
 
 
 fetched out of the received string.
 
 Maybe this will will help someone in future.
 
 Thomas 'Neo' Weber
 ---
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 - Original Message - 
 From: Thomas Weber [EMAIL PROTECTED]
 To: PHP-List [EMAIL PROTECTED]
 Sent: Saturday, September 13, 2003 9:15 PM
 Subject: [PHP] socket_write eats data
 
 
 
 
 
 
 Hi,
 
 I am deveoping a chatserver in IRC-style in PHP. For communication it
 
 
 uses
 
 
 socket-multiplexing aka socket_select. So long so good, works
perfectly.
 The problem is, than when i make several socket_write's to the same
 
 
 client
 
 
 without waiting about 0.1sec after each write, the written data gets
 
 
 lost
 
 
 somewhere. socket_write does NOT throw any error, the data seams just
 sended, but the clients never receives it.
 
 Small example of the used code:
 -
 var $clients // array of 'client'-objects, each object has it's own
 socket-descriptor in the object-variable $socket
 
 function write_to_clients ($text) {
  for ($i = 0; $i  count ($this-clients); $i++) {
socket_write ($this-clients[$i]-socket, $text);
  }
  // usleep (1); if this is uncommented, all write are received by
 
 
 all
 
 
 clients
 }
 
 for ($i = 0; $i  10; $i++) {
$this-write_to_clients (test .$i);
 }
 -
 
 Okay, this doesn't check the client-sockets for readiness to write,
but
 
 
 
 
 even
 
 
 
 
 if I check (via socket_select), ALL clients are ready to write and
 
 
 writes
 
 
 get lost too. It can't be the network-connection, because the tests
run
 
 
 
 
 with
 
 
 
 
 standalone PHP-clients on the same machine.
 
 Is there any possibility to make fast writes without waiting after
each
 write? The wait limits the server to max. 10 writes per second, wich
 
 
 isn't
 
 
 really enaugh for a good chatserver.
 
 Thanks for your help!
 
 Thomas 'Neo' Weber
 ---
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 
 
 
 -- 
 http://www.radinks.com/upload
 Drag and Drop File Uploader.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 


 -- 
 http://www.radinks.com/upload
 Drag and Drop File Uploader.

 -- 
 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] innodb + php caching issues

2003-09-14 Thread esctoday.com | Wouter van Vliet
Might want to try to send aa 'commit' command to the database. Just the
first thing that enters my mind

 - -Original Message-
 - From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 - Sent: zondag 14 september 2003 7:55
 - To: [EMAIL PROTECTED]
 - Subject: [PHP] innodb + php caching issues
 - 
 - Hi there i have experienced a wierd bug , where after i 
 - commit a query in innodb that change wont be viewable until 
 - i refresh the page , this doesnt happen in a similar system 
 - framwork using myisam tables the change is viewable, what 
 - could be the problem ? should i just give nocache headers 
 - for a quick fix?
 - 
 - --
 - 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] php sockets was Re: [PHP] socket_write eats data - solved

2003-09-14 Thread Raditha Dissanayake
Hi thomas,

Thomas Weber wrote:

IMAP? We were talking about IRC,

Used imap as an example.

the Internet Relay Chat.
In detail, my problems doesn't even refer to IRC directly, as i am
developing a server for a html-based webchat, but the server-structure and
the messages are nearly the same.
Yes my questions was how are you going to maintain the connection 
between two different connectsion. As far as i know sockets cannot be 
serialized in php4.

Once you realize the basics of socket-multicasting, it is no problem to
maintain hundreds of simultanous TCP-connects via arrays of sockets, also
called descriptor-sets. PHP seems to directly use the underlying C-
libraries, so everything you can imagine is possible.
Thanx i am aware of it

 

--
http://www.radinks.com/upload
Drag and Drop File Uploader.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


php-general Digest 14 Sep 2003 13:14:44 -0000 Issue 2296

2003-09-14 Thread php-general-digest-help

php-general Digest 14 Sep 2003 13:14:44 - Issue 2296

Topics (messages 162533 through 162552):

Re: Integrating an Applet with PHP
162533 by: Raditha Dissanayake

Re: socket_write eats data - solved
162534 by: Raditha Dissanayake
162535 by: Thomas Weber
162544 by: Raditha Dissanayake
162550 by: Thomas Weber

Trying to submit form to frame and pass php var
162536 by: info.vtwebdesigners.com

Re: Calling functions from Button actions
162537 by: daniel.electroteque.org
162540 by: John W. Holmes
162541 by: daniel.electroteque.org
162542 by: John W. Holmes
162543 by: daniel.electroteque.org

Re: Text into a url
162538 by: daniel.electroteque.org

Re: square brackets in form names violate HTML specs?
162539 by: Robert Cummings

change PHP include directory
162545 by: Tim Thorburn
162546 by: John W. Holmes
162548 by: Tom Rogers

innodb + php caching issues
162547 by: daniel.electroteque.org
162551 by: esctoday.com | Wouter van Vliet

CGI Error, IIS
162549 by: nabil

php sockets was Re: [PHP] socket_write eats data - solved
162552 by: Raditha Dissanayake

Administrivia:

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

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

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
Hi,

Ouch tried it again and mozilla had a heart attack and core dumped :-((
Then i tried konqueror browser worked like a charm
Gentlemen, i think others in the group must be pretty annoyed about this 
thread shall we hop over to a java group?

Raditha Dissanayake wrote:

Mozilla 1.4 Red Hat 9.0 KDE 3.2 JRE 1.4.2

Todd Cary wrote:

Raditha -

I am using NS 7.1 running in Windows 2000.  Which version of Netscape 
are you running?

This certainly is a strange situation.

http://www.hexidec.com/ekitdemo.php

No HTML shows in the Editor window on startup with NS; it is there 
with IE.

Todd

Raditha Dissanayake wrote:

HI,

I tried it on netscape and it works. My jre is 1.4.2. AFAIK this is 
the only stable jre after 1.3xx series. It's a simple matter to add 
a line of code to the java applet to do the base64 decoding if you 
are concerned about compatibility.

On the point raised about activex : The default plug in for ie 
(extremely crappy) is in fact an activex but that does not mean your 
applet behaves like an activex.



Todd Cary wrote:

Dan -

I am surprised that an Open Source applet would rely on ActiveX.  
It appears that there is something I am not doing correctly in 
setting the DATA param for Netscape.

Please overlook my ignorance about browsers and applets as I try to 
get a better understanding, but is BASE64 encoding/decoding a 
feature of IE and not , possibly, of  Netscape?

Todd

Dan Anderson wrote:

why does it work in IE and not in Netscape 7.1?
  




I'm pretty sure ActiveX controls don't run on anything besides MS
Windows Lockinware (TM).  There are a number of other things that
netscape does not fully support (try loading a page with an iframe 
tag
in Netscape).  You probably ran into another such problem.

-Dan

 

--











--
http://www.radinks.com/upload
Drag and Drop File Uploader.
---End Message---
---BeginMessage---
Is IRC UDP?
Thomas Weber wrote:
Hi,

i've checked a hundred things before posting this question, but i forgot the
most important thing, the buffer.
The 'eaten' writes were buffered by the network-kernel and sent as bunch of
data. If too much data for the buffer is sent, the write is broken up and
completed in the next bunch-of-data.
My receive-script hasn't diplayed the raw output, but an unserialized array,
fetched out of the received string.
Maybe this will will help someone in future.

Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]
- Original Message - 
From: Thomas Weber [EMAIL PROTECTED]
To: PHP-List [EMAIL PROTECTED]
Sent: Saturday, September 13, 2003 9:15 PM
Subject: [PHP] socket_write eats data

 

Hi,

I am deveoping a chatserver in IRC-style in PHP. For communication it uses
socket-multiplexing aka socket_select. So long so good, works perfectly.
The problem is, than when i make several socket_write's to the same client
without waiting about 0.1sec after each write, the written data gets lost
somewhere. socket_write does NOT throw any error, the data seams just
sended, but the clients never receives it.
Small example of the used code:
-
var $clients // array of 'client'-objects, each object has it's own
socket-descriptor in the object-variable $socket
function write_to_clients ($text) {
 for ($i = 0; $i  count ($this-clients); $i++) {
   socket_write ($this-clients[$i]-socket, $text);
 }
 // usleep (1); if this is uncommented, all write are received by all
clients
}
for ($i = 0; $i  10; $i++) {
   $this-write_to_clients 

[PHP] Need Help Troubleshooting Code That Works Till It Comes to Form at End

2003-09-14 Thread Stephen Tiano
I spent last night trying, overnight brooding (in my sleep), and this 
morning, finally, finding and fixing the errant line in the code below 
to get it to display in my browser the entries I made in a test name 
named users.

So I got is to display every column of every entry. But when I tried a 
specialized select statement in the query box provided by the form at 
the very end of this code, when I pressed the Submit button, nothing 
changed; I was still left staring at the table of all the info in users.

What am I missing in the form?

Thanks much.

Steve Tiano

--

?php

if(!isset($query) || empty($query))
   {$query = select * from users;}
//stripslashes is necessary because the slect statement is
//coming from a form. In most systems, the magic_quotes
//setting (see Appendix A) will prepend single quotes
//with backslashes, which could be problematic.
$query=stripslashes($query);
mysql_connect(localhost, name, password) or die (Could not 
connect to database);
mysql_select_db(mysqlphp_db_apps_exerDB) or die (Could not select 
database);
$result = mysql_query($query) or die(mysql_error() );

$number_cols = mysql_num_fields($result);

echo bquery: $query/b;
//lay out table header
echo table border = 1\n;
echo tr align=center\n;
for ($i=0; $i$number_cols; $i++)
{
   echo th . mysql_field_name($result, $i). /th\n;
}
echo /tr\n;//end table header
//lay out table body
while ($row = mysql_fetch_row($result))
{
   echo tr align=left\n;
   for ($i=0; $i$number_cols; $i++)
   {
   echo td;
   if (!isset($row[$i])) //test for null value
   {echo NULL;}
   else
   {echo $row[$i];}
   echo /td\n;
   }
   echo /tr\n;
}
echo /table;

?

form action=? echo $PHP_SELF? method=GET
   input type=text name=query size=50br
   input type=submit
/form
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Need Help Troubleshooting Code That Works Till It Comes to Form at End

2003-09-14 Thread John W. Holmes
Stephen Tiano wrote:

So I got is to display every column of every entry. But when I tried a 
specialized select statement in the query box provided by the form at 
the very end of this code, when I pressed the Submit button, nothing 
changed; I was still left staring at the table of all the info in users.
[snip]
if(!isset($query) || empty($query))
   {$query = select * from users;}
[snip]
form action=? echo $PHP_SELF? method=GET
   input type=text name=query size=50br
   input type=submit
/form
Is register_globals ON or OFF? From you're code, you're assuming it's ON 
and $query will be created. If it's off, however, there will be no 
$query, only $_GET['query'] or $_REQUEST['query'].

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] Trying to submit form to frame and pass php var

2003-09-14 Thread Raditha Dissanayake
Hi,
you cannot invoke php functions from javascript. You have to pass on any 
relevent variables (which can be done with hidden input fields) with 
your POST/GET data to the script for processing on the server.

[EMAIL PROTECTED] wrote:

Hello I was wondering if someone could help me out.

Trying to submit form to frame and pass php var at the same time.

script language=JavaScript!--
function submitform(){
top.admin.document.adminform.submit();
}
//--/script
and...

frameset rows=538,83 cols=*
 frame src=admin.php?order=1 name=admin id=admin
 frame src=status.php name=status scrolling=auto id=status
/frameset
Link look like: a href=javascript:submitform();
target=_parentDelete/a
What I need to do though, is run this exact script while passing
($delete=yes) as php at the same time?  Basically, run the form and if
delete=yes then use the following form tag :  form name=adminform
method=post action=setup.php?delete=yes  target=_parent
Any ideas?  Thanks Brandon



 



--
http://www.radinks.com/upload
Drag and Drop File Uploader.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Calling functions from Button actions

2003-09-14 Thread Marek Kilimajer
I hope you don't use this method. It is VERY unsafe. You execute ANY 
function that the user tells you.

Daniel Souza wrote:
?
   function func1()
   {
   }
   function func2()
   {
   }
   function func3()
   {
   }
   function func4()
   {
   }
   function func5()
   {
   }
   if (isset($_REQUEST['funcs']))
  foreach ($_REQUEST['funcs'] as $key=$val)
 if (function_exists($key))
$key();
?
hr
form method=POST
input type=submit name=funcs[func1] value=Execute Function 1br
input type=submit name=funcs[func2] value=Execute Function 2br
input type=submit name=funcs[func3] value=Execute Function 3br
input type=submit name=funcs[func4] value=Execute Function 4br
input type=submit name=funcs[func5] value=Execute Function 5br
/form
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Function calls and strings

2003-09-14 Thread Curt Zirzow
* Thus wrote Ney André de Mello Zunino ([EMAIL PROTECTED]):

 I seek to find out whether PHP also has a syntax to allow function calls 
 within a string, so that explicit concatenation is not needed. E.g.:
 
 something like:
 
   $s = The result is {getResult($foo)}.;
 
 as opposed to
 
   $s = The result is  . getResult($foo) . .;
 
 If that is not possible, I would appreciate if someone could suggest the 
 rationale.

How do I tell it NOT to call the function, i want to just store
this in a string:

$s = The result is {getResult(\$foo)}.;
echo $s;

---
The result is {getResult($foo)).
---


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] square brackets in form names violate HTML specs?

2003-09-14 Thread Curt Zirzow
* Thus wrote Robert Cummings ([EMAIL PROTECTED]):
 On Sat, 2003-09-13 at 17:21, Eugene Lee wrote:
  On Sat, Sep 13, 2003 at 06:15:29PM +, Curt Zirzow wrote:
  : * Thus wrote Eugene Lee ([EMAIL PROTECTED]):
  :  Something I've noticed in PHP is a proliferation of code like this:
  :  
  :  input name=stuff[title] value= type=text size=40
  [...]
  : The way to properly do it would be to set set your name as:
  : 
  : input name=stuff%5Btitle%5D value= type=text size=40
  
  Great idea, thanks Curt!
 
 I almost fell for this and updated my code. Then I decided to read the
 spec for myself and noticed that it doesn't say anywhere that % is ok
 either *grin*.

   - ID and NAME tokens must begin with a letter ([A-Za-z]) and
 may be followed by any number of letters, digits ([0-9]),
 hyphens (-), underscores (_), colons (:), and periods
 (.).

Yeah I sort of ignored that :) What is interesting though is that
the html spec isn't fully supporiting HTTP.  This probably should be
changed to allow urlencoded characters. Although I do see the
justification for this 

document.forms[0].stuff[title].value
or 
document.forms[0].stuff%5Btitle%5D.value

just wont work


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] CGI Error, IIS

2003-09-14 Thread Curt Zirzow
* Thus wrote nabil ([EMAIL PROTECTED]):
 Why this happen with me with IIS
 CGI Error
 The specified CGI application misbehaved by not returning a complete set of
 HTTP headers. The headers it did return are:

check your IIS logs.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] square brackets in form names violate HTML specs?

2003-09-14 Thread John W. Holmes
Curt Zirzow wrote:

* Thus wrote Robert Cummings ([EMAIL PROTECTED]):

On Sat, 2003-09-13 at 17:21, Eugene Lee wrote:

On Sat, Sep 13, 2003 at 06:15:29PM +, Curt Zirzow wrote:
: * Thus wrote Eugene Lee ([EMAIL PROTECTED]):
:  Something I've noticed in PHP is a proliferation of code like this:
:  
:  	input name=stuff[title] value= type=text size=40
[...]
: The way to properly do it would be to set set your name as:
: 
: input name=stuff%5Btitle%5D value= type=text size=40

Great idea, thanks Curt!
I almost fell for this and updated my code. Then I decided to read the
spec for myself and noticed that it doesn't say anywhere that % is ok
either *grin*.
 - ID and NAME tokens must begin with a letter ([A-Za-z]) and
   may be followed by any number of letters, digits ([0-9]),
   hyphens (-), underscores (_), colons (:), and periods
   (.).


Yeah I sort of ignored that :) What is interesting though is that
the html spec isn't fully supporiting HTTP.  This probably should be
changed to allow urlencoded characters. Although I do see the
justification for this 

document.forms[0].stuff[title].value
or 
document.forms[0].stuff%5Btitle%5D.value

just wont work
Kind of supports the idea that PHP should turn multiple variables into 
an array automatically, without the need of specifying [ and ].

That would kill the ability of name keys in the HTML, though...

input type=text name=name[xxx][yyy] value=

I like being able to do that and don't really care if it doesn't conform 
to the HTML spec... oh well. :)

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] caching program

2003-09-14 Thread Curt Zirzow
* Thus wrote Andrea Tricco ([EMAIL PROTECTED]):
 For the images that don't contain http://; my program is already able to
 get them from the web server.
 In other cases, I have to determine the name of the directory where the html
 page is located.
 Thus, the equivocal paths are the problem, for example:
 
 www.php.net/manual/it/index.php
 
 www.php.net/manual/it/
 
 www.php.net/manual/it
 
 The reply of the server web is the same in the three cases.

Not true, Like I had posted ealier the last url apache will
redirect the person requesting the file to:

www.php.net/manual/it/

php does this transparently with the current method you are using
to obtain the files.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] CGI Error, IIS

2003-09-14 Thread John W. Holmes
nabil wrote:

Why this happen with me with IIS
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Although it's not a bug, read this:

http://bugs.php.net/bug.php?id=12061

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP] HTTP_GET_VARS VS. _GET

2003-09-14 Thread Todd Cary
I notice the use of _GET in some messages.  Is this the same as 
HTTP_GET_VARS[]?

Where in the manual is this documented?

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


Re: [PHP] More Image Transformation Difficulty

2003-09-14 Thread Marek Kilimajer
Anytime you encounter any error with images, comment out Content-Type 
header and you will see the error right in your browser. In this case 
the error is
bFatal error/b:  Call to undefined function:  imagejpg() in 
b/usr/home/jakus1/www/htdocs/jpg.php/b on line b64/b

should be imagejpeg

[EMAIL PROTECTED] wrote:

I'm trying to write a script that pulls an image from a database and transforms
the size if passed a width via the url query string.
Thanks to the helpful hint about the function imagecreatefromstring, I 
think I'm now able to ready image data I've pulled for a database with 
GD. However, I'm still having trouble resizing... at least, when I'm 
sending the image to my browser, I'm being told that it cannot be 
displayed, because it contains errors. (And the script does work if
I don't try resizing... see below for example URL).

Here's what I'm doing:

$row = mysql_fetch_row($dbresult);
$imgdata = $row[0];
if(isset($width)  !empty($width)  is_numeric($width))
/* only do transformation if given a width */
{
$gdimg = imagecreatefromstring($imgdata);
$srcWidth = imagesx($gdimg);
$srcHeight = imagesy($gdimg);
$scaleFactor = $width/$srcWidth;
$targetHeight = $srcHeight * $scaleFactor;
$resizedimg = imagecreatetruecolor($width,$targetHeight);

imagecopyresized($resizedimg,$gdimg,0,0,0,0,$width,$targetHeight,$srcWidth,$srcHeight);
}
	header(Content-Type: image/jpeg);
	header(Content-Transfer-Encoding: binary\n);
	//send file contents
	if(!empty($resizedimg)) 
		imagejpg($resizedimg);
	else 
	{
		header(Content-length:  . strlen($imgdata) . \n);
		print($imgdata);
	}

Does anyone see what I'm doing wrong? Again, the script actually works if I
don't try to do the transform. See:
http://www.fsboutah.net/jpg.php?table=homeskey=4field=Picture1

and

http://www.fsboutah.net/jpg.php?table=homeskey=4field=Picture1width=100

for contrasts.

-W

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


Re: [PHP] HTTP_GET_VARS VS. _GET

2003-09-14 Thread Larry E . Ullman
I notice the use of _GET in some messages.  Is this the same as 
HTTP_GET_VARS[]?
More or less. $_GET was added in version 4.1 and has an added advantage 
of being global in scope (it's a superglobal).

Where in the manual is this documented?
http://www.php.net/release_4_1_0.php
http://www.php.net/manual/en/language.variables.predefined.php
Hope that helps,
Larry
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Is this inefficient?

2003-09-14 Thread Todd Cary
I may have two buttons on the form and the Form Action has the same 
value as the current form, then at the top of my php script, I may have

$continue = $HTTP_POST_VARS[btnContinue];
$cancel   = $HTTP_POST_VARS[btnCancel];
followed by

if ($continue) {
 //Do something - usually go to another page
} elseif {
($cancel) {
 // Do something - usually go to another page
} else {
 //Do something
}
Is this inefficient or is there a better way to do this?

+++

For listing records, I create a function, grid_show() and use it like 
below after creating the header.  It gets called for each record in the 
record set.  Suggestions welcomed

Todd

 /* Display the grid */
 function grid_show($id, $ct, $date, $place, $est_amt, $card, $ccn, 
$session_id) {
   if ($ct % 2) {
 $class = Even;
   } else {
 $class = Odd;
   }
   echo(tr);
   // The first column contains a link for the display of the record
   // in trans_edit.php.
   echo('td class=' . $class . 'ba 
href=trans_edit.php?session_id=' . $session_id .
  'tmp_id=' . $id .
  '' . Edit . '/a' .
  /b/td);
   echo(NL);
   echo('td class=' . $class . 'b' . $date . /b/td);
   echo(NL);
   echo('td class=' . $class . 'b' . $place . /b/td);
   echo(NL);
   echo('td class=' . $class . 'b' . $est_amt . /b/td);
   echo(NL);
   echo('td class=' . $class . 'b' . $card . /b/td);
   echo(NL);
   echo('td class=' . $class . 'b' . $ccn . /b/td);
   echo(NL);
   echo('td class=' . $class . 'b' . $state . /b/td);
   echo(NL);
   echo(/tr\n);
 }

--

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


Re: [PHP] Displaying Blobs by a newbie

2003-09-14 Thread Phil King
Hi Curt,

Thanks for the tip.

I created the two scripts . The image tag on the main page calls the image
from the other script with an incremented id parameter.

Thanks for your help.

Phil.
Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Phil King ([EMAIL PROTECTED]):
  Hi All,
 
  I have some images in a mysql database. I wish to display all these
images
  on a PHP Page.
 
  I have created a query to retrieve all the images from the database but
all
  that is displayed is characters.
  I have the Content-Type as image/jpeg in the header of the page to
display
  the images.

 Basically you need two scripts:

 script1:
 generate html that has img tags that point to script2.

 script2:
 read one image from the database and send that image with the
 appropriate content-type


 
  Can anyone advise me or point me in the right direction to rectify this.

 This has been discussed may times on the list, you can search the
 archives to find out more detailed discussions on this.


 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.

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



[PHP] strtotime() question

2003-09-14 Thread Kyle Bisignani
Hello,
I'm not even quite sure if I am posting this message in the right place,
so please bear with me.
I have a question regarding the strtotime() function.  I am developing a PHP
script to handle dates for my web site, and I need an easy way to get from
today to tomorrow to +2 days to +3 days... you get the idea... all the way
up to +90 days.  The strtotime() function seems ideal because the script can
easily put in +51 days and it knows what to do.
My question is how does it handle Daylight Savings Time?  The program I
was previously using (written in Perl) actually jumped a day or duplicated a
day when DST was coming up or ending.  When using the +19 days syntax in
the strtotime() function, does it take into account DST and not cause
similar problems?

Thank you very much for any help.
~Kyle Bisignani

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



[PHP] CPanel adding POP account

2003-09-14 Thread Dasmeet
I am having a server that runs CPanel/WHM... I wish to create a free 
email service... Are there any PHP scripts available for the same??
Thanks in advance
Dasmeet

--
--
Domainwala.com
Domain Names from $7.99 at http://www.domainwala.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] CPanel adding POP account

2003-09-14 Thread Warren Vail
Try;

http://www.cpanel.net/docs/cp/

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Dasmeet [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 11:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] CPanel adding POP account


I am having a server that runs CPanel/WHM... I wish to create a free 
email service... Are there any PHP scripts available for the same??
Thanks in advance
Dasmeet

-- 
--
Domainwala.com
Domain Names from $7.99 at http://www.domainwala.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] Verifying E-mail Addresses

2003-09-14 Thread Dan Anderson
I'm having a problem with e-mail addresses entered by users that are
invalid (i.e. $email == some person at somewhere.com).  Is there a
function I could call like:

?php

  if (email_is_valid($email))
   { mail_out_newsletter($email); }
  else
   { yelp_and_whine(); }

?

Thanks in advance,

Dan

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



RE: [PHP] CPanel adding POP account

2003-09-14 Thread Warren Vail
found a better programming resource at

http://cpanel.net/docs.htm

Seems you may be able to access each cpanel function (see the sample PHP
script).

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Warren Vail [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 11:59 AM
To: Dasmeet; [EMAIL PROTECTED]
Subject: RE: [PHP] CPanel adding POP account


Try;

http://www.cpanel.net/docs/cp/

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Dasmeet [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 11:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] CPanel adding POP account


I am having a server that runs CPanel/WHM... I wish to create a free
email service... Are there any PHP scripts available for the same??
Thanks in advance
Dasmeet

--
--
Domainwala.com
Domain Names from $7.99 at http://www.domainwala.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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] passthru loses php posted variables

2003-09-14 Thread exasperated
Anyone come across something like this before?

I have made a little test script as follows:
?
header (Content-Type: application/pdf);
$command_line = /usr/bin/pdflabelseries  .
escapeshellcmd($_POST['labelstart']) .   .
escapeshellcmd($_POST['labelend']);
exec (echo \$command_line\ /opt/specs/labels.txt);
//passthru($command_line);
?

The form takes input from a posted form with two variables, labelstart and
labelend.  In the above test, if I put in 'start' and 'end' as the posted
variable data, the output from /opt/specs/labels.txt (writable by the http
server) is:
/usr/bin/pdflabelseries start end
All is well and good.  Now is where it heads South.  I uncomment the
passthru command above.  The output from the script in /opt/specs/labels.txt
from the same posted form with the same data entered is now:
/usr/bin/pdflabelseries
pdflabelseries is a C program that I have confirmed works perfectly on the
command line (i.e. generates the requisite pdf file to stdout).
Even if the C program fails (which it does not appear to do from the output
in the httpd logs as it outputs its command line to stderr), surely php
should not lose its own internal variables, especially, for a command that
is executed BEFORE the passthru command.

I am truly baffled.

Any help appreciated.
Regards

Mark

I am running vanilla Mandrake 9.1 with the following PHP rpms:
libphp_common430-430-11mdk
php-pear-4.3.0-3mdk
apache2-mod_php-2.0.44_4.3.1-2mdk
php-xml-4.3.0-2mdk
php-dba_bundle-4.3.0-4mdk
php-pgsql-4.3.0-4mdk
php-xmlrpc-4.3.0-2mdk
php-manual-en-4.3.0-2mdk
php430-devel-430-11mdk
php-gd-4.3.0-2mdk

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



[PHP] Novice in eCommerce

2003-09-14 Thread Karen Lubrecht
this may not be the right place to ask this, but perhaps someone here
can tell me what I don't know and should be trying to learn!

I can uses php in the construction of a web site. I can create a data
base and authenticate users. I can create a shopping cart. I know that
osCommerce is highly thought of. I can get a merchant card. I know that
a SSL certificate is needed and if it is shared due to a shared server,
the insurance is only for the owner of the server not for those accounts
hosted. I know how to encrypt email using PGP or GNUPG.

What I seem to be dense about is the technique for connecting the credit
card company and the shopping cart, and where the SSL fits into this
code! Something just isn't making sense!

My appologies if I am trying to get php to do something that it isn't
meant to do! If you can tell me what should be doing it I would greatly
appreciate it!

TIA

Karen 

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



[PHP] Program works only when there are records :-(

2003-09-14 Thread Ryan A
Hi,
I have a select statment with a UNION so that i am getting 5 COUNT(*)'s from
a table.

After that I have this code:
*
$res = mysql_query($tt);
$num_rows = mysql_num_rows($res); //This is line 25
$x=1;

for($i=0; $i5; $i++)
{
$a = mysql_result($res, $i); //This is line 30
$bb[$x]=$a;
$x++;
}

$one = $bb[1];
$two = $bb[2];
$thr = $bb[3];
$fou = $bb[4];
$fiv = $bb[5];

$tot=$one + $two + $thr + $fou + $fiv;
*

When i have some records in the database this works fine and i get all the
values  in $one,$two etc but when a new account is created and i the
COUNT(*) gets back just 0 I get these ugly errors/warnings on my page:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 25

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30



What should i do and wheres the problem? I searched on google but just found
some sites outputting this, no real help.
Totally confused, please help.

Thanks,
-Ryan

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



[PHP] no response from a simple php/mysql code

2003-09-14 Thread Wei Wang
Hi, all, 

I'm a total newbie to php and just couldn't make the following php file(grabbed at 
awtrey.com, basic php/mysql code) running at http://weiwang.freeshell.org/guest.php
I've read some php tutorials but I think I must've missed a very fundamental point 
that led to the failure of this code. 
I'd highly appreciate it if anyone could drop me a line with any advice. 


Many thanks,

Wei Wang

?
/*
PHP Guestbook 1.1
Written by Tony Awtrey
Anthony Awtrey Consulting
See http://www.awtrey.com/support/dbeweb/ for more information

1.1 - Oct. 20, 1999 - changed the SQL statement that reads data
  back out of the database to reverse the order putting the
  newest entries at the top and limiting the total displayed
  by default to 20. Added the ability to get the complete list
  by appending the URL with '?complete=1'. Added the code and
  additional query to count and list the total number of entries
  and included a link to the complete list.
1.0 - Initial release

This is the SQL statement to create the database required for
this application.

CREATE TABLE guests (
  guest_id
int(4)
unsigned
zerofill
DEFAULT ''
NOT NULL
auto_increment,
  guest_name varchar(50),
  guest_email varchar(50),
  guest_time timestamp(14),
  guest_message text,
  PRIMARY KEY (guest_id)
);

*/


// This checks to see if we need to add another guestbook entry.

if (($REQUEST_METHOD=='POST')) {


// This loop removed dangerous characters from the posted data
// and puts backslashes in front of characters that might cause
// problems in the database.

  for(reset($HTTP_POST_VARS);
$key=key($HTTP_POST_VARS);
next($HTTP_POST_VARS)) {
$this = addslashes($HTTP_POST_VARS[$key]);
$this = strtr($this, ,  );
$this = strtr($this, ,  );
$this = strtr($this, |,  );
$$key = $this;
  }
  
  
  // This will catch if someone is trying to submit a blank
  // or incomplete form.
  
  if ($name  $email  $message ) {


// This is the meat of the query that updates the guests table

$query = INSERT INTO guests ;
$query .= (guest_id, guest_name, ;
$query .= guest_email, guest_time, guest_message) ;
$query .= values(,'$name','$email',NULL,'$message');
mysql_pconnect(ol.freeshell.org,weiwang,password)
   or die(Unable to connect to SQL server);
mysql_select_db(weiwang) or die(Unable to select database);
mysql_query($query) or die(Insert Failed!);
 echo pHello World/p;
 //die(after query);
  } else {


// If they didn't include all the required fields set a variable
// and keep going.

$notall = 1;

  }
}
?
!-- Start Page --
HTML
HEAD
TITLEAdd A Message/TITLE
/HEAD

BODY BGCOLOR=white

H1Add a Message/H1

!-- Let them know that they have to fill in all the blanks --
? if ($notall == 1) { ?
PFONT COLOR=redPlease answer all fields/FONT/P
? } ?

!-- The bits of PHP in the form allow the data that was already input
 to be placed back in the form if it is filled out incompletely --

FORM METHOD=post ACTION=guest.php
PRE
Your Name:   INPUT
  TYPE=text
  NAME=name
  SIZE=20
  MAXLENGTH=50
  VALUE=? echo $name; ?
Your Email:  INPUT
  TYPE=text
  NAME=email
  SIZE=20
  MAXLENGTH=50
  VALUE=? echo $email; ?

Enter Message:
TEXTAREA NAME=message COLS=40 ROWS=8 WRAP=Virtual
? echo $message; ?
/TEXTAREA

INPUT TYPE=submit VALUE=Add

/PRE
/FORM

HR

?


// This is where we connect to the database for reading.

mysql_pconnect(ol.freeshell.org,weiwang,password)
   or die(Unable to connect to SQL server);
mysql_select_db(weiwang) or die(Unable to select database);


// This is where we count the number of entries.

$query = SELECT COUNT(*) FROM guests;
$numguests = mysql_query($query) or die(Select Failed!);
$numguest = mysql_fetch_array($numguests);

?

!--  This is where we report the total messages. --
P
A HREF=guest.php?complete=1? echo $numguest[0]; ? people/A have
left me a message.
/P

?


// This is where we decide to get all the entries or just the last 20.
// This variable is set by just adding a '?complete=1' after the URL.

if ($complete == 1) {
  $query = SELECT * FROM guests ORDER BY guest_time DESC;
} else {
  $query = SELECT * FROM guests ORDER BY guest_time DESC LIMIT 20;
}
$guests = 

[PHP] more details about previous email

2003-09-14 Thread Wei Wang
Hi, all, 

I'm a total newbie to php and just couldn't make the following php file(grabbed at 
awtrey.com, basic php/mysql code) running at http://weiwang.freeshell.org/guest.php
I guess I didn't elaborate what the problem was. The idea of the program was simply a 
guest message list. And when all
3 text fields get input and Add is clicked, one entry should be put into the table 
guests and displayed at the bottom of the page. Now the problem is no record is 
inserted at all. And neither of the die() comes out. What is the problem?
I've read some php tutorials but I think I must've missed a very fundamental point 
that led to the failure of this code. 
I'd highly appreciate it if anyone could drop me a line with any advice. 


Many thanks,

Wei Wang

?
/*
PHP Guestbook 1.1
Written by Tony Awtrey
Anthony Awtrey Consulting
See http://www.awtrey.com/support/dbeweb/ for more information

1.1 - Oct. 20, 1999 - changed the SQL statement that reads data
  back out of the database to reverse the order putting the
  newest entries at the top and limiting the total displayed
  by default to 20. Added the ability to get the complete list
  by appending the URL with '?complete=1'. Added the code and
  additional query to count and list the total number of entries
  and included a link to the complete list.
1.0 - Initial release

This is the SQL statement to create the database required for
this application.

CREATE TABLE guests (
  guest_id
int(4)
unsigned
zerofill
DEFAULT ''
NOT NULL
auto_increment,
  guest_name varchar(50),
  guest_email varchar(50),
  guest_time timestamp(14),
  guest_message text,
  PRIMARY KEY (guest_id)
);

*/


// This checks to see if we need to add another guestbook entry.

if (($REQUEST_METHOD=='POST')) {


// This loop removed dangerous characters from the posted data
// and puts backslashes in front of characters that might cause
// problems in the database.

  for(reset($HTTP_POST_VARS);
$key=key($HTTP_POST_VARS);
next($HTTP_POST_VARS)) {
$this = addslashes($HTTP_POST_VARS[$key]);
$this = strtr($this, ,  );
$this = strtr($this, ,  );
$this = strtr($this, |,  );
$$key = $this;
  }
  
  
  // This will catch if someone is trying to submit a blank
  // or incomplete form.
  
  if ($name  $email  $message ) {


// This is the meat of the query that updates the guests table

$query = INSERT INTO guests ;
$query .= (guest_id, guest_name, ;
$query .= guest_email, guest_time, guest_message) ;
$query .= values(,'$name','$email',NULL,'$message');
mysql_pconnect(ol.freeshell.org,weiwang,password)
   or die(Unable to connect to SQL server);
mysql_select_db(weiwang) or die(Unable to select database);
mysql_query($query) or die(Insert Failed!);
 echo pHello World/p;
 //die(after query);
  } else {


// If they didn't include all the required fields set a variable
// and keep going.

$notall = 1;

  }
}
?
!-- Start Page --
HTML
HEAD
TITLEAdd A Message/TITLE
/HEAD

BODY BGCOLOR=white

H1Add a Message/H1

!-- Let them know that they have to fill in all the blanks --
? if ($notall == 1) { ?
PFONT COLOR=redPlease answer all fields/FONT/P
? } ?

!-- The bits of PHP in the form allow the data that was already input
 to be placed back in the form if it is filled out incompletely --

FORM METHOD=post ACTION=guest.php
PRE
Your Name:   INPUT
  TYPE=text
  NAME=name
  SIZE=20
  MAXLENGTH=50
  VALUE=? echo $name; ?
Your Email:  INPUT
  TYPE=text
  NAME=email
  SIZE=20
  MAXLENGTH=50
  VALUE=? echo $email; ?

Enter Message:
TEXTAREA NAME=message COLS=40 ROWS=8 WRAP=Virtual
? echo $message; ?
/TEXTAREA

INPUT TYPE=submit VALUE=Add

/PRE
/FORM

HR

?


// This is where we connect to the database for reading.

mysql_pconnect(ol.freeshell.org,weiwang,password)
   or die(Unable to connect to SQL server);
mysql_select_db(weiwang) or die(Unable to select database);


// This is where we count the number of entries.

$query = SELECT COUNT(*) FROM guests;
$numguests = mysql_query($query) or die(Select Failed!);
$numguest = mysql_fetch_array($numguests);

?

!--  This is where we report the total messages. --
P
A HREF=guest.php?complete=1? echo $numguest[0]; ? people/A have
left me a message.
/P

?


RE: [PHP] Program works only when there are records :-(

2003-09-14 Thread esctoday.com | Wouter van Vliet
Start by giving us the value of $tt, ... That'll probably tell more about
the problem. Or you can do something like this:

if ($res = mysql_query($tt)) {
$num_rows = mysql_num_rows($res); //This is line 25
$x=1;

for($i=0; $i5; $i++) {
$a = mysql_result($res, $i); //This is line 30
$bb[$x]=$a;
$x++;
}
} else {
print sorry, no results found;
};

Also, for:
=
for($i=0; $i5; $i++) {
$a = mysql_result($res, $i); //This is line 30
=

I'd suggest: while($a = mysql_fetch_array($res)) { 

Wouter


-Original Message-
From: Ryan A [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 14, 2003 11:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Program works only when there are records :-(

Hi,
I have a select statment with a UNION so that i am getting 5 COUNT(*)'s from
a table.

After that I have this code:
*
$res = mysql_query($tt);
$num_rows = mysql_num_rows($res); //This is line 25
$x=1;

for($i=0; $i5; $i++)
{
$a = mysql_result($res, $i); //This is line 30
$bb[$x]=$a;
$x++;
}

$one = $bb[1];
$two = $bb[2];
$thr = $bb[3];
$fou = $bb[4];
$fiv = $bb[5];

$tot=$one + $two + $thr + $fou + $fiv;
*

When i have some records in the database this works fine and i get all the
values  in $one,$two etc but when a new account is created and i the
COUNT(*) gets back just 0 I get these ugly errors/warnings on my page:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 25

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30



What should i do and wheres the problem? I searched on google but just found
some sites outputting this, no real help.
Totally confused, please help.

Thanks,
-Ryan

-- 
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: Calling functions from Button actions

2003-09-14 Thread Daniel Souza
I dont use it. Its just an example.
Thanks anyway.

Daniel

Marek Kilimajer [EMAIL PROTECTED] escreveu na mensagem
news:[EMAIL PROTECTED]
 I hope you don't use this method. It is VERY unsafe. You execute ANY
 function that the user tells you.

 Daniel Souza wrote:
  ?
 function func1()
 {
 }
 function func2()
 {
 }
 function func3()
 {
 }
 function func4()
 {
 }
 function func5()
 {
 }
 
 if (isset($_REQUEST['funcs']))
foreach ($_REQUEST['funcs'] as $key=$val)
   if (function_exists($key))
  $key();
  ?
  hr
  form method=POST
  input type=submit name=funcs[func1] value=Execute Function 1br
  input type=submit name=funcs[func2] value=Execute Function 2br
  input type=submit name=funcs[func3] value=Execute Function 3br
  input type=submit name=funcs[func4] value=Execute Function 4br
  input type=submit name=funcs[func5] value=Execute Function 5br
  /form
 

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



Re: [PHP] Program works only when there are records :-(

2003-09-14 Thread Ryan A
Hey,
Thanks for replying.

sorry, i thought i explained what $tt was, but here it is in program code if
you want to be clear on it.

$tt = SELECT  COUNT(*), 'Count1' FROM shared WHERE user ='.$mmmy_user.'
and  ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count2' FROM dedicated
WHERE user='.$mmmy_user.' and  ccno=.$mmmy_ccno. UNION SELECT  COUNT(*),
'Count3' FROM reseller WHERE user ='.$mmmy_user.' and  ccno=.$mmmy_ccno.
UNION SELECT COUNT(*), 'Count4' FROM colocated WHERE user ='.$mmmy_user.'
and  ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count5' FROM freehosting
WHERE user ='.$mmmy_user.' and  ccno=.$mmmy_ccno;

I'll try those things you outlined till then.

Cheers,
-Ryan


 Start by giving us the value of $tt, ... That'll probably tell more about
 the problem. Or you can do something like this:

 if ($res = mysql_query($tt)) {
 $num_rows = mysql_num_rows($res); //This is line 25
 $x=1;

 for($i=0; $i5; $i++) {
 $a = mysql_result($res, $i); //This is line 30
 $bb[$x]=$a;
 $x++;
 }
 } else {
 print sorry, no results found;
 };

 Also, for:
 =
 for($i=0; $i5; $i++) {
 $a = mysql_result($res, $i); //This is line 30
 =

 I'd suggest: while($a = mysql_fetch_array($res)) {

 Wouter


 -Original Message-
 From: Ryan A [mailto:[EMAIL PROTECTED]
 Sent: Sunday, September 14, 2003 11:45 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Program works only when there are records :-(

 Hi,
 I have a select statment with a UNION so that i am getting 5 COUNT(*)'s
from
 a table.

 After that I have this code:
 *
 $res = mysql_query($tt);
 $num_rows = mysql_num_rows($res); //This is line 25
 $x=1;

 for($i=0; $i5; $i++)
 {
 $a = mysql_result($res, $i); //This is line 30
 $bb[$x]=$a;
 $x++;
 }

 $one = $bb[1];
 $two = $bb[2];
 $thr = $bb[3];
 $fou = $bb[4];
 $fiv = $bb[5];

 $tot=$one + $two + $thr + $fou + $fiv;
 *

 When i have some records in the database this works fine and i get all the
 values  in $one,$two etc but when a new account is created and i the
 COUNT(*) gets back just 0 I get these ugly errors/warnings on my page:

 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 25

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30



 What should i do and wheres the problem? I searched on google but just
found
 some sites outputting this, no real help.
 Totally confused, please help.

 Thanks,
 -Ryan

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



[PHP] space sensitive?

2003-09-14 Thread Stevie D Peele
Is PHP space sensitive??


The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!

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



RE: [PHP] Program works only when there are records :-(

2003-09-14 Thread esctoday.com | Wouter van Vliet
This looks like a pretty decent query to me... To figure out more about the
errors mysql is producing, you can try to put a 

print mysql_error();

After ever call to a mysql function .. From there you should be able to
learn more about the errors, and if not: don't bother posting what
mysql_error() produces. Ow, and one question: does it give the errors if
there's no rows in any table, or also if there's no rows in one of the
tables? And in the second option, does it give you the errors less often?

Wouter

-Original Message-
From: Ryan A [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 15, 2003 12:49 AM
To: esctoday.com | Wouter van Vliet
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Program works only when there are records :-(

Hey,
Thanks for replying.

sorry, i thought i explained what $tt was, but here it is in program code if
you want to be clear on it.

$tt = SELECT  COUNT(*), 'Count1' FROM shared WHERE user ='.$mmmy_user.'
and  ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count2' FROM dedicated
WHERE user='.$mmmy_user.' and  ccno=.$mmmy_ccno. UNION SELECT  COUNT(*),
'Count3' FROM reseller WHERE user ='.$mmmy_user.' and  ccno=.$mmmy_ccno.
UNION SELECT COUNT(*), 'Count4' FROM colocated WHERE user ='.$mmmy_user.'
and  ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count5' FROM freehosting
WHERE user ='.$mmmy_user.' and  ccno=.$mmmy_ccno;

I'll try those things you outlined till then.

Cheers,
-Ryan


 Start by giving us the value of $tt, ... That'll probably tell more about
 the problem. Or you can do something like this:

 if ($res = mysql_query($tt)) {
 $num_rows = mysql_num_rows($res); //This is line 25
 $x=1;

 for($i=0; $i5; $i++) {
 $a = mysql_result($res, $i); //This is line 30
 $bb[$x]=$a;
 $x++;
 }
 } else {
 print sorry, no results found;
 };

 Also, for:
 =
 for($i=0; $i5; $i++) {
 $a = mysql_result($res, $i); //This is line 30
 =

 I'd suggest: while($a = mysql_fetch_array($res)) {

 Wouter


 -Original Message-
 From: Ryan A [mailto:[EMAIL PROTECTED]
 Sent: Sunday, September 14, 2003 11:45 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Program works only when there are records :-(

 Hi,
 I have a select statment with a UNION so that i am getting 5 COUNT(*)'s
from
 a table.

 After that I have this code:
 *
 $res = mysql_query($tt);
 $num_rows = mysql_num_rows($res); //This is line 25
 $x=1;

 for($i=0; $i5; $i++)
 {
 $a = mysql_result($res, $i); //This is line 30
 $bb[$x]=$a;
 $x++;
 }

 $one = $bb[1];
 $two = $bb[2];
 $thr = $bb[3];
 $fou = $bb[4];
 $fiv = $bb[5];

 $tot=$one + $two + $thr + $fou + $fiv;
 *

 When i have some records in the database this works fine and i get all the
 values  in $one,$two etc but when a new account is created and i the
 COUNT(*) gets back just 0 I get these ugly errors/warnings on my page:

 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 25

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30

 Warning: mysql_result(): supplied argument is not a valid MySQL result
 resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line 30



 What should i do and wheres the problem? I searched on google but just
found
 some sites outputting this, no real help.
 Totally confused, please help.

 Thanks,
 -Ryan

 -- 
 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] space sensitive?

2003-09-14 Thread John W. Holmes
Stevie D Peele wrote:

Is PHP space sensitive??
PHP is very sensitive about it's space. Don't go into it's personal 
space otherwise you can upset it and cause it to cry.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] Program works only when there are records :-(

2003-09-14 Thread Ryan A
Hey,
Thanks for replying.

 This looks like a pretty decent query to me...

Thanks.

I took your advise and put a couple of print mysql_error(); and got 8 of
the same error...
*
You have an error in your SQL syntax near 'UNION SELECT COUNT(*), 'Count2'
FROM dedicated where user='testing' and' at line 1


But i have checked the SQL over and againanybody see something wrong?

Ow, and one question: does it give the errors if
 there's no rows in any table, or also if there's no rows in one of the
 tables? And in the second option, does it give you the errors less often?

Just ran a couple of tests, its giving the same output even if the table has
records!
Cant understand it.

Been working 9 straight hours today and i think i screwed up somewhere with
this code with all the modifications i have been doing.

Tell me if you spot anything, am posting the sql again below.

Cheers,
-Ryan


$tt = SELECT  COUNT(*), 'Count1' FROM shared WHERE user ='.$mmmy_user.'
and  ccno=.$mmmy_ccno.
UNION
SELECT COUNT(*), 'Count2' FROM dedicated
WHERE user='.$mmmy_user.' and  ccno=.$mmmy_ccno.
UNION
SELECT  COUNT(*),
'Count3' FROM reseller WHERE user ='.$mmmy_user.' and  ccno=.$mmmy_ccno.
UNION
SELECT COUNT(*), 'Count4' FROM colocated WHERE user ='.$mmmy_user.'
and  ccno=.$mmmy_ccno.
UNION
SELECT COUNT(*), 'Count5' FROM freehosting
WHERE user ='.$mmmy_user.' and  ccno=.$mmmy_ccno;

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



Re: [PHP] space sensitive?

2003-09-14 Thread Ryan A
To get a good healthy php you have to walk it more than a java or C etc, if
you live next to a park or a compound it would be fantatic but they have
known to be healthy even if raised in a small apartment.

-Ryan


We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com


- Original Message - 
From: John W. Holmes [EMAIL PROTECTED]
To: Stevie D Peele [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 1:13 AM
Subject: Re: [PHP] space sensitive?


 Stevie D Peele wrote:

  Is PHP space sensitive??

 PHP is very sensitive about it's space. Don't go into it's personal
 space otherwise you can upset it and cause it to cry.

 -- 
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 php|architect: The Magazine for PHP Professionals  www.phparch.com

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


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



Re: [PHP] Re: HTTP_REFERER

2003-09-14 Thread Louie Miranda
SCRIPT_FILENAME, sorry but i didnt get this part.


- Original Message - 
From: Eugene Lee [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 12, 2003 4:51 PM
Subject: Re: [PHP] Re: HTTP_REFERER


 On Fri, Sep 12, 2003 at 04:21:16PM +0800, Louie Miranda wrote:
 : Eugene Lee mentioned:
 :  On Fri, Sep 12, 2003 at 03:53:22PM +0800, Louie Miranda wrote:
 :  : Eugene Lee mentioned:
 :  : 
 :  :  Several Windoze firewalls also filter out HTTP_REFERER.
 :  :
 :  : what can you suggest, im trying to do a referer email program on a
 :  : website and i think HTTP_REFERER will be my first approach, but
 :  : limited on some browsers and firewall.
 : 
 :  It depends on what exactly you are trying to accomplish.
 : 
 : no, im making a send this page to a friend program
 : when the users click the button a small pop-up window will come out
 : and the http_referer will work and catch the previous page.
 
 Since it's a button, you could always send the SCRIPT_FILENAME to the
 pop-up window via a GET or POST method.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



[PHP] How are variables called in current php?

2003-09-14 Thread Wei Wang
hi, all,

I have a piece of code stuck at the point of if (($REQUEST_METHOD=='post')). 
var_dump($REQUEST_METHOD); shows that the variable doesn't exist. 
Since I grabbed the code from a 2001 update, is there any chance that this is already 
obsolete? I checked the documentation but didn't find anything relevant.
Any advice would be highly appreciated. ;-)



The following is the complete code that I got stuck at


if (($REQUEST_METHOD=='post')) {


// This loop removed dangerous characters from the posted data
// and puts backslashes in front of characters that might cause
// problems in the database.

  for(reset($HTTP_POST_VARS);
$key=key($HTTP_POST_VARS);
next($HTTP_POST_VARS)) {
$this = addslashes($HTTP_POST_VARS[$key]);
$this = strtr($this, ,  );
$this = strtr($this, ,  );
$this = strtr($this, |,  );
$$key = $this;
  }
else
{ print ('Boo, I never got executed'); }//apparently the script never make it to this 
point

And add appriopriate
   assigments at the top of your script.

[PHP] (Conclusion) Re: [PHP] Program works only when there are records :-(

2003-09-14 Thread Ryan A
Its a version problem, UNION was not implempted till V4, and my host has
V3.23
Anybody know of a work around with my code? I have found some work arounds
on google but its too advanced for me...i dont really understand left joins,
right joins etc

Cheers,
-Ryan


We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com


- Original Message - 
From: esctoday.com | Wouter van Vliet [EMAIL PROTECTED]
To: 'Ryan A' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 1:09 AM
Subject: RE: [PHP] Program works only when there are records :-(


 This looks like a pretty decent query to me... To figure out more about
the
 errors mysql is producing, you can try to put a

 print mysql_error();

 After ever call to a mysql function .. From there you should be able to
 learn more about the errors, and if not: don't bother posting what
 mysql_error() produces. Ow, and one question: does it give the errors if
 there's no rows in any table, or also if there's no rows in one of the
 tables? And in the second option, does it give you the errors less often?

 Wouter

 -Original Message-
 From: Ryan A [mailto:[EMAIL PROTECTED]
 Sent: Monday, September 15, 2003 12:49 AM
 To: esctoday.com | Wouter van Vliet
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Program works only when there are records :-(

 Hey,
 Thanks for replying.

 sorry, i thought i explained what $tt was, but here it is in program code
if
 you want to be clear on it.

 $tt = SELECT  COUNT(*), 'Count1' FROM shared WHERE user ='.$mmmy_user.'
 and  ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count2' FROM dedicated
 WHERE user='.$mmmy_user.' and  ccno=.$mmmy_ccno. UNION SELECT
COUNT(*),
 'Count3' FROM reseller WHERE user ='.$mmmy_user.' and
ccno=.$mmmy_ccno.
 UNION SELECT COUNT(*), 'Count4' FROM colocated WHERE user
='.$mmmy_user.'
 and  ccno=.$mmmy_ccno. UNION SELECT COUNT(*), 'Count5' FROM freehosting
 WHERE user ='.$mmmy_user.' and  ccno=.$mmmy_ccno;

 I'll try those things you outlined till then.

 Cheers,
 -Ryan


  Start by giving us the value of $tt, ... That'll probably tell more
about
  the problem. Or you can do something like this:
 
  if ($res = mysql_query($tt)) {
  $num_rows = mysql_num_rows($res); //This is line 25
  $x=1;
 
  for($i=0; $i5; $i++) {
  $a = mysql_result($res, $i); //This is line 30
  $bb[$x]=$a;
  $x++;
  }
  } else {
  print sorry, no results found;
  };
 
  Also, for:
  =
  for($i=0; $i5; $i++) {
  $a = mysql_result($res, $i); //This is line 30
  =
 
  I'd suggest: while($a = mysql_fetch_array($res)) {
 
  Wouter
 
 
  -Original Message-
  From: Ryan A [mailto:[EMAIL PROTECTED]
  Sent: Sunday, September 14, 2003 11:45 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Program works only when there are records :-(
 
  Hi,
  I have a select statment with a UNION so that i am getting 5 COUNT(*)'s
 from
  a table.
 
  After that I have this code:
  *
  $res = mysql_query($tt);
  $num_rows = mysql_num_rows($res); //This is line 25
  $x=1;
 
  for($i=0; $i5; $i++)
  {
  $a = mysql_result($res, $i); //This is line 30
  $bb[$x]=$a;
  $x++;
  }
 
  $one = $bb[1];
  $two = $bb[2];
  $thr = $bb[3];
  $fou = $bb[4];
  $fiv = $bb[5];
 
  $tot=$one + $two + $thr + $fou + $fiv;
  *
 
  When i have some records in the database this works fine and i get all
the
  values  in $one,$two etc but when a new account is created and i the
  COUNT(*) gets back just 0 I get these ugly errors/warnings on my page:
 
  Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
  resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line
25
 
  Warning: mysql_result(): supplied argument is not a valid MySQL result
  resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line
30
 
  Warning: mysql_result(): supplied argument is not a valid MySQL result
  resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line
30
 
  Warning: mysql_result(): supplied argument is not a valid MySQL result
  resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line
30
 
  Warning: mysql_result(): supplied argument is not a valid MySQL result
  resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line
30
 
  Warning: mysql_result(): supplied argument is not a valid MySQL result
  resource in /usr163/home/b/e/bestweb/public_html/co.details.php on line
30
 
 
 
  What should i do and wheres the problem? I searched on google but just
 found
  some sites outputting this, no real help.
  Totally confused, please help.
 
  Thanks,
  -Ryan
 
  -- 
  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



[PHP] php generate thumbnails

2003-09-14 Thread Russell Conder
Sir, I read in a thread that you mailed some code to generate thumbnails
Might I also have a copy ?
It's been driving me crazy, all week.
Thanks 
Cheers
Russell



 This e-mail message contains information which is legally privileged
 and/or confidential.  If you are not the intended recipient,
 you are notified that any unauthorised disclosure, copying, distribution
http://www.waiheke.co.nz
http://www.accommodationinnewzealand.co.nz
http://www.zealand.org.nz

 or use of this information is strictly prohibited. If you
 have received this message in error please notify us by return e-mail.
 Telephone 09 372 9287 Fax 09 372 8082 email as above

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



[PHP] XML Reading, Writing

2003-09-14 Thread Jeff Fitzgerald
	I need to use PHP to read, modify and write xml files. I have seen 
something called expat which I am having trouble installing. Is that the 
only way to do this? Any help greatly appeciated...
	

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


[PHP] htmlentities -- can it skip tags

2003-09-14 Thread Justin French
Hi all,

I need to convert some text from a database for presentation on 
screen... as per usual, characters like quotes and ampersands () are 
giving me grief.  the obvious answer is to apply htmlspecialchars(), 
BUT this also converts all  and  into lt; and gt; signs, which 
destroys the html mark-up within the text.

Is there a non-tag equivalent of htmlspecialchars(), or do I need to 
build one?

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


Re: [PHP] htmlentities -- can it skip tags

2003-09-14 Thread John W. Holmes
Justin French wrote:

Hi all,

I need to convert some text from a database for presentation on 
screen... as per usual, characters like quotes and ampersands () are 
giving me grief.  the obvious answer is to apply htmlspecialchars(), BUT 
this also converts all  and  into lt; and gt; signs, which destroys 
the html mark-up within the text.

Is there a non-tag equivalent of htmlspecialchars(), or do I need to 
build one?
You'll have to build one.

If you know what characters are causing trouble, you could just use 
str_replace on them. Or you could use htmlspecialchars() and then run 
str_replace to convert lt; and gt; back into brackets.

You could also use get_html_translation_table() to get the conversions, 
remove the  and  conversion elements of the array and then use strtr() 
to do the conversion.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] How are variables called in current php?

2003-09-14 Thread Jason Sheets
Looks like that code depends on register globals being enabled which 
have been off for some time.  You can either turn register globals on in 
php.ini (not recommended) or with an .htaccess file (better than using 
php.ini not as good as changing the code if that is possible).

Information about all three of these is available at 
http://www.php.net/manual/en

If you own the code you can use $_SERVER['REQUEST_METHOD'].

Jason

Wei Wang wrote:

hi, all,

I have a piece of code stuck at the point of if (($REQUEST_METHOD=='post')). var_dump($REQUEST_METHOD); shows that the variable doesn't exist. 
Since I grabbed the code from a 2001 update, is there any chance that this is already obsolete? I checked the documentation but didn't find anything relevant.
Any advice would be highly appreciated. ;-)



The following is the complete code that I got stuck at

if (($REQUEST_METHOD=='post')) {


// This loop removed dangerous characters from the posted data
// and puts backslashes in front of characters that might cause
// problems in the database.

 for(reset($HTTP_POST_VARS);
   $key=key($HTTP_POST_VARS);
   next($HTTP_POST_VARS)) {
   $this = addslashes($HTTP_POST_VARS[$key]);
   $this = strtr($this, ,  );
   $this = strtr($this, ,  );
   $this = strtr($this, |,  );
   $$key = $this;
 }
else
{ print ('Boo, I never got executed'); }//apparently the script never make it to this 
point
And add appriopriate
  assigments at the top of your script.
 

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


[PHP] User Access

2003-09-14 Thread Ryan Stagg
How would one go about allowing editable access to only the entry creator

For example:
If I added an entry to the site and only wanted myself to be able to edit /
delete it, likewise with other users how would I go about setting this up in
DW MX on PHP4 and mysql??

Cheers

Ryan

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



[PHP] Branching to a page

2003-09-14 Thread Todd Cary
Back in the earlier days of PHP, pages were not cached so I developed a 
method of branching to a page by opening a new socket.  Since it has 
worked over the years in quite a variety of applications, I have not 
changed...but maybe I should.  Are there any glaring deficiencies with 
doing this:

 // Verify the Session ID
 if ($session_id) {
 ...
 } else {
   bounce_post($server, $path, $url, abort.php, );
   exit;
 }
Where bounce is defined as

 function bounce_post($server, $path, $url, $page, $info) {
   $http = new http;
   $fp = $http-http_fpost($server, $path . $page, $info);
   if($fp) {
 print 'BASE HREF=' . $url . $page . 'p';
 fpassthru($fp);
   };
 }
Todd

--

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


Re: [PHP] User Access

2003-09-14 Thread Raditha Dissanayake
Sorry but your problem isn't very clear.

If you are talking of dreamweaver problem you are better off using their 
support forums. Or are you talking about a wiki site?

Ryan Stagg wrote:

How would one go about allowing editable access to only the entry creator

For example:
If I added an entry to the site and only wanted myself to be able to edit /
delete it, likewise with other users how would I go about setting this up in
DW MX on PHP4 and mysql??
Cheers

Ryan

 



--
http://www.radinks.com/upload
Drag and Drop File Uploader.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How are variables called in current php?

2003-09-14 Thread Raditha Dissanayake
Wei Wang wrote:

hi, all,

I have a piece of code stuck at the point of if (($REQUEST_METHOD=='post')). var_dump($REQUEST_METHOD); shows that the variable 

should be $REQUEST_METHOD == 'POST'
why don't you just use the $_REQUEST array instead?


--
http://www.radinks.com/upload
Drag and Drop File Uploader.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] User Access

2003-09-14 Thread Ryan Stagg
No it's not a Dreamweaver problem

I have a site where users can insert data via a PHP form, I want to be able
to set up a system where the user can login and edit their entries only, in
other words they cant edit another users data.

Ryan


Raditha Dissanayake [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Sorry but your problem isn't very clear.

 If you are talking of dreamweaver problem you are better off using their
 support forums. Or are you talking about a wiki site?


 Ryan Stagg wrote:

 How would one go about allowing editable access to only the entry creator
 
 For example:
 If I added an entry to the site and only wanted myself to be able to edit
/
 delete it, likewise with other users how would I go about setting this up
in
 DW MX on PHP4 and mysql??
 
 Cheers
 
 Ryan
 
 
 


 -- 
 http://www.radinks.com/upload
 Drag and Drop File Uploader.

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



Re: [PHP] more details about previous email

2003-09-14 Thread Raditha Dissanayake
Wei Wang wrote:
if you are asking questions about specific scripts you will always be
better off in the message boards / mailings lists maintained by the
script owner.
However i will hazard a guess that you have not created the tables in
the db.

CREATE TABLE guests (
  guest_id
int(4)
unsigned
zerofill
DEFAULT ''
NOT NULL
auto_increment,
  guest_name varchar(50),
  guest_email varchar(50),
  guest_time timestamp(14),
  guest_message text,
  PRIMARY KEY (guest_id)
);

  


-- 
http://www.radinks.com/upload
Drag and Drop File Uploader.

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



Re: [PHP] XML Reading, Writing

2003-09-14 Thread Raditha Dissanayake
Hi,

The php xml modules are installed by default with recent versions of 
php. This requires that you have libexpat on your machine. They are 
available on most linux distributions cds. If you are on windows you can 
dwonload from the site (forgotton the url)

From the type of questions you have asked i get the impression that 
youa re total newby to xml. Please head off the w3c.org you will find 
the specs there. You will find some good tutorials at w3schools.com

all the best

ps:
The next time you ask a question you might want to start a new thread 
instead of replying to an exisiting message.



Jeff Fitzgerald wrote:

I need to use PHP to read, modify and write xml files. I have seen 
something called expat which I am having trouble installing. Is that 
the only way to do this? Any help greatly appeciated...




--
http://www.radinks.com/upload
Drag and Drop File Uploader.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] User Access

2003-09-14 Thread Raditha Dissanayake
Sounds like a wiki in it's simplest form. Please do a search for php 
wiki in sourceforge or hotscripts you will be able to find lots of 
scripts that let you achieve just this.

all the best

Ryan Stagg wrote:

No it's not a Dreamweaver problem

I have a site where users can insert data via a PHP form, I want to be able
to set up a system where the user can login and edit their entries only, in
other words they cant edit another users data.
Ryan

Raditha Dissanayake [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

Sorry but your problem isn't very clear.

If you are talking of dreamweaver problem you are better off using their
support forums. Or are you talking about a wiki site?
Ryan Stagg wrote:

   

How would one go about allowing editable access to only the entry creator

For example:
If I added an entry to the site and only wanted myself to be able to edit
 

/
 

delete it, likewise with other users how would I go about setting this up
 

in
 

DW MX on PHP4 and mysql??

Cheers

Ryan



 

--
http://www.radinks.com/upload
Drag and Drop File Uploader.
   

 



--
http://www.radinks.com/upload
Drag and Drop File Uploader.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] htmlentities -- can it skip tags

2003-09-14 Thread Justin French
On Monday, September 15, 2003, at 12:58  PM, John W. Holmes wrote:

Justin French wrote:

Hi all,
I need to convert some text from a database for presentation on 
screen... as per usual, characters like quotes and ampersands () are 
giving me grief.  the obvious answer is to apply htmlspecialchars(), 
BUT this also converts all  and  into lt; and gt; signs, which 
destroys the html mark-up within the text.
Is there a non-tag equivalent of htmlspecialchars(), or do I need to 
build one?
You'll have to build one.

If you know what characters are causing trouble, you could just use 
str_replace on them. Or you could use htmlspecialchars() and then run 
str_replace to convert lt; and gt; back into brackets.
Which is what I just did as a 'patch' :)


You could also use get_html_translation_table() to get the 
conversions, remove the  and  conversion elements of the array and 
then use strtr() to do the conversion.
I like that idea a LOT.

Thanks John!

Justin

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


Re: [PHP] htmlentities -- can it skip tags

2003-09-14 Thread Justin French
On Monday, September 15, 2003, at 12:58  PM, John W. Holmes wrote:

Justin French wrote:

Hi all,
I need to convert some text from a database for presentation on 
screen... as per usual, characters like quotes and ampersands () are 
giving me grief.  the obvious answer is to apply htmlspecialchars(), 
BUT this also converts all  and  into lt; and gt; signs, which 
destroys the html mark-up within the text.
Is there a non-tag equivalent of htmlspecialchars(), or do I need to 
build one?
You'll have to build one.

If you know what characters are causing trouble, you could just use 
str_replace on them. Or you could use htmlspecialchars() and then run 
str_replace to convert lt; and gt; back into brackets.
Which is what I just did as a 'patch' :)


You could also use get_html_translation_table() to get the 
conversions, remove the  and  conversion elements of the array and 
then use strtr() to do the conversion.
I like that idea a LOT.

Thanks John!

Justin

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


Re: [PHP] (Conclusion) Re: [PHP] Program works only when there are records :-(

2003-09-14 Thread Eugene Lee
On Mon, Sep 15, 2003 at 02:15:56AM +0200, Ryan A wrote:
: 
: Its a version problem, UNION was not implempted till V4, and my host has
: V3.23
: Anybody know of a work around with my code? I have found some work arounds
: on google but its too advanced for me...i dont really understand left joins,
: right joins etc

The user notes in the MySQL documentation includes some suggestions that
work around UNION-less MySQL 3.x systems.

http://www.mysql.com/doc/en/UNION.html

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



Re: [PHP] Re: HTTP_REFERER

2003-09-14 Thread Eugene Lee
On Mon, Sep 15, 2003 at 07:58:25AM +0800, Louie Miranda wrote:
: Eugene Lee mentioned:
:  On Fri, Sep 12, 2003 at 04:21:16PM +0800, Louie Miranda wrote:
:  : Eugene Lee mentioned:
:  :  On Fri, Sep 12, 2003 at 03:53:22PM +0800, Louie Miranda wrote:
:  :  : Eugene Lee mentioned:
:  :  : 
:  :  :  Several Windoze firewalls also filter out HTTP_REFERER.
:  :  :
:  :  : what can you suggest, im trying to do a referer email program on a
:  :  : website and i think HTTP_REFERER will be my first approach, but
:  :  : limited on some browsers and firewall.
:  : 
:  :  It depends on what exactly you are trying to accomplish.
:  : 
:  : no, im making a send this page to a friend program
:  : when the users click the button a small pop-up window will come out
:  : and the http_referer will work and catch the previous page.
:  
:  Since it's a button, you could always send the SCRIPT_FILENAME to the
:  pop-up window via a GET or POST method.
:
: SCRIPT_FILENAME, sorry but i didnt get this part.

On URL A, $_SERVER['SCRIPT_FILENAME'] reports URL A.  And on that page,
if you click on a link that takes you to URL B, then in URL B you'll get
$_SERVER['HTTP_REFERER'] that also says URL A.

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



[PHP] Security of php_auth_pw ?

2003-09-14 Thread Neale Yates
Is anyone able to advise me on the security of the password when using
PHP authentication.  My specific concern is whether the password can be
intercepted between the browser and server when submitted.

thanks

Neale

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



[PHP] browser detector (php side)

2003-09-14 Thread Louie Miranda
Im looking for a browser detector and can redirect to a certain page if its
match something. So far phpsniff is the only thing i found.

But i didnt got it to work d redirection part.

any ideas?


-
Louie


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