Re: [PHP] Re: Difference between $_POST[foo] and $_POST['foo']?

2003-06-17 Thread Tom Woody
On Tue, 2003-06-17 at 09:09, nabil wrote:
 A side question along with  this ,,, how can I include $_POST['foo']  in the
 :
 $sql =select * from db where apple = '$_POST['foo']'  ;
 
 without getting an error ??
 should I append it as $var= $_POST['foo']; before???


The rule of thumb I follow with these and other Associative Arrays is:

when setting the variable its $_POST['foo']
when accessing the variable its $_POST[foo]

so it your example it would be:
$sql = select * from db where apple = '$_POST[foo]';
 
-- 
Tom Woody

In a world without boundaries why
do we need Gates and Windows?


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



[PHP] Setting Return-Path header for mail() on Linux

2003-06-13 Thread Tom Woody
Is it possible to change the Return-Path header in PHP on linux?  I have
seen all the posts about setting it in the php.ini with the -f switch to
sendmail.  But I need to set it based on the person logged into the
page?  Right now the Return-Path is set to a default that gets sent to
me (the administrator).

I have a group of about 20 users who log into the webpage, and send
email messages.  If any of the messages bounce, those users don't know
about it until I sift through the postmaster mailbox and let them know
(that is unless the remote mail server is nice and send the bounce to
the From: or Reply-To:).  Changing the Return-Path would solve this for
everyone.  Any thoughts ideas, or am i just out of luck? 
-- 
Tom

In a world without boundaries why
do we need Gates and Windows?


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



Re: [PHP] mysql - get actual row

2003-06-10 Thread Tom Woody
On Tue, 2003-06-10 at 17:18, Harry.de wrote:
 Hi,
 if i insert into a mysql table a row e.g.
mysql_query(INSERT into TEST (testfield) VALUES ('This is a test'));
 and the first field is an auto increment (e.g. NR),
 how can i get the value of the auto increment NR i've actually inserted?

mysql_insert_id()

in the future a search of the archive first, or a search of php.net
would have found this.
 
-- 
Tom

In a world without boundaries why
do we need Gates and Windows?


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



Re: [PHP] Resending POST Variables

2003-05-29 Thread Tom Woody
On Wed, 2003-05-28 at 11:38, Shaun wrote:
 ok,
 
 basically this is so I can implement page numbering on my search results,
 the user submits the form and I want to be able to send the form results
 back to the same page when the user clicks 'next' or 'previous'.
 
I do the very same thing as you, but I link to the same page.  I have my
search results show a count, and the user can choose a specific page, or
they can use next and previous links.  But I never leave the first page.

And my page uses both GET and POST...Also its an internally accessed 
page only so I don't have as many security aspect to deal with.

I check from the presence of on of the $_POST variables that will always
be present.  If its there, I perform actions assuming a $_POST
occurred.  Otherwise I assume $_GET, as there will never be a case where
both a POST and a GET happen at the same time.  The search results are
done as links to the $_SERVER['PHP_SELF'] with get variables appended on
the URL.  This sets the page I'm looking at, then I use the offset and
limit on the mysql query to build the next page.  If you are interested
I can send more specific code example...
-- 
Tom 

In a world without boundaries why
do we need Gates and Windows?


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



Re: [PHP] time() question

2003-03-13 Thread Tom Woody
On Thu, 13 Mar 2003 12:07:33 -0500
Tom Ray [EMAIL PROTECTED] wrote:

 Is there an easy way to display the epoch time given by time() in a
 human readable format? Basically, if I do $time = time(); and the
 insert that data into my mysql database and then pull that information
 out again how do I make it look like 2003-03-13 or a variant of that?
 
