[PHP] Unsubscribing

2002-12-06 Thread Van Andel, Robert
Anyone know how to unsubscribe from this list.  I have tried several different things 
including the unscribe field on the mailing list page and an unsubscribe command via 
email.

Robbert van Andel 





RE: [PHP] Sigh :)

2002-12-04 Thread Van Andel, Robert
One question that comes up is why are you putting the double quotes around the search 
string ready maria?  Should there be an entry in the database that includes the double 
quotes.  Right now that is what your sql statement is looking for.  So an entry like 
this

Are you ready maria?

Would not be found but an entry like

The book ready maria is great

Would return something.



Robbert van Andel 


-Original Message-
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 9:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Sigh :)


Hi,

Can someone take a look at this again, please?

http://news.php.net/article.php?group=php.generalarticle=126934

Your posts so far have proven fruitless. Thanks for trying. :) I do appreciate it.

I will try to answer everyone at the same time.

Someone mentionned it might be a problem with magic_quotes, but I didn't really follow.

http://news.php.net/article.php?group=php.generalarticle=126990

I did test what he suggested:

From John Holmes
 try this

Doesn't work. :) Thanks. I did try:

$sql = SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH 
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.$search.' IN 
BOOLEAN MODE) ORDER BY id asc;

It echos:

('\ready maria\' IN BOOLEAN MODE)

It should echo:

('ready maria' IN BOOLEAN MODE)

for it to work. But even if I add slashquotes, it won't do it.

--
could you get the error message with mysql_error() and post it here?

There is no error. I wish there was :) Thanks for trying.

Doesn't work - Resembles +ready +maria
hmm - how do you get your string ready maria?

input name=search

why '.$table.' and not '.$table.'
with what you've got now, I believe you are looking for table name.

Good idea. Done that. Doesn't change . :) Thanks.

also, use double quotes for start and end of variables as in:
$sql=select * from '.$table.' where var='some
value other than a number' ;

Doesn't work. :) Thanks.

John


-- 
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] max file size on uploading files

2002-11-27 Thread Van Andel, Robert
One problem may be your browser timing out before the end of the script.  Another may 
be (although I'm not 100% sure) is that the file excedes the max memory set aside by 
PHP.

Robbert van Andel 

-Original Message-
From: Nick Wilson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 10:03 AM
To: php-general
Subject: [PHP] max file size on uploading files


Hi all, 

I must be missunderstanding something here, I have this in an php 'upload
form':

input type=hidden name=MAX_FILE_SIZE value=10

So why won't it upload a 1.5MB file?

Many thanks

-- 
Nick Wilson //  www.tioka.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] ignoring client supplied session data

2002-11-27 Thread Van Andel, Robert
What I do on my pages is perhaps a convoluted way of doing it but it works.  I set a 
username and password session variables. Every time the page loads the script verifies 
the username and password are correct.  If not, they don't get to see the rest.  This, 
in my mind, pervents someone from supplying a key variable like 
$_session['logged_in'].  This way they have to know the username and password.

Robbert van Andel 


-Original Message-
From: Evan Nemerson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 12:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] ignoring client supplied session data


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'm setting up a site using sessions right now, and I was just wondering if 
there is a way to ignore anything from the client side- I want them to POST a 
username and password, from there all data should be handled on the server.

I'm already using the query string to avoid cookies, but I want to make sure 
that if the user _does_ have cookies on, any change in the data will be 
ignored by the server. Any suggestions?

Basically, I think it would be a lot more efficient for me to set a 
_SESSION['logged_in'] variable once than query the database for every page, 
but I don't know if it would be secure or not- I don't want someone setting 
the logged_in variable in their cookie, then getting full access to the 
site...


Thanks,
Evan


- -- 
If you would be a real seeker after truth, you must at least once in your life 
doubt, as far as possible, all things.

- -Rene Descartes
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE95S1W/rncFku1MdIRAqdUAJ478Q5xFn7vDDE7RFXUI1aQnaZWBACgmN55
VNdAnVIliDD6eNwRm3R2SMQ=
=61VE
-END PGP SIGNATURE-


-- 
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] ignoring client supplied session data

2002-11-27 Thread Van Andel, Robert
On the other hand, I use only one query, searching for the username.  I had 
experimented with other methods but did not find anything that I felt gave me great 
security.  Using a session variable that says the person is logged in can be placed 
into a query string therefore bypassing the authentication process

Robbert van Andel 

-Original Message-
From: Evan Nemerson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 12:59 PM
To: Van Andel, Robert; [EMAIL PROTECTED]
Subject: Re: [PHP] ignoring client supplied session data


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I was thinking about doing that, but I was hoping to avoid superfluous 
database queries. It is my fallback method, but i _really_ want to use 
sessions, but limit them to server-side modification.


On Wednesday 27 November 2002 12:51 pm, Van Andel, Robert wrote:
 What I do on my pages is perhaps a convoluted way of doing it but it works.
  I set a username and password session variables. Every time the page loads
 the script verifies the username and password are correct.  If not, they
 don't get to see the rest.  This, in my mind, pervents someone from
 supplying a key variable like $_session['logged_in'].  This way they have
 to know the username and password.

 Robbert van Andel


 -Original Message-
 From: Evan Nemerson [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 27, 2002 12:39 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] ignoring client supplied session data


 I'm setting up a site using sessions right now, and I was just wondering if
 there is a way to ignore anything from the client side- I want them to POST
 a username and password, from there all data should be handled on the
 server.

 I'm already using the query string to avoid cookies, but I want to make
 sure that if the user _does_ have cookies on, any change in the data will
 be ignored by the server. Any suggestions?

 Basically, I think it would be a lot more efficient for me to set a
 _SESSION['logged_in'] variable once than query the database for every page,
 but I don't know if it would be secure or not- I don't want someone setting
 the logged_in variable in their cookie, then getting full access to the
 site...


 Thanks,
 Evan

