[PHP] Re: I hate to do this - Parse error...

2002-07-27 Thread Chris Earle

I think the Parse error might actually be on the last line of your query (
the  .'; ).  I tested that on my page and if I put in the query, as is, it
gave me a parse error.  Without the ending .' it was okay though.

 function view_post($tid){
__
 $query = 'select forum_post.name, forum_post.time, forum_post.uid,
 forum_post.message, priv_user.username from forum_post, priv_user where
 forum_post.uid = priv_user.uid AND forum_post.tid = '.$tid.'; // HERE
__
 $result = mysql_query($query) or die(Query failed: $querybr .
 mysql_error());
 $num_results = mysql_num_rows($result);

 for ($i=0; $i  $num_results; $i++)
   {
  $row = mysql_fetch_array($result);
  echo $row['name'].'  '.date('jS-M-Y',$row['time']).'
 '.$row['username'].\nbr; // Parse error here - line 24
  echo $row['message'].\nbr;
  }

 }



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




[PHP] Re: How to UPDATE two MySQL Tables

2002-07-27 Thread Chris Earle

You can use REPLACE instead of making two separate queries (UPDATE and
INSERT) because it checks if it is there, and if it's not, then it adds it;
otherwise it updates it.  I think that's right ... but the SQL server's SQL
server is broken! (the irony!)

That won't solve all of your problems, but it might help.  Check up at
www.mysql.com on how to use REPLACE

Monty [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have two tables: member_basic and member_detail. When a member edits
their
 record, they can edit or add data for either table, but, the data stored
in
 member_detail isn't required, so, they can possibly leave these fields
 blank. By the way, both tables would be linked by a member id.

 Here's my dilemma: If they do fill in any fields associated with
 member_detail, I have to first see whether or not there's an entry in the
 member_detail table already for that user (based on member id number). If
 not, I then have to check ALL the form fields associated with this table
to
 see if any data was actually entered so I know whether or not to create a
 new record for the member in member_detail. If there is already an entry
for
 that member in member_detail, then I can just do a standard UPDATE.

 Now maybe this is how it has to be done, but, I was hoping there might be
an
 easier way to do this. It appears it's not possible to UPDATE a JOINed
table
 during a query, which is what I was hoping. I am trying to keep the DB
 efficient by keeping optional data that may be left empty in another
table,
 but, it's only making my life difficult, so, unless there's an easier way,
I
 may just combine all the fields into one table and be done with it.

 Sorry for the long-winded explanation. Any suggestion are greatly
 appreciated!

 Monty







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




Re: [PHP] Stopping Multiple Entries in mySQL DB

2002-07-27 Thread Chris Earle

do that plus with your insert, just do INSERT IGNORE .

John Holmes [EMAIL PROTECTED] wrote in message
01c2358a$bd729fc0$b402a8c0@mango">news:01c2358a$bd729fc0$b402a8c0@mango...
  I just want my Adding Into Database script to check if
  the Name/Country already exists, and if it does, it
  shouldn't be allowed.
 
  If some with
  Name : Jackson
  Country : USA
  exists in my DB, no one with same name/country should
  be able to add his name/country in the DB.

 Have your database handle that, not PHP.

 When you create your table, make the combo of Name and Country unique.

 CREATE TABLE your_table {
 Name VARCHAR(15),
 Country VARCHAR(15),
 UNIQUE Name_Country (Name, Country)
 }

 Then you can have Jackson, USA, Jackson, UK, Someone Else, USA,
 etc...just not the same combination at all.

 ---John Holmes...




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




[PHP] Combining Columns in MySQL for PHP

2002-07-27 Thread Chris Earle

I was wondering if there was any way to get MySQL to combine the specified
SELECT columns into one column.

i.e.,

SELECT COMBINE(column_1, column_2) As column FROM column_list;

Would give me the results of column_1 and column_2 simply by going through
column.

Is there any thing that does this in MySQL, or do I have to do this in PHP?
I've been searching mysql.com, but there search engine seems to be broken
and gives me errors frequently. :(



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




Re: [PHP] Combining Columns in MySQL for PHP

2002-07-27 Thread Chris Earle

Thanks for the reply, and I see that I didn't get specific enough (my fault!
sorry).

Here's what I want to take from:

+-+--+
| col_1| col_2 |
+-+--+
| 2.0| 6.8|
+-+--+
| 4.1| 8.9|
+-+--+

I want to do something like SELECT COMBINE(col_1, col_2) as col FROM
column_list ORDER BY col;

Which would give me:

+---+
| col |
+---+
| 2.0 |
+---+
| 4.1 |
+---+
| 6.8 |
+---+
| 8.9 |
+---+

CONCAT would only work if I want strings concatenated on the same row.  Is
there some way I can use JOIN to get what I want?

John Holmes [EMAIL PROTECTED] wrote in message
000201c235a7$59348560$b402a8c0@mango">news:000201c235a7$59348560$b402a8c0@mango...
  SELECT COMBINE(column_1, column_2) As column FROM column_list;
 
  Would give me the results of column_1 and column_2 simply by going
 through
  column.

 Use CONCAT() where you have COMBINE().

 ---John Holmes...




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




Re: [PHP] filling an array(2)

2002-07-26 Thread Chris Earle

   for($m=1;$m=5;$m++){
   $div_idd[$m]=${'row-sub' . $m . 'd'};
   }

I'm not sure if it will work, but you might try either using the
mysql_fetch_array($result); function and then refer to them by
$row[src1d]; or try $div_idd[$m] = $row-$$name; where $name = sub . $m
. d;  I'm not sure if that will work, but it might be worth a try.

--
Steve Buehler [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Ok.  That makes since.

 Thanks
 Steve
  At 04:20 PM 7/26/2002 -0500, you wrote:
 var names can only be letters, numbers, and underscores.
 
 Jim Grill
 Support
 Web-1 Hosting
 http://www.web-1hosting.net
 - Original Message -
 From: Steve Buehler [EMAIL PROTECTED]
 To: PHP [EMAIL PROTECTED]
 Sent: Friday, July 26, 2002 3:53 PM
 Subject: [PHP] filling an array(2)
 
 
   h.  Ok.  Can somebody explain this one?  Why won't it work
correctly?
  
   for($m=1;$m=5;$m++){
   $div_idd[$m]=${'row-sub' . $m . 'd'};
   }
  
   Can it not be done with a 3 parter?  The columns in the table that
$row
   gets, are sub1d, sub2d, sub3d, sub4d and sub5d.  Or is it the -
that is
   messing it up?  I have tried escaping them row\-\sub, but that
didn't
 work.
   What would I search for on the PHP site or where are directions
located
   that tells me how to use this type of putting a variable together.  It
   makes it hard to search for it if I don't know what it is called.
  
   Thanks
   Steve
  
  
   --
   This message has been scanned for viruses and
   dangerous content by MailScanner, and is
   believed to be clean.
   ow3
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
 
 
 
 --
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.
 ow3



 --
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.
 ow3




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




[PHP] Re: Quotes getting screwed up in form fields

2002-07-26 Thread Chris Earle

http://www.php.net/manual/en/function.stripslashes.php
Check that out, it might help.

Monty [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 If someone enters this into a field...

New York City

 and I need to re-display it in the field (if an error occurred, for
 example), this is what's in the field...

New York \

 I have another multi-line text field that I used quotes in and this
doesn't
 happen with that field, even though they are both being treated in the
same
 manner. What am I missing?




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




[PHP] Re: Table formatting

2002-07-26 Thread Chris Earle

You can do what he said or just put a separate loop inside the original
loop.

Depending on how you get the info, you can use either way (his would create
less overhead if you are just using the same TD info every row, otherwise
they're really the same because his way you'll have to create an array to
access later for multiple rows, or just do my way and have the loop access
the NEXT *3* (or whatever) items ...).

i.e.,
for (LOOP FOR TR)
{
for (LOOP FOR TD) {}
}

César aracena [EMAIL PROTECTED] wrote in message
001a01c234f0$a5e8ad80$28ed0dd1@gateway">news:001a01c234f0$a5e8ad80$28ed0dd1@gateway...
Hi all.

Last nite I've came across a problem I wasn't able to figure out by my
self. It's not difficult to make a loop that will make new *TABLE ROWS*
(tr) to show several DB objects in a nice way. what I need to do, is
to display 2 or maybe even 3 of this objects stored in a DB per table
row, separated in different *TABLE COLUMS* (td). how can I achieve
this? What I usually do is:

--
// DB QUERY
$query = SELECT * FROM table_name;
$result = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($result);

// NOW THE LOOP
for ($i=0; $i$num_rows; $i++)
{
 $row = mysql_fetch_array($result);
 echo tr;
 echo td;
 echo $row[whatever];
 echo /td;
 echo /tr;
}
--

but how can I get 2 or 3 columns displaying different db objects? A loop
inside a loop?

Thanks in advance,

 mailto:[EMAIL PROTECTED] Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621





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




[PHP] Re: problems with func_get_arg()

2002-07-26 Thread Chris Earle

It must simply be a bug (probably confusing the function doTitle by calling
it, it might thinking you're requesting its info the second pass? Don't know
why, but it's a possibility)...

James Nord [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 Using the following code snippet

 function doHead() {
 header(Last-Modified:  . gmdate(D, d M Y H:i:s,
 getlastmod()) .  GMT);
 if (func_num_args() == 2) {
   doTitle(func_get_arg(0), func_get_arg(1));
 }
 else {
   doTitle(func_get_arg(0));
 }

 if I pass 2 argument into the function then I get the following error
 *
 Fatal error*: func_get_arg(): Can't be used as a function parameter


 but passing 1 argument is ok as is using the following code with 2
arguments

 function doHead() {
 header(Last-Modified:  . gmdate(D, d M Y H:i:s,
 getlastmod()) .  GMT);
 if (func_num_args() == 2) {
   $a = func_get_arg(0);
   $b = func_get_arg(1);
   doTitle($a, $b);
 }
 else {
   doTitle(func_get_arg(0));
 }

 Is there a particualr reason for this or is it a bug? PHP/4.1.2 on
 Debian Stable (PowerPC)

 /James

 --
 Technology is a word that describes something that doesn't work yet.
 Douglas Adams






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




[PHP] Re: need help with unusual php/mysql/array manipulation script

2002-07-26 Thread Chris Earle

Ahhh, good old UO.  I remember GMing my taming, crazy what they've done to
the game since I've quit (120 skill, insane!).

I'm not completely sure of a few things about your question and I think that
I could help if you supply the answers to my questions.

Does one tamer's taming of an animal increase ALL animals by a generic
amount (i.e., John tames a cow for the first time, then Bill tames it,
then John tames a polar bear for the first time and, again, Bill retames
it; do both examples raise the requirement 9.8 points or is it based on the
animal)?

If it is generic the answer is simple, if not, it might get a little more
complicated.

Spam [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I run an online gaming fansite, and most people that
 visit my site want to know what would be best to raise
 their skill on.  I started a script which basically
 takes numeric data (0-120) and pulls the information
 they need from my database.  I got the easy part down,
 which you can see here:

 http://www.tamingarchive.com/main/whattotame.php

 The complete listing of everything within the database
 is listed here:

 http://www.tamingarchive.com/tameables/

 Basically, the script pulls the animals from the
 database based on their min value.  Problem is when
 multiple people use the same animal for skill.  If Joe
 tames it, it might be 59.1 required skill, but if Bob
 comes and retames it, it takes 63.9 skill (+4.9).  I
 need to be able to somehow add creatures into my array
 that I just pulled from the database with the
 necessary amount added to the min value and sort it
 all by the min value.  My desired output would be
 like this:

 Rat  -0.9
 Sewer Rat-0.9
 Cow  11.1
 Rat (2nd) 3.9
 Sewer Rat (2nd)   3.9
 Cow (2nd)15.9
 Rat (3rd)18.3
 Sewer Rat (3rd)  18.3

 My select statement just does multiple OR comparisons
 to see if adding the 2nd  3rd retame values to the
 min value will still put it within my desired range.
 The quality part of the script is just a comparison
 on the min value.

 I don't even know where to begin to add these modified
 values to my array.  I'm awful with arrays anyway.
 Any help would be greatly appreciated.

 sasha





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




Re: [PHP] calling user-defined php functions from a href tag

2002-07-26 Thread Chris Earle

You can make the radio button submit the form... or you can actually make
the link a form and make it an onClick scenario to submit data.  You can
simply do this like this (untested, but the idea works!):

SCRIPT LANGUAGE=Javascript
!--
function CallFunc(CallME)
{
document.NoOneReallyCares.FuncToCall.value = CallME;
document.NoOneReallyCares.submit(); // there might be one step I've
forgotten on this object
}
//--
/SCRIPT

FORM NAME=NoOneReallyCares ACTION=functions.php METHOD=POST
INPUT TYPE=hidden NAME=FuncToCall VALUE=
A HREF=javascript:void(CallFunc('functionnamehere'));
onMouseOver=window.status='function.php'; onMouseOut=window.status='';
/FORM

Michael [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...


 Hmm.

 Hey, Mathieu. Many thanks for the reply. However, I currently AM using a
 form. What I'm trying to get away from, is the two step process:

 1.  pick your option
 2.  click submit

 I'm trying to get a one-step process, where the user can click on a link,
 and that calls the function.

 JavaScript won't work, because it's client side, and can't be used to call
 a server-side php function (unless you tell me some neat trick I don't
 know about yet). See my struggle now?




 On Fri, 26 Jul 2002, Mathieu Dumoulin wrote:

  Date: Fri, 26 Jul 2002 21:46:00 -0400
  From: Mathieu Dumoulin [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] calling user-defined php functions from a href tag
 
  Easy
 
  Your form when pressed the button submit will send the data from the
form
  via post (Which is the best method) to the functions.php with all the
  functions. What you need to modify now is that all the input
type=radio
  need to be modified to FuncToExec name.
 
  When you receive the input of the form, you just verify what $FuncToExec
is
  and execute the correct function.
 
  ?php
 
  if($FuncToExec == joe){
  joe();
  }elseif(...){
  }
 
  ... (All functions in your file goes there)...
 
  ?
 
  Now what you also want to add is that if your JOE function is to return
  something, the IF ELSE calling that thing should intercept the value
  returned and this part of the script should either do something with
that
  value or just redirect the value to another script by GET mode:
 
  header(location: myresultpage.php?result=$result);
 
  There, sorted that out right?
 
  have fun
  insanecoder!
 
  Michael [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  
  
   Hi, Justin.
  
   Thanks very much for the reponse.
   Yeah, this is a SUPER simplified form of my question, so please don't
   expect it to make sense. Heh.
  
   Basically, I have a php file with dozens of functions in it. I want
ONE of
   them to get called when a link is clicked.
  
   Currently, I achieve this with the use of HTML forms. My form
generates a
   list of options. And the user has to select an option, then click the
   SUBMIT button.
  
   But I want to make it a one-step process, whereby the user only needs
to
   click on the option.
  
   Of course, you can't achieve this in a form with JavaScript, but the
   JavaScript code won't let me execute a server-side php function
   (obviously).
  
   And I don't want to just shoot the link off to another page (even
though
   that's what it was designed to do). I want to call a very specific
   function.
  
   Tricky, I know.   :(
  
   -- Michael
  
   On Sat, 27 Jul 2002, Justin French wrote:
  
Date: Sat, 27 Jul 2002 11:35:23 +1000
From: Justin French [EMAIL PROTECTED]
To: Michael [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP] calling user-defined php functions from a href
tag
   
on 27/07/02 12:09 PM, Michael ([EMAIL PROTECTED]) wrote:
   
 ?php
 function joe() {
 $temp1=10;
 $temp2=20;
 $result=$temp1+$temp2;
 echo The result of this function is:  . $result;
 }
 ?
   
wouldn't that be
   
return The result of this function is:  . $result;
   
rather than echo?
   
   
Anyhoo, you haven't specified HOW you want to communicate the result
of
  the
function to the browser.
   
A HREF is supposed to take you off to another page (amongst other
  things),
which might be what you're after.
   
JavaScript (*shudder*) is designed to provide client-side actions,
so
  maybe
a javascript alert is what you want, or a pop-up window, or who
knows
  what.
   
You need to decide what happens, in a story board fashion.
   
   
Remember, everything in PHP code takes place on the server, BEFORE
the
browser gets it.
   
   
Example of using JS alert:
   
HTML
?
function joe() {
$temp1=10;
$temp2=20;
$result=$temp1+$temp2;
return The result of this function is:  . $result;
}
?
A HREF=# onclick=javascript:alert('?=joe()?')calculate
foo/a
/HTML
   
but really, I can't understand why you wouldn't just do:
   

[PHP] Re: Traversing an appendable file

2002-07-22 Thread Chris Earle

I was thinking it was obvious because otherwise I'd have just been using
that and not even posted about the a/a+.  Using a works in the way that
it is supposed to (it starts at the end), but what I wanted was to use
append and then just append to anywhere in the file.

Currently to get that done I use file(filelocation); and then just search
that array for what I want.  Once I find it I save the key and then
concatenate what I want to that line.  Then after I've done that I implode
the array and w (write) that.   This of course works perfectly, but once
the file starts to get larger, I'm worried that it is going to become slow,
so I was looking for a way to append (which now that I think about it, would
do the same thing, only with less work on my part).

Richard Lynch [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 Is there any way to fseek (or something to the exact same effect) a file
 opened with a or a+?
 
 I've tried rewinding and fseeking appendable files, but neither work.
 
 Opening up in r+ gives me part of the desired result, but if where I
want
 to write is not at the end, it writes over things, which I obviously do
not
 want.

 It may be obvious to you that you don't want that, but it's not to anybody
 else :-)

 Use r+ and fseek to the end of the file.  You can use PHP's filesize
 (filelength?) function to find out where that is.

 I think a+ is only if you are promising not to go backwards into the old
 data...  Maybe it's for some kind of OS optimization or something...



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




[PHP] Re: Looked at documentation, should be fine

2002-07-22 Thread Chris Earle

$MailToAddress = [EMAIL PROTECTED];

No quotes around the e-mail address.


 $Message .= \n\n$HTTP_POST_VARS[Footer];
You left out quotes from Footer

Dean Ouellette [EMAIL PROTECTED] wrote in message
00b901c231e6$30300e10$9c89adac@yoda">news:00b901c231e6$30300e10$9c89adac@yoda...
 I am running this on php 3.0
 I have read every document I could find on the web, and cant figure out
 why this form submission is not working.

 No errors, just does not sent the e-mail to my account

 ?php
 If ('GET' == $HTTP_SERVER_VARS['REQUEST_METHOD']) {
   $MailToAddress = [EMAIL PROTECTED];
   $MailSubject = 'Get Involved List';
   }
 ?

 ?
 If ('POST' == $HTTP_SERVER_VARS['REQUEST_METHOD'])
   if (isset($HTTP_POST_VARS['email'])) {
 $MailFromAddress = $HTTP_POST_VARS['email'];
   } else {
 $MailFromAddress = '[EMAIL PROTECTED]';
   }

   $Message = $HTTP_POST_VARS['Message'];
   if (isset($HTTP_POST_VARS['Header'])) {
  $Message = $HTTP_POST_VARS['Header'] . \n\n$Message;
   }

   if (isset($HTTP_POST_VARS['Footer'])) {
 $Message .= \n\n$HTTP_POST_VARS[Footer];
   }

   mail($MailToAddress, $MailSubject, $Message, $MailFromAddress);
   ?




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




Re: [PHP] Re: does this mean ....

2002-07-22 Thread Chris Earle

r+ allows you to read and write... if that's what you wanted (I think it
is).  Note that it will write over any data that is behind the location of
the file pointer (so write to the end of the file).

Peter [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...


  -Original Message-
  From: David Robley [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, 23 July 2002 10:41 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Re: does this mean 
 
 
  In article [EMAIL PROTECTED],
  [EMAIL PROTECTED]
  says...
   hi all,
  
   I'm tring to make a script to prompt for a username  then a password
=
   for that user onto the actual machine rather than just a web site...
  
   now i've come across this this line in some documentation
  
   if ( $File =3D popen( $useradd_prog $useradd_name, r ) )
   {
   .
   .
   .
now to my actual question ..
  
   does that r just mean read? and if so should that r be a w for =
   write in order for it to work?
  
  
  
   Cheers=20
  
   Peter=20
   the only dumb question is the one that wasn't asked=20
   =20
 
  If you are just checking the name/password against an existing list,
then
  you only need read. If you want to add something, then you need a
  different mode.
 
  However, I think you may be better off uing fopen, instead of popen, if
  you are trying to do what I think you are. The documentation for
  fopen has
  a comprehensive description of the modes available; note that w is
kindof
  destructive in the wrong context :-)
 
  Cheers
  --
  David Robley
  Temporary Kiwi!
 
  Quod subigo farinam
 
 i'm tring to run the useradd command (under Solaris) to add a user to the
 system so i don't have to continueously remote log in and also make it
 easier for myself to add users to the system(s).. maybe popen isn't the
best
 option for this .. though i don't think fopen will be able to do what i
need
 it to do.. maybe playing around with sockets would be better?


 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] Re: include files and global variables

2002-07-21 Thread Chris Earle

Hmm.  Here's how you can make it load EVERYtime the file is included, plain
and simply.  In the include file, create the function.and the call it after
you've made it.  To get the other function to work, you might want to try
placing the function ABOVE checkMaster();
 (you should probably simply put that in the same file, but above it).
functions.php
?
function myfunction () {}

myfunction();
?

I have the feeling that the problem with the session variable is that you're
calling it before anything has been done to define it in the main page, so
it is null when you check it.  Try debugging it with echo statements here
and there that call out variables so that you know they're defined
correctly.  Also, turn on error_reporting(E_ALL); (you can simply call it
at the top of the page--first thing).  That will tell you when variables are
used if they're null and other errors that aren't fatal, but might cause
problems.

Jon Wyatt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 I have some pages which include a number of files.
 In one of the include files I have a function which I wish to be executed
 everytime the include file is loaded.

 Therefore I place the function name in the include file at the top.

 However, this function uses a session variable to decide whether to call
 another function and it appears that this variable is not being carried
 across. For example, the start of the include file might look like this:-


 ?php

 checkMaster();


 function checkMaster()
 {
 global $master_session;
 if ($master_session[db_host])
 {
 connectToDB();
 }
 }


 function connectToDB()
 {
 ...
 


 The master_session variable is not set and hence connectToDB is never
 called.
 If I place the checkMaster code in each page that includes this file then
it
 all works fine. How do I get round this?

 Thanks.

 jon.

 Better than having your body rubbed vigorously with a cheese grater.
 http://www.samuri.co.uk.


 _
 MSN Photos is the easiest way to share and print your photos:
 http://photos.msn.com/support/worldwide.aspx




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




[PHP] Here's how to fix it

2002-07-21 Thread Chris Earle

You have to use a FOR or WHILE loop.  PHP 3 doesn't supported the foreach
loop.

You can get identical results by using the examples here:
http://www.php.net/manual/en/control-structures.foreach.php

Dean Ouellette [EMAIL PROTECTED] wrote in message
000b01c230f5$7837aa70$9c89adac@yoda">news:000b01c230f5$7837aa70$9c89adac@yoda...
 I have a different host I use for my sites, this is one I took over, and
 they insist I use this hosting company, friend of an owner.  Have been
 trying to get to switch but wont.  So any ideas on how can get this to
 work, no text coming in email

 When I print_r($_POST) what does that do?)))
 I get

print_r shows everything in the array on the screen.

 print_r($_POST)
 Fatal error: Call to unsupported or undefined function foreach() in
 /www/docs/www.electjoemarine.com/email.php on line 71

  PHP Version 3.0.16
   ?
   $MailToAddress = [EMAIL PROTECTED];
   $MailSubject = Group volunteer  list;
   if (!$MailFromAddress) {
   $MailFromAddress = $email;
   }
   $Header = ;
   $Footer = ;
  
   foreach($_POST as $key = $val)
   {
   $val = stripslashes($val);
   $Message .= $key = $val\n;
   }
 
  What do you see when you:  print_r($_POST)

I believe it says Array ( $whatevertheKEYis = $theVALUE, $nextKEY =
$nextValue) on screen for it.  Basically, it makes it so you could copy and
paste it and create a replica of THAT array.  Mostly used for debugging.



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




Re: [PHP] Re: HTML E-mails

2002-07-21 Thread Chris Earle

 So most email programs suck.  Consider that Outlook and OE are the two
 single most popular mail clients in existance.  Then, once you've
 stretched out from the foetal position and stopped weeping
 uncontrollably, try to educate people about HTML mail :-).

Actually I enjoy my Outlook Express...

MIME-Version: 1.0\r\n
   .Content-type: text/html; charset=iso-8859-1\r\n

Is all that I add other than the default headers of From: and Reply (after
the MIME ...) and it works for me.

Also, not to start a flame war, but you might want to look at
http://abcnews.go.com/sections/scitech/TechTV/techtv_hackertargets020719.htm
l



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




Re: [PHP] Re: HTML E-mails

2002-07-21 Thread Chris Earle

All I add to my headers to make them work are:

MIME-Version: 1.0\r\n
   .Content-type: text/html; charset=iso-8859-1\r\n
.From: [EMAIL PROTECTED]\r\n
.Reply-To: $ReplyEmail);

I'm running Outlook Express and that works perfectly.



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




[PHP] Re: Smart ass form

2002-07-21 Thread Chris Earle

+++--+-+
| expid | devid | devlanguage | devtime  |
+++--+-+
|   1 | 1 | PHP | less than 1 year  |
|   2 | 1 | MySQL| less than 1 year  |
|   3 | 1 | HTML   | more than 5 years |
++--++-+

I'll use that as the template:

I'll assume that you know how to get the expid and devid in there and I'll
just put them in there as numbers.
? $devselect = SELECT NAME=\devtime[]\ SIZE=\1\
OPTION VALUE=\1y\Less than 1 year
OPTION VALUE=\5y\More than 5 years
etc
/SELECT;?

FORMTABLE
TR
THexpid/THTHdevid/THTHdevlangu/THTHdevtime/TH
/TR
!-- a loop will generate each new row --
TR
TD1/TDTD1/TDTD?=$LanguageName[$expid]?INPUT TYPE=Check?
if ($UserKnows[$expid]) { echo  CHECKED; }?
VALUE=language[]/TDTD?=$devselect?/TD
/TR
!-- this will end what the loop outputs --
TR
TD2/TDTD1/TDTD?=$LanguageName[$expid]?INPUT TYPE=Check?
if ($UserKnows[$expid]) { echo  CHECKED; }?
VALUE=language[]/TDTD?=$devselect?/TD
/TR
etc...
!-- here's the hardcoded extras --
TD-/TDTD1/TDTDINPUT TYPE=Text NAME=DevSetLang[]
VALUE=TD?=$devselect?/TD
etc..
/TABLE/FORM

Now you can access them by (I think) doing something like this:
if (!empty($_POST[language][0])) // (I think that check boxes give  if
they're not checked)
if (!empty($_POST[DevSetLang][0])) // you might consider making a separate
devselect variable for the text boxes, which will make it easier to check
(the array index will work easier)

I hope that that helps.




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




[PHP] Re: if $char == any form of white space

2002-07-21 Thread Chris Earle

If you want to use ereg just [:space:] ... I'm not too sure about what to do
with the Perl one.

Justin French [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 Is this the best way to check if a $char is ANY FORM OF WHITESPACE (space,
 \t, \r, \n, etc etc)?


 if(preg_match('/\s/', $char))
 {
 ...
 }

 ??


 Thanks
 Justin




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




[PHP] Traversing an appendable file

2002-07-21 Thread Chris Earle

Is there any way to fseek (or something to the exact same effect) a file
opened with a or a+?

I've tried rewinding and fseeking appendable files, but neither work.

Opening up in r+ gives me part of the desired result, but if where I want
to write is not at the end, it writes over things, which I obviously do not
want.



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




[PHP] Re: Sessions vs passing variables

2002-07-21 Thread Chris Earle

What do you mean by pass? Using a GET method, POST, COOKIE or are you trying
to do something else (other than SESSION)?

Mike Mannakee [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 When I try to pass a variable from one page to another the variable is
 completely inaccessible IF I have a session going.  The data has to be
 passed from one page to the next through the link, as the link tells which
 product the user hit.  Any thoughts?

 Mike Mannakee





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




Re: [PHP] Re: HTML E-mails

2002-07-21 Thread Chris Earle

What's so hard with stopping script kiddies (which is just about all you can
do with an e-mail to my knowledge -- aside from attachments).

In PHP or Perl you could easily write a script that kills ANY SCRIPT tags
and APPLET tags, as well as anything else that might pop up anything.  I
don't understand why no one just does that with C++, it's not even that hard
in that either (actually pretty easy because you just find the SCRIPT or
whatever tag and then delete everything until the end tag ... if that means
bye bye e-mail, then bye bye e-mail).  Is there some other flaw (other than
the awe-inspiring trust that of attachments that people have) that I don't
know about?

Maybe some day I might just have to work on something similar to this idea.



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




[PHP] Re: Redirect Question

2002-07-21 Thread Chris Earle

 Which versions of IE is somebody claiming can't handle a Location: header?

It's not version 6



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




[PHP] Re: Redirect Question

2002-07-21 Thread Chris Earle

 Which versions of IE is somebody claiming can't handle a Location: header?

And it's not version 4 (I'm assuming not 5(.5) either)



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




[PHP] Re: server performance

2002-07-21 Thread Chris Earle

I think that's entirely dependent on the server's OS.  If the OS has a
problem, then yes, obviously, otherwise I don't see a reason (unless there
is a bug) for significant speed loss.
Eat Pasta Type Fasta [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Not exactly a PHP question, but you guys will know,

 is there a significant performance difference in how long does it take a
 server to find files as the directories become more nested,

 eg.

 1. file index.php uses images from directory DIR

 vs.

 2. file index.php uses images from directory images/DIR

 vs.

 3. file index.php uses images from directory files/images/DIR

 Thanks in advance,

 R



 --__-__-__
 eat pasta
 type fasta




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




[PHP] Re: NOT an easy upload

2002-07-21 Thread Chris Earle

function pic_upload($userid)
{
if (is_uploaded_file($_FILES['devpicture']['tmp_name']))
{
$filename = $_FILES['devpicture']['tmp_name'];
$realname = $_FILES['devpicture']['name'];

$username = $userid..jpg;

copy($_FILES['devpicture']['tmp_name'],
c:/apache/htdocs/os-seek/photos\\.$username);
$username;
}
else
{
echo Possible file upload attack: filename
.$_FILES['devpicture']['name']..br;
}
}

---
and then the updating
---

pic_upload($id);

$query = UPDATE os_developers SET devpicture = '$username' WHERE devid
= $id;
$result = mysql_query($query) or die(mysql_error());

I don't exactly know what is wrong, but I can definitely tell you that you
have two gaping security holes with this code.  Unless you're doing checks
that you did not show (which is highly likely), $username and $id can be set
to anything.  I'm not exactly sure how important/unimpornant some of that
stuff is, but you might want to make sure you kill off MySQL comment code
inside there and other possible exploits.

The other problem with your code is that you're not debugging it.  Set up
echo statements here and there to make sure variables are defined as you
think they are, that's the biggest mistake I see myself and others make, not
defining variables as I think I am.



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




[PHP] Oh, the problem

2002-07-21 Thread Chris Earle

It appears that $username isn't being defined within the scope of the query.
You define it only in the function.

Try do this instead:

$username = ;

function pic_upload($userid)
{
global $username;
//... the rest of the code
}
// now do the queries and everything else.

I think that will fix your problem.

César aracena [EMAIL PROTECTED] wrote in message
000301c23129$aebbab30$adc405c8@gateway">news:000301c23129$aebbab30$adc405c8@gateway...
Hi all. I'm trying to handle a picture upload. So far, I've made my
script store it where I want with the name I want. The only problem now,
is that it should store that given name into a MySQL DB table. I tried
it by calling a function which stores the picture and returns a variable
called $picname then use an UPDATE statement but that variable isn't
passed. any ideas? The code looks like this:

function pic_upload($userid)
{
if (is_uploaded_file($_FILES['devpicture']['tmp_name']))
{
$filename = $_FILES['devpicture']['tmp_name'];

$realname = $_FILES['devpicture']['name'];

$username = $userid..jpg;

copy($_FILES['devpicture']['tmp_name'],
c:/apache/htdocs/os-seek/photos\\.$username);

$username;
}
else
{
echo Possible file upload attack: filename
.$_FILES['devpicture']['name']..br;
}
}

---
and then the updating
---

pic_upload($id);

$query = UPDATE os_developers SET devpicture = '$username' WHERE devid
= $id;
$result = mysql_query($query) or die(mysql_error());

Thanks in advance,

Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621






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




Re: [PHP] Oh, the problem

2002-07-21 Thread Chris Earle

Sure thing.  Always love to help.

-Chris


César aracena [EMAIL PROTECTED] wrote in message
001801c23136$6748bb50$adc405c8@gateway">news:001801c23136$6748bb50$adc405c8@gateway...
Chris. Thanks for living me a hand in such a fast way. It helped me
fine.

César.

 -Original Message-
 From: Chris Earle [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 12:51 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Oh, the problem

 It appears that $username isn't being defined within the scope of the
 query.
 You define it only in the function.

 Try do this instead:

 $username = ;

 function pic_upload($userid)
 {
 global $username;
 //... the rest of the code
 }
 // now do the queries and everything else.

 I think that will fix your problem.

 César aracena [EMAIL PROTECTED] wrote in message
 000301c23129$aebbab30$adc405c8@gateway">news:000301c23129$aebbab30$adc405c8@gateway...
 Hi all. I'm trying to handle a picture upload. So far, I've made my
 script store it where I want with the name I want. The only problem
now,
 is that it should store that given name into a MySQL DB table. I tried
 it by calling a function which stores the picture and returns a
variable
 called $picname then use an UPDATE statement but that variable isn't
 passed. any ideas? The code looks like this:

 function pic_upload($userid)
 {
 if (is_uploaded_file($_FILES['devpicture']['tmp_name']))
 {
 $filename = $_FILES['devpicture']['tmp_name'];

 $realname = $_FILES['devpicture']['name'];

 $username = $userid..jpg;

 copy($_FILES['devpicture']['tmp_name'],
 c:/apache/htdocs/os-seek/photos\\.$username);

 $username;
 }
 else
 {
 echo Possible file upload attack: filename
 .$_FILES['devpicture']['name']..br;
 }
 }

 ---
 and then the updating
 ---

 pic_upload($id);

 $query = UPDATE os_developers SET devpicture = '$username' WHERE
devid
 = $id;
 $result = mysql_query($query) or die(mysql_error());

 Thanks in advance,

 Cesar Aracena
 CE / MCSE+I
 Neuquen, Argentina
 +54.299.6356688
 +54.299.4466621






 --
 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] Re: Using Javascript

2002-07-21 Thread Chris Earle

You use the onClick feature like this:

input type=text name=text1 onClick=dd.value='? echo $correct; ?'
no semicolon unless there is more than one thing being called/defined -- you
use single quotes within the onClick's double quotes

Uma Shankari T. [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Hello,

  I need to display a value on the text box during onClick event where the
 data is fetched from the database..I have given the code like this but it
 is giving unterminated string constant..


 input type=text name=text1 onClick=(dd.value=? echo $correct; ?);


 Can anyone please tell me how to solve this ...


 Thanks  Regards,
 Uma




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




Re: [PHP] Cookies - good or bad???

2002-07-21 Thread Chris Earle

Can't you say that about anything?

Scott Fletcher [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I don't use cookies either due to the fact that some web browser block the
 cookies and some web browser's bug that affected the cookie.  For example,
 if Internet Explorer have a bug with the cookie then it is gurantee that
 you'll never find MS to have this bug fix in a few days.  It could take 6
 months or a year.  So, what's the point with using hte cookie?

 Analysis  Solutions [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  On Thu, Jul 18, 2002 at 03:38:51PM +0200, PHPCoder wrote:
 
   What are the general feeling out there amongst developers about the
use
   of cookies?
 
  Cookies rely on client side.  I never rely on the client for anything.
 
  When it comes to examples of how to do things The Right Way, I say go
  take a look at amazon.com.  No cookies.  No Java'sCrap.  Works
flawlessly.
 
  --Dan
 
  --
 PHP classes that make web design easier
  SQL Solution  |   Layout Solution   |  Form Solution
  sqlsolution.info  | layoutsolution.info |  formsolution.info
   T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
   4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409





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




[PHP] Re: html entry within XML database

2002-07-21 Thread Chris Earle

You can of course use htmlspecialcharacters (check php manual if you don't
know what this is) and then it will kill every thing that generates errors.

William S. [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am experimenting with using an XML file as a
 database. One of the things I do is provide
 a way of adding records to the database by an
 html form.

 This seems to work out well so far unless one
 of the fields in a record contains an html
 reference. The result is a Sablotron parse error.

 What is the best way around this? Should I
 validate the form before it is submitted so that
 html references are rejected? How would I do this?

 --
 Bill
 Amsterdam, NL



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




[PHP] Re: how can this be? GET instead of POST - db error

2002-07-21 Thread Chris Earle

The person could have been trying to break into the DB.

Andy [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi everybody,

 I am just trying to find out how some db errors happened during a user was
 browsing my web app.

 This is out of the Apache log:

 GET /subapp_profiles/act_upload_image.php HTTP/1.1 200 160
 POST /subapp_profiles/act_upload_image.php HTTP/1.1 302 5

 I do not have a clue where this GET request could come from. This has
caused
 a empty sql statement and therefore a db error. How can could this be
 achieved? By clicking back in the browser window? I dont think so since
the
 same user was on another site before.

 Has anybody a idea on that?

 Andy





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




Re: [PHP] Re: if syntax

2002-07-12 Thread Chris Earle


Mike Ford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  -Original Message-
  From: Chris Earle [mailto:[EMAIL PROTECTED]]
  Sent: 11 July 2002 18:28
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Re: if syntax
 
 
   when it would be just as easy, and more functional, to
  write this (even
   saves a few characters, too!):
  
  if (x):
 while (y):
...
 endwhile;
 ...
  endif;
 
  You're adding characters...
 
  { + } opposed to : + endif;

 No, no, no!  Look again -- I was contrasting this with:

if (x) {
   while (y) {
  ...
   } // end while
   ...
} // end if

 which I see quite often in other people's scripts.

 Then the difference is  { and } // end if as opposed to : and
 endif;, and indeed you are saving characters -- and it's more
functional,
 because the PHP processor is getting to check the end* statements match
the
 correct block opener, rather than just matching back to the next unclosed
 { regardless of whether it's on an appropriate block opener or not.  To
 me, this is such a huge advantage that I just can't understand why people
 insist on sticking with the all-braces style, and that's regardless of the
 fact that I just think it's more readable.

Oh, just as the other guy said, I don't comment my braces because I tab in
everything evenly (each if is another tab with the nested code tabed one
further).  I do comment my functions end braces because they can get pretty
big and they're all at the same level of tabbing.

I think that most people (like me) use it because of their backgrounds in
other programming languages.  I learned PHP after I was doing a lot of C++
work ... so it came very naturely.

 Cheers!

 Mike

 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211



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




Re: [PHP] Re: if syntax

2002-07-12 Thread Chris Earle

  PHP will tell you you have a syntax error on the very last
  line of your
  file, and you have no option but to go back and laboriously
  hand match all
  of your braces -- and with each ellipsis representing maybe
  tens (or even
  hundreds!)
 
  Don't be ridiculous.  Any decent editor will tell you where
  the missing { or
  } is.  No need to search for it by hand.

 Well, yes, but not the full story.  If the only clue you have is that
 there's probably a brace missing somewhere in the 600 lines of your file,
 and some of your structures nest 7 or 8 levels deep, that's still an awful
 lot of braces that you potentially have to check for matching partners,
even
 with a helpful editor to ease the task.  (And we know that some people
don't
 have helpful editors -- just look at the requests in this list for
 recommendations!!)  If, on the other hand, you get a parse error at line
234
 in one of the deeper levels of nested structures, your search is
immediately
 much more focussed.  This is just a plain fact, surely...?

I've never had a problem where it didn't give me a close estimate to where
the { or } was missing.  And I'm one of those ill-suited NotePad guys
(my Visual Studio copy is at work and I reformatted this computer recently).
:)

  Not to mention that if you've indented properly, it's trivial
  to find it,
  even in something as ill-suitable for Programming as NotePad.

 Ah, indeed -- but, again, not everyone indents properly!!

I'm not sure that's a fair argument to make because you can say the same
thing about code with the if (exp): endif; code, I'm sure a lot of people
use it's simplicity (I do use it on occasion, but I indent like { }) and
then don't indent.

  Now PHP will throw an error at the endwhile, because it
  knows there's an
  endfor missing -- and you've already cut out a large chunk
  of your code to
  check; better yet, as you're checking you can see at a
  glance what each
  end should be matching.  And every end has to be there, too -- no
  cursing yourself for that lazy day when you left out a few
  comments on some
  unimportant closing braces!
 
  None of my closing braces have comments.  I never have a problem with
  missing ones.

If I miss one the PHP parser gives me a big enough clue for me to find it
within 30 seconds.  I can definitely understand that though and I bet that
that is easier, especially in harder to read, uncommented code (that's a
general statement, not a shot at anyone).

 You must have much keener eyesight than me, then.  I often have difficulty
 telling which } lines up under which { (when I'm reading code written in
 that style, that is!), especially if they're on different pages of a
 listing.  When I code in a braced language, I *always* comment my closing
 braces for this reason.   Even in PHP using end* statements, I often add
 comment to tell me *which* if an endif matches, just to be sure.  (I
do
 the same in VB, too!)

I've got the same idea as him, but I wear glasses (not bad vision though ...
next up from 20/20).  I never added VB comments to my End If statements, I
might comment inside about what's going on, but never what's being matched.
I have the feeling your code is very readable, which is a good thing, but I
like my way for my own selfish reasons (much of which cannot be explained to
mere mortals!).

  YMMV.

 I guess.  But I think other people's probably varies more, and the number
of
 occasions on this list when I think but if you'd used alternative syntax
 style you'd *know* where the problem was grows by the week.

You're probably right, but it is a religious and huge experience thing.
I've been working with { } for quite, especially a while outside of PHP and
I rarely have a problem (except when moving to ASP ... that normally takes a
quick relearning curve because of the VB syntax).

 Oh dear, I see I've got into rant mode once more.  Right, I'll shut up
now,
 and that really will be my last word on the topic.  Well, at least until
 someone else brings it up again.

Oops.

 Cheers!

 Mike


-Chris



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




Re: [PHP] Re: if syntax

2002-07-11 Thread Chris Earle

 when it would be just as easy, and more functional, to write this (even
 saves a few characters, too!):

if (x):
   while (y):
  ...
   endwhile;
   ...
endif;

You're adding characters...

{ + } opposed to : + endif;

Don't go for the fuzzy Math from the Al Gore campaign!



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




Re: [PHP] Editing files by line

2002-07-11 Thread Chris Earle

Cool thanks, that probably will make my code execute a decent bit faster (as
the file gets larger).

But the array_search function never works for me (don't know why, I know
exactly what I'm searching for and that it is there), so I made my own
function..

//Find and return first occurance of a string ($Find) in any line of
$LineArray
function FindKey($LineArray, $Find)
{
 foreach($LineArray as $key = $value)
 {
  if (ereg($Find, $value))
   return $key;
 }

 return FALSE;
} // END OF FindKey(...);

I think this combined with your code should help me a lot, thanks a ton.

Analysis  Solutions [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Thu, Jul 11, 2002 at 02:11:30PM +1000, Martin Towell wrote:
  From: Chris Earle [mailto:[EMAIL PROTECTED]]
 
  I was wondering if there was a function that would allow me to jump
  to a certain line if a file and then write from there?  I'm searching
  php.net without any luck :(.
 
  I dodn't know of any single function that does what you want, but you
can do
  this:
 
  $contents = file($filename);  // each line has it's own array position
  $contents[$line] = $newline;

 That's nice, except you could start overwriting existing data.

 If you're only interested in appending to the end of a file, then use
$fp = fopen('filename', 'a+');
 and fputs() all you want.

 But, if you want to stick stuff into the middle...

#  Real process uses file(),
#  but for test, set Content manually.
$Content[] = 'The start of the content array.';
$Content[] = 'Some more stuff.';
$Content[] = 'And yet more stuff.';

$Location = array_search('Some more stuff.', $Content);

$New[] = 'Why, here is some new stuff';

$Final = array_merge(
   array_slice($Content, 0, $Location + 1),
   $New,
   array_slice($Content, 0 - (count($Content) - $Location - 1))
);

#  In your process, you'll really want to insert
#  implode('', $Final)  into the file with fputs(),
#  but, hey, this is a demonstration.
print_r($Final);


 --Dan

 --
PHP classes that make web design easier
 SQL Solution  |   Layout Solution   |  Form Solution
 sqlsolution.info  | layoutsolution.info |  formsolution.info
  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409



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




[PHP] Re: MAIL() Trouble. Need your eyes.

2002-07-11 Thread Chris Earle

What's the error message?

Shane [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Greetings, I am attempting to send an HTML based email using the Mail()
function in PHP.

I am having great luck until I include an OBJECT or EMBED tag in the HTML
string.

I am running PHP 4.2.1 on a WIN NT client.

If I uncomment the OBJECT or EMBED lines below in the $message variable, my
script errors out on the MAIL() call at the bottom.

Please, any help would be appreciated.
Thanks folks!

- NorthBayShane
-
?PHP
$myname = Me Myself;
$myemail = [EMAIL PROTECTED];
$myreplyemail = [EMAIL PROTECTED];
$contactname = Mister Contact;
$contactemail = [EMAIL PROTECTED];

---
MY VERY LONG $MESSAGE STRING
---

$message = htmlheadtitle/title;
$message.= meta http-equiv='Content-Type' content='text/html;
charset=iso-8859-1'/head;
$message.= body bgcolor='#54616E' text='#FF' link='#FF6600'
vlink='#99' alink='#FF9900';
$message.= centertable width='501' border='0' cellspacing='0'
cellpadding='0'trtd width='500'
background='http://www.delaplaine.net/flashmail/noflash.gif';

--
HERE IS WHERE THE TROUBLE STARTS
IF I UNCOMMENT THE OBJECT OR EMBED TAG
THE SERVER ERRORS OUT ON MY MAIL() CALL
--

//$message.= pobject
classid='clsid:D27CDB6E-AE6D-11cf-96B8-44455354'
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=5,0,0,0' width='500' height='300'param name=movie
value='http://www.delaplaine.net/flashmail/delaplaine.swf'param
name=quality value=highparam name=menu value=falseparam name='BGCOLOR'
value='#54616E';
//$message.= embed
src='http://www.delaplaine.net/flashmail/delaplaine.swf' quality=high
pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_
Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500'
height='300' bgcolor='#54616E'/embed;
//$message.= /object/p;

--
HERE IS WHERE THE TROUBLE ENDS
--
$message.= /td;
$message.= td bgcolor='#54616E'img
src='http://www.delaplaine.net/flashmail/spacer.gif' width='1'
height='300'/td/tr;
$message.= trtd align='center'pbr/ppfont face='Verdana, Arial,
Helvetica, sans-serif' size='1'a
href='http://www.delaplaine.net/extranet/fm.php?sec=newid=noflash'Click
here/a if you cannot see the animation above./font/ppfont
face='Verdana, Arial, Helvetica, sans-serif' size='1' color='#99'copy;
Copyright 2002, Delaplaine Creative.br All rights
reserved./font/p/tdtd align='center'nbsp;/td/tr;
$message.= /tablepnbsp;/p/center;
$message.= /body/html;

$subject = FlashMail Test;
$headers = MIME-Version: 1.0\r\n;
$headers.= Content-type: text/html; charset=iso-8859-1\r\n;
$headers.= From: .$myname..$myemail.\r\n;
$headers.= To: .$contactname..$contactemail.\r\n;
$headers.= Reply-To: .$myname.$myreplyemail\r\n;
$headers.= X-Priority: 1\r\n;
$headers.= X-MSMail-Priority: High\r\n;
$headers.= X-Mailer: Just My Server;

mail($contactemail, $subject, $message, $headers);

?



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




Re: [PHP] Dos Paths

2002-07-10 Thread Chris Earle

By Winblows does that mean you think Windows blows or that you guys don't
have a compiler for Windows?

Borland gives out a free C++ compiler for Win...

If you're running Linux, then get gcc/g++, it's free.

Bb [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 It doesn't matter how fast it does it.  It matters what language it does
it.
 C and C++ are a big no no as our company doesn't have a compiler
(winblows).

 Thanks for the pointer

 David Otton [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  On Wed, 10 Jul 2002 13:14:44 +0100, you wrote:
 
  I've got an application that requires dos folder names (8.3 standard)
as
  input.
  
  I also have PHP, which quite happily can cope with both.
  
  Can someone help me write a function to translate full paths to dos
paths
 
  You may have to drop down to C/C++ and ask the OS to lookup the short
  version of the path for you (GetShortPathName and GetShortPathNameW).
  But if you want to do it by hand, Knowledge Base article Q142982
  might be a place to start.
 





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




[PHP] Security with XML

2002-07-10 Thread Chris Earle

I've created a db like system with XML and PHP, and I want to require a
username/password to change the contents of the file.

How should I go about documenting the username/password?  The contents of
the site aren't really all to important (no financial info or anything like
that, mostly just links actually), but I don't want someone's information
stolen because someone found the users.xml file and opened it.

Running on a Windows 2k server with IIS5.



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




[PHP] Appending to a file

2002-07-10 Thread Chris Earle

I'm just curious if there's a function that allows you to see how many lines
there are in a file.  I could just set up a while(!feof($fp)) { fgets($fp);
count++; } obviously, but I'm curious if there's a function built in like
flines($fp) that I haven't noticed at php.net?



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




[PHP] Look below

2002-07-10 Thread Chris Earle

There's a bunch of headers below that have been replied to... some still
have his information inside.



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




[PHP] Re: help pls..

2002-07-10 Thread Chris Earle

I'd create an array that held the Change value (0 [false] or 1 [true]) for
each. Then I'd make a loop that just set up the table with an if statement:
if ($Change[$count]) { echo $bg; }.  $Change[0] would correspond with ph1,
unless you started the array(1 = ...).

Peter [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 howdy all

 my aim is to have a user submit a form and then from there replace cell
colours with in a table. I'm referencing the cells by cell id's  eg

 tr
   td height=10 bgcolor=? echo $bg; ? id=ph1font size=-2
face=Arial, Helvetica, sans-serif1/font
   /td
   td height=10 bgcolor=? echo $bg; ? id=ph2font size=-2
face=Arial, Helvetica, sans-serif2/font
   /td
   td height=10 bgcolor=? echo $bg; ? id=ph3font size=-2
face=Arial, Helvetica, sans-serif3/font
   /td
   td height=10 bgcolor=? echo $bg; ? id=ph4font size=-2
face=Arial, Helvetica, sans-serif4/font
   /td
 /tr

 now using a switch statement eg

 switch( $bg )
   {
 case red:
 print( #FF );
 break;
 //a few more colours in here
 default:
 print( #FF );
 break;
   }
 what would be the best way to tell it what  cell colours to replace on
submit would it be an if, for or a do/while statement that would be the
better option ( or any others that  4 that matter) if i wanted to have just
the cells with the ids of ph2  ph3 to be changed?


 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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread Chris Earle

Ya, I did it with ASP (customer requested) about 2 months ago...

Chris Hewitt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Craig,

 Its not PHP but HTML. I do this for a client. Make a Word document as
 needed, save it as rtf. Put a link onto my html page calling a
 particular routine. The routine reads the .rtf file, looking for
 replaceable parameters, replacing them with the customised values for
 this customer and saves the file under a new name indicating it is for
 this customer (still .rtf).

 A new page has a link to this new file. When the user clicks it, as
 their browser has the mime type for .rtf set to MS Word, Word starts up
 and opens the file.

 OK, in the application I did this in I used pl/sql (as the database was
 Oracle and there was no php) but there is no reason why you should not
 write a php routine to replace the parameters and resave the file.

 HTH
 Chris

 Craig wrote:

 I know that php can open files.
 What I was wondering is if it can :-
 Start Word
 Open a Word template
 Generate fields in the template based on hidden fields and generate the
page
 





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




Re: [PHP] Security with XML

2002-07-10 Thread Chris Earle

Are you telling me that you cannot look at
37b51d194a7513e45b56f6524f2d51f2 and see that the is the same as bar?
... Just kidding.

Thanks for the tip, that makes a lot of sense.

Andrew Chase [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You could store passwords as MD5 hashes which of course is NOT really
 encryption, but it would obfuscate the users' passwords.  They would still
 be vulnerable to social engineering (Hmm, I'll try his wife's name, then
 his dog's name, then his phone#, etc) and brute force (I'm going to run
 every word in the pspell dictionary through MD5 and see if anything
 matches) attacks, but it would be better than plain text, at least.

 So, instead of

 user
 nameFoo/name
 passwordbar/password
 /user

 you would have
 user
 nameFoo/name
 password37b51d194a7513e45b56f6524f2d51f2/password
 /user

 When 'Foo' tries to log in, you would just use MD5() on the password he
 entered in the web form and compare it to the value in the XML file.  If
it
 matches, he's in... otherwise, it's not the right password.

 I'm sure others will come up with more secure ideas, but anything is more
 secure than passwords in plain text. :)

 -Andy

  -Original Message-
  From: Chris Earle [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, July 10, 2002 9:42 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Security with XML
 
 
  I've created a db like system with XML and PHP, and I want to require a
  username/password to change the contents of the file.
 
  How should I go about documenting the username/password?  The contents
of
  the site aren't really all to important (no financial info or
  anything like
  that, mostly just links actually), but I don't want someone's
information
  stolen because someone found the users.xml file and opened it.




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




Re: [PHP] SQL field problem

2002-07-10 Thread Chris Earle

I'd make another array that I can refer to and check for a value from the
original query (which with a huge array could become cumbersome, but it
doesn't look like you have will have too many duplicate names).  Every time
you come across a new value, add it to the 2nd array (if it's not new, then
don't add it), then put the pointer of the array back to the start.  Return
whether it was added or not, if it was added, then return 1 (true -- you can
display that word), or else return 0 (false -- it was already in the list
and thus has been displayed).

Of course you might not want to do this if both arrays are going to become
huge (if the first is going to be like 1 long, but the 2nd is only 4
long then it might still be slow).  I believe there is a SQL Query that can
cancel out duplicates for you.

Ed Lazor [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You can refer to fields by their number.

 $Row[3];

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 10, 2002 10:40 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] SQL field problem


 Hello

 I have a problem with mysql.I create a table with a field kat.In this
 field are entries like this :

 Light
 Dark
 Dark
 Light
 Robot
 Find
 Dark
 Light

 You see that all entries are not unique.So i want to list as output all
 entries but only once.If the word Dark is in the table 6 times php
should
 output dark only 1 time.
 How should i solve this problem ?

 Thanks!
 chris



 This message is intended for the sole use of the individual and entity to
 whom it is addressed, and may contain information that is privileged,
 confidential and exempt from disclosure under applicable law.  If you are
 not the intended addressee, nor authorized to receive for the intended
 addressee, you are hereby notified that you may not use, copy, disclose or
 distribute to anyone the message or any information contained in the
 message.  If you have received this message in error, please immediately
 advise the sender by reply email and delete the message.  Thank you very
 much.



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




Re: [PHP] SQL field problem

2002-07-10 Thread Chris Earle

Martin's post is what you want... knew there was a query (just couldn't
remember it).


Chris Earle [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'd make another array that I can refer to and check for a value from the
 original query (which with a huge array could become cumbersome, but it
 doesn't look like you have will have too many duplicate names).  Every
time
 you come across a new value, add it to the 2nd array (if it's not new,
then
 don't add it), then put the pointer of the array back to the start.
Return
 whether it was added or not, if it was added, then return 1 (true -- you
can
 display that word), or else return 0 (false -- it was already in the list
 and thus has been displayed).

 Of course you might not want to do this if both arrays are going to become
 huge (if the first is going to be like 1 long, but the 2nd is only 4
 long then it might still be slow).  I believe there is a SQL Query that
can
 cancel out duplicates for you.

 Ed Lazor [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  You can refer to fields by their number.
 
  $Row[3];
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, July 10, 2002 10:40 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] SQL field problem
 
 
  Hello
 
  I have a problem with mysql.I create a table with a field kat.In this
  field are entries like this :
 
  Light
  Dark
  Dark
  Light
  Robot
  Find
  Dark
  Light
 
  You see that all entries are not unique.So i want to list as output all
  entries but only once.If the word Dark is in the table 6 times php
 should
  output dark only 1 time.
  How should i solve this problem ?
 
  Thanks!
  chris
 
 


  This message is intended for the sole use of the individual and entity
to
  whom it is addressed, and may contain information that is privileged,
  confidential and exempt from disclosure under applicable law.  If you
are
  not the intended addressee, nor authorized to receive for the intended
  addressee, you are hereby notified that you may not use, copy, disclose
or
  distribute to anyone the message or any information contained in the
  message.  If you have received this message in error, please immediately
  advise the sender by reply email and delete the message.  Thank you very
  much.





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




Re: [PHP] Script File Permissions

2002-07-10 Thread Chris Earle

That clever guy is my brother, so I know what buttons to push.

I actually got the ability to be able to edit files through my scripts, so
it does work.  Thanks for the help/input!

Alberto Serra [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 ðÒÉ×ÅÔ!

 Chris Earle wrote:
  Thank you for the reply (I don't speak or read Russian if that's what
that
  other stuff is).
 It is, but it's nothing more than hello and my signature, so you did
 not miss any basic content :)

  I forgot to mention that the server is a Win2k server with
  IIS 5 running.  Obviously I'm not the server admin (otherwise I would be
  using Apache).
 Dunno. Never had that running myself. BUt as far as I can remember Ms
 security should be directory based. So the guy actually *might* allow
 you writing somewhere if you can convince him that it would show how
 clever he is ;)

  I hope that I can get permissions, but I bet you're right.  Probably
just
  have to create a database, which I planned on doing (and know how to).
I
  really did want to use XML though, oh well.

 Besides, sooner or later you might need to just log events out to a flat
 file, right?

 ÐÏËÁ
 áÌØÂÅÒÔÏ
 ëÉÅ×


 @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@

 LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
 lOrD i'M sHiNiNg...
 YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
 tHe TeSt, YeS iT iS
 ThE tEsT, yEs It Is
 tHe TeSt, YeS iT iS
 ThE tEsT, yEs It Is...




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




Re: [PHP] sigh... forms

2002-07-10 Thread Chris Earle

I don't have time to actually make the function for you, but I know it could
be easily done with a single function and a double for loop, which could go
through an two-dimensional array of the questions (first element), answers
(next group except last), and the right answer (last element).

basically:

$ArrCount = count($Question);

for ($Counter = 0; $Counter  $ArrCount; $Counter++)
{
$Que = $Question[$Counter][0];
$SecArrCount = count($Question[$Counter]);
// SecArrCount should be the number equal to the last element (answer)
?SCRIPT LANGUAGE=Javascriptfunction CheckAnswer() {var RightAnswer
= $Question[$Counter][$SecArrCount]; }/SCRIPT?
for ($AnsCount = 1; $AnsCount  SecArrCount; $AnsCount++):
?!--Write the HTML code with the PHP variables
($Question[$Counter][$AnsCount]) placed where they're needed--?
endfor;
$AnsCount++;
}

The other loop would then generate a table row kind of like this:

TRTD
SCRIPT LANGUAGE=Javascript...
function CheckAnswer(str)
{
var Answer = ?=$Question[$Counter][$LastElementNum]?
if (
}
/SCRIPT...
$Question[$Counter][0]..BR..INPUT.. onChange=CheckAnswer(this.value)
or SELECT..options...
onClick=CheckAnswer(this.value)/SELECT../TD../TR..

I didn't check to see if any of that stuff worked, but it should give you a
basic idea of what I mean.


In response to one of your e-mails to me (for some reason I cannot send
e-mail right now, but I can post in here): RE: [PHP] Generating word
documents based on fields in a browser

I would think so, and with all of the functions with PHP it might be easier.



I had some trouble making up a template language in ASP, but in PHP it would
be quite easy because of the vast amount of built-in functions.  You might
be able to fiddle with the exec(); function to start up programs on a
Windows server, but don't take my word for it.



Henning Sittler [EMAIL PROTECTED] wrote in message
FBA86B8BA4D6D411BC2A0002B323D39A019408D4@MAIL2">news:FBA86B8BA4D6D411BC2A0002B323D39A019408D4@MAIL2...
 Speaking of forms, and I'm sure lots have asked this before me, but anyone
 know anywhere I can go to see some examples or existing code for
 automatically generating and and validating dynamic forms?

 Wait though, I'm already doing this myself.  To explain further, what I
 really want is an abstract set of php functions to say, ok, I want another
 form with say 10 questions, and I want to define each question and set of
 possible answers (input types and ranges) manually, and have the action
 script automatically check that the input types and ranges for each
question
 are valid.



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




[PHP] Editing files by line

2002-07-10 Thread Chris Earle

I was wondering if there was a function that would allow me to jump to a
certain line if a file and then write from there?  I'm searching php.net
without any luck :(.

Also, if there is not specific function, is there a trick that gives the
same effect (without reading the entire file line by line, then writing to
it where I need to, then replacing the file)?

Thanks in advance (hopefully :)).



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




Re: [PHP] Development Tools

2002-07-10 Thread Chris Earle

I too am using a plain old text editor for PHP (Notepad), but I did enjoy
the environment of Interdev for ASP...

I think by far the best feature most development tools have to offer is the
syntax highlighting, I like seeing comments in green/grey, with the plain
text and vars in black, and a lot of the other syntax in red (with other
colors for some things obviously).  All in all, it's just the way it makes
my code look that makes me like them a little bit more than normal text
editors.  I don't use the tools in any of those to create my pages, I code
everything myself (I like to code things, including the forms ... even if
they do get annoying sometimes).

Oh ya, in most development toolsets when you start typing functions and
stuff it will bring up a little drop down box (without stopping you from
going on typing) with functions and variables starting with what you're
typing.  It's just nice.

Uwe Birkenhain [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I think that - on windows - nothing is better than textpad
 (www.textpad.com).
 Simply the best editor the world has seen so far!

 What makes development tools better than a good editor? (serious question)

 Uwe





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




Re: [PHP] Editing files by line

2002-07-10 Thread Chris Earle

That's what I was talking about :).  I wish there was something built in
that would just let me append a file where I want, that would make things a
little easier.  Oh well, thanks a lot for the help that makes sense (and I
think it works).

Martin Towell [EMAIL PROTECTED] wrote in message
6416776FCC55D511BC4E0090274EFEF508A5FD@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A5FD@EXCHANGE...
 I dodn't know of any single function that does what you want, but you can
do
 this:

 $contents = file($filename);  // each line has it's own array position
 $contents[$line] = $newline;
 $content = implode(\n, $contents);
 $f = fopen($filename, w);
 fputs($f, $content);
 fclose($f);


 (not tested, but should work as is) some error checking would also be
 good :)

 -Original Message-
 From: Chris Earle [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 11, 2002 2:10 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Editing files by line


 I was wondering if there was a function that would allow me to jump to a
 certain line if a file and then write from there?  I'm searching php.net
 without any luck :(.

 Also, if there is not specific function, is there a trick that gives the
 same effect (without reading the entire file line by line, then writing to
 it where I need to, then replacing the file)?

 Thanks in advance (hopefully :)).



 --
 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] Appending to a file

2002-07-10 Thread Chris Earle

Thanks again for this response.  The computer is a Win2k server.


Thanks for the tips. :)

Martin Towell [EMAIL PROTECTED] wrote in message
6416776FCC55D511BC4E0090274EFEF508A5FE@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A5FE@EXCHANGE...
 or use the unix command wc

 $num_lines = `wc -l $file`;

 Martin

 -Original Message-
 From: Analysis  Solutions [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 11, 2002 2:13 PM
 To: PHP List
 Subject: Re: [PHP] Appending to a file


 On Wed, Jul 10, 2002 at 12:45:01PM -0400, Chris Earle wrote:
  I'm just curious if there's a function that allows you to see how many
 lines
  there are in a file.

 I don't recall there being one.  Simple way:

$Array = file('file.name');
echo count($Array);

 --Dan

 --
PHP classes that make web design easier
 SQL Solution  |   Layout Solution   |  Form Solution
 sqlsolution.info  | layoutsolution.info |  formsolution.info
  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

 --
 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] Re: sendmail_path help

2002-07-10 Thread Chris Earle

Can you just use the built-in mail function?

mail([EMAIL PROTECTED], Errors, $ObjectGET-EMAIL, // doesn't have to
be an object
From: [EMAIL PROTECTED]\n
   .Reply-To: [EMAIL PROTECTED]\n
   .X-Mailer: PHP/ . phpversion());

Ricky Dhatt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I've been trying to tweak my sendmail_path to work with some batch emails
I
 have to sent out[1].   What'd like to do is set within a virtual site in
 httpd.conf:

 php_admin_value sendmail_path =
 /usr/sbin/sendmail -t -oQ/var/spool/mqueue_batch -ODeliveryMode=q

 Problem is when I do this, my emails go in to oblivion.  I've tried other
 paths/options like /usr/sbin/sendmail -oi -t -odq and it works just
fine.
 I've tested my path in a perl script so I'm sure it's correct; I'm sure my
 permissions are correct...any ideas?


 --Ricky

 [1] It's not spam.  Honest!





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




[PHP] Script File Permissions

2002-07-09 Thread Chris Earle

I've been trying and trying to get my site to work lately and all but one
part does.  Of course that one part is the most important part (it always
is).

My problem is probably rather simple to most of you, but I don't know how to
get around it: My script does not have permissions to write/append files or
just flat out create the files; it can read any files (accessed
files//nameoffile.xml).  Originally I was working with text files, but
that didn't work either (and had the exact same problems).

So my question is this: how do I get my script to have permissions to write
or append to any file?



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




Re: [PHP] can I call a variable... using variables?

2002-07-09 Thread Chris Earle

Why not just make the form's input names var[] then PHP will make them
into an array:

for ($i = 1; $i  100; $i++)
{
 if ($var[$i -1]  0)
  echo Yup. . $var[$i - 1] . is greater than 0.;
}


Martin Clifford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
You would have to set up a dummy variable to hold the value of two
concatenated variable names.  I'd love to write an example, but work is
draggin' me down, sorry!

Martin

 Joseph Szobody [EMAIL PROTECTED] 07/09/02 02:12PM 
So here's what I'm trying to do:

I have a form submitting dozens of variables called var1, var2, var3, ..
and on and on.

I want to check the value of each of these variables:

for($i = 1;$i  100; $i++) {
  if($var$i  0)
echo Yup. $var$i is greater than 0;
}

I get a parse error when trying to run this code. Can I not use $i to call
the $var1, $var2, etc. variables? Is there another way of doing this?

Thanks,

Joseph




--
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] Script File Permissions

2002-07-09 Thread Chris Earle

Alberto Serra [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 ðÒÉ×ÅÔ!

 Chris Earle wrote:
  So my question is this: how do I get my script to have permissions to
write
  or append to any file?

 Ask your sysadmin (I can almost bet the answer will be NO, I have to
 tell you).

 Apache should be running on your system as user nobody, and most
 probably does NOT have the permission to write anything at all (apart
 from file uploads).

 ÐÏËÁ
 áÌØÂÅÒÔÏ
 ëÉÅ×

Thank you for the reply (I don't speak or read Russian if that's what that
other stuff is).  I forgot to mention that the server is a Win2k server with
IIS 5 running.  Obviously I'm not the server admin (otherwise I would be
using Apache).

I hope that I can get permissions, but I bet you're right.  Probably just
have to create a database, which I planned on doing (and know how to).  I
really did want to use XML though, oh well.

Thanks for the response,
Chris Earle



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




[PHP] Re: Feedback please

2002-07-02 Thread Chris Earle

You misspelled Location in the job search under preferences of a found
person.

Bret L Conard [EMAIL PROTECTED] wrote in message
001701c221dc$a4713700$02fea8c0@BretLConard">news:001701c221dc$a4713700$02fea8c0@BretLConard...
Hi All..
I have recently completed work on a PHP, MySQL driven job site for Technical
employment. Geared toward independent contractors and the people who hire
them.

If any one has the time, could you look at:
www.tech-temp.com
and give feedback either on the list or privately? I *think* I have covered
all the bases but could use the input


Thanks,
Bret





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




[PHP] Updating (appending) a file

2002-07-01 Thread Chris Earle

I cannot figure out how to access the file and update it (which is just
/files/*.txt from where I'll be accesing it -- in other words I'm accessing
it  from mydomain.com/index.php, but the file is
mydomain.com/files/Names.txt).  By update I mean append.  I tried to access
it with the complete local address (C:\\... it's a IIS5 server on Win2k; I
did use the \\).

So, what file path do I use to update (append) a file on the same Windows 2k
server as my web server (/files/*.txt is the location of the file relative
to the PHP code being executed).

I want to be able to update the file on my server (which can be accessed
through FTP the way $Location works out, if I do it manually in the
browser).  My question is how do I go about accessing it?  Do I have to use
the ftp_connect(); functions somehow or can I just go about with something
like this:
---
// This doesn't work though:

  $Location = ftp://;. $Find-USER .:. $Find-PASS .mysite.com/files/.
$Find-BRANCH ..txt;

  if (!$fp = fopen($Location, a))
  { // This is always what shows
   Error(Error: 0001.  File (. $Location .) could not be found.);
  }
  else
  {
   if (!fwrite($fp, $Find-Line)) // line is an HTML tag/link (Something
like A HREF=http://somesite.com; ALT=blah)
   {
Error(Error: 0002. Information was not written.);
   }

   if (!fclose($fp))
   {
Error(Error: 0003.  File close error.);
   }
  }
-



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




RE: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

I didn't want to make a new post, but my Reply - Send button makes
Outlook crash (this isn't the web server! :)).

More to the point: if that relative path doesn't work, and the path is right
and the file does exist, what does that mean?


-- if the php file is: mydomain.com/index.php
-- and the data file is: mydomain.com/files/Names.txt
--
-- then the relative path is not \\files\\Names.txt , it's
-- files\\Names.txt
--
-- HTH
-- Martin




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




Re: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

The server has error reporting turned off (can I change this even though I'm
not there?)...

I cannot do it with the file in my base folder either.

Martin Towell [EMAIL PROTECTED] wrote in message
6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
 maybe a permissions thing?

 do you get any errors back? if so, what error is it?

 try appending to a file in the same directory as index.php and see how
that
 goes.

 -Original Message-
 From: Chris Earle [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 02, 2002 3:54 PM
 To: [EMAIL PROTECTED]
 Subject: RE: RE: [PHP] Updated (appending) a file

 More to the point: if that relative path doesn't work, and the path is
right
 and the file does exist, what does that mean?

 -- if the php file is: mydomain.com/index.php
 -- and the data file is: mydomain.com/files/Names.txt
 --
 -- then the relative path is not \\files\\Names.txt , it's
 -- files\\Names.txt
 --
 -- HTH
 -- Martin



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




Re: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

display_errors = On;  according to phpinfo(); All other error reporting is
off though.  But nothing is being displayed.

Chris Earle [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 The server has error reporting turned off (can I change this even though
I'm
 not there?)...

 I cannot do it with the file in my base folder either.

 Martin Towell [EMAIL PROTECTED] wrote in message
 6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
  maybe a permissions thing?
 
  do you get any errors back? if so, what error is it?
 
  try appending to a file in the same directory as index.php and see how
 that
  goes.
 
  -Original Message-----
  From: Chris Earle [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, July 02, 2002 3:54 PM
  To: [EMAIL PROTECTED]
  Subject: RE: RE: [PHP] Updated (appending) a file
 
  More to the point: if that relative path doesn't work, and the path is
 right
  and the file does exist, what does that mean?
 
  -- if the php file is: mydomain.com/index.php
  -- and the data file is: mydomain.com/files/Names.txt
  --
  -- then the relative path is not \\files\\Names.txt , it's
  -- files\\Names.txt
  --
  -- HTH
  -- Martin





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




Re: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

Permission denied

Yep. Crap.  If I let PHP create the file (delete the files as they exist
now), that will give it permission (because it will have made them), right?

Thanks a lot for all the help.


Martin Towell [EMAIL PROTECTED] wrote in message
6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE...
 This should work

 error_reporting(E_ALL);

 but be prepared for all dem warnings !  :)



 BTW: I get an undeliverable mail to your email address when I reply to
all
 :(

 -Original Message-
 From: Chris Earle [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 02, 2002 4:04 PM
 To: [EMAIL PROTECTED]
 Subject: Re: RE: [PHP] Updated (appending) a file


 The server has error reporting turned off (can I change this even though
I'm
 not there?)...

 I cannot do it with the file in my base folder either.

 Martin Towell [EMAIL PROTECTED] wrote in message
 6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
  maybe a permissions thing?
 
  do you get any errors back? if so, what error is it?
 
  try appending to a file in the same directory as index.php and see how
 that
  goes.
 
  -Original Message-----
  From: Chris Earle [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, July 02, 2002 3:54 PM
  To: [EMAIL PROTECTED]
  Subject: RE: RE: [PHP] Updated (appending) a file
 
  More to the point: if that relative path doesn't work, and the path is
 right
  and the file does exist, what does that mean?
 
  -- if the php file is: mydomain.com/index.php
  -- and the data file is: mydomain.com/files/Names.txt
  --
  -- then the relative path is not \\files\\Names.txt , it's
  -- files\\Names.txt
  --
  -- HTH
  -- Martin



 --
 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: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

Thanks again man, you've been a ton of help.

I gotta get some sleep now!  Thanks again.

Martin Towell [EMAIL PROTECTED] wrote in message
6416776FCC55D511BC4E0090274EFEF508A58C@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58C@EXCHANGE...
 Um - yeah - sorta
 depends if the script has write access to the directory too :)
 but try and see, I guess is the best option ...

 -Original Message-
 From: Chris Earle [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 02, 2002 4:14 PM
 To: [EMAIL PROTECTED]
 Subject: Re: RE: [PHP] Updated (appending) a file


 Permission denied

 Yep. Crap.  If I let PHP create the file (delete the files as they exist
 now), that will give it permission (because it will have made them),
right?

 Thanks a lot for all the help.


 Martin Towell [EMAIL PROTECTED] wrote in message
 6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE...
  This should work
 
  error_reporting(E_ALL);
 
  but be prepared for all dem warnings !  :)
 
 
 
  BTW: I get an undeliverable mail to your email address when I reply to
 all
  :(
 
  -Original Message-----
  From: Chris Earle [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, July 02, 2002 4:04 PM
  To: [EMAIL PROTECTED]
  Subject: Re: RE: [PHP] Updated (appending) a file
 
 
  The server has error reporting turned off (can I change this even though
 I'm
  not there?)...
 
  I cannot do it with the file in my base folder either.
 
  Martin Towell [EMAIL PROTECTED] wrote in message
  6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
   maybe a permissions thing?
  
   do you get any errors back? if so, what error is it?
  
   try appending to a file in the same directory as index.php and see how
  that
   goes.
  
   -Original Message-----
   From: Chris Earle [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, July 02, 2002 3:54 PM
   To: [EMAIL PROTECTED]
   Subject: RE: RE: [PHP] Updated (appending) a file
  
   More to the point: if that relative path doesn't work, and the path is
  right
   and the file does exist, what does that mean?
  
   -- if the php file is: mydomain.com/index.php
   -- and the data file is: mydomain.com/files/Names.txt
   --
   -- then the relative path is not \\files\\Names.txt , it's
   -- files\\Names.txt
   --
   -- HTH
   -- Martin



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