in php you would do: (see
http://www.php.net/manual/en/function.date.php)
$date = date('Y-m-d',time());

in mysql you would do:
(http://www.mysql.com/doc/en/Date_and_time_functions.html)
select date_format('%Y-%m-%d', field) from table where ...;


-- 
Tom Woody
Systems Administrator

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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



Re: [PHP] What do I do wrong?

2003-03-13 Thread Tom Woody
On Fri, 14 Mar 2003 00:37:38 +0100
Michael Cronstrom [EMAIL PROTECTED] wrote:

 I get the message:
 
 Notice: Undefined variable: msg in 
 F:\www-root\domain.com\website\script.php on line 202
 
 whats wrong?
Questions like this and you are asking for trouble... first off how are
we supposed to help you with the problem if we don't know what is on
line 202.  Are we supposed to be clairvoyent, or should we divine the
answer from tea leaves.  Without the code, or at least the code around
line 202 you are asking the impossible  yes this would make me a
troll...

-- 
Tom Woody
Systems Administrator

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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



[PHP] Sessions Tutorial [was: Re: [PHP] Another questions about usning session.]

2003-03-12 Thread Tom Woody
I have found this to the best tutorial I have seen yet on sessions...its
very straight forward, and took care of a lot of questions that I had.

http://www.sitepoint.com/article/319/95

snip snip
-- 
Tom Woody
Systems Administrator

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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



[PHP] HTTP_REFERER security implications?

2003-03-10 Thread Tom Woody
I am working on a simple authentication script, where the user submits a
login and password, the credentials are checked and the user is
redirected to another script.  The new script checks the HTTP_REFERER
and if its the original script it continues, otherwise it stops with a
message about being unauthorized.

What kind of security implications may I be backing myself into?  I want
to try and stay away from cookies, and as small as this is I think
Session management is a little overkill.  The average user isn't going
to spend much more than 1 or 2 minutes on the site (not much for them to
see or do).  I have seen this method used on other sites, but I prefer
to check with the experts first.

thanks,

-- 
Tom

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



Re: [PHP] SSH change password!

2003-01-24 Thread Tom Woody
The one problem and serious security risk you will be introducing is
that if you run passwd as an unprivliged user you can only change the
password of the user you are running it as.  Therefore, the webserver
would be running as apache, so the only password it could change would
be for user apache.

To get passwd to change any password it has to be run as root, therefore
you would need to run the webserver as root.  You would be opening a
serious pandora's box with that option.

Since your users have access to the server through a shell account
(otherwise why bother with user accounts), you would be better served by
PuTTY or another ssh client that the users change their passwords by
logging in to the shell account.

On Fri, 24 Jan 2003 11:48:50 -0600
Mantas Kriauciunas [EMAIL PROTECTED] wrote:

 Hey!
 
 I was wondering with what command do you execute shell commands?
 
 What I need is to change users password on the server, I want to write
 that script and it needs to be safe. So I don't know what should I
 use. I think I will need to check username and password, then log in
 through website with it and then use passwd command on that user to
 change the password. Or maybe I am wrong, I never done something like
 that.
 
 Thanks for any info!
 
 -mNTKz
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Tom Woody
Systems Administrator
NationWide Flood Research, Inc.
phone: 214-631-0400 x209
  fax: 214-631-0800

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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




Re: [PHP] Problem with Include

2002-12-24 Thread Tom Woody
I have found this to be very true with RedHat 8 (includes Apache2.0.40,
and php 4.2.2).  While RedHat 8.0 isn't really ready for a production
server, apache2 and php definitly are not.  You have to bend over
backwards to get some things working correctly if at all.  Plus there
are still some stability issues with RH 8.

As far as my production servers go apache 1.3 and RH 7.3 for now.

On Tue, 24 Dec 2002 00:02:49 -0700
Rick Widmer [EMAIL PROTECTED] wrote:

 At 08:04 AM 12/24/02 +0300, sport4ever wrote:
 
 maybe there is something wrong with php.ini
 notice that I faced with this problem just after I upgraded to (PHP
 4.2.1),(Apache2), everything was great before!
 
 The last I heard PHP + Apache2 is pretty much experimental, and not 
 recommended for production servers.  Unless you plan on working to
 debug the combination of programs, you should be using Apache 1.3 if
 you want to use PHP.
 
 There are a few combinations of versions that work together, but
 unless you are willing to put a lot of extra effort and study into
 using Apache 2, stick with 1.3 until the PHP developers announce
 Apache 2 support.
 


-- 
Tom Woody
Systems Administrator

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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




Re: [PHP] Escaping '#' Sign

2002-12-11 Thread Tom Woody
Have to be a bit more specific, cause I can't reproduce your
problem...  Do you have some code examples that show it clearer?

name for client is COMPANY #1 in DB

?php
 include dbconnect.inc; //sets up db connection

 $sel = mysql_query(select name from client 
 where clntid='1000', $connection);
 $result =  mysql_fetch_object($sel);
 $name = $result-name;
 echo This is the name: $namebr;
?

Output:

This is the name: COMPANY #1

A # sign is just another character in HTML, and all php is doing is
creating the html for you.  the # sign would only effect a difference in
PHP code within the ?php ?, which when you are doing a query that
doesn't happen.

-- 
Tom


On Wed, 11 Dec 2002 15:45:18 -0800
Mike Smith [EMAIL PROTECTED] wrote:

 I have a string I'm returning from a database. Some entries have #
 signs 
   in the names ie (COMPANY #42, COMPANY #43...). When I display
   results 
 all I have is COMPANY. Everything after the # is dropped off. I tried:
 
 If ($cust) {
   $cust2=ereg_replace('#','no',$cust);
   //tried $cust2=ereg_replace(#,no,$cust); too
 }
 
 but that still returns the same thing (COMPANY).
 
 Also tried:
 
 $cust2 = preg_replace ('(pound|#163);'i, chr(163), $cust);


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




Re: [PHP] Decrypt Password

2002-11-26 Thread Tom Woody
Password function is one way only...your only choice is to use
encrypt() decrypt() or just do like most other places, they say they
lost it, and you email it to a verified email address.


On Tue, 26 Nov 2002 16:16:22 -0500
Stephen [EMAIL PROTECTED] wrote:

 I would like to make a Lost Password part to my member's area script
 but the problem is, the passwords in the database are encrypted using
 the password function. How could I decrypt it for a lost password
 thing?
 
 Thanks,
 Stephen Craton
 http://www.melchior.us
 
 Life is a gift from God. Wasting it is like destroying a gift you got
 from the person you love most. -- http://www.melchior.us


-- 
Tom Woody
Systems Administrator
NationWide Flood Research, Inc.
phone: 214-631-0400 x209
  fax: 214-631-0800

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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




[PHP] Automatic file upload...

2002-11-21 Thread Tom Woody
I am trying to put together a script so that I can upload files to a
php script, with just a URL and can't seem to get my brain around it.

For example, The browser would have a url like:
http://example.com/upload/fileupload.php?filename=C:\filename.txt

Is there a way to do this and I'm just missing it, or will the client
have to browse and choose the filename with a form/form type of
construct?

I have tried some google searches on input syntax, as well as php
file uploads to no success.  The simple code I have been working with
is (obviously nothing has been found for automatically submitting a
form):

?php
  if (is_uploaded_file($_FILES['toProcess']['tmp_name'])) {
//successfully uploaded
move_uploaded_file($_FILES['toProcess']['tmp_name'],
   /var/www/html/filename.txt);
echo File successfully uploaded...thank youbr\n;
  }
  else {
echo Upload Problembr\n;
  }

?
html
body
form enctype=multipart/form-data action=? $PHP_SELF; ?
  method=POST
Filename: input type=file name=toProcess
 value=file:///home/user/uploadtest.txt
input type=submit
/form
/body
/html

-- 
Tom

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




Re: [PHP] catching a robot or spider

2002-11-20 Thread Tom Woody
User agent isn't very useful.  Most web spiders can be set to
return what ever user agent needed.  You are depending on the
writers/users of the spiders to follow commonly acceptable practices ie
looking for robots.txt and the like.



On Tue, 19 Nov 2002 14:54:49 +0100
Wilbert Enserink [EMAIL PROTECTED] wrote:

 Hi all,
 
 
 does anybody know a way to make a distinction between robots and
 users? should I use the user agent? Or is this not a safe method.
 If the visitor is a spider/robot I want to include some script
 containing extra URL's for the robot.
 
 regards Wilbert
 
 
 -
 Pas de Deux
 Van Mierisstraat 25
 2526 NM Den Haag
 tel 070 4450855
 fax 070 4450852
 http://www.pdd.nl
 [EMAIL PROTECTED]
 -


-- 
Tom Woody
Systems Administrator
NationWide Flood Research, Inc.
phone: 214-631-0400 x209
  fax: 214-631-0800

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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




[PHP] Specifying file to send in url...

2002-11-15 Thread Tom Woody
I may be way off base on this, but is it possible to specify a filename
on a url as in...

The user types in http://server/script.php?filetosend=filename.txt

The script.php recieves that file and processes accordingly?  Because
of the way its specified it would be a GET but I am not sure if this is
even possible.

Something tells me I have seen this done before but I am not sure. 
Thanks for any help on this.  I have done some Googling and Archive
search for something related and have come up blank.

-- 
Tom 

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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




Re: [PHP] how to generate ms-word files

2002-11-14 Thread Tom Woody
http://sourceforge.net/projects/php-doc-xls-gen/

On 14 Nov 2002 08:22:00 +
BigDog [EMAIL PROTECTED] wrote:

 You might want to do a search on google and see if someone has written
 a class on creating word documents.
 
 I am almost certain that someone has created on.
 
 This will save you much time...
 
 On Thu, 2002-11-14 at 12:34, michael wrote:
  hello
  
  I'm trying to generate ms-word files with php. Until now, I can
  create a document and even insert page-breaks. Is there any
  tutorials going further(boxes, mergedocuments etc...)?
  



-- 
Tom 

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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




Re: [PHP] starting recompiled php as a cgi-interpreter

2002-11-11 Thread Tom Woody
I did a search for cgi in the online documentation, and the first item
was this:

http://www.php.net/manual/en/printwn/install.commandline.php

On Mon, 11 Nov 2002 19:10:08 +0100
[EMAIL PROTECTED] wrote:

 Hi Maxim,
 
 can you please be so kind to forward me the according link to
 the manual regarding the installation of php as cgi.
 
 On the www.php.net site there is not much about php as a cgi
 interpreter.
 
 Thank u
 
 Oliver Etzel
 
 lowcost domains
 lowcost serverhousing www.t-host.de
 
   - Original Message - 
   From: Maxim Maletsky 
   To: [EMAIL PROTECTED] 
   Cc: [EMAIL PROTECTED] 
   Sent: Saturday, November 09, 2002 11:05 PM
   Subject: Re: [PHP] starting recompiled php as a cgi-interpreter
 
 
 
   read the manual regarding the installation of php as cgi. There you
   will find the clues. I am not very sure what exactly you meant.
 
   -- 
   Maxim Maletsky
   [EMAIL PROTECTED]
 
 
   On Sat, 9 Nov 2002 15:34:47 +0100 [EMAIL PROTECTED] wrote:
 
Hi PHP-List,

Oh sorry, more concrete for an easy question:

How can I start up this new and recompiled version of PHP which
was recompiled
-not as a DSO-
 but runs PHP as a CGI-Interpreter???

How can I start this fresh and recompiled PHP as a
CGI-Interpreter??

How to start and fire up?
Please help.

Oliver Etzel
lowcost domains
lowcost serverhousing www.t-host.com


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

 
 


-- 
Tom

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




Re: [PHP] How do I check if a checkbox has been checked?

2002-11-01 Thread Tom Woody
The syntax as I have used it is (not the cleanest or best way to do
it by a long run - but it works):

?php
if ($_POST['shipper_save'] == off) {
  $shipper_save = ;
}
else {
  $shipper_save = checked;
}
?
input type=checkbox name=shipper_save ?=$shipper_save?

this will have the checkbox be checked by default, also you can do what
ever other things you need to do based on the on/off conditions.

On Fri, 1 Nov 2002 10:47:43 -0500
DonPro [EMAIL PROTECTED] wrote:

 Hi,
 
 I have a form with a checkbox like so:
 input type=checkbox value=ON name=shipper_save
 
 When I submit, the value is always shown as ON regardless of whether
 I've checked the checkbox or not.  So this begets the question, How
 can I code my PHP form processing script to determine whether the
 checkbox was checked?
 
 Thanks,
 Don
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Tom Woody
Systems Administrator
NationWide Flood Research, Inc.
phone: 214-631-0400 x209
  fax: 214-631-0800

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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




Re: [PHP] How to get linefeed from textfields registered in mysql?

2002-10-28 Thread Tom Woody
While I am not exactly sure of everything you are asking I think I had
a similar problem...

You need to convert the \r to \n before you put it into the DB.


On Mon, 28 Oct 2002 19:30:15 +0100
Raymond Lilleodegard [EMAIL PROTECTED] wrote:

 Hi!
 
 I have made a guestbook to my website driven by php and mysql.
 
 But I don't know how to get the text as it is written in the textfield
 before it is sent to mysql. So is it possible to save the hits on
 enter in the database?
 
 Best regards Raymond
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Tom Woody
Systems Administrator
NationWide Flood Research, Inc.
phone: 214-631-0400 x209
  fax: 214-631-0800

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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




Re: [PHP] Plus sign changing to space in html form

2002-10-28 Thread Tom Woody
I did your little test and couldn't reproduce the problems you are
having. as+df gets returned correctly.

Test server: Apache 1.3.23-11 w/ PHP 4.1.2-7 (RH7.3 rpms)

On Tue, 29 Oct 2002 00:26:39 +0100
Stan [EMAIL PROTECTED] wrote:

 When i post a string containing plus sign with htmp form to a php
 scritp, the '+' is changed to space.
 e.g: i enter 'as+df' to a text input but $_POST[] returns 'as df'
 instead. It must be in php or apache configuration bcause i have this
 problem only on sytem with FreeBSD. On windows it works as expected.
 
 Know someone how could i make the '+' left intact? Please help.
 
 
 ?
 echo $_POST['test'];
 ?
 form actiom='test.php' method=POST
 input type=text value='' name=test
 input type=submit value='submit'
 /form
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Tom Woody
Systems Administrator
NationWide Flood Research, Inc.
phone: 214-631-0400 x209
  fax: 214-631-0800

Don't throw your computer out the window, 
throw the Windows out of your computer! 


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