- -- 
If anyone can show me, and prove to me, that I am wrong in thought or deed, I 
will gladly change. I seek the truth, hich never yet hurt anybody. It is only 
persistence in delusion and ignorance which does harm.

- -Marcus Aurelius
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE95TIp/rncFku1MdIRAgGdAKCQCNMUL+OuTomXQH07zr6tjn7cUwCcDMrU
Ucup8rpk4c3jS2w+5Ej6yNo=
=el8E
-END PGP SIGNATURE-


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




RE: [PHP] ignoring client supplied session data

2002-11-27 Thread Van Andel, Robert
I will look into it.  I still consider my self a newbie in the process having picked 
up a book back in February and learning to do it.  I haven't gotten into using things 
like $_SESSION[] and similar with posting forms.  Thanks.

Robbert van Andel 
=== 
Network Operator 
NW Regional Operations Center 
Charter Communications 
ROC Phone: 866-311-6646 
Desk Phone: 360-828-6727 
email: DL NW ROC 
=== 


-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 1:28 PM
To: Van Andel, Robert
Cc: Evan Nemerson; [EMAIL PROTECTED]
Subject: RE: [PHP] ignoring client supplied session data


At 22:17 27.11.2002, Van Andel, Robert said:
[snip]
On the other hand, I use only one query, searching for the username.  I had 
experimented with other methods but did not find anything that I felt gave 
me great security.  Using a session variable that says the person is logged 
in can be placed into a query string therefore bypassing the authentication 
process
[snip] 

That's the main issue why register_globals is off by default since 4.2. If
you don't use register_globals, your $_SESSION array is safe from
intruders; only your script can set it from within your session. If any
malicious guy passes a query variable ?$_SESSION['authorized']=true, this
will only show up in the $_GET array, nowhere else. A print_r() of $_GET
with this query string gives:

$_GET = Array (
[$_SESSION] = Array (
['authorized'] = 1
)
) 

You might want to check out

http://www.php.net/manual/en/security.registerglobals.php

to read about the security issues involved. Basically having
register_globals set to on allows an arbitrary user to implant variables of
their choice into PHP, making any script more than unsafe. Having it
switched off allows YOU to control the data that you work with - an
absolute MUST unless you're begging for trouble, IMHO.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




RE: [PHP] decimal places

2002-11-26 Thread Van Andel, Robert

$amount = 17.9;
$dollars = $ . number_format($amount, 2);
echo $dollars;

you should see $17.90.
Robbert van Andel 


-Original Message-
From: Bryan Koschmann - GKT [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 11:29 AM
To: PHP General
Subject: [PHP] decimal places


Hello,

Does anyone here have a good way to make sure dollar amounts are formatted
properly? I have something that returns data, but the problem is it's
stored where any trailing zero isn't kept, like this:

$16.95 or $172.82 are fine

$17.90 or $190.20 come back as $17.9 and $190.2

I would like to make sure they are all properly formatted. Any ideas?

Thanks in advance,

Bryan


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





This email and any files transmitted with it are confidential and intended solely for 
the use of the individual or entity to whom they are addressed. If you have received 
this email in error please notify the system manager. This message contains 
confidential information and is intended only for the individual named. If you are not 
the named addressee you should not disseminate, distribute or copy this e-mail.

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




RE: [PHP] displaying record number in a cell in a table

2002-11-26 Thread Van Andel, Robert
$result = mysql_query(select * from [database table]);

echo table;

while($data = mysql_fetch_array($result))
{
$count++;
echo tr;
echo td$count/td;
echo td$data[0]/td;
echo td$data[1]/td;
...and so on
echo /tr;

}

echo /table;

This will give you a row number for each row.

Robbert van Andel 

-Original Message-
From: Peter Houchin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 4:49 PM
To: php_gen
Subject: [PHP] displaying record number in a cell in a table


howdy,

I've had a look around and haven't been able to find what I'm after..

What I'm trying to do is display the number of each individual record with
in a table in a db WITH OUT relying on the records id, here what I've come
up with so far:

//get and count the number of records in the table
$result = mysql_query(SELECT count(*) AS num FROM resellers);
$num = mysql_result($result,0,num);

//display the number of records
for ($i = 1; $i = $num; $i++) {?
tddiv align='center'
font class=content?//=$myrow['id']

print $i;?
/font
/div/td
?}

now this all works except that it displays 12345etc in every cell of the
html table when i need it to display as

1
2
3
4
5
etc

with each number on a new row in the html table ..

TIA  I hope i've made what am after clear enough...

Cheers

Peter
the only dumb question is the one that wasn't asked



-- 
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] testing for empty array

2002-11-26 Thread Van Andel, Robert
I believe if(empty($keywords)) or even if(!$keywords) will check if they are empty

Robbert van Andel 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 4:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] testing for empty array


I have an array $keywords, how do I test to see if it is empty?  $keywords == '' seems 
to throw out an error.


-- 
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] easy things - forms, variable sending

2002-11-22 Thread Van Andel, Robert
This can be done with JavaScript

input type=radio value=somevalue name=somename
onclick=this.form.submit()

I don't think there is a way to do it with PHP since PHP is a server side
application.

Robbert van Andel 


-Original Message-
From: Krzysztof Wozniak [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 2:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] easy things - forms, variable sending


Hi,
 
This is a trivial question - what function can I use to automatically
proceed to some link, one that can be executed without any user input.
 
How can we, most efficiently, send all the data (variables) from one
page to another?
 
Also, would you happen to know, as PHP is very often used in forms, how
to generate a radiobutton, which when clicked upon automatically
proceeds and does not need a Submit button? 
 
 Krzysztof Piotr Wozniak 
Cell: (001) 617 - 493 - 2294 ~~ Room: (001) 617 - 970 - 1359
  485 Dunster Mail Center ~ 02138 Cambridge, MA, USA
 ~~~  http://www.fas.harvard.edu/~kwozniak
www.fas.harvard.edu/~kwozniak ~~~
One Ring to rule them all, One Ring to find them, One Ring to bring them
all and in the darkness bind them
 


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] session trouble

2002-11-22 Thread Van Andel, Robert
Make sure that you have nothing before 

?PHP
session_register();
etc

You may also need to add session_start() but I'm not 100% sure on that.  I
generally do on all my applications that use sessions.

Robbert van Andel 

-Original Message-
From: empty [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 2:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] session trouble


hi guys ;

 I can't use session bla..as on my site.
PHP Code
?php
session_register();
if(isset($username)  isset($pass)){
if(login($username,$pass)){
$valid_user=$username;
session_start(valid_user);
do_html_url(/,Ana Sayfa);

}else{
echo(Teknik bir sorun nedeniyle giriþ iþleminiz
gerçekleþtirilemiyor. Lütfen Daha sonra tekrar deneyiniz3.);
}
}
else{
 ?
...
 
Warning: Cannot send session cache limiter - headers already sent (output
started at D:\sites\inc\register.inc:23) in D:\sites\uyelik\login.php on
line 90

I cant understand and solve the warning message, what is it?

thanks all.


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



 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] MY CLIENT

2002-11-21 Thread Van Andel, Robert
Perhaps its the moderator sending them out ;)  (This'll be my one and only
off topic post, I just couldn't resist).

Robbert van Andel 


-Original Message-
From: UberGoober [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 5:35 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] MY CLIENT


I've had some of my posts moderated away, how do these jokers sneak them in?


Troy May [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Sorry, I'm holding out for the 126 million.  :)



 -Original Message-
 From: GEORGE EMEKA [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 20, 2002 10:18 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] MY CLIENT
 Importance: High



 GOLDEN BUSINESS OPPORTUNITY
 I am an Attorney and close confidant of MRS. MARYAM
 ABACHA, the former first lady and wife of the late
 GEN. SANI ABACHA, the former head of state and
 commander in chief of the armed forces of the Federal
 Republic of Nigeria.

 She (MRS. M. ABACHA), has as a result of the trust and
 confidence she has in me mandated that I search for a
 reliable and trustworthy foreign partner, who
 will help receive some funds which she had in cash
 totaling US$45m (Forty Five Million United States
 Dollars Only) into a personal, company or any
 reliable foreign bank account for safe keeping for a
 short period of time, since her family bank accounts
 within and outside the country have all been
 frozen by the authorities. (I would refer you to the
 website of
 .http://www.transnationale.org/anglais/sources/tiersmonde/dirigeants__aba
 http://allafrica.com/stories/200203180074.html
 http://www.time.com/time/europe/magazine/2000/27/swiss.html ,
  for further information
 about these monies and the ABACHAS)

 This money in question has however, been carefully
 keptin defaced form and deposited with a security
 company that has branches in Europe and America.
 You may therefore be required to travel to any
 of the branches to collect the money on behalf of my
 client for safe keeping.

 It may also interest you to know that she (MRS.
 ABACHA) and her family have, since the inception of
 the present democratic government, been placed under
 partial house arrest, with their international
 traveler's passports withdrawn pending  the resolution
 of current fund recovery face - off between them and
 the present RTD GEN. OBASANJO led Federal Government,
 which from all indications will not exceed this year.

 She has decided to offer anybody who will be willing
 to render this tremendous assistance 20% of the total
 sum, while 5% shall be set aside for incidental
 expenses.

 Note that this transaction involves no risks
 whatsoever, as you will have no dealing with my
 Country, Nigeria. Rather, you will deal directly with
 the security company, which is based where the money
 is right now.

 Let me have your confidential Tel/Fax Numbers in your
 response to this proposal.

 I shall let you into a complete picture of this
 mutually beneficial transaction when I have received
 your anticipated positive reply. This matter should be
 treated as urgent and confidential. This is very
 important.

 Best Regards,

 Barrister George Emeka.







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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] show mysql- processing time

2002-11-21 Thread Van Andel, Robert
This is what I did.

$StartTime = date(U);
$result = mysql_query($query);
$EndTime = date(U);

$difference = $EndTime - $StartTime;
echo pThe query took $difference seconds to generate/p\n;

Perhaps not the most accurate but who cares about a few milliseconds.

Robbert van Andel 

-Original Message-
From: Tularis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 8:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] show mysql- processing time


I was wondering if anyone knew of a way to return the processing time of 
a mysql query via php.

And NOT using the

$starttime = time();
mysql_query($whatever);
$endtime = time();
$processingtime = $endtime - $starttime;

Does anyone please?


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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] show mysql- processing time

2002-11-21 Thread Van Andel, Robert
Sorry,  I didn't read the entire message.  Didn't realize you were already
using my suggestion.

Robbert van Andel 

-Original Message-
From: Tularis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 8:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] show mysql- processing time


I was wondering if anyone knew of a way to return the processing time of 
a mysql query via php.

And NOT using the

$starttime = time();
mysql_query($whatever);
$endtime = time();
$processingtime = $endtime - $starttime;

Does anyone please?


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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] echo'ing array contents through reference variable ... why doesn't this work???

2002-11-21 Thread Van Andel, Robert
Perhaps the error lies in 

for ($n = 0; $i  count($$pdag); $n++) {

You have $$pdag instead of $$pdag.  You also have it lower down in the code.

Robbert van Andel 

-Original Message-
From: -[ Rene Brehmer ]- [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 1:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] echo'ing array contents through reference variable ...
why doesn't this work???


I've run into something I don't understand...

This is my test code:

  $premieredag =
array(2002-11-22,2002-11-29,2002-12-06,2002-12-18);
  $d20021122 = array(001);
  $d20021129 = array(002,003,004);
  $d20021206 = array(005,006,007);
  $d20021218 = array(008,009);

  for ($i = 0; $i  count($premieredag); $i++) {
echo(td class=\date\ width=\15%\);
echo date(j. F Y,strtotime($premieredag[$i]));
echo (/tdtdnbsp;/td\n);
echo(/trtr\n);
$pdag = d.str_replace(-,,$premieredag[$i]);
for ($n = 0; $i  count($$pdag); $n++) {
  echo(td colspan=\2\ class=\filmtxt\);
  echo($$pdag[$n]);
  echo(/td\n);
  echo(/trtr\n);
}
  }

When it runs, it goes beserk, and gives me this:

td class=date width=15%22. November 2002/tdtdnbsp;/td
/trtr
td colspan=2 class=filmtxt/td
/trtr
td colspan=2 class=filmtxt/td
/trtr
td colspan=2 class=filmtxt/td
/trtr
td colspan=2 class=filmtxt/td
/trtr
td colspan=2 class=filmtxt/td
/trtr

...and so on ...

It never ends ... and I get no error messages ... 

So I must conclude that count($$pdag) does not work on reference
variables... what can you do about that? The arrays that $$pdag refers to
are variable length (or will be in the final code), so I really need to be
able to do it this way ...

Any other way to find the top of an array ???

Rene


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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] echo'ing array contents through reference variable ... why doesn't this work???

2002-11-21 Thread Van Andel, Robert


The message should say:

Perhaps the error lies in 

for ($n = 0; $i  count($$pdag); $n++) {

You have $$pdag instead of $pdag.  You also have it lower down in the code.

-Original Message-
From: Van Andel, Robert 
Sent: Thursday, November 21, 2002 1:10 PM
To: -[ Rene Brehmer ]-; [EMAIL PROTECTED]
Subject: RE: [PHP] echo'ing array contents through reference variable
... why doesn't this work???


Perhaps the error lies in 

for ($n = 0; $i  count($$pdag); $n++) {

You have $$pdag instead of $$pdag.  You also have it lower down in the code.

Robbert van Andel 

-Original Message-
From: -[ Rene Brehmer ]- [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 1:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] echo'ing array contents through reference variable ...
why doesn't this work???


I've run into something I don't understand...

This is my test code:

  $premieredag =
array(2002-11-22,2002-11-29,2002-12-06,2002-12-18);
  $d20021122 = array(001);
  $d20021129 = array(002,003,004);
  $d20021206 = array(005,006,007);
  $d20021218 = array(008,009);

  for ($i = 0; $i  count($premieredag); $i++) {
echo(td class=\date\ width=\15%\);
echo date(j. F Y,strtotime($premieredag[$i]));
echo (/tdtdnbsp;/td\n);
echo(/trtr\n);
$pdag = d.str_replace(-,,$premieredag[$i]);
for ($n = 0; $i  count($$pdag); $n++) {
  echo(td colspan=\2\ class=\filmtxt\);
  echo($$pdag[$n]);
  echo(/td\n);
  echo(/trtr\n);
}
  }

When it runs, it goes beserk, and gives me this:

td class=date width=15%22. November 2002/tdtdnbsp;/td
/trtr
td colspan=2 class=filmtxt/td
/trtr
td colspan=2 class=filmtxt/td
/trtr
td colspan=2 class=filmtxt/td
/trtr
td colspan=2 class=filmtxt/td
/trtr
td colspan=2 class=filmtxt/td
/trtr

...and so on ...

It never ends ... and I get no error messages ... 

So I must conclude that count($$pdag) does not work on reference
variables... what can you do about that? The arrays that $$pdag refers to
are variable length (or will be in the final code), so I really need to be
able to do it this way ...

Any other way to find the top of an array ???

Rene


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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 




 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] how can php get the values of a group of checkbox

2002-11-21 Thread Van Andel, Robert
Check boxes should not be given the same name.  Radio buttons should to
denote a grouping.  In other words, if you want to have a bunch of radio
buttons indicating a choice between items (say bananas, oranges, and
apples), you would name them the same thing and give them each a different
value.  Checkboxes need to be given unique names to identify them.  Using
the example above, you would have three check boxes one called bananas, one
called oranges and one called apples.  They are given the value of true when
they are submitted.  You could probably hard code the value as well, but I
rarely do so.

Robbert van Andel 


-Original Message-
From: Xin Qi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 11:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP] how can php get the values of a group of checkbox


hi there,

if i have a group of checkboxes, and they have the SAME name, when they are
submited into a php script, how can this php file get the value of each
checkbox?

since they have the same name, $_GET[checkbox_name] only returns the last
one.

thanks



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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] help needed with forms

2002-11-21 Thread Van Andel, Robert
Sounds like JavaScript would be the answer here.  You can use a javascript
function to validate the form before it is even submitted.

Robbert van Andel 

-Original Message-
From: Pushpinder Singh Garcha [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 1:28 PM
To: [EMAIL PROTECTED]
Subject: [PHP] help needed with forms


Hello

I am using php based forms, which collect information from the client 
and send it in the form a email message to the admin.
I need to start using validation i.e. check whether some field/s  has 
been correctly entered in the from.
My application consists of 2 php pages
1).  info.php(this page consists of the plain form and the has its 
action parameter set to send_info.php)
2).  send_info.php  (this forms collects the information that the 
client entered and composes a message and mails it to
admin)

So I use headers in the following manner:

The send_info.php code starts like this

?
if($email =='') {
 header(Location: http://www.mysite.com/info.php;);
}
?


This takes the user back to the info.php page with all the fields reset.
What I need is that
1).  An alert box must be displayed which tells the user where he went 
wrong
2).  Also the data that the user had entered on the form must not be 
reset to blank.

I know this sounds very trivial.
Please help me out.
Thanks
--pS

Pushpinder Singh Garcha




 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] GD : Black background with imagecreatetruecolor

2002-11-21 Thread Van Andel, Robert
Testing

Robbert van Andel 

-Original Message-
From: Arnaud [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 1:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] GD : Black background with imagecreatetruecolor


Hi everyone,

I'd like to use imagecreatetruecolor function in order to cut and paste
JPG files on a white background. It seems not to work correctly.

Here is my test scripts :

This one works perfectly :
?
$im=imagecreate(50,50);
$COULEUR_BLANC=imagecolorallocate($im,255,255,255);
header (Content-type: image/png);
ImagePNG($im);
imagedestroy($im);
?

I obtain a white image but using GD 2.x, the imagecopy function fails.

This other script doesn't work :
?
$im=imagecreatetruecolor(50,50);
$COULEUR_BLANC=imagecolorallocate($im,255,255,255);
header (Content-type: image/png);
ImagePNG($im);
imagedestroy($im);
?

I'm getting a black image.

My configuration is PHP 4.2.3 with gd2 running on Windows XP (I've also
tested it on my web provider machine - Linux with PHP 4.2.2)

Any help would be great.

Thanks in advance

Arnaud



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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] how can php get the values of a group of checkbox

2002-11-21 Thread Van Andel, Robert
Use an array (checkbox[1], checkbox[2]).  Then use a loop to pull get the
data after posting.  If you expect only one choice, use a radio button.

Robbert van Andel 

-Original Message-
From: Xin Qi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 1:54 PM
To: Van Andel, Robert; [EMAIL PROTECTED]
Subject: Re: [PHP] how can php get the values of a group of checkbox


RE: [PHP] how can php get the values of a group of checkboxthank you, but
what if all the checkboxes are generated dynamicly? I mean, I do not know
how many checkboxes where will be until the php script generate the html
page completely. if i have them unique names, it is kind of boring when php
loads $_GET[] because it will be $_GET[$one_variable]. 

For a group checkboxes with the same name, there will be no such problem. 
  - Original Message - 
  From: Van Andel, Robert 
  To: Xin Qi ; [EMAIL PROTECTED] 
  Sent: Thursday, November 21, 2002 4:26 PM
  Subject: RE: [PHP] how can php get the values of a group of checkbox


  Check boxes should not be given the same name.  Radio buttons should to
denote a grouping.  In other words, if you want to have a bunch of radio
buttons indicating a choice between items (say bananas, oranges, and
apples), you would name them the same thing and give them each a different
value.  Checkboxes need to be given unique names to identify them.  Using
the example above, you would have three check boxes one called bananas, one
called oranges and one called apples.  They are given the value of true when
they are submitted.  You could probably hard code the value as well, but I
rarely do so.

  Robbert van Andel 



  -Original Message- 
  From: Xin Qi [mailto:[EMAIL PROTECTED]] 
  Sent: Thursday, November 21, 2002 11:14 AM 
  To: [EMAIL PROTECTED] 
  Subject: [PHP] how can php get the values of a group of checkbox 



  hi there, 

  if i have a group of checkboxes, and they have the SAME name, when they
are 
  submited into a php script, how can this php file get the value of each 
  checkbox? 

  since they have the same name, $_GET[checkbox_name] only returns the
last 
  one. 

  thanks 




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



   The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 




 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] Newbie: PHP/MySQL (SELECT)

2002-11-20 Thread Van Andel, Robert
$sql1 = titulo like '%$titulotxt%'
$sql2 = cd like '$cdstxt';
$sql = SELECT * FROM divx WHERE $sql1 AND $sql2 ORDER BY titulo;

I think you are getting the error because of the ($titulotxt) ? portion of
your sql statements.  You really only need the two statements listed above
and then put into your actual sql statement.

Robbert van Andel 

-Original Message-
From: Mr. BuNgL3 [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 11:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Newbie: PHP/MySQL (SELECT)


Hi...
I'm with a little sintax problem...
The question is that i have two search fields (titulotxt and cdstxt) and i
want to create an mysql condition... i trying:

 $sql1=($titulotxt) ? titulo like '%.$titulotxt.%':;
 $sql2=($cdstxt) ? cds like '$cdstxt':;
 $sql=SELECT * FROM divx WHERE .$sql1.$sql2  ORDER BY titulo;

but he's giving me a sintax error on the 3 line... Can anyone
teach me how i must do to validate the mysql condition and make it work?
Thanks





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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] Graph Question..

2002-11-20 Thread Van Andel, Robert
What I'm wondering is if you are calling the graphic's placing into the page
correctly.  I believe the class will probably work. 

I have a page that includes a graph that I generate using mySQL and PHP.
This is the code I use to actually display the graphic (not what generates
it).

ImageJPEG($pic,$graphname);

echo p align=\center\image src=\$graphname\/p\n;

Of course there is a significant amount of code that actually generates
$pic, but this is what I had to do to make the graphic appear.

Robbert van Andel 

-Original Message-
From: Jim Hatridge [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 12:03 PM
To: PHP-GEN
Subject: Re: [PHP] Graph Question..


On Wednesday 20 November 2002 20:37, Van Andel, Robert wrote:
 More information would be helpful.  Perhaps the code to the page that is
 causing you trouble (i.e. the one where you are using the class you
 downloaded yesterday).  Perhaps you are missing a key piece there.

 Robbert van Andel

HI Robbert et al..

Below is part of the code. I don't think I should send it all to the list, 
it's quite large. Looking at all this I think that I'm missing a lib for 
graphs. But I can't find anything on my SuSE 8.1 disks. What libs do I need 
for doing graphs?

Thanks

JIM



 -Original Message-
 From: James Hatridge [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, November 20, 2002 7:07 AM
 To: PHP-GEN
 Subject: [PHP] Graph Question..



 Hi all,,

 I d/l'ed a class for graphs last night. When I got the class working
 instead

 of a line graph I got the netscape symbol for no picture, ie a broken box.
 I

 must have missed something. Could someone give me a clue what I'm doing
 wrong?

 Thanks

 JIM

#

?
require Color.php;
require Graph.php;
require Barchart.php;

$white = new Color(255,255,255);
$blue = new Color(0,0,255);
$red = new Color(255,0,0);
$green = new Color(0,255,0);

$line = new Barchart(500,500,$white);

$ar1 = array(12,13,16,2,5,10,0,1,2,8);
$ar2 = array(20,13,-1,2,23,11,1,3,4,9);
$ar3 = array(11,15,20,12,6,-10,28,30,10,0);

$line-addArray($ar1, $white);
$line-addArray($ar2, $green);
$line-addArray($ar3, $red);
$line-printHTML();

?


##
-- 
Vielfeind -- Viel Ehr'
Antiamerikanische Propaganda in der Philatelie des 20. Jahrhunderts
  http:/www.fecundswamp.net/~hatridge/stamps/index.html


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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] Download File

2002-11-19 Thread Van Andel, Robert
If the word document you are trying to download is already on the server,
you could probably just make a link to the file

a href=http://host.com/document.doc;

When the user clicks on it, they either view the document if they have the
MS Word plugin, or they are asked to download it.  I'm not sure that using
php is warranted.

Robbert van Andel 


-Original Message-
From: Michelle [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 7:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Download File


I would like to download a word-document from another site and save it to my
harddrive.
How would I go about doing this?

I tried:
?php
$filename = http://host.com/document.doc;

$fd = fopen ($filename, rb);
$string = fread ($fd, filesize ($filename)); ERROR
fclose ($fd);

$fname = my_saved_doc.doc;
$fp = fopen ($fname, wb);

?

ERROR:
Warning: stat failed for http://host.com/document.doc (errno=2 - No such
file or directory) in d:\inetpub\wwwroot\dl-doc.php on line 8

I believe this has something to do with the access rights to the folders or
something...




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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





[PHP] Returning an array in a function

2002-11-19 Thread Van Andel, Robert
How would I return an array of data with a function?

Robbert van Andel 




 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] how to read text file one line at a time

2002-11-19 Thread Van Andel, Robert
This works too.

$fp = fopen($filename,'r');
while($line=fgets($fp))
{
//do what you need to do with $line
}
fclose($fp);

Robbert van Andel 


-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 11:44 AM
To: Kelly Meeks
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] how to read text file one line at a time


$array = file($filename);

Each line of the array will have a line of your file.

Or, if you want to do it line by line:

  $fp = fopen($filename,'r');
  while(!feof($fp)) {
$line = fgets($fp);
  }
  fclose($fp);

-Rasmus

On Tue, 19 Nov 2002, Kelly Meeks wrote:

 here's an example of a text file I need to read...

 abcd|test1|morevalues|otherstuff

efghijklm|a;kd;laskf;alskdjf;alskdf;askldjasldkf|;askd;lakjl;asdf|al;sdjf;al
f

 I believe each line is seperated by a carriage return.

 How can I read this in one line at a time in to a variable?

 I'm assuming that I could then explode that variable using the pipe as the
seperator text?

 Kelly



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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] Create Login Page

2002-11-18 Thread Van Andel, Robert
I recently set up a log in page.  I'm doing it a little differently than
you.  First I establish a session and set up two session variables
(sessusername and sesspassword).

I check to see if these variables have been set,
if they have, I then check the username and password with the database to
make sure the username and password are correct.

Might be a little round about way of doing it, but I don't run into any
header errors.

?php
// Start a session
session_start();

//echo session_id() . br\n;
// register the username and password
session_register(sessuser,sesspass);

// connect to the database
{code omitted}

?

html
head
title

/title

/head
body
?php
//verify the username and password
if($sessuser)
{
//echo Verifying username $sessusernmaebr\n;
if(!$verifyres = mysql_query(SELECT * FROM users WHERE
`username`='$sessuser')) die(mysql_error());
if(mysql_num_rows($verifyres)=1)
{
$verifydata = mysql_fetch_array($verifyres);

if($verifydata[2] != $sesspass)
{
$message = Incorrect Password;
$sessuser=;
}
}
else
{
$message=The username '$sessuser' was not found;
$sessuser=;
}
}   
//insert an if statement looking for the username and password
if(!$sessuser)
{
echo pfont face=\$font\ size=\3\bPlease log
in./b/font/p\n;
if($message) echo pfont face=\$font\ size=\3\
color=\red\b$message/b/font/p\n;

echo form method=\post\ action=\weekly.php\\n;
echo pinput type=\text\ name=\sessuser\
size=\15\br\n;
echo input type=\password\ name=\sesspass\
size=\15\br\n;
echo input type=\submit\ value=\Log In\/p\n;  

}
else
{

}

Hope this is helpfull

Robbert van Andel 

-Original Message-
From: Pushpinder Singh Garcha [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 18, 2002 1:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Create Login Page 


Hi All

I am trying to create  a login page using php and mysql database.

This is the code that I am trying to use:
?php
// File Name: auth04.php
// Check to see if $PHP_AUTH_USER already contains info

if (!isset($PHP_AUTH_USER)) {
// If empty, send header causing dialog box to appear
header('WWW-Authenticate: Basic realm=My Private Stuff');
header('HTTP/1.0 401 Unauthorized');
exit;

} else if (isset($PHP_AUTH_USER)) {
// If non-empty, check the database for matches
// connect to MySQL

mysql_connect(localhost, mysql, sunny)
or die (Unable to connect to database.);

// select database on MySQL server

mysql_select_db(masterstream)
or die (Unable to select database.);

// Formulate the query

$sql = SELECT *
 FROM guest
 WHERE login='$PHP_AUTH_USER' and 
password='$PHP_AUTH_PW';

// Execute the query and put results in $result
$result = mysql_query($sql);

// Get number of rows in $result. 0 if invalid, 1 if valid.

$num = mysql_numrows($result);

if ($num != 0) {
echo PYou're authorized!/p;   
exit;

} else {

header('WWW-Authenticate: Basic realm=My Private
Stuff');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
}
?

This is the error that I get when I point my browser to this page both 
when the script is run locally and on th eremte webserver.
btw: I am running Mac OS Jagaur

Warning: Cannot add header information - headers already sent by 
(output started at /Users/pgarcha/Sites/auth.php:7) in 
/Users/pgarcha/Sites/auth.php on line 13

Warning: Cannot add header information - headers already sent by 
(output started at /Users/pgarcha/Sites/auth.php:7) in 
/Users/pgarcha/Sites/auth.php on line 14


Many Thanks
--Pushpinder



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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action 

RE: [PHP] How to process data from forms

2002-11-18 Thread Van Andel, Robert
Your variables are also available as plain old variables.  For a newbie it
might be easier and more user frinedly to use it that way rather than the
array mentioned below.

In your case, $demand and $name would contain the information entered by the
user.  I generally use this method in my code.


Robbert van Andel 


-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 18, 2002 4:36 PM
To: one_gundam_war
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] How to process data from forms


At 01:06 19.11.2002, one_gundam_war spoke out and said:
[snip]
Ok. I am kind of new to PHP, but I have a question. I have a site, and it

You've got a lot of questions then I'm sure :)
Ok, let's start:

has a system where people can apply. However, the mailto: system seems like
it would be too much of a hassle, and I don't want to make users skip it
just because they use webmail.

So, does anyone know how to make the values in a form either automatically
get e-mailed to an address (as in you just hit submit and it does it.
does
not involve the client's e-mail addy) or to write it to a data file (which
I
can then check and see individual responses in).

If you submit a form to a PHP script, the form variables are accessible in
a global associative array ($_GET for forms using the GET method, $_POST
for post forms, or $_REQUEST for both). You can easily hand these variables
to either an SQL statement, or to the mail() function for further
processing.

Assume this little form:

form action=mailform.php method=post
Enter your name here: input type=text name=namebr
What is your demand? textarea name=demand/textareabr
input type=submit value=send it up
/form

When the user clicks on Send it up, your script named mailform.php gets
executed and can process the data:


?php

// put the stuff into SQL
$sql = 'insert into mytable (name, demand) values (\'' .
   str_replace('\'', '\'\'', $_POST['name']) . '\',' .
   str_replace('\'', '\'\'', $_POST['demand']) . '\')';

// mail that stuff to me
mail('[EMAIL PROTECTED]', 'Form received from Webuser',
 'Name: '.$_POST['name'].\n\nDemand: .$_POST['demand'].\n\n .
 'Yours sincerely, ' . $_SERVER['PHP_SELF']);

?
h1Thanks for klicking that button!/h1
-

This is of course kinda crude, untested, etc etc etc, but I hope you get
the basic idea. http://www.php.net/manual/en/ is a great place to look up
anything you need.



-- 
   O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] what else do i need in this upload script?

2002-11-15 Thread Van Andel, Robert
This looks fine except the MAX_FILE_SIZE looks rather small.  I had an issue
with it earlier this week and found that the fileI was trying to upload was
larger than the MAX_FILE_SIZE.  I believe this is measured in bytes, so your
file cannot be larger than 1KB.  Are you getting any errors?

Robbert van Andel 

-Original Message-
From: Tweak2x [mailto:Tweak2x;Carolina.rr.com]
Sent: Friday, November 15, 2002 1:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP] what else do i need in this upload script?


ok, this is upload.php:

form enctype=multipart/form-data action=upload.php method=post
input type=hidden name=MAX_FILE_SIZE value=1000
Send this file: input name=userfile type=file
input type=submit value=Send File
/form


what else do i need to make afile upload?



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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





[PHP] PHP Website

2002-11-15 Thread Van Andel, Robert
Anyone else having trouble accessing PHP.net?

Robbert van Andel 




 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] newbie's question

2002-11-15 Thread Van Andel, Robert
Don't know about a correct way but you can use if(empty($variable))

Robbert van Andel 


-Original Message-
From: Frank Wang [mailto:wang960;yahoo.com]
Sent: Friday, November 15, 2002 7:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP] newbie's question


Hi,
what is the correct way of testing if a string is empty or not?

fw



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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] newbie's question

2002-11-15 Thread Van Andel, Robert
Yes it would.  I like to make things complicated :)

Robbert van Andel 


-Original Message-
From: Steve Keller [mailto:skeller;healthtvchannel.org]
Sent: Friday, November 15, 2002 5:11 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] newbie's question


Err... sorry. The logic was there but my fingers got a bit ahead of my 
brain. The check works, but if you want to just check if it's empty turn 
the conditional to a negative, like so:

if (!$testVar) {
etc.
}

That makes it If NOT $testVar



  I may be crazy, but wouldn't if ($variable) work just as well? If the 
string is empty it'll return a negatory on that check.
 
  Lemme double check that.
 
  $testVar = ;
  if ($testVar) {
echo Yes;
  }
  else {
echo No;
  }
 
  Yeah, ok. That ran just fine under 4.2.3.
--
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)
Email: [EMAIL PROTECTED]
Web: www.healthtvchannel.org


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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] trim strings

2002-11-13 Thread Van Andel, Robert
You should be able to use substr().  

In your case, you would do
$newstring = substr($string,10);

Click the link for documentation.
http://www.php.net/manual/en/function.substr.php

Robbert van Andel 
=== 
Network Operator 
NW Regional Operations Center 
Charter Communications 
ROC Phone: 866-311-6646 
Desk Phone: 360-828-6727 
email: DL NW ROC 
=== 


-Original Message-
From: Greg [mailto:gregchagnon;hotmail.com]
Sent: Wednesday, November 13, 2002 9:15 AM
To: [EMAIL PROTECTED]
Subject: [PHP] trim strings


Hi-
Is there return a string with it's first 10  characters stripped?  Thanks.
_Greg



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


 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





[PHP] File Upload problem

2002-11-12 Thread Van Andel, Robert
I am having issues uploading a file.  I am trying to up load a file from my
computer to the server so taht I can run a mysql query using the load data
infile query.  here is the code

html
body
?PHP
if (isset($users_file))
{
// connect to the database
//database connection code

echo BRemote File Name:/B $users_fileBR;
echo BLocal File Name:/B $users_file_nameBR;
echo BLocal File Size:/B $users_file_sizeBR;
if (isset($users_file_type))
{
echo BLocal File Type:/B $users_file_typeP; 
}

// Change $doc_directory to your 'DocumentRoot'.
$doc_directory = /www/www.linuxguruz.org/htdocs/;
$my_file = tmp/uploaded-.$users_file_name;
$copy_path = $doc_directory.$my_file;

if ($users_file != none)
{
$query = LOAD DATA LOCAL INFILE '$users_file' ;
$query .= INTO TABLE `nrb_test` ;
$query .= FIELDS TERMINATED BY ',' ENCLOSED BY '\'
ESCAPED BY '' ;
$query .= LINES TERMINATED BY '\r\n' ;
$query .= IGNORE 1 LINES;

echo $queryBR\n;

if(!$result = mysql_query($query))
{
echo File upload failed!;
}
else
{
?A HREF=?PHP echo $my_file; ?Upload
Complete!/A?PHP
}
}
else
{
echo PYou must select a file to upload!P; ?
A HREF=?PHP echo $PHP_SELF; ?BBack/B/A
to the Upload Form
?PHP
}
}

else
{
?
form action=? echo $PHP_SELF; ?
 enctype=multipart/form-data method=POST
input type=hidden name=MAX_FILE_SIZE value=2
input type=file name=users_filebr
input type=submit value=Upload!
/form
?PHP
}
?
/body
/html

When I submit the form at the bottom of the script, the $user_file variable
equals none.  I am unable to figure out what is going on.  The variable
$users_file_name lists the file's name, but the $user_file is none and the
$user_file_size =0. 
 
Why is $user_file equal to none?  Any help will be greatly appreciated. 



 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] File Upload problem

2002-11-12 Thread Van Andel, Robert
It was a typo.  Sorry.

Robbert van Andel 
=== 
Network Operator 
NW Regional Operations Center 
Charter Communications 
ROC Phone: 866-311-6646 
Desk Phone: 360-828-6727 
email: DL NW ROC 
=== 


-Original Message-
From: Ernest E Vogelsinger [mailto:ernest;vogelsinger.at]
Sent: Tuesday, November 12, 2002 3:46 PM
To: Van Andel, Robert
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] File Upload problem 


At 00:25 13.11.2002, Van Andel, Robert said:
[snip] 
FORM action=? echo $PHP_SELF; ? method=post 
encType=multipart/form-dataINPUT type=hidden value=2
name=MAX_FILE_SIZE 
INPUT type=file name=users_fileBRINPUT type=submit value=Upload!
/FORM?PHP
 }
?
When I submit the form at the bottom of the script, the $user_file variable
equals none.  I am unable to figure out what is going on.  The variable
$users_file_name lists the file's name, but the $user_file is none and the
$user_file_size =0. 
 
Why is $user_file equal to none?  Any help will be greatly appreciated. 
[snip] 

Try to use the name $users_file and $users_file_size (note the 's' after
user).
Just in case that was no typo in your message...


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 





RE: [PHP] File Upload problem

2002-11-12 Thread Van Andel, Robert
Upon reading my reply, I think perhaps I wasn't clear enough.  I am using
users_file, etc.  I am unable to upload a file because $users_file is given
the value of none.


-Original Message-
From: Van Andel, Robert 
Sent: Tuesday, November 12, 2002 3:59 PM
To: Ernest E Vogelsinger
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] File Upload problem 


It was a typo.  Sorry.

-Original Message-
From: Ernest E Vogelsinger [mailto:ernest;vogelsinger.at]
Sent: Tuesday, November 12, 2002 3:46 PM
To: Van Andel, Robert
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] File Upload problem 


At 00:25 13.11.2002, Van Andel, Robert said:
[snip] 
FORM action=? echo $PHP_SELF; ? method=post 
encType=multipart/form-dataINPUT type=hidden value=2
name=MAX_FILE_SIZE 
INPUT type=file name=users_fileBRINPUT type=submit value=Upload!
/FORM?PHP
 }
?
When I submit the form at the bottom of the script, the $user_file variable
equals none.  I am unable to figure out what is going on.  The variable
$users_file_name lists the file's name, but the $user_file is none and the
$user_file_size =0. 
 
Why is $user_file equal to none?  Any help will be greatly appreciated. 
[snip] 

Try to use the name $users_file and $users_file_size (note the 's' after
user).
Just in case that was no typo in your message...


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers. 




 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